From a2bf71c26341de16256f42770f3bde42b50c1f43 Mon Sep 17 00:00:00 2001 From: rd <1344903914@qq.com> Date: Sat, 16 Aug 2025 09:57:16 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E8=A7=86=E9=A2=91=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../detail/components/ai-suggest/index.vue | 8 +++++--- .../upload-manuscript-modal/index.vue | 17 +++++++++++++---- .../upload-manuscript-modal/index.vue | 17 ++++++++++++++--- 3 files changed, 32 insertions(+), 10 deletions(-) diff --git a/src/views/creative-generation-workshop/explore/detail/components/ai-suggest/index.vue b/src/views/creative-generation-workshop/explore/detail/components/ai-suggest/index.vue index 32e1614..4ad7cbb 100644 --- a/src/views/creative-generation-workshop/explore/detail/components/ai-suggest/index.vue +++ b/src/views/creative-generation-workshop/explore/detail/components/ai-suggest/index.vue @@ -264,17 +264,19 @@ export default { }; const getCommentName = (item) => { - if (item.commenter_id === 0) { - return '佚名'; - } // 姓名脱敏:保留首尾字符,中间拼接6个**** const maskName = (name) => { if (!name || name.length <= 1) return name; // 单字符不脱敏 return name[0] + '****' + name[name.length - 1]; }; + // 手机号脱敏:保留前3位和后4位,中间4位替换为**** const maskMobile = (mobile) => mobile?.replace(/^(\d{3})\d{4}(\d{4})$/, '$1****$2'); + if (item.commenter_id === 0) { + return item.commenter?.name ? maskName(item.commenter?.name) : '佚名'; + } + const maskedName = maskName(item.commenter?.name); const maskedMobile = maskMobile(item.commenter?.mobile); return maskedName || maskedMobile; diff --git a/src/views/creative-generation-workshop/manuscript-writer/list/components/upload-manuscript-modal/index.vue b/src/views/creative-generation-workshop/manuscript-writer/list/components/upload-manuscript-modal/index.vue index 5f6f3dd..676ee58 100644 --- a/src/views/creative-generation-workshop/manuscript-writer/list/components/upload-manuscript-modal/index.vue +++ b/src/views/creative-generation-workshop/manuscript-writer/list/components/upload-manuscript-modal/index.vue @@ -55,6 +55,8 @@ export default { const taskStatus = ref(TASK_STATUS.DEFAULT); const form = ref(cloneDeep(INITIAL_FORM)); const works = ref([]); + const uploadingFiles = ref([]); // 上传中 + const uploadSuccessFiles = ref([]); // 上传成功 // 生成自增 id(基于当前列表中最大的 id) const getNextWorkId = () => { @@ -65,8 +67,6 @@ export default { return currentMax + 1; }; - // 剪贴板功能 - const isLink = computed(() => uploadType.value === UPLOAD_TYPE.LINK); const isLocal = computed(() => uploadType.value === UPLOAD_TYPE.LOCAL); const isDefault = computed(() => taskStatus.value === TASK_STATUS.DEFAULT); @@ -90,6 +90,8 @@ export default { taskStatus.value = TASK_STATUS.DEFAULT; form.value = cloneDeep(INITIAL_FORM); works.value = []; + uploadingFiles.value = []; + uploadSuccessFiles.value = []; }; const open = () => { @@ -137,6 +139,8 @@ export default { const formData = new FormData(); formData.append('file', file); + uploadingFiles.value.push(file); + const { code, data } = await postWorksByFileWriter(formData, { timeout: 0, headers: { @@ -145,10 +149,15 @@ export default { }, }); if (code === 200) { - taskStatus.value = TASK_STATUS.SUCCESS; if (data) { const id = data.id ?? getNextWorkId(); - works.value.push({ ...data, id }); + const _data = { ...data, id }; + works.value.push(_data); + uploadSuccessFiles.value.push(_data); + } + + if (uploadingFiles.value.length === uploadSuccessFiles.value.length) { + taskStatus.value = TASK_STATUS.SUCCESS; } } }; diff --git a/src/views/creative-generation-workshop/manuscript/list/components/upload-manuscript-modal/index.vue b/src/views/creative-generation-workshop/manuscript/list/components/upload-manuscript-modal/index.vue index ddf6a55..3a975cb 100644 --- a/src/views/creative-generation-workshop/manuscript/list/components/upload-manuscript-modal/index.vue +++ b/src/views/creative-generation-workshop/manuscript/list/components/upload-manuscript-modal/index.vue @@ -50,6 +50,8 @@ export default { const uploadType = ref(UPLOAD_TYPE.LINK); const taskStatus = ref(TASK_STATUS.DEFAULT); const form = ref(cloneDeep(INITIAL_FORM)); + const uploadingFiles = ref([]); // 上传中 + const uploadSuccessFiles = ref([]); // 上传成功 const works = ref([]); // 生成自增 id(基于当前列表中最大的 id) @@ -87,6 +89,8 @@ export default { taskStatus.value = TASK_STATUS.DEFAULT; form.value = cloneDeep(INITIAL_FORM); works.value = []; + uploadingFiles.value = []; + uploadSuccessFiles.value = []; }; const getWriterLink = async () => { @@ -160,6 +164,8 @@ export default { const formData = new FormData(); formData.append('file', file); + uploadingFiles.value.push(file); + const { code, data } = await postWorksByFile(formData, { timeout: 0, headers: { @@ -167,10 +173,15 @@ export default { }, }); if (code === 200) { - taskStatus.value = TASK_STATUS.SUCCESS; if (data) { const id = data.id ?? getNextWorkId(); - works.value.push({ ...data, id }); + const _data = { ...data, id }; + works.value.push(_data); + uploadSuccessFiles.value.push(_data); + } + + if (uploadingFiles.value.length === uploadSuccessFiles.value.length) { + taskStatus.value = TASK_STATUS.SUCCESS; } } }; @@ -185,7 +196,7 @@ export default { // 删除项目 const onDelete = (index) => { works.value.splice(index, 1); - if(!works.value.length) { + if (!works.value.length) { taskStatus.value = TASK_STATUS.DEFAULT; } };