From 3781e6cd47d60ba49aa32490cf3e2589a064cdb8 Mon Sep 17 00:00:00 2001 From: Kven <2955163637@qq.com> Date: Tue, 17 Jun 2025 15:41:52 +0800 Subject: [PATCH] =?UTF-8?q?feat(@vben/web-antd):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E5=A4=B1=E8=B4=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 增加登录失败刷新token --- apps/web-antd/src/store/auth.ts | 6 ++++++ apps/web-antd/src/views/word/components/word-work-view.vue | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/web-antd/src/store/auth.ts b/apps/web-antd/src/store/auth.ts index f39af97..c1e6f7f 100644 --- a/apps/web-antd/src/store/auth.ts +++ b/apps/web-antd/src/store/auth.ts @@ -77,6 +77,12 @@ export const useAuthStore = defineStore('auth', () => { }); } } + } catch (error: any) { + if (error.code === 401) { + const { csrf } = await getUserInfoApi(); // 获取新的 token + setToken(csrf.token); // 更新 CSRF token + accessStore.setAccessToken(csrf.token); + } } finally { loginLoading.value = false; } diff --git a/apps/web-antd/src/views/word/components/word-work-view.vue b/apps/web-antd/src/views/word/components/word-work-view.vue index 5dcaf9f..92b4d94 100644 --- a/apps/web-antd/src/views/word/components/word-work-view.vue +++ b/apps/web-antd/src/views/word/components/word-work-view.vue @@ -238,8 +238,8 @@ const startFetching = async () => { } conversationId.value = res.conversationId; const { filename, url } = extractDocxInfo(res.answer); - if (res.messageFiles) { - const { id, url } = res.messageFiles[0]; + if (res.answer) { + // const { id, url } = res.messageFiles[0]; resultItems.value.push({ key: resultItems.value.length + 1, role: 'ai', @@ -265,7 +265,7 @@ const startFetching = async () => { onClick: () => { const link = document.createElement('a'); link.href = url; - link.download = id; + link.download = filename; document.body.append(link); link.click(); link.remove();