From b117cad0f34a191410adc9cc12a1affb6dc3dcbe Mon Sep 17 00:00:00 2001 From: jmal Date: Fri, 12 Jul 2024 16:29:53 +0800 Subject: [PATCH 1/2] =?UTF-8?q?style:=20=E4=BC=98=E5=8C=96=E5=8D=95?= =?UTF-8?q?=E4=B8=AA=E6=96=87=E4=BB=B6=E9=87=8D=E5=BB=BA=E7=B4=A2=E5=BC=95?= =?UTF-8?q?=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/preview/FileDetails.vue | 41 +++++++++++++++++--------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/src/components/preview/FileDetails.vue b/src/components/preview/FileDetails.vue index 17a1cdd..e461412 100644 --- a/src/components/preview/FileDetails.vue +++ b/src/components/preview/FileDetails.vue @@ -17,7 +17,19 @@ - + +

+ + 是否开始扫描? +

+
+ 取消 + 确定 +
+ +
正在同步文件基本信息: {{ syncPercent }}% 正在为文件内容创建索引: {{ indexingPercent }}%
@@ -162,20 +174,18 @@ export default { } this.syncLoading = !((this.syncPercent === 100 && this.indexingPercent === 100) || (this.syncPercent === 0 && this.indexingPercent === 0)); }, + cancelScan() { + document.getElementById('scanDirectoryBtn-file').click() + }, scanDirectory(file) { - this.$confirm('是否开始扫描? ', '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning' - }).then(() => { - this.syncLoading = true - this.syncPercent = 0 - this.clickSync = true - settingApi.syncUser({username: this.$store.state.user.name, path: decodeURIComponent(file.path + file.name)}).then(() => { - this.clickSync = false - }).catch(() => { - this.clickSync = false - }) + this.cancelScan() + this.syncLoading = true + this.syncPercent = 0 + this.clickSync = true + settingApi.syncUser({username: this.$store.state.user.name, path: decodeURIComponent(file.path + file.name)}).then(() => { + this.clickSync = false + }).catch(() => { + this.clickSync = false }) }, } @@ -216,6 +226,9 @@ export default { } >>> .details-scan { + .el-form-item__label { + line-height: 32.5px; + } margin-bottom: 10px; .el-button--mini, .el-button--mini.is-round { padding: 5px 15px; From e1499fab03077b88314ff0cb574b98d50932d2fc Mon Sep 17 00:00:00 2001 From: jmal Date: Fri, 12 Jul 2024 17:25:59 +0800 Subject: [PATCH 2/2] =?UTF-8?q?perf:=20=E6=90=9C=E7=B4=A2=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E9=98=B2=E6=8A=96=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ShowFile/ShowFile.vue | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/components/ShowFile/ShowFile.vue b/src/components/ShowFile/ShowFile.vue index f3e195a..9a7f7d0 100644 --- a/src/components/ShowFile/ShowFile.vue +++ b/src/components/ShowFile/ShowFile.vue @@ -162,13 +162,13 @@ placeholder="搜索" v-model="searchFileName" :clearable="true" - @keyup.enter.native="searchFile(searchFileName)" + @keyup.enter.native="searchFileEnter(searchFileName)" @focus="setInputFocus" - @input="searchFile(searchFileName)" + @input="searchFileEnter(searchFileName)" @blur="setInputBlur()" - @clear="searchFile(searchFileName)" + @clear="searchFileEnter(searchFileName)" > - + @@ -809,6 +809,8 @@ import FileTree from '@/components/FileTree' import '@/utils/directives.js' +import _ from "lodash"; + import fileConfig from '@/utils/file-config' import EditElement from '@/views/markdown/EditElement' import IframePreview from '@/components/preview/IframePreview.vue' @@ -1088,6 +1090,7 @@ export default { permanentDeleteDisable: false, // 是否禁用永久删除选项 selectDeleteFile: [], // 选中的删除文件 deleteLoading: false, // 删除loading + debounceSearch: null,// 搜索防抖 } }, computed: { @@ -1155,7 +1158,11 @@ export default { : '' }, }, - created() {}, + created() { + this.debounceSearch = _.debounce((key, onLoad) => { + this.searchFile(key, onLoad) + }, 200) + }, watch: { $route(to) { if (to.query.tagId && this.queryCondition.tagId !== this.$route.query.tagId) { @@ -2696,6 +2703,9 @@ export default { } } }, + searchFileEnter(key, onLoad) { + this.debounceSearch(key, onLoad) + }, searchFile(key, onLoad) { if (key) { this.beforeLoadData(onLoad)