From 52b4451692c2286af88088ed76b5da0c0793eeab Mon Sep 17 00:00:00 2001 From: jmal Date: Fri, 5 Jul 2024 19:04:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=90=8D=E4=B8=AD=E6=9C=89'#'=E6=97=A0=E6=B3=95=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=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 | 22 ++++++---------------- src/utils/file-config.js | 3 ++- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/src/components/ShowFile/ShowFile.vue b/src/components/ShowFile/ShowFile.vue index e6b01ba..a1f57d6 100644 --- a/src/components/ShowFile/ShowFile.vue +++ b/src/components/ShowFile/ShowFile.vue @@ -2323,7 +2323,7 @@ export default { if (searchPathIndex < 0) { keywordQuery = '' } - this.$router.push(`?vmode=${this.vmode}&path=${encodeURI(this.path)}${queryFolder ? '&folder=' + queryFolder : ''}${queryTagId}${basePath}${keywordQuery}${searchOpenFolder}`) + this.$router.push(`?vmode=${this.vmode}&path=${encodeURI(this.path).replaceAll('#', '%23')}${queryFolder ? '&folder=' + queryFolder : ''}${queryTagId}${basePath}${keywordQuery}${searchOpenFolder}`) } if (!unRefresh) { this.pagination.pageIndex = 1 @@ -2559,13 +2559,11 @@ export default { 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}` - : '' + const basePath = this.getBasePath().replaceAll('#', '%23') + const keyword = this.$route.query.keyword ? `&keyword=${this.$route.query.keyword}` : '' const folder = this.$route.query.folder ? `&folder=${this.$route.query.folder}` : '' const searchOpenFolder = this.$route.query.searchOpenFolder ? `&searchOpenFolder=${this.$route.query.searchOpenFolder}` : '' - this.$router.push(`?vmode=${this.vmode}&path=${this.path}${folder}${queryTagId}${basePath}${keyword}${searchOpenFolder}`) + this.$router.push(`?vmode=${this.vmode}&path=${this.path.replaceAll('#', '%23')}${folder}${queryTagId}${basePath}${keyword}${searchOpenFolder}`) // 改变拖拽目标 this.rowDrop() // 画矩形选取 @@ -2790,9 +2788,7 @@ export default { const queryTagId = this.$route.query.tagId ? `&tagId=${this.$route.query.tagId}` : '' - const path = this.$route.query.path - ? `&path=${this.$route.query.path}` - : '' + const path = this.$route.query.path ? `&path=${this.$route.query.path}`.replaceAll('#', '%23') : '' const keyword = this.$route.query.keyword ? `&keyword=${this.$route.query.keyword}` : '' @@ -4199,14 +4195,8 @@ export default { this.path = this.path.replace(/\/\//g, '/') // 去掉this.path开头的this.basePath this.path = this.path.replace(this.basePath, '/') - const path = encodeURI(this.path) + const path = encodeURI(this.path).replaceAll('#', '%23') - // 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 diff --git a/src/utils/file-config.js b/src/utils/file-config.js index 552e05e..94a8ed4 100644 --- a/src/utils/file-config.js +++ b/src/utils/file-config.js @@ -40,7 +40,8 @@ export default { } let baseUrl = serverUrl || this.baseUrl let fileUrl = `${baseUrl}/file/${owner}${encodeURI(file.path)}${encodeURI(file.name)}` - fileUrl = fileUrl.replace(/%5C/g, '/') + fileUrl = fileUrl.replaceAll('#', '%23') + fileUrl = fileUrl.replaceAll(/%5C/g, '/') if (token) { return `${fileUrl}?jmal-token=${token}&name=${username}` }