perf: 非分享界面添加复制下载链接的选项
This commit is contained in:
parent
a3fe98f489
commit
d9b33ef28c
@ -258,6 +258,7 @@
|
|||||||
v-if="
|
v-if="
|
||||||
item.operation === 'unFavorite' || item.operation === 'favorite'
|
item.operation === 'unFavorite' || item.operation === 'favorite'
|
||||||
"
|
"
|
||||||
|
class="menu-option"
|
||||||
@click="menusOperations(item.operation)"
|
@click="menusOperations(item.operation)"
|
||||||
@mouseover.prevent.stop="
|
@mouseover.prevent.stop="
|
||||||
menuFavoriteOver(index, rowContextData.isFavorite)
|
menuFavoriteOver(index, rowContextData.isFavorite)
|
||||||
@ -870,6 +871,7 @@ import EditElement from "@/views/markdown/EditElement";
|
|||||||
import OfficePreview from "@/components/preview/OfficePreview";
|
import OfficePreview from "@/components/preview/OfficePreview";
|
||||||
import ShareDialog from "@/components/ShareDialog/index.vue";
|
import ShareDialog from "@/components/ShareDialog/index.vue";
|
||||||
import {getUsername} from "@/api/user";
|
import {getUsername} from "@/api/user";
|
||||||
|
import Clipboard from "clipboard";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ShowFile",
|
name: "ShowFile",
|
||||||
@ -2690,7 +2692,8 @@ export default {
|
|||||||
id: row.id,
|
id: row.id,
|
||||||
currentDirectory: encodeURI(this.$route.query.path),
|
currentDirectory: encodeURI(this.$route.query.path),
|
||||||
pageIndex: this.pagination.pageIndex,
|
pageIndex: this.pagination.pageIndex,
|
||||||
pageSize: this.pagination.pageSize
|
pageSize: this.pagination.pageSize,
|
||||||
|
folder: this.$route.query.folder
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
this.loadData(res, onLoad);
|
this.loadData(res, onLoad);
|
||||||
@ -2709,7 +2712,8 @@ export default {
|
|||||||
id: row.mountFileId || row.id,
|
id: row.mountFileId || row.id,
|
||||||
currentDirectory: encodeURI(this.$route.query.path),
|
currentDirectory: encodeURI(this.$route.query.path),
|
||||||
pageIndex: this.pagination.pageIndex,
|
pageIndex: this.pagination.pageIndex,
|
||||||
pageSize: this.pagination.pageSize
|
pageSize: this.pagination.pageSize,
|
||||||
|
folder: this.$route.query.folder
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
this.loadData(res, onLoad);
|
this.loadData(res, onLoad);
|
||||||
@ -3191,13 +3195,17 @@ export default {
|
|||||||
if (!row.isFolder) {
|
if (!row.isFolder) {
|
||||||
this.menus.splice(-2, 0, { iconClass: "duplicate", label: "创建副本", operation: "duplicate" })
|
this.menus.splice(-2, 0, { iconClass: "duplicate", label: "创建副本", operation: "duplicate" })
|
||||||
}
|
}
|
||||||
if (row.isShare && !row.shareBase) {
|
if ((row.isShare && !row.shareBase) || row.ossFolder) {
|
||||||
// 删除分享选项
|
// 删除分享选项
|
||||||
let index = this.menus.findIndex(item => item.operation === "share")
|
let index = this.menus.findIndex(item => item.operation === "share")
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
this.menus.splice(index, 1)
|
this.menus.splice(index, 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (row.isShare && !row.isPrivacy) {
|
||||||
|
// 添加复制下载链接选项
|
||||||
|
this.menus.splice(-2, 0, { iconClass: "menu-fuzhi", label: "复制下载链接", operation: "copyDownloadLink" })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.preliminaryRowData(row);
|
this.preliminaryRowData(row);
|
||||||
},
|
},
|
||||||
@ -3449,6 +3457,10 @@ export default {
|
|||||||
// 下载
|
// 下载
|
||||||
this.downloadFile();
|
this.downloadFile();
|
||||||
break;
|
break;
|
||||||
|
case "copyDownloadLink":
|
||||||
|
// 复制下载链接
|
||||||
|
this.copyDownloadLink(this.rowContextData)
|
||||||
|
break;
|
||||||
case "remove":
|
case "remove":
|
||||||
// 删除
|
// 删除
|
||||||
this.deleteFile();
|
this.deleteFile();
|
||||||
@ -3771,6 +3783,25 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 复制下载链接
|
||||||
|
copyDownloadLink(row) {
|
||||||
|
let url = window.location.origin + fileConfig.previewUrl(this.$store.getters.name, row, undefined, undefined)
|
||||||
|
let clipboard = new Clipboard('.newFileMenu', {
|
||||||
|
text: function () {
|
||||||
|
return url
|
||||||
|
}
|
||||||
|
})
|
||||||
|
clipboard.on('success', e => {
|
||||||
|
this.$message({message: '复制成功', type: 'success', duration: 1000});
|
||||||
|
// 释放内存
|
||||||
|
clipboard.destroy()
|
||||||
|
})
|
||||||
|
clipboard.on('error', e => {
|
||||||
|
// 不支持复制
|
||||||
|
this.$message({message: '该浏览器不支持自动复制', type: 'warning', duration: 1000});
|
||||||
|
clipboard.destroy()
|
||||||
|
})
|
||||||
|
},
|
||||||
// 收藏/取消收藏
|
// 收藏/取消收藏
|
||||||
favoriteOperating(isFavorite) {
|
favoriteOperating(isFavorite) {
|
||||||
const fileIds = this.getSelectIdList();
|
const fileIds = this.getSelectIdList();
|
||||||
|
|||||||
@ -356,12 +356,12 @@ export default {
|
|||||||
singleMenus: [
|
singleMenus: [
|
||||||
{iconClass: 'menu-open', label: '打开', operation: 'open'},
|
{iconClass: 'menu-open', label: '打开', operation: 'open'},
|
||||||
{iconClass: 'menu-download', label: '下载', operation: 'download'},
|
{iconClass: 'menu-download', label: '下载', operation: 'download'},
|
||||||
{iconClass: 'menu-fuzhi', label: '复制下载连接', operation: 'copyDownloadUrl'},
|
{iconClass: 'menu-fuzhi', label: '复制下载链接', operation: 'copyDownloadUrl'},
|
||||||
],
|
],
|
||||||
singleMenusEdit: [
|
singleMenusEdit: [
|
||||||
{iconClass: 'menu-open', label: '打开', operation: 'open'},
|
{iconClass: 'menu-open', label: '打开', operation: 'open'},
|
||||||
{iconClass: 'menu-download', label: '下载', operation: 'download'},
|
{iconClass: 'menu-download', label: '下载', operation: 'download'},
|
||||||
{iconClass: 'menu-fuzhi', label: '复制下载连接', operation: 'copyDownloadUrl'},
|
{iconClass: 'menu-fuzhi', label: '复制下载链接', operation: 'copyDownloadUrl'},
|
||||||
],
|
],
|
||||||
multipleMenus: [
|
multipleMenus: [
|
||||||
{iconClass: 'menu-download', label: '下载', operation: 'download'},
|
{iconClass: 'menu-download', label: '下载', operation: 'download'},
|
||||||
@ -1042,7 +1042,7 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 复制下载连接
|
// 复制下载链接
|
||||||
copyDownloadLink(url) {
|
copyDownloadLink(url) {
|
||||||
let clipboard = new Clipboard('.menu-option', {
|
let clipboard = new Clipboard('.menu-option', {
|
||||||
text: function () {
|
text: function () {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user