💄文件图标上添加分享图标
This commit is contained in:
parent
4b8938d8d8
commit
b0e56ec12f
@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<span>
|
<span>
|
||||||
|
<svg-icon v-if="item.isShare" class="share-dir" icon-class="share"/>
|
||||||
<a v-if="strLength(item.folder) > maxNameLength">
|
<a v-if="strLength(item.folder) > maxNameLength">
|
||||||
<el-tooltip class="item" effect="dark" :content="item.folder" placement="top">
|
<el-tooltip class="item" effect="dark" :content="item.folder" placement="top">
|
||||||
<a v-if="pathList.length >= maxPathCount">
|
<a v-if="pathList.length >= maxPathCount">
|
||||||
@ -93,6 +94,11 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.share-dir {
|
||||||
|
color: #52c41a;
|
||||||
|
margin-right: -0.5rem;
|
||||||
|
font-size: 1.2rem !important;
|
||||||
|
}
|
||||||
.redirect {
|
.redirect {
|
||||||
color: #97a8be;
|
color: #97a8be;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,30 +1,38 @@
|
|||||||
<template>
|
<template>
|
||||||
<span>
|
<span>
|
||||||
<div v-if="item.isFavorite && !public">
|
<div v-if="item.isFavorite && !public">
|
||||||
<div v-if="pc">
|
<div v-if="pc">
|
||||||
<svg-icon v-if="!grid" class="favorite" icon-class="menu-favorite-hover"
|
<svg-icon v-if="!grid" class="pc list icon-favorite" icon-class="Favoritestarrate"/>
|
||||||
style="font-size: 1rem;float: right;margin-left: 1rem;position: absolute;"/>
|
<svg-icon v-if="grid" class="pc grid icon-favorite" icon-class="Favoritestarrate"/>
|
||||||
<svg-icon v-if="grid" class="favorite" icon-class="menu-favorite-hover"
|
</div>
|
||||||
style="font-size: 1.5rem;right: 0;top: -1rem;position: absolute;z-index: 1;"/>
|
<div v-else>
|
||||||
</div>
|
<svg-icon v-if="!grid" class="mobile list icon-favorite" icon-class="Favoritestarrate"/>
|
||||||
<div v-else>
|
<svg-icon v-if="grid" class="mobile grid icon-favorite" icon-class="Favoritestarrate"/>
|
||||||
<svg-icon v-if="!grid" class="favorite" icon-class="menu-favorite-hover"
|
</div>
|
||||||
style="font-size: 0.5rem;float: right;margin-left: 0.5rem;position: absolute;"/>
|
</div>
|
||||||
<svg-icon v-if="grid" class="favorite" icon-class="menu-favorite-hover"
|
<div v-if="item.isShare && item.shareId && !public">
|
||||||
style="font-size: 1rem;right: 0;top: -1rem;position: absolute;z-index: 1;"/>
|
<div v-if="pc">
|
||||||
</div>
|
<svg-icon v-if="!grid" class="pc list icon-share" icon-class="share"/>
|
||||||
|
<svg-icon v-if="grid" class="pc grid icon-share" icon-class="share"/>
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
<svg-icon v-if="!grid" class="mobile list icon-share" icon-class="share"/>
|
||||||
|
<svg-icon v-if="grid" class="mobile grid icon-share" icon-class="share"/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<svg-icon v-if="item.isFolder" icon-class="folder"/>
|
<svg-icon v-if="item.isFolder" icon-class="folder"/>
|
||||||
<svg-icon v-else-if="item.contentType.indexOf('video') > -1" icon-class="video"/>
|
<svg-icon v-else-if="item.contentType.indexOf('video') > -1" icon-class="video"/>
|
||||||
<div v-else-if="item.contentType.indexOf('audio') > -1" v-on:mousedown="noDrag($event)">
|
<div v-else-if="item.contentType.indexOf('audio') > -1" v-on:mousedown="noDrag($event)">
|
||||||
<div v-if="item.music !== undefined">
|
<div v-if="item.music !== undefined">
|
||||||
<div v-if="item.music.name !== null">
|
<div v-if="item.music.name !== null">
|
||||||
<el-image v-if="grid" :style="{'height':details?'110px':(gridWidth-35) + 'px'}" fit="contain" :src="item.fileId ? (audioCoverUrl+item.fileId) : (audioCoverUrl+item.id)">
|
<el-image v-if="grid" :style="{'height':details?'110px':(gridWidth-35) + 'px'}" fit="contain"
|
||||||
|
:src="item.fileId ? (audioCoverUrl+item.fileId) : (audioCoverUrl+item.id)">
|
||||||
<div slot="error" class="image-slot">
|
<div slot="error" class="image-slot">
|
||||||
<svg-icon class="avatar-default-image" icon-class="audio"/>
|
<svg-icon class="avatar-default-image" icon-class="audio"/>
|
||||||
</div>
|
</div>
|
||||||
</el-image>
|
</el-image>
|
||||||
<el-avatar v-if="!grid" shape="square" :src="item.fileId ? (audioCoverUrl+item.fileId) : (audioCoverUrl+item.id)">
|
<el-avatar v-if="!grid" shape="square"
|
||||||
|
:src="item.fileId ? (audioCoverUrl+item.fileId) : (audioCoverUrl+item.id)">
|
||||||
<div slot="default">
|
<div slot="default">
|
||||||
<svg-icon class="avatar-default-image" icon-class="audio"/>
|
<svg-icon class="avatar-default-image" icon-class="audio"/>
|
||||||
</div>
|
</div>
|
||||||
@ -35,13 +43,15 @@
|
|||||||
</div>
|
</div>
|
||||||
<!--<svg-icon v-else-if="item.contentType.indexOf('text') > -1" icon-class="file-txt"/>-->
|
<!--<svg-icon v-else-if="item.contentType.indexOf('text') > -1" icon-class="file-txt"/>-->
|
||||||
<div v-else-if="item.contentType.startsWith('image')" v-on:mousedown="noDrag($event)">
|
<div v-else-if="item.contentType.startsWith('image')" v-on:mousedown="noDrag($event)">
|
||||||
<el-image v-if="grid || grid === 'details'" :style="{'height':details?'110px':(gridWidth-35) + 'px'}" fit="contain" :src="item.fileId ? (imageUrl+item.fileId) : (imageUrl+item.id)">
|
<el-image v-if="grid || grid === 'details'" :style="{'height':details?'110px':(gridWidth-35) + 'px'}"
|
||||||
|
fit="contain" :src="item.fileId ? (imageUrl+item.fileId) : (imageUrl+item.id)">
|
||||||
<div slot="error" class="image-slot">
|
<div slot="error" class="image-slot">
|
||||||
<svg-icon icon-class="loading-image-error"/>
|
<svg-icon icon-class="loading-image-error"/>
|
||||||
</div>
|
</div>
|
||||||
</el-image>
|
</el-image>
|
||||||
|
|
||||||
<el-avatar v-if="!grid" shape="square" :src="item.fileId ? (imageUrl+item.fileId) : (imageUrl+item.id)"></el-avatar>
|
<el-avatar v-if="!grid" shape="square"
|
||||||
|
:src="item.fileId ? (imageUrl+item.fileId) : (imageUrl+item.id)"></el-avatar>
|
||||||
</div>
|
</div>
|
||||||
<!--<svg-icon v-else-if="item.contentType.indexOf('application/pdf') > -1" icon-class="file-pdf"/>-->
|
<!--<svg-icon v-else-if="item.contentType.indexOf('application/pdf') > -1" icon-class="file-pdf"/>-->
|
||||||
<!--<svg-icon v-else-if="item.contentType.indexOf('word') > -1" icon-class="file-word"/>-->
|
<!--<svg-icon v-else-if="item.contentType.indexOf('word') > -1" icon-class="file-word"/>-->
|
||||||
@ -51,72 +61,128 @@
|
|||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { iconClass } from '@/utils/file-type'
|
import {iconClass} from '@/utils/file-type'
|
||||||
export default {
|
|
||||||
name: 'IconFile',
|
export default {
|
||||||
props: {
|
name: 'IconFile',
|
||||||
imageUrl: {
|
props: {
|
||||||
type: String,
|
imageUrl: {
|
||||||
default: ''
|
type: String,
|
||||||
},
|
default: ''
|
||||||
audioCoverUrl: {
|
|
||||||
type: String,
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
grid: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
gridWidth: {
|
|
||||||
type: Number,
|
|
||||||
default: 120
|
|
||||||
},
|
|
||||||
details: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
public: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
item: {
|
|
||||||
type: Object,
|
|
||||||
default: function () {
|
|
||||||
return {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
data() {
|
audioCoverUrl: {
|
||||||
return {
|
type: String,
|
||||||
pc: window.pc,
|
default: ''
|
||||||
}
|
|
||||||
},
|
},
|
||||||
mounted() {
|
grid: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
},
|
},
|
||||||
computed: {
|
gridWidth: {
|
||||||
findIconClass(){
|
type: Number,
|
||||||
let suffix = this.item.suffix;
|
default: 120
|
||||||
if(!suffix && this.item.fileName){
|
|
||||||
suffix = this.item.fileName.substring(this.item.fileName.lastIndexOf('.') + 1);
|
|
||||||
}
|
|
||||||
if(iconClass.has(suffix)){
|
|
||||||
return iconClass.get(suffix)
|
|
||||||
}
|
|
||||||
return 'file'
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
methods: {
|
details: {
|
||||||
noDrag(e) {
|
type: Boolean,
|
||||||
// console.log('noDrag',e)
|
default: false
|
||||||
// e.preventDefault()
|
},
|
||||||
|
public: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
item: {
|
||||||
|
type: Object,
|
||||||
|
default: function () {
|
||||||
|
return {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
pc: window.pc,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
findIconClass() {
|
||||||
|
let suffix = this.item.suffix;
|
||||||
|
if (!suffix && this.item.fileName) {
|
||||||
|
suffix = this.item.fileName.substring(this.item.fileName.lastIndexOf('.') + 1);
|
||||||
|
}
|
||||||
|
if (iconClass.has(suffix)) {
|
||||||
|
return iconClass.get(suffix)
|
||||||
|
}
|
||||||
|
return 'file'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
noDrag(e) {
|
||||||
|
// console.log('noDrag',e)
|
||||||
|
// e.preventDefault()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.avatar-default-image{
|
.avatar-default-image {
|
||||||
height: 35px;
|
height: 35px;
|
||||||
width: 35px;
|
width: 35px;
|
||||||
line-height: 35px;
|
line-height: 35px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.icon-favorite {
|
||||||
|
position: absolute;
|
||||||
|
color: #f5222d;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc.grid.icon-favorite {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile.grid.icon-favorite {
|
||||||
|
width: 1.3rem;
|
||||||
|
height: 1.3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc.list.icon-favorite {
|
||||||
|
font-size: 1rem;
|
||||||
|
left: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile.list.icon-favorite {
|
||||||
|
font-size: 0.5rem;
|
||||||
|
margin-left: -1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-share {
|
||||||
|
color: #52c41a;
|
||||||
|
position: absolute;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc.grid.icon-share {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile.grid.icon-share {
|
||||||
|
width: 1.3rem;
|
||||||
|
height: 1.3rem;
|
||||||
|
margin-left: 2.8rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pc.list.icon-share {
|
||||||
|
font-size: 1rem;
|
||||||
|
right: 1.3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile.list.icon-share {
|
||||||
|
font-size: 0.5rem;
|
||||||
|
margin-left: 0.5rem;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -2520,7 +2520,7 @@ export default {
|
|||||||
menuFavoriteLeave(index, isFavorite) {
|
menuFavoriteLeave(index, isFavorite) {
|
||||||
this.highlightFavorite(this.isCollectView ? true : isFavorite, false)
|
this.highlightFavorite(this.isCollectView ? true : isFavorite, false)
|
||||||
},
|
},
|
||||||
// 是否高亮收图标
|
// 是否高亮收藏图标
|
||||||
highlightFavorite(isFavorite, isHover) {
|
highlightFavorite(isFavorite, isHover) {
|
||||||
const item_menu = this.menus.find(item => {
|
const item_menu = this.menus.find(item => {
|
||||||
if (item.operation === 'favorite' || item.operation === 'unFavorite') {
|
if (item.operation === 'favorite' || item.operation === 'unFavorite') {
|
||||||
@ -2901,10 +2901,17 @@ export default {
|
|||||||
isFolder: row.isFolder
|
isFolder: row.isFolder
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
this.shareDialog = true
|
this.shareDialog = true
|
||||||
|
// 这3行代码是为了让vue刷新数据
|
||||||
|
const isFavorite = this.rowContextData.isFavorite
|
||||||
|
this.rowContextData.isFavorite = !isFavorite
|
||||||
|
this.rowContextData.isFavorite = isFavorite
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
this.shareLink = window.location.origin + '/s?s=' + res.data
|
let shareId = res.data
|
||||||
|
this.shareLink = window.location.origin + '/s?s=' + shareId
|
||||||
this.generateShareLinkLoading = false
|
this.generateShareLinkLoading = false
|
||||||
|
this.rowContextData.shareId = shareId
|
||||||
}
|
}
|
||||||
|
this.rowContextData.isShare = true
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.shareDialog = false
|
this.shareDialog = false
|
||||||
this.generateShareLinkLoading = false
|
this.generateShareLinkLoading = false
|
||||||
@ -3137,7 +3144,7 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.path = '/' + row.name
|
this.path = '/' + row.name
|
||||||
}
|
}
|
||||||
const item = {'folder': row.name}
|
const item = {'folder': row.name, 'isShare': row.isShare}
|
||||||
this.pathList.push(item)
|
this.pathList.push(item)
|
||||||
this.pagination.pageIndex = 1
|
this.pagination.pageIndex = 1
|
||||||
const path = encodeURI(this.path);
|
const path = encodeURI(this.path);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user