From 04ffd78dd5354a640adc1475b2c0afb35d0c186e Mon Sep 17 00:00:00 2001 From: jmal Date: Mon, 3 Jun 2024 16:32:06 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E9=87=8D=E5=BB=BA?= =?UTF-8?q?=E7=B4=A2=E5=BC=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/sse/SSEClient.js | 2 ++ src/utils/image.js | 1 - src/views/setting/cloudManager.vue | 16 +++++++++++----- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/sse/SSEClient.js b/src/sse/SSEClient.js index 90434f7..a1ff885 100644 --- a/src/sse/SSEClient.js +++ b/src/sse/SSEClient.js @@ -55,6 +55,8 @@ function onMessage(msg) { const url = msg.url if (url === 'synced') { store.dispatch('updateMessage', {event: 'msg/synced', data: msg}) + } else if (url === 'indexing') { + store.dispatch('updateMessage', {event: 'msg/indexing', data: msg}) } else if (url === 'uploaderChunkSize') { store.dispatch('updateMessage', {event: 'uploaderChunkSize', data: msg.body}) } else { diff --git a/src/utils/image.js b/src/utils/image.js index 152f58a..fbf31fe 100644 --- a/src/utils/image.js +++ b/src/utils/image.js @@ -51,6 +51,5 @@ export function formatExif(exifInfo) { if (exifInfo['latitude']) { exifStr += `纬度: ${exifInfo['latitude']}\r\n` } - console.log(exifStr) return exifStr } diff --git a/src/views/setting/cloudManager.vue b/src/views/setting/cloudManager.vue index fa1d027..e9d3467 100644 --- a/src/views/setting/cloudManager.vue +++ b/src/views/setting/cloudManager.vue @@ -47,9 +47,10 @@ - {{ syncPercent }}% + 正在同步文件基本信息: {{ syncPercent }}% + 正在为文件内容创建索引: {{ indexingPercent }}% - 一般用于初始化操作, 将文件数据同步到数据库 + 重建索引分为两步: 1.同步文件基本信息, 2.为文件内容创建索引
重置角色、菜单: @@ -148,6 +149,7 @@ export default { uploadUrl: `${process.env.VUE_APP_BASE_API}/user/setting/upload_logo?jmal-token=${this.$store.state.user.token}&name=${this.$store.state.user.name}`, title: '网盘管理', syncLoading: false, + indexingPercent: 100, syncPercent: 100, resetLoading: false, webpEnabled: false, @@ -224,7 +226,10 @@ export default { message(msg) { if (msg.event === 'msg/synced') { this.syncPercent = msg.data.body - if (this.syncPercent >= 100) { + } + if (msg.event === 'msg/indexing') { + this.indexingPercent = msg.data.body + if (this.indexingPercent >= 100) { this.syncLoading = false } } @@ -351,8 +356,9 @@ export default { getIsSync() { settingApi.isSync({username: this.$store.state.user.name}).then((res) => { this.syncLoading = true; - this.syncPercent = res.data - this.syncLoading = this.syncPercent < 100; + this.syncPercent = res.data.syncPercent + this.indexingPercent = res.data.indexingPercent + this.syncLoading = !(this.syncPercent === 100 && this.indexingPercent === 100); }) }, sync() {