diff --git a/.env.development b/.env.development index 9af443b..d7eb731 100644 --- a/.env.development +++ b/.env.development @@ -4,6 +4,7 @@ ENV = 'development' # base api VUE_APP_BASE_API = '/api' VUE_APP_BASE_FILE_API = '/file' +VUE_APP_BASE_PRIVIEW_API = '/priview' # vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable, # to control whether the babel-plugin-dynamic-import-node plugin is enabled. diff --git a/.env.production b/.env.production index 1f08d0e..fe53a1d 100644 --- a/.env.production +++ b/.env.production @@ -4,3 +4,4 @@ ENV = 'production' # base api VUE_APP_BASE_API = '/api' VUE_APP_BASE_FILE_API = '/file' +VUE_APP_BASE_PRIVIEW_API = '/priview' diff --git a/.env.staging b/.env.staging index 692a8a0..21aecf0 100644 --- a/.env.staging +++ b/.env.staging @@ -6,3 +6,4 @@ ENV = 'staging' # base api VUE_APP_BASE_API = '/api' VUE_APP_BASE_FILE_API = '/file' +VUE_APP_BASE_PRIVIEW_API = '/priview' diff --git a/public/netdisk.png b/public/facion.ico similarity index 100% rename from public/netdisk.png rename to public/facion.ico diff --git a/public/favicon.ico b/public/favicon.ico deleted file mode 100644 index 34b63ac..0000000 Binary files a/public/favicon.ico and /dev/null differ diff --git a/src/styles/home-index.scss b/src/styles/home-index.scss index 9bfcd21..db392df 100644 --- a/src/styles/home-index.scss +++ b/src/styles/home-index.scss @@ -339,3 +339,14 @@ height: 60px; margin: 20px; } + +.select-operation { + display: flex; + -webkit-box-pack: start; + -ms-flex-pack: start; + justify-content: flex-start; + .select-operation-button { + margin-top: 5px; + padding: 10px; + } +} diff --git a/src/views/404.vue b/src/views/404.vue index 1791f55..920346a 100644 --- a/src/views/404.vue +++ b/src/views/404.vue @@ -8,13 +8,13 @@ 404
-
OOPS!
-
All rights reserved - wallstreetcn -
+
哎呦!
+ + +
{{ message }}
-
Please check that the URL you entered is correct, or click the button below to return to the homepage.
- Back to home +
请检查您输入的URL是否正确,或单击下面的按钮返回首页。
+ 返回首页
@@ -26,7 +26,7 @@ export default { name: 'Page404', computed: { message() { - return 'The webmaster said that you can not enter this page...' + return '网站管理员说您无法进入此页面...' } } } diff --git a/src/views/home/index.vue b/src/views/home/index.vue index 3568be9..9e20558 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -57,9 +57,6 @@ - - - @@ -123,7 +120,7 @@
- + @@ -202,7 +199,7 @@ @@ -258,7 +255,23 @@ element-loading-spinner="el-icon-loading" element-loading-background="#f6f7fa88">
- {{indexList.length>0 ? '已选择 '+this.tableHead[2].label : "选择"}} +
+ {{indexList.length>0 ? '已选择 '+this.tableHead[2].label : "选择"}} +
+ + 下载 + + + 分享 + + + 移动或复制 + + + + +
+
@@ -435,7 +448,7 @@ export default { positionX:0, positionY:0, grid: true, - vmode: 'list', + vmode: 'grid', gridColumnNum: -1, gridHoverItemIndex: -1, gridHoverIntermediate: -1, @@ -563,6 +576,9 @@ export default { },10) }, clickGridItemCheckBox(item,index) { + if(this.indexList.length === 0){ + this.selectRowData = [] + } // 同步列表的checkbox if(this.indexList.includes(index)){ this.$refs.fileListTable.toggleRowSelection(item,false) @@ -1394,37 +1410,27 @@ export default { menusOperations(operation) { switch (operation) { case 'share': - this.shareDialog = true - this.shareFileName = this.rowContextData.name - api.generate({ - userId: this.rowContextData.userId, - fileId: this.rowContextData.id - }).then(res => { - if (res.data) { - this.shareLink = 'http://'+window.location.host+'/s?s='+res.data - this.generateShareLinkLoading = false - console.log(window.location.host, this.$route) - } - }) + // 分享 + this.share() break case 'favorite': - console.log('operation', '收藏') + // 收藏 this.favoriteOperating(true) break case 'edit': - console.log('edit', '编辑') + // 编辑 this.$router.push(`/markdown/editor?id=${this.rowContextData.id}`) break - case 'open':d - console.log('open', '打开') + case 'open': + // 打开 this.fileClick(this.rowContextData) break case 'deselect': - console.log('deselect', '取消选定') + // 取消选定 this.$refs.fileListTable.toggleRowSelection(this.rowContextData) break case 'unFavorite': - console.log('unFavorite', '取消收藏') + // 取消收藏 this.favoriteOperating(false) break case 'details': @@ -1435,25 +1441,20 @@ export default { console.log('详情', this.rowContextData) break case 'rename': - console.log('重命名') + // 重命名 this.renameFileName = this.rowContextData.name this.editingIndex = this.rowContextData.index break case 'copy': - console.log('移动或复制') - this.dialogMoveOrCopyVisible = true - const that = this - setTimeout(function () { - that.selectTreeNode = that.$refs.directoryTree.getCurrentNode() - that.selectTreeNode.showName = ' "' + that.selectTreeNode.name + '"' - },100) + // 移动或复制 + this.moveOrCopy() break case 'download': - console.log('下载') + // 下载 this.downloadFile() break case 'remove': - console.log('operation', '删除') + // 删除 this.deleteFile() break } @@ -1499,6 +1500,14 @@ export default { copyFileTree() { this.copyOrMove('copy'); }, + moveOrCopy(){ + this.dialogMoveOrCopyVisible = true + const that = this + setTimeout(function () { + that.selectTreeNode = that.$refs.directoryTree.getCurrentNode() + that.selectTreeNode.showName = ' "' + that.selectTreeNode.name + '"' + },100) + }, copyOrMove(operating){ let operation = '复制' if(operating === 'move'){ @@ -1510,7 +1519,7 @@ export default { } let fileIds = []; - if (this.menusIsMultiple) { + if (this.menusIsMultiple || this.indexList.length > 1) { const exits = this.selectRowData.some(value => { fileIds.push(value.id) const thisParentPath = value.path @@ -1526,7 +1535,11 @@ export default { return } } else { - fileIds.push(this.rowContextData.id) + if(this.rowContextData.id){ + fileIds.push(this.rowContextData.id) + }else{ + fileIds.push(this.rowContextData[0].id) + } } this.copyOrMoveApi(operating,fileIds,this.selectTreeNode.id) }, @@ -1593,6 +1606,27 @@ export default { ); } }, + share(row) { + if(!row || !row.id){ + if(this.rowContextData.id){ + row = this.rowContextData + } else { + row = this.selectRowData[0] + } + } + this.shareDialog = true + this.shareFileName = row.name + api.generate({ + userId: row.userId, + fileId: row.id + }).then(res => { + if (res.data) { + this.shareLink = 'http://'+window.location.host+'/s?s='+res.data + this.generateShareLinkLoading = false + console.log(window.location.host, this.$route) + } + }) + }, // 复制分享链接 copyShareLink() { var clipboard = new Clipboard('.tag-share-link') @@ -1624,12 +1658,16 @@ export default { }) if (totalSize > 0) { var fileIds = []; - if (this.menusIsMultiple) { + if (this.indexList.length > 1) { this.selectRowData.forEach(value => { fileIds.push(value.id) }) } else { + if (this.rowContextData.id) { fileIds.push(this.rowContextData.id) + } else { + fileIds.push(this.selectRowData[0].id) + } } window.open(process.env.VUE_APP_BASE_FILE_API + 'download?jmal-token=' + this.$store.state.user.token + '&fileIds=' + fileIds, '_self') } else { @@ -1654,7 +1692,7 @@ export default { deleteFile() { let fileList = [] const fileIds = [] - if (this.menusIsMultiple) { + if (this.menusIsMultiple || this.indexList.length > 1) { fileList = this.selectRowData this.selectRowData.forEach(value => { fileIds.push(value.id) @@ -1662,6 +1700,7 @@ export default { } else { fileIds.push(this.selectRowData[0].id) } + console.log(fileIds) const str = this.getShowSumFileAndFolder(fileList) this.$confirm('此操作将永久删除' + str + ', 是否继续?', '提示', { @@ -1738,9 +1777,14 @@ export default { }else{ // 打开文件 const fileIds = [row.id] - const url = process.env.VUE_APP_BASE_FILE_API + 'preview/' + row.name + '?jmal-token=' + this.$store.state.user.token + '&fileIds=' + fileIds + let url = process.env.VUE_APP_BASE_FILE_API + 'preview/' + row.name + '?jmal-token=' + this.$store.state.user.token + '&fileIds=' + fileIds window.open(url, '_blank') } + // const fileIds = [row.id] + // let url = 'http://localhost:10010/preview/' + row.name + '?jmal-token=' + this.$store.state.user.token + '&fileIds=' + fileIds + // url = process.env.VUE_APP_BASE_PRIVIEW_API+'/onlinePreview?url='+encodeURIComponent(url); + // console.log("url",url) + // window.open(url); } } } diff --git a/src/views/public/share/shareList.vue b/src/views/public/share/shareList.vue index 8a39463..2583161 100644 --- a/src/views/public/share/shareList.vue +++ b/src/views/public/share/shareList.vue @@ -19,7 +19,7 @@
- 下载 + 下载 diff --git a/vue.config.js b/vue.config.js index b48cc5d..10961e8 100644 --- a/vue.config.js +++ b/vue.config.js @@ -52,6 +52,14 @@ module.exports = { pathRewrite: { ['^' + process.env.VUE_APP_BASE_FILE_API]: '' } + }, + [process.env.VUE_APP_BASE_PRIVIEW_API]: { + target: 'http://localhost:8012/', + // target: `http://127.0.0.1:${port}/mock`, + changeOrigin: true, + pathRewrite: { + ['^' + process.env.VUE_APP_BASE_PRIVIEW_API]: '' + } } } // before: require('./mock/mock-server.js')