From 2cf727fc8019ec4988f78107721a0e7dd723c592 Mon Sep 17 00:00:00 2001 From: jmal Date: Mon, 20 May 2024 11:43:58 +0800 Subject: [PATCH 01/15] fix: 106 --- src/components/preview/SimTextPreview.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/preview/SimTextPreview.vue b/src/components/preview/SimTextPreview.vue index 7833f10..11ce4ad 100644 --- a/src/components/preview/SimTextPreview.vue +++ b/src/components/preview/SimTextPreview.vue @@ -894,10 +894,10 @@ }else{ if(editableTabValue.copyTitle === editableTabValue.title){ editableTabValue.title += '*' - editableTabValue.status = 'Modifying' - this.isShowUpdateBtn = true - editableTabValue.change = value } + editableTabValue.status = 'Modifying' + this.isShowUpdateBtn = true + editableTabValue.change = value } }, saveAll(isClose){ From 56bfd19d1884c87c0be7edc74d7e3b9c9e57c8e4 Mon Sep 17 00:00:00 2001 From: jmal Date: Mon, 20 May 2024 12:07:53 +0800 Subject: [PATCH 02/15] =?UTF-8?q?style:=20=E4=BC=98=E5=8C=96=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E7=BC=96=E8=BE=91=E7=9A=84=E4=BF=9D=E5=AD=98=E6=8C=89?= =?UTF-8?q?=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/preview/SimTextPreview.vue | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/components/preview/SimTextPreview.vue b/src/components/preview/SimTextPreview.vue index 11ce4ad..506f198 100644 --- a/src/components/preview/SimTextPreview.vue +++ b/src/components/preview/SimTextPreview.vue @@ -53,7 +53,7 @@ > - 保存所有 + {{saveTitle}} editable.status === 'Modifying') + if (modifyingTags) { + let modifyingLength = modifyingTags.length + if(modifyingLength > 1) { + this.saveTitle = '保存全部' + return + } + } + this.saveTitle = '保存' }, saveAll(isClose){ this.editableTabs.forEach((tab,index) => { @@ -957,6 +971,7 @@ this.isShowUpdateBtn = false } } + this.updateSaveTitle() if(!this.modifyMsg){ this.$refs.historyPopover.loadHistoryPathList(this.editableTabsValue) this.modifyMsg = this.$message({ From 133133b0d6a6fbf32c72b8644bed0ae1c2de1649 Mon Sep 17 00:00:00 2001 From: jmal Date: Mon, 20 May 2024 18:38:06 +0800 Subject: [PATCH 03/15] =?UTF-8?q?fix:=20=E6=90=9C=E7=B4=A2=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E4=B8=8B=E8=B7=B3=E8=BD=AC=E8=B7=AF=E5=BE=84=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ShowFile/ShowFile.vue | 185 +++++++++++++++------------ 1 file changed, 106 insertions(+), 79 deletions(-) diff --git a/src/components/ShowFile/ShowFile.vue b/src/components/ShowFile/ShowFile.vue index cf84b92..a0524c0 100644 --- a/src/components/ShowFile/ShowFile.vue +++ b/src/components/ShowFile/ShowFile.vue @@ -1331,6 +1331,18 @@ export default { this.onCreateFilename = this.$route.query.highlight this.clearOnCreateFilename() } + // remove query.basePath + if (this.$route.query.basePath) { + this.basePath = this.$route.query.basePath + } + + // remove query.folder + if (this.$route.query.folder && this.$route.query.keyword) { + const query = { ...this.$route.query }; + delete query.folder; + this.$router.replace({ query }); + } + let that = this; window.onresize = function() { that.clientHeight = @@ -2276,27 +2288,24 @@ export default { this.lastLink(); }, lastLink() { - this.handleLink( - this.pathList[this.pathList.length - 2], - this.pathList.length - 2 - ) + let keywordQuery = '' + const searchPathIndex = this.pathList.findIndex(item => item.search) + if (searchPathIndex === this.pathList.length - 1) { + keywordQuery = '&keyword=' + } + this.handleLink(this.pathList[this.pathList.length - 2],this.pathList.length - 2, undefined, undefined, keywordQuery) }, - handleLink(item, index, unPushLink, unRefresh) { + handleLink(item, index, unPushLink, unRefresh, keywordQuery) { + console.log('handleLink item', item) + console.log('handleLink: this.pathList', this.pathList) + this.pathList.splice(this.pathList.findIndex((v, i) => i === index + 1),this.pathList.length - (index + 1)) if (item && item.search) { if (item.searchKey) { - this.searchFileByKeyWord(item.searchKey); + this.searchFileByKeyword(item.searchKey); } else if (item.row) { - this.searchFileAndOpenDir(item.row); + this.searchFileAndOpenDir(item.row.id); } - this.pathList.splice( - this.pathList.findIndex((v, i) => i === index + 1), - this.pathList.length - (index + 1) - ); } else { - this.pathList.splice( - this.pathList.findIndex((v, i) => i === index + 1), - this.pathList.length - (index + 1) - ); this.pathList.forEach((p, number) => { if (number === 0) { this.path = ""; @@ -2306,18 +2315,22 @@ export default { } this.path = this.path.replace(/\\/g, "/"); }) - let queryFolder = localStorage.getItem(this.path) if (!unPushLink) { const queryTagId = this.$route.query.tagId ? `&tagId=${this.$route.query.tagId}` : '' const basePath = this.getBasePath() - const keyword = this.$route.query.keyword ? `&keyword=${this.$route.query.keyword}` : '' - if (!this.$route.query.path) { - this.$router.push(`?vmode=${this.vmode}&path=${encodeURI(this.path)}${queryFolder ? '&folder='+queryFolder : ''}${queryTagId}${basePath}${keyword}`); + if (keywordQuery !=='&keyword=') { + keywordQuery = this.$route.query.keyword ? `&keyword=${this.$route.query.keyword}` : '' } else { - this.$router.push(`?vmode=${this.vmode}&path=${encodeURI(this.path)}${queryFolder ? '&folder='+queryFolder : ''}${queryTagId}${basePath}${keyword}`); + keywordQuery = '' } + const searchPathIndex = this.pathList.findIndex(item => item.search) + if (searchPathIndex < 0) { + keywordQuery = '' + } + console.log('keywordQuery', keywordQuery) + this.$router.push(`?vmode=${this.vmode}&path=${encodeURI(this.path)}${queryFolder ? '&folder='+queryFolder : ''}${queryTagId}${basePath}${keywordQuery}`); } if (!unRefresh) { this.pagination.pageIndex = 1; @@ -2328,6 +2341,7 @@ export default { getBasePath() { let basePath = this.$route.query.basePath ? `&basePath=${this.$route.query.basePath}` : '' if (!this.path || this.path.length < 2) { + this.basePath = '/' return '' } return basePath @@ -2495,15 +2509,13 @@ export default { } } let suffix = newFileName.substring(newFileName.lastIndexOf(".") + 1); - api - .addFile({ + api.addFile({ fileName: encodeURI(newFileName), isFolder: false, folder: this.$route.query.folder, username: this.$store.state.user.name, parentPath: encodeURI(parentPath) - }) - .then(res => { + }).then(res => { this.createFileLoading = false; switch (suffix && !this.$route.query.folder) { case "txt": @@ -2525,13 +2537,12 @@ export default { setTimeout(function() { that.newCreateFileDialog = false; }, 200) - }) - .catch(() => { + }).catch(() => { this.createFileLoading = false; }); } }, - searchFileByKeyWord(key) { + searchFileByKeyword(key) { this.searchFile(key); }, // 切换布局 @@ -2678,6 +2689,17 @@ export default { storageType = 'File' } } + + console.log('loadData1: this.path', this.path) + + const path = this.$route.query.path ? this.$route.query.path : '/' + const basePath = this.$route.query.basePath ? this.$route.query.basePath : '/' + this.path = basePath + path + this.path = this.path.replace(/\\/g, '/') + this.path = this.path.replace(/\/\//g, '/') + + console.log('loadData2: this.path', this.path) + this.$store.dispatch('updateMessage', {event: 'storageTypeChange', data: storageType}) }, // 设置挂载文件的用户名(文件的所有者) @@ -2697,7 +2719,7 @@ export default { if (this.onCreateFilename) { let index = this.fileList.findIndex(item => item.name === this.onCreateFilename); if (index > -1) { - let row = this.fileList[index]; + let row = this.fileList[index] setTimeout(() => { this.$refs.fileListTable.clearSelection() this.$refs.fileListTable.toggleRowSelection([{ row: row ,selected: true}]) @@ -2708,28 +2730,24 @@ export default { searchFile(key, onLoad) { if (key) { this.beforeLoadData(onLoad); - // this.pathList = [{ folder: "" }]; + // this.pathList = [{ folder: "" }] // 查找this.pathList中是否已经有搜索的路径 - let isExist = false; - this.pathList.forEach(item => { - if (item.search) { - // 修改搜索的路径 - item.folder = "搜索: " + '"' + key + '"'; - isExist = true; - } - }); - if (!isExist) { - const item1 = {}; - item1["folder"] = "搜索: " + '"' + key + '"'; - item1["search"] = true; - item1["searchKey"] = key; - this.pathList.push(item1); + const searchPathIndex = this.pathList.findIndex(item => item.search) + if (searchPathIndex < 0) { + const item1 = {} + item1["folder"] = `搜索: ${key}` + item1["search"] = true + item1["searchKey"] = key + this.pathList.push(item1) } + console.log('searchFile: this.pathList', this.pathList) const queryTagId = this.$route.query.tagId ? `&tagId=${this.$route.query.tagId}` : '' + const folder = this.$route.query.folder ? `&folder=${this.$route.query.folder}` : '' const basePath = this.getBasePath() const keyword = key ? `&keyword=${key}` : '' - const path = this.path ? encodeURI(this.path) : "/"; - this.$router.push(`?vmode=${this.vmode}&path=${path}${keyword}${queryTagId}${basePath}`); + console.log('this.path', this.path, this.$route.query.path) + const path = this.path ? encodeURI(this.path.replace(this.basePath, '/')) : "/" + this.$router.push(`?vmode=${this.vmode}&path=${path}${keyword}${queryTagId}${basePath}${folder}`) api.searchFile({ userId: this.$store.state.user.userId, username: this.$store.state.user.name, @@ -2744,8 +2762,7 @@ export default { pageIndex: this.pagination.pageIndex, pageSize: this.pagination.pageSize, showFolderSize: localStorage.getItem('showFolderSize') - }) - .then(res => { + }).then(res => { this.loadData(res, onLoad); this.listModeSearch = true; this.listModeSearchOpenDir = false; @@ -2756,13 +2773,12 @@ export default { } } }, - searchFileAndOpenDir(row, onLoad) { + searchFileAndOpenDir(fileId, onLoad) { this.beforeLoadData(onLoad); - api - .searchFileAndOpenDir({ + api.searchFileAndOpenDir({ userId: this.$store.state.user.userId, username: this.$store.getters.name, - id: row.id, + id: fileId, currentDirectory: this.getQueryPath(), pageIndex: this.pagination.pageIndex, pageSize: this.pagination.pageSize, @@ -2772,15 +2788,12 @@ export default { .then(res => { this.loadData(res, onLoad); this.listModeSearch = true; - this.listModeSearchOpenDir = row; + this.listModeSearchOpenDir = fileId; }); - this.path = row.path + row.name; - this.path = this.path.replace(/\\/g, "/"); }, openDir(row, onLoad) { this.beforeLoadData(onLoad); - api - .searchFileAndOpenDir({ + api.searchFileAndOpenDir({ userId: this.$store.state.user.userId, username: this.$store.getters.name, id: row.mountFileId || row.id, @@ -2789,25 +2802,28 @@ export default { pageSize: this.pagination.pageSize, folder: this.$route.query.folder, showFolderSize: localStorage.getItem('showFolderSize') - }) - .then(res => { + }).then(res => { this.loadData(res, onLoad); }); - this.path = row.path + row.name; - this.path = this.path.replace(/\\/g, "/"); + this.path = row.path + row.name + this.path = this.path.replace(/\\/g, '/') }, getFileList(onLoad) { if (this.$route.query.keyword) { if (this.$route.query.keyword !== "undefined") { - this.searchFileName = this.$route.query.keyword; + this.searchFileName = this.$route.query.keyword + } + const searchPathIndex = this.pathList.findIndex(item => item.search) + if (this.$route.query.folder && searchPathIndex > -1) { + this.searchFileAndOpenDir(this.$route.query.folder, onLoad) + } else { + this.searchFile(this.searchFileName) } - this.searchFile(this.searchFileName) } else { this.searchFileName = "" this.getFileListed = true this.beforeLoadData(onLoad) - api - .fileList({ + api.fileList({ userId: this.$store.state.user.userId, username: this.$store.state.user.name, currentDirectory: this.getQueryPath(), @@ -2830,8 +2846,7 @@ export default { }, getFileListBySearchMode(onLoad) { this.beforeLoadData(onLoad); - api - .fileList({ + api.fileList({ userId: this.$store.state.user.userId, username: this.$store.state.user.name, currentDirectory: this.getQueryPath(), @@ -2839,8 +2854,7 @@ export default { pageIndex: this.pagination.pageIndex, pageSize: this.pagination.pageSize, showFolderSize: localStorage.getItem('showFolderSize') - }) - .then(res => { + }).then(res => { this.loadData(res, onLoad); }); }, @@ -4073,32 +4087,45 @@ export default { this.pathList.push(item); this.pagination.pageIndex = 1; const folder = row.id ? `&folder=${row.id}` : '' - this.$router.push(`?vmode=${this.vmode}${keyword}${folder}${queryTagId}${basePath}`); - this.searchFileAndOpenDir(row); + const path = this.$route.query.path ? `&path=${this.$route.query.path}` : '' + console.log('this.listModeSearch: this.path', this.path) + console.log('this.listModeSearch: this.pathList', this.pathList) + const basePath = this.getBasePath() + this.$router.push(`?vmode=${this.vmode}${path}${keyword}${folder}${queryTagId}${basePath}`); + this.searchFileAndOpenDir(row.id); } else { let notHomePage = this.$route.path.length > 1 - if (notHomePage && this.basePath.length === 1) { + console.log('notHomePage', notHomePage) + console.log('this.path', this.path) + console.log('row.path', row.path) + if (notHomePage && this.path + "/" !== row.path && this.basePath.length === 1) { this.basePath = row.path } - if (this.path) { - this.path += "/" + row.name; - } else { - this.path = this.basePath + row.name; - } + + this.path += "/" + row.name; + this.path = this.path.replace(/\\/g, '/') + this.path = this.path.replace(/\/\//g, '/') // 去掉this.path开头的this.basePath this.path = this.path.replace(this.basePath, '/') + const path = encodeURI(this.path); + + // if (this.path) { + // this.path += "/" + row.name; + // } else { + // this.path = this.basePath + row.name; + // } + // // 去掉this.path开头的this.basePath const item = { folder: row.name, shareBase: row.shareBase }; this.pathList.push(item); this.pagination.pageIndex = 1; - const path = encodeURI(this.path); if (this.$store.getters.userId !== row.userId) { row.mountFileId = row.id } if (row.mountFileId) { localStorage.setItem(this.path, row.mountFileId) } - const basePath = this.basePath.length > 1 ? '&basePath='+this.basePath : '' - this.$router.push(`?vmode=${this.vmode}&path=${path}${row.mountFileId ? '&folder='+row.mountFileId : ''}${queryTagId}${basePath}${keyword}`); + const basePath = this.basePath ? `&basePath=${this.basePath}` : '' + this.$router.push(`?vmode=${this.vmode}&path=${encodeURI(path)}${row.mountFileId ? '&folder='+row.mountFileId : ''}${queryTagId}${basePath}${keyword}`); this.openDir(row); } } else { From a16ecc01590c6f9045e765dd95610700c4971f8c Mon Sep 17 00:00:00 2001 From: jmal Date: Mon, 20 May 2024 18:47:09 +0800 Subject: [PATCH 04/15] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E7=8A=B6=E6=80=81=E4=B8=8B,=E8=BF=9B=E5=85=A5?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E5=90=8E=E7=9A=84=E5=8F=B3=E9=94=AE=E8=8F=9C?= =?UTF-8?q?=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ShowFile/ShowFile.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/ShowFile/ShowFile.vue b/src/components/ShowFile/ShowFile.vue index a0524c0..cfd3b47 100644 --- a/src/components/ShowFile/ShowFile.vue +++ b/src/components/ShowFile/ShowFile.vue @@ -3289,7 +3289,8 @@ export default { setMenus(row) { this.menus = JSON.parse(JSON.stringify(this.singleMenus)); // 挂载的文件 - if (this.$route.query.folder) { + const owner = localStorage.getItem('mountFileOwner') + if (this.$route.query.folder && owner) { // 根据权限设置菜单 this.setMenusByPermission(row); } else { From 40e91e75a9f4e996f3394be7379e091a253737c8 Mon Sep 17 00:00:00 2001 From: jmal Date: Mon, 20 May 2024 18:48:19 +0800 Subject: [PATCH 05/15] style: remove log --- src/components/ShowFile/ShowFile.vue | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/components/ShowFile/ShowFile.vue b/src/components/ShowFile/ShowFile.vue index cfd3b47..4d97339 100644 --- a/src/components/ShowFile/ShowFile.vue +++ b/src/components/ShowFile/ShowFile.vue @@ -2296,8 +2296,6 @@ export default { this.handleLink(this.pathList[this.pathList.length - 2],this.pathList.length - 2, undefined, undefined, keywordQuery) }, handleLink(item, index, unPushLink, unRefresh, keywordQuery) { - console.log('handleLink item', item) - console.log('handleLink: this.pathList', this.pathList) this.pathList.splice(this.pathList.findIndex((v, i) => i === index + 1),this.pathList.length - (index + 1)) if (item && item.search) { if (item.searchKey) { @@ -2329,7 +2327,6 @@ export default { if (searchPathIndex < 0) { keywordQuery = '' } - console.log('keywordQuery', keywordQuery) this.$router.push(`?vmode=${this.vmode}&path=${encodeURI(this.path)}${queryFolder ? '&folder='+queryFolder : ''}${queryTagId}${basePath}${keywordQuery}`); } if (!unRefresh) { @@ -2690,16 +2687,12 @@ export default { } } - console.log('loadData1: this.path', this.path) - const path = this.$route.query.path ? this.$route.query.path : '/' const basePath = this.$route.query.basePath ? this.$route.query.basePath : '/' this.path = basePath + path this.path = this.path.replace(/\\/g, '/') this.path = this.path.replace(/\/\//g, '/') - console.log('loadData2: this.path', this.path) - this.$store.dispatch('updateMessage', {event: 'storageTypeChange', data: storageType}) }, // 设置挂载文件的用户名(文件的所有者) @@ -2740,12 +2733,10 @@ export default { item1["searchKey"] = key this.pathList.push(item1) } - console.log('searchFile: this.pathList', this.pathList) const queryTagId = this.$route.query.tagId ? `&tagId=${this.$route.query.tagId}` : '' const folder = this.$route.query.folder ? `&folder=${this.$route.query.folder}` : '' const basePath = this.getBasePath() const keyword = key ? `&keyword=${key}` : '' - console.log('this.path', this.path, this.$route.query.path) const path = this.path ? encodeURI(this.path.replace(this.basePath, '/')) : "/" this.$router.push(`?vmode=${this.vmode}&path=${path}${keyword}${queryTagId}${basePath}${folder}`) api.searchFile({ @@ -4089,16 +4080,11 @@ export default { this.pagination.pageIndex = 1; const folder = row.id ? `&folder=${row.id}` : '' const path = this.$route.query.path ? `&path=${this.$route.query.path}` : '' - console.log('this.listModeSearch: this.path', this.path) - console.log('this.listModeSearch: this.pathList', this.pathList) const basePath = this.getBasePath() this.$router.push(`?vmode=${this.vmode}${path}${keyword}${folder}${queryTagId}${basePath}`); this.searchFileAndOpenDir(row.id); } else { let notHomePage = this.$route.path.length > 1 - console.log('notHomePage', notHomePage) - console.log('this.path', this.path) - console.log('row.path', row.path) if (notHomePage && this.path + "/" !== row.path && this.basePath.length === 1) { this.basePath = row.path } From 987beaa25d7ec09810f8071207ab09389f5783fc Mon Sep 17 00:00:00 2001 From: AmCoder Date: Tue, 21 May 2024 14:33:13 +0800 Subject: [PATCH 06/15] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=A4=B9=E5=90=8E=E6=97=A0=E6=B3=95=E8=BF=9B?= =?UTF-8?q?=E5=85=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ShowFile/ShowFile.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ShowFile/ShowFile.vue b/src/components/ShowFile/ShowFile.vue index cf84b92..1401dad 100644 --- a/src/components/ShowFile/ShowFile.vue +++ b/src/components/ShowFile/ShowFile.vue @@ -4073,7 +4073,7 @@ export default { this.pathList.push(item); this.pagination.pageIndex = 1; const folder = row.id ? `&folder=${row.id}` : '' - this.$router.push(`?vmode=${this.vmode}${keyword}${folder}${queryTagId}${basePath}`); + this.$router.push(`?vmode=${this.vmode}${keyword}${folder}${queryTagId}${this.basePath}`); this.searchFileAndOpenDir(row); } else { let notHomePage = this.$route.path.length > 1 From 00cee6b81337bd42fd03b5ac987432be2e93af83 Mon Sep 17 00:00:00 2001 From: jmal Date: Tue, 21 May 2024 18:04:45 +0800 Subject: [PATCH 07/15] fix: 109 --- src/components/ShowFile/ShowFile.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ShowFile/ShowFile.vue b/src/components/ShowFile/ShowFile.vue index cf84b92..d89d533 100644 --- a/src/components/ShowFile/ShowFile.vue +++ b/src/components/ShowFile/ShowFile.vue @@ -3298,7 +3298,7 @@ export default { this.menus.splice(index, 1) } } - if (row.isShare && !row.isPrivacy) { + if (row.isShare && !row.isPrivacy && !row.isFolder) { // 添加复制下载链接选项 this.menus.splice(-2, 0, { iconClass: "menu-fuzhi", label: "复制下载链接", operation: "copyDownloadLink" }) } From 7845a8050d31ae18ec69a01e18dfcefb9c726e1f Mon Sep 17 00:00:00 2001 From: jmal Date: Wed, 22 May 2024 09:25:03 +0800 Subject: [PATCH 08/15] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E6=9B=B4=E6=8D=A2=E5=85=B3=E9=94=AE=E5=AD=97=E5=90=8E?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E7=9A=84=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ShowFile/ShowFile.vue | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/components/ShowFile/ShowFile.vue b/src/components/ShowFile/ShowFile.vue index 4d97339..de4dd8c 100644 --- a/src/components/ShowFile/ShowFile.vue +++ b/src/components/ShowFile/ShowFile.vue @@ -2725,16 +2725,23 @@ export default { this.beforeLoadData(onLoad); // this.pathList = [{ folder: "" }] // 查找this.pathList中是否已经有搜索的路径 + + const item = {} + item["folder"] = `搜索: ${key}` + item["search"] = true + item["searchKey"] = key + + let folder = this.$route.query.folder ? `&folder=${this.$route.query.folder}` : '' + const searchPathIndex = this.pathList.findIndex(item => item.search) if (searchPathIndex < 0) { - const item1 = {} - item1["folder"] = `搜索: ${key}` - item1["search"] = true - item1["searchKey"] = key - this.pathList.push(item1) + this.pathList.push(item) + } else { + this.pathList.splice(searchPathIndex, this.pathList.length - searchPathIndex) + this.pathList.push(item) + folder = '' } const queryTagId = this.$route.query.tagId ? `&tagId=${this.$route.query.tagId}` : '' - const folder = this.$route.query.folder ? `&folder=${this.$route.query.folder}` : '' const basePath = this.getBasePath() const keyword = key ? `&keyword=${key}` : '' const path = this.path ? encodeURI(this.path.replace(this.basePath, '/')) : "/" From fe81bf5d045f9011db1b31132d93e87af0275108 Mon Sep 17 00:00:00 2001 From: jmal Date: Wed, 22 May 2024 09:35:55 +0800 Subject: [PATCH 09/15] =?UTF-8?q?test:=20=E8=B7=B3=E8=BD=AC=E8=B7=AF?= =?UTF-8?q?=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ShowFile/ShowFile.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/ShowFile/ShowFile.vue b/src/components/ShowFile/ShowFile.vue index de4dd8c..15d38f1 100644 --- a/src/components/ShowFile/ShowFile.vue +++ b/src/components/ShowFile/ShowFile.vue @@ -2803,8 +2803,8 @@ export default { }).then(res => { this.loadData(res, onLoad); }); - this.path = row.path + row.name - this.path = this.path.replace(/\\/g, '/') + // this.path = row.path + row.name + // this.path = this.path.replace(/\\/g, '/') }, getFileList(onLoad) { if (this.$route.query.keyword) { From c4aa8eb2dbdca2c34f5dcc4c38a4300ae8607efb Mon Sep 17 00:00:00 2001 From: jmal Date: Wed, 22 May 2024 11:42:37 +0800 Subject: [PATCH 10/15] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E6=94=B6?= =?UTF-8?q?=E8=97=8F=E9=A1=B5=E5=8F=B3=E9=94=AE=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ShowFile/ShowFile.vue | 38 ++++++++++++++++------------ src/views/favorite/index.vue | 36 ++------------------------ 2 files changed, 24 insertions(+), 50 deletions(-) diff --git a/src/components/ShowFile/ShowFile.vue b/src/components/ShowFile/ShowFile.vue index af36436..a2246a5 100644 --- a/src/components/ShowFile/ShowFile.vue +++ b/src/components/ShowFile/ShowFile.vue @@ -1324,7 +1324,7 @@ export default { } }); } - if (this.$route.query.folder && this.path) { + if (this.$route.query.folder && this.path && !this.$route.query.keyword) { localStorage.setItem(this.path, this.$route.query.folder) } if (this.$route.query.highlight) { @@ -2297,6 +2297,7 @@ export default { }, handleLink(item, index, unPushLink, unRefresh, keywordQuery) { this.pathList.splice(this.pathList.findIndex((v, i) => i === index + 1),this.pathList.length - (index + 1)) + console.log('handleLink', item) if (item && item.search) { if (item.searchKey) { this.searchFileByKeyword(item.searchKey); @@ -2313,8 +2314,7 @@ export default { } this.path = this.path.replace(/\\/g, "/"); }) - let queryFolder = localStorage.getItem(this.path) - + let queryFolder = localStorage.getItem("mountFileOwner") ? localStorage.getItem(this.path) : this.$route.query.folder if (!unPushLink) { const queryTagId = this.$route.query.tagId ? `&tagId=${this.$route.query.tagId}` : '' const basePath = this.getBasePath() @@ -2773,6 +2773,14 @@ export default { }, searchFileAndOpenDir(fileId, onLoad) { this.beforeLoadData(onLoad); + + const queryTagId = this.$route.query.tagId ? `&tagId=${this.$route.query.tagId}` : '' + const path = this.$route.query.path ? `&path=${this.$route.query.path}` : '' + const keyword = this.$route.query.keyword ? `&keyword=${this.$route.query.keyword}` : '' + const basePath = this.getBasePath() + const folder = `&folder=${fileId}` + this.$router.push(`?vmode=${this.vmode}${path}${keyword}${queryTagId}${basePath}${folder}`) + api.searchFileAndOpenDir({ userId: this.$store.state.user.userId, username: this.$store.getters.name, @@ -3102,7 +3110,7 @@ export default { this.rowContextData = row; } const isFavorite = this.rowContextData.isFavorite; - this.highlightFavorite(this.isCollectView ? true : isFavorite, false); + this.highlightFavorite(isFavorite, false); }, // 单元格hover进入时事件 cellMouseEnter(row) { @@ -3356,7 +3364,7 @@ export default { ) { this.menusIsMultiple = true; this.menus = this.multipleRightMenus; - this.highlightFavorite(this.isCollectView, false); + this.highlightFavorite(false, false); } else { this.$refs.fileListTable.clearSelection(); this.$refs.fileListTable.toggleRowSelection([{ row: row }]); @@ -3394,10 +3402,10 @@ export default { } }, menuFavoriteOver(index, isFavorite) { - this.highlightFavorite(this.isCollectView ? true : isFavorite, false); + this.highlightFavorite(isFavorite, false); }, menuFavoriteLeave(index, isFavorite) { - this.highlightFavorite(this.isCollectView ? true : isFavorite, false); + this.highlightFavorite(isFavorite, false); }, // 是否高亮收藏图标 highlightFavorite(isFavorite, isHover) { @@ -3911,19 +3919,17 @@ export default { const fileIds = this.getSelectIdList(); this.rowContextData.isFavorite = isFavorite; this.highlightFavorite(isFavorite, true); - api - .favoriteUrl({ + api.favoriteUrl({ fileIds: fileIds, isFavorite: isFavorite - }) - .then(res => { + }).then(() => { // 收藏页面 - if (!isFavorite && this.isCollectView) { + const homePage = !this.$route.query.path || this.$route.query.length <= 1 + if (!isFavorite && this.isCollectView && homePage) { // 移除列表 this.removeSelectItme(); } - }) - .catch(() => { + }).catch(() => { this.rowContextData.isFavorite = !isFavorite; }); }, @@ -4118,8 +4124,8 @@ export default { if (row.mountFileId) { localStorage.setItem(this.path, row.mountFileId) } - const basePath = this.basePath ? `&basePath=${this.basePath}` : '' - this.$router.push(`?vmode=${this.vmode}&path=${encodeURI(path)}${row.mountFileId ? '&folder='+row.mountFileId : ''}${queryTagId}${basePath}${keyword}`); + const basePath = this.basePath && this.basePath.length > 1 ? `&basePath=${this.basePath}` : '' + this.$router.push(`?vmode=${this.vmode}&path=${path}${row.mountFileId ? '&folder='+row.mountFileId : ''}${queryTagId}${basePath}${keyword}`); this.openDir(row); } } else { diff --git a/src/views/favorite/index.vue b/src/views/favorite/index.vue index aedb13a..d61eaa1 100644 --- a/src/views/favorite/index.vue +++ b/src/views/favorite/index.vue @@ -7,10 +7,6 @@ :orderCustom="true" :defaultSort="sortable" :queryCondition="queryCondition" - :singleMenus="singleMenus" - :singleMenusEdit="singleMenusEdit" - :multipleMenus="multipleMenus" - :multipleRightMenus="multipleRightMenus" :contextMenus="contextMenus" > @@ -45,7 +41,7 @@ }, { label: '刷新', operation: 'refresh'}, { divider: true, operation: 'divider' }, - { label: '新建', operation: 'create' , homeDisable: true ,child: [ + { label: '新建', operation: 'create' , homeDisable: true, child: [ { label: '文件夹', operation: 'createFolder', iconClass: 'folder'}, { divider: true, operation: 'divider' }, { label: '文本', operation: 'createTextFile', iconClass: 'file-txt'}, @@ -58,35 +54,7 @@ }, { divider: true, operation: 'divider' }, { label: '写文章', operation: 'createMarkdownFile'}, - ], - singleMenus: [ - { iconClass: 'menu-open', label: '打开', operation: 'open' }, - { iconClass: 'share', label: '分享', operation: 'share' }, - { iconClass: 'menu-favorite', label: '收藏', operation: 'favorite' }, - { iconClass: 'menu-details', label: '详细信息', operation: 'details' }, - { iconClass: 'menu-rename', label: '重命名', operation: 'rename' }, - { iconClass: 'menu-copy', label: '移动或复制', operation: 'copy' }, - { iconClass: 'menu-download', label: '下载', operation: 'download' }, - // { iconClass: 'menu-favorite-hover', label: '取消收藏', operation: 'unFavorite' } - ], - singleMenusEdit: [ - { iconClass: 'menu-open', label: '打开', operation: 'open' }, - { iconClass: 'share', label: '分享', operation: 'share' }, - { iconClass: 'menu-favorite', label: '收藏', operation: 'favorite' }, - { iconClass: 'menu-edit1', label: '编辑', operation: 'edit' }, - { iconClass: 'menu-details', label: '详细信息', operation: 'details' }, - { iconClass: 'menu-rename', label: '重命名', operation: 'rename' }, - { iconClass: 'menu-download', label: '下载', operation: 'download' }, - // { iconClass: 'menu-favorite-hover', label: '取消收藏', operation: 'unFavorite' } - ], - multipleMenus: [ - { iconClass: 'menu-download', label: '下载', operation: 'download' }, - { iconClass: 'menu-favorite-hover', label: '取消收藏', operation: 'unFavorite' } - ], - multipleRightMenus: [ - { iconClass: 'menu-download', label: '下载', operation: 'download' }, - { iconClass: 'menu-favorite-hover', label: '取消收藏', operation: 'unFavorite' } - ], + ] } }, } From 6418c607c9966a19525fc0bbf44cf9493ecf316c Mon Sep 17 00:00:00 2001 From: jmal Date: Wed, 22 May 2024 11:43:36 +0800 Subject: [PATCH 11/15] style: remove log --- src/components/ShowFile/ShowFile.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/ShowFile/ShowFile.vue b/src/components/ShowFile/ShowFile.vue index a2246a5..fbf9dd8 100644 --- a/src/components/ShowFile/ShowFile.vue +++ b/src/components/ShowFile/ShowFile.vue @@ -2297,7 +2297,6 @@ export default { }, handleLink(item, index, unPushLink, unRefresh, keywordQuery) { this.pathList.splice(this.pathList.findIndex((v, i) => i === index + 1),this.pathList.length - (index + 1)) - console.log('handleLink', item) if (item && item.search) { if (item.searchKey) { this.searchFileByKeyword(item.searchKey); From 93dca9c47009f0d92bc874d26ec070ae24d96cfb Mon Sep 17 00:00:00 2001 From: jmal Date: Wed, 22 May 2024 14:51:00 +0800 Subject: [PATCH 12/15] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E7=AB=AF=E6=90=9C=E7=B4=A2=E7=8A=B6=E6=80=81=E4=B8=8B?= =?UTF-8?q?=E6=89=93=E5=BC=80=E7=9B=AE=E5=BD=95=E7=9A=84=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/home/mobile/index.vue | 96 ++++++++++++++++++++++++--------- 1 file changed, 70 insertions(+), 26 deletions(-) diff --git a/src/views/home/mobile/index.vue b/src/views/home/mobile/index.vue index e772874..2b6d89b 100644 --- a/src/views/home/mobile/index.vue +++ b/src/views/home/mobile/index.vue @@ -34,7 +34,7 @@ v-model="loading" :finished="finished" :finished-text="statistics()" - @load="searchStatus && searchValue.length>0?searchFile(searchValue,true):getFileList(true)" + @load="getFileList(true)" > @@ -807,10 +807,13 @@ export default { searchAction.style.marginRight = '-44px' searchAction.style.visibility = 'hidden' this.searchValue = '' + this.pathList.splice(1, this.pathList.length - 1) + this.$router.push(`?vmode=${this.vmode}`) this.getFileList() }, onSearch() { if (this.searchValue.length < 1) { + this.$router.push(`?vmode=${this.vmode}`) this.getFileList() } else { this.searchFile(this.searchValue) @@ -898,25 +901,53 @@ export default { this.loading = true; this.getFileList(); }, - getFileList(onLoad) { - this.beforeLoadData(onLoad) - api.fileList({ - username: this.$store.state.user.name, + searchFileAndOpenDir(fileId, onLoad) { + this.beforeLoadData(onLoad); + api.searchFileAndOpenDir({ userId: this.$store.state.user.userId, - currentDirectory: encodeURI(this.$route.query.path), - folder: this.$route.query.folder, - queryFileType: this.queryFileType, - sortableProp: this.sortableProp, - order: this.order, - isFolder: this.queryCondition.isFolder, - isFavorite: this.queryCondition.isFavorite, - queryCondition: this.queryCondition, + username: this.$store.getters.name, + id: fileId, pageIndex: this.pagination.pageIndex, pageSize: this.pagination.pageSize, + folder: this.$route.query.folder, + showFolderSize: localStorage.getItem('showFolderSize') }).then(res => { - this.loadData(res, onLoad) - }).catch(e => { - }) + this.loadData(res, onLoad) + this.listModeSearch = true + }) + }, + getFileList(onLoad) { + this.beforeLoadData(onLoad) + if (this.$route.query.keyword) { + if (this.$route.query.keyword !== "undefined") { + this.searchValue = this.$route.query.keyword + } + const searchPathIndex = this.pathList.findIndex(item => item.search) + if (this.$route.query.folder && searchPathIndex > -1) { + this.searchFileAndOpenDir(this.$route.query.folder, false) + } else { + this.searchFile(this.searchValue, onLoad) + } + } else { + this.beforeLoadData(onLoad) + api.fileList({ + username: this.$store.state.user.name, + userId: this.$store.state.user.userId, + currentDirectory: encodeURI(this.$route.query.path), + folder: this.$route.query.folder, + queryFileType: this.queryFileType, + sortableProp: this.sortableProp, + order: this.order, + isFolder: this.queryCondition.isFolder, + isFavorite: this.queryCondition.isFavorite, + queryCondition: this.queryCondition, + pageIndex: this.pagination.pageIndex, + pageSize: this.pagination.pageSize, + }).then(res => { + this.loadData(res, onLoad) + }).catch(e => { + }) + } }, searchFile(key, onLoad) { if (key) { @@ -933,7 +964,6 @@ export default { this.loadData(res, onLoad) this.path = '' this.listModeSearch = true - this.listModeSearchOpenDir = false }) } }, @@ -943,9 +973,9 @@ export default { this.pagination.pageIndex++ } else { this.pagination.pageIndex = 1 + this.fileList = [] } this.finished = false; - this.fileList = [] }, // 填充数据 loadData(res, onLoad) { @@ -1087,15 +1117,29 @@ export default { item['folder'] = row.name item['index'] = this.pathList.length - 1 this.pathList.push(item) - const path = encodeURI(this.path); - if (this.$store.getters.userId !== row.userId) { - row.mountFileId = row.id + const keyword = this.$route.query.keyword ? `&keyword=${this.$route.query.keyword}` : '' + if (this.listModeSearch) { + const item = {}; + item["folder"] = row.name; + item["search"] = true; + item["row"] = row; + this.pathList.push(item); + this.pagination.pageIndex = 1; + const folder = row.id ? `&folder=${row.id}` : '' + const path = this.$route.query.path ? `&path=${this.$route.query.path}` : '' + this.$router.push(`?vmode=${this.vmode}${path}${keyword}${folder}`); + this.getFileList() + } else { + const path = encodeURI(this.path); + if (this.$store.getters.userId !== row.userId) { + row.mountFileId = row.id + } + if (row.mountFileId) { + localStorage.setItem(this.path, row.mountFileId) + } + this.$router.push(`/_m?vmode=${this.vmode}&path=${path}${keyword}${row.mountFileId ? '&folder='+row.mountFileId : ''}`) + this.getFileList() } - if (row.mountFileId) { - localStorage.setItem(this.path, row.mountFileId) - } - this.$router.push(`/_m?vmode=${this.vmode}&path=${path}${row.mountFileId ? '&folder='+row.mountFileId : ''}`) - this.getFileList() } else { if (row.contentType.startsWith('image')) { // 图片 From 69e94ef8ed6cb8f299bbcf9e5c77a12fade41784 Mon Sep 17 00:00:00 2001 From: jmal Date: Wed, 22 May 2024 15:02:54 +0800 Subject: [PATCH 13/15] =?UTF-8?q?perf:=20=E6=90=9C=E7=B4=A2=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E4=B8=8B=E6=98=BE=E7=A4=BA=E7=BB=93=E6=9E=9C=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ShowFile/ShowFile.vue | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/components/ShowFile/ShowFile.vue b/src/components/ShowFile/ShowFile.vue index fbf9dd8..a6de74b 100644 --- a/src/components/ShowFile/ShowFile.vue +++ b/src/components/ShowFile/ShowFile.vue @@ -158,7 +158,9 @@ :clearable="true" @keyup.enter.native="searchFile(searchFileName)" @focus="setInputFocus" + @input="searchFile(searchFileName)" @blur="setInputBlur()" + @clear="searchFile(searchFileName)" > @@ -239,12 +241,9 @@
+ {{this.pagination["total"]}}个结果:  获取更多数据... - {{ - !finished - ? "已加载 " + getSummaries3 - : "已全部加载 " + getSummaries3 - }} + {{ !finished ? "已加载 " + getSummaries3 : "已全部加载 " + getSummaries3 }}
From 3ea590eee17dc745b267887e563d769b1a175f84 Mon Sep 17 00:00:00 2001 From: jmal Date: Wed, 22 May 2024 15:17:28 +0800 Subject: [PATCH 14/15] =?UTF-8?q?perf:=20=E6=8E=A8=E5=87=BA=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E6=B8=85=E9=99=A4localStorage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/user.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/store/modules/user.js b/src/store/modules/user.js index e17c59f..56b5c9e 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -174,6 +174,7 @@ const actions = { logout({ commit, state }) { return new Promise((resolve, reject) => { logout(state.token).then(() => { + localStorage.clear() removeToken() removeConsumerId() removeRememberName() From 2da4d65098c320866e58f9a2859834f74060ce98 Mon Sep 17 00:00:00 2001 From: jmal Date: Wed, 22 May 2024 15:19:32 +0800 Subject: [PATCH 15/15] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=96=87=E4=BB=B6=E5=A4=B9=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ShowFile/ShowFile.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ShowFile/ShowFile.vue b/src/components/ShowFile/ShowFile.vue index a6de74b..1ab89e5 100644 --- a/src/components/ShowFile/ShowFile.vue +++ b/src/components/ShowFile/ShowFile.vue @@ -3457,7 +3457,7 @@ export default { break; case "show-folder-size": const showFolderSize = localStorage.getItem('showFolderSize') - localStorage.setItem('showFolderSize', showFolderSize === 'false') + localStorage.setItem('showFolderSize', showFolderSize ? false : true) this.getFileList(); break; case "orderName":