diff --git a/src/api/setting-api.js b/src/api/setting-api.js index 6c0f6a9..98c68e6 100644 --- a/src/api/setting-api.js +++ b/src/api/setting-api.js @@ -1,13 +1,20 @@ import request from '@/utils/request' export default { - sync(params) { + syncUser(params) { return request({ url: '/user/setting/sync', method: 'get', params }) }, + syncCloud(params) { + return request({ + url: '/cloud/setting/sync', + method: 'get', + params + }) + }, isSync(params) { return request({ url: '/user/setting/isSync', diff --git a/src/components/ShowFile/ShowFile.vue b/src/components/ShowFile/ShowFile.vue index 97b366a..6341c47 100644 --- a/src/components/ShowFile/ShowFile.vue +++ b/src/components/ShowFile/ShowFile.vue @@ -660,70 +660,8 @@ :file="officePreviewRow" :status.sync="officePreviewVisible" > - - -
- -
- - - {{ rowContextData.name }} - - - {{ - rowContextData.isFolder ? '文件夹' : rowContextData.contentType - }} - -
- - {{ rowContextData.music.singer }} - - - {{ '《' + rowContextData.music.album + '》' }} - - - {{ '《' + rowContextData.music.songName + '》' }} - -
- - {{ rowContextData.w + ' x ' + rowContextData.h }} - - - {{ formatSize(rowContextData.size) }} - - - {{ rowContextData.path }} - - - {{ rowContextData.uploadDate }} - - - {{ rowContextData.updateDate }} - - - {{ formatExif(rowContextData.exif) }} - -
-
+ + @import 'src/styles/index'; @import 'src/styles/home-index'; -/*overflow: hidden;*/ -/*white-space: nowrap;*/ -/*text-overflow: ellipsis;*/ .dashboard-container { min-width: 498px; height: 100%; @@ -4422,70 +4359,6 @@ export default { outline: 0; } ->>> .el-drawer__header { - color: #000000; - - span { - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - } -} - -.details-form { - margin: 20px 10px 0 20px; - - >>> .el-form-item__content { - white-space: normal; - word-break: break-all; - word-wrap: break-word; - line-height: 25px; - } - - >>> .el-form-item__label { - line-height: 25px; - } - - >>> .el-form-item { - margin-bottom: 0; - } - - >>> .details-position { - margin: 10px 0; - - .el-form-item__content { - line-height: 20px; - color: #84a0c3; - } - - .el-form-item__label { - line-height: 20px; - } - } - - a:hover { - color: #409eff; - } -} - -.drawer-icon { - text-align: center; - position: relative; - >>> .icon-favorite { - display: none; - } - >>> .icon-share { - display: none; - } - >>> .icon-tag { - display: none; - } -} - -.drawer-icon-font >>> .svg-icon { - font-size: 8rem; -} - .list-item { height: 50px; } diff --git a/src/components/preview/FileDetails.vue b/src/components/preview/FileDetails.vue new file mode 100644 index 0000000..15b428a --- /dev/null +++ b/src/components/preview/FileDetails.vue @@ -0,0 +1,242 @@ + + + + + diff --git a/src/sse/SSEClient.js b/src/sse/SSEClient.js index a1ff885..90434f7 100644 --- a/src/sse/SSEClient.js +++ b/src/sse/SSEClient.js @@ -55,8 +55,6 @@ 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/views/setting/cloudManager.vue b/src/views/setting/cloudManager.vue index e9d3467..7b37566 100644 --- a/src/views/setting/cloudManager.vue +++ b/src/views/setting/cloudManager.vue @@ -44,11 +44,9 @@ 什么是webp?
重建索引: - - + 正在同步文件基本信息: {{ syncPercent }}% - 正在为文件内容创建索引: {{ indexingPercent }}% + 正在为文件内容创建索引: {{ indexingPercent }}%
重建索引分为两步: 1.同步文件基本信息, 2.为文件内容创建索引
重置角色、菜单: @@ -149,6 +147,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, + clickSync: false, indexingPercent: 100, syncPercent: 100, resetLoading: false, @@ -225,13 +224,7 @@ export default { watch: { message(msg) { if (msg.event === 'msg/synced') { - this.syncPercent = msg.data.body - } - if (msg.event === 'msg/indexing') { - this.indexingPercent = msg.data.body - if (this.indexingPercent >= 100) { - this.syncLoading = false - } + this.updateSyncStatus(msg.data.body) } } }, @@ -355,22 +348,36 @@ export default { }, getIsSync() { settingApi.isSync({username: this.$store.state.user.name}).then((res) => { - this.syncLoading = true; - this.syncPercent = res.data.syncPercent - this.indexingPercent = res.data.indexingPercent - this.syncLoading = !(this.syncPercent === 100 && this.indexingPercent === 100); + this.updateSyncStatus(res.data) }) }, + updateSyncStatus(dataPercent) { + const {syncPercent, indexingPercent} = dataPercent + if (syncPercent) { + this.syncPercent = syncPercent + } else { + this.syncPercent = 0 + } + if (indexingPercent) { + this.indexingPercent = indexingPercent + } else { + this.indexingPercent = 0 + } + this.syncLoading = !((this.syncPercent === 100 && this.indexingPercent === 100) || (this.syncPercent === 0 && this.indexingPercent === 0)); + }, sync() { - this.$confirm('是否开始同步? ', '提示', { + this.$confirm('是否开始扫描? ', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => { this.syncLoading = true this.syncPercent = 0 - settingApi.sync({username: this.$store.state.user.name}).then(() => { - this.$message.success("开始同步...") + this.clickSync = true + settingApi.syncCloud({username: this.$store.state.user.name}).then(() => { + this.clickSync = false + }).catch(() => { + this.clickSync = false }) }) },