From 6c12ba9a9d2920394aec689fb342ee7a133416ac Mon Sep 17 00:00:00 2001 From: CY-1 <516183795@qq.com> Date: Sun, 22 Sep 2024 04:22:47 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=AE=8C=E6=88=90=E4=B8=8A=E4=BC=A0=E5=9B=BE?= =?UTF-8?q?=E7=89=87/=E6=9B=BF=E6=8D=A2=E5=9B=BE=E7=89=87=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=88=B7=E6=96=B0=202.=E5=AE=8C=E6=88=90todoList?= =?UTF-8?q?=E6=94=B9=E5=8F=98=E7=BB=9F=E8=AE=A1=E4=BF=A1=E6=81=AF=E6=94=B9?= =?UTF-8?q?=E5=8F=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/renderer/src/stores/config.ts | 42 +++++++++++++ .../src/views/picture/PictureIndex.vue | 17 +++++- .../src/views/picture/PictureUpload.vue | 41 +++++++++---- .../src/views/picture/PictureViewerInfo.vue | 10 +++- .../renderer/src/views/todo/TaskProgress.vue | 17 +++++- .../src/views/todo/TodoChartCompleted.vue | 18 ++++++ .../src/renderer/src/views/todo/TodoIndex.vue | 59 ++++++++++++------- .../src/renderer/src/views/todo/TodoStat.vue | 32 +++++++--- 8 files changed, 192 insertions(+), 44 deletions(-) diff --git a/blossom-editor/src/renderer/src/stores/config.ts b/blossom-editor/src/renderer/src/stores/config.ts index b81bb3a..e0ad977 100644 --- a/blossom-editor/src/renderer/src/stores/config.ts +++ b/blossom-editor/src/renderer/src/stores/config.ts @@ -164,3 +164,45 @@ export const useConfigStore = defineStore('configStore', { } } }) + + +// 上传文件后通知刷新List +export const onUploadAfter = defineStore('onUploadAfter', { + state: () => ({ + response: { + isSuccess: false, + msg: '' + } + }), + actions: { + setResponse(response: { isSuccess: boolean; msg: string }): void { + this.response = response; + } + }, + getters: { + getResponse(state) { + return state.response; + } + } +}); + +// 修改todo状态后 通知刷新统计 +export const onTodoChange = defineStore('onTodoChange', { + state: () => ({ + response: { + isSuccess: false, + msg: '' + } + }), + actions: { + setResponse(response: { isSuccess: boolean; msg: string }): void { + this.response = response; + } + }, + getters: { + getResponse(state) { + return state.response; + } + } +}); + diff --git a/blossom-editor/src/renderer/src/views/picture/PictureIndex.vue b/blossom-editor/src/renderer/src/views/picture/PictureIndex.vue index 7cd2755..7d40f32 100644 --- a/blossom-editor/src/renderer/src/views/picture/PictureIndex.vue +++ b/blossom-editor/src/renderer/src/views/picture/PictureIndex.vue @@ -199,7 +199,7 @@ import PictureBatchDel from './PictureBatchDel.vue' import PictureTransfer from './PictureTransfer.vue' import errorImg from '@renderer/assets/imgs/img_error.png' import Notify from '@renderer/scripts/notify' - +import {onUploadAfter} from '@renderer/stores/config' const userStore = useUserStore() useLifecycle( @@ -278,6 +278,16 @@ const clickCurFolder = (tree: DocTree) => { getPictureStat(curFolder.value.id) } +/** + * 订阅文件上传通知 + */ +const uploadResult = onUploadAfter() +uploadResult.$subscribe((mutation, state)=>{ + if(state.response.isSuccess){ + refresh() + } +}) + /** * 刷新 */ @@ -423,11 +433,14 @@ const deletePicture = (pic: Picture) => { pic.delTime = 2 getPictureStat(curFolder.value?.id) getPictureStat() + // 删除后刷新list + refresh() }) .catch((_) => { pic.delTime = 0 pic.url = urlBak }) + }) } @@ -524,6 +537,8 @@ const delBatchIgnoreCheck = () => { } delIgnoreCheck.value = true isShowBatchDelDialog.value = true + // 删除后刷新 + refresh() } const deleted = (ids: Array) => { diff --git a/blossom-editor/src/renderer/src/views/picture/PictureUpload.vue b/blossom-editor/src/renderer/src/views/picture/PictureUpload.vue index e767e81..8022545 100644 --- a/blossom-editor/src/renderer/src/views/picture/PictureUpload.vue +++ b/blossom-editor/src/renderer/src/views/picture/PictureUpload.vue @@ -8,17 +8,18 @@ multiple :disabled="!curFolder || !curFolder?.id" :action="serverStore.serverUrl + uploadFileApiUrl" - :data="(f: UploadRawFile) => uploadDate(f, curFolder!.id, porps.repeatUpload)" + :data="(f: UploadRawFile) => uploadDate(f, curFolder!.id, prop.repeatUpload)" :headers="{ Authorization: 'Bearer ' + userStore.auth.token }" :show-file-list="true" :before-upload="beforeUpload" - :on-success="onUploadSeccess" + :on-success="onUploadSuccess" :on-error="onError"> 请先选择文件夹,再上传文件请先选择文件夹,再上传文件 + - 点击或拖拽上传至
+ 点击或拖拽上传至
《{{ curFolder?.name }}》
@@ -26,15 +27,16 @@