From 1dfbb0aa10fedfdf13290adfa16a7437e76fab87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?DIY=E7=86=99?= Date: Mon, 24 May 2021 18:11:04 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E5=A2=9E=E5=8A=A0=E5=A4=8D=E5=88=B6?= =?UTF-8?q?=E7=9B=B4=E9=93=BE=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + src/components/FileHandler.vue | 39 ++++++++++++++++++++++++-------- src/components/ui/MduiDialog.vue | 14 ++++++++++-- src/main.js | 3 ++- 4 files changed, 45 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index b659ef9..c0e1ecf 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "style-resources-loader": "^1.4.1", "vue": "^2.5.2", "vue-axios": "^3.2.0", + "vue-clipboard2": "^0.3.1", "vue-router": "^3.0.1", "vuex": "^3.6.0" }, diff --git a/src/components/FileHandler.vue b/src/components/FileHandler.vue index fb93ccb..41da288 100644 --- a/src/components/FileHandler.vue +++ b/src/components/FileHandler.vue @@ -43,6 +43,15 @@

注意:若原文件位置改变,重命名或删除链接将失效

+ +
+ {{link.res}} +
+ +

未登录,请先登录

@@ -63,8 +72,9 @@ import FormUtils from '../utils/FormUtils' import API from '../api/API' import MduiDialog from './ui/MduiDialog.vue' import MduiCheckbox from "./ui/MduiCheckbox" +import MduiBtn from './ui/MduiBtn.vue' export default { - components: { FileBrowser, FileList, Container, SearchResult, MduiDialog, MduiCheckbox }, + components: { FileBrowser, FileList, Container, SearchResult, MduiDialog, MduiCheckbox, MduiBtn }, name: 'FileHandler', props: { 'uid': { @@ -89,7 +99,8 @@ export default { link: { expr: 32, preview: true, - info: {} + info: {}, + res: '' } } }, @@ -110,6 +121,14 @@ export default { } }, methods: { + onCopy(e) { + if (e) { + mdui.snackbar('复制成功!') + } else { + mdui.snackbar('复制失败!') + } + }, + async getURL() { let e = (await this.$axios( apiConfig.resource.getFileDC(this.uid, @@ -120,14 +139,16 @@ export default { )) let url = apiConfig.server || location.origin + apiConfig.resource.downloadUseFileDC(e.data.data, !this.link.preview, this.link.info.fileInfo.name) - let content = ` -

下载链接

- - ${url} - - ` + this.link.res = url; + // let content = ` + //

下载链接

+ // + // ${url} + // + // ` this.$refs.dialog.close() - mdui.alert(content) + // mdui.alert(content) + this.$refs.linkResDialog.open() }, openDialog(info) { this.link.info = info diff --git a/src/components/ui/MduiDialog.vue b/src/components/ui/MduiDialog.vue index 3f9fb91..e4973ab 100644 --- a/src/components/ui/MduiDialog.vue +++ b/src/components/ui/MduiDialog.vue @@ -6,8 +6,11 @@
{{title}}
- - + +
@@ -36,6 +39,13 @@ export default { */ type: Boolean, default: false + }, + 'disableDefBtn': { + /** + * 控制是否禁用默认按钮 + */ + type: Boolean, + default: false } }, data() { diff --git a/src/main.js b/src/main.js index 5e9a0d4..31ec0cf 100644 --- a/src/main.js +++ b/src/main.js @@ -12,12 +12,13 @@ import Store from './Store' import apiConfig from './api/API' import formatter from "./utils/StringFormatter" import Theme from './utils/Theme' +import VueClipboard from 'vue-clipboard2' Vue.config.productionTip = false Vue.use(VueAxios, axios) Vue.prototype.$axios = axios Vue.prototype.$mdui = mdui.$ Vue.prototype.$eventBus = new Vue() - +Vue.use(VueClipboard) // 注册全局过滤器 格式化数字为方便阅读的存储大小表示 Vue.filter('formatSize', e => { return formatter.formatSizeString(e) -- Gitee