From b85e91c2106d2db9fd7401ed657d3b55377ff8aa Mon Sep 17 00:00:00 2001 From: panda <1565636758@qq.com> Date: Mon, 8 Dec 2025 15:24:44 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81Editor=E7=BB=84=E4=BB=B6=E7=9A=84edit?= =?UTF-8?q?orConfig=E5=8F=82=E6=95=B0=E5=90=88=E5=B9=B6=E6=9C=AA=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E6=B7=B1=E5=BA=A6=E5=90=88=E5=B9=B6=EF=BC=8C=E5=A4=96?= =?UTF-8?q?=E9=83=A8=E7=9A=84props=E5=A6=82=E4=BD=95=E4=BC=A0=E5=85=A5?= =?UTF-8?q?=E7=9A=84=E8=AF=9D=EF=BC=8C=E4=BC=9A=E5=AF=BC=E8=87=B4=E4=BA=8C?= =?UTF-8?q?=E7=BA=A7=E5=8F=82=E6=95=B0=E9=83=BD=E4=B8=A2=E5=A4=B1=EF=BC=8C?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E6=B7=B1=E5=BA=A6=E5=90=88=E5=B9=B6=E3=80=82?= =?UTF-8?q?=202=E3=80=81=E5=9C=A8=E5=90=8E=E5=8F=B0=E5=88=A0=E9=99=A4token?= =?UTF-8?q?=E3=80=81refreshtoken=E5=90=8E=EF=BC=8C=E5=89=8D=E5=8F=B0?= =?UTF-8?q?=E4=BB=8D=E7=BC=93=E5=AD=98token=E7=9A=84=E6=83=85=E5=86=B5?= =?UTF-8?q?=E4=B8=8B=EF=BC=8C=E5=A6=82=E6=9E=9C=E7=9B=B4=E6=8E=A5=E8=AE=BF?= =?UTF-8?q?=E9=97=AElogin=E9=A1=B5=E9=9D=A2=E4=BC=9A=E5=8D=A1=E6=AD=BB?= =?UTF-8?q?=E6=89=93=E4=B8=8D=E5=BC=80=E3=80=82=E5=9C=A8=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E7=99=BB=E5=87=BA=E7=9A=84=E5=88=A4=E6=96=AD=E5=A4=84=E5=BC=BA?= =?UTF-8?q?=E5=88=B6=E5=88=A0=E9=99=A4=E6=9C=AC=E5=9C=B0token=E5=B9=B6?= =?UTF-8?q?=E9=87=8D=E8=B5=B0=E8=B7=AF=E7=94=B1=E5=AE=88=E5=8D=AB=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 877734639d665b38f4c4b554c74545060c923f34) --- src/components/Editor/src/Editor.vue | 3 ++- src/config/axios/service.ts | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/Editor/src/Editor.vue b/src/components/Editor/src/Editor.vue index c2905ff8b..260781ad0 100644 --- a/src/components/Editor/src/Editor.vue +++ b/src/components/Editor/src/Editor.vue @@ -8,6 +8,7 @@ import { ElMessage } from 'element-plus' import { useLocaleStore } from '@/store/modules/locale' import { getRefreshToken, getTenantId } from '@/utils/auth' import { getUploadUrl } from '@/components/UploadFile/src/useUpload' +import merge from 'lodash-es/merge' defineOptions({ name: 'Editor' }) @@ -75,7 +76,7 @@ const handleCreated = (editor: IDomEditor) => { // 编辑器配置 const editorConfig = computed((): IEditorConfig => { - return Object.assign( + return merge( { placeholder: '请输入内容...', readOnly: props.readonly, diff --git a/src/config/axios/service.ts b/src/config/axios/service.ts index 9214bf8ea..c4dae4d9c 100644 --- a/src/config/axios/service.ts +++ b/src/config/axios/service.ts @@ -161,6 +161,8 @@ service.interceptors.response.use( } // 2. 进行刷新访问令牌 try { + // 刷新令牌时,需要将 isRelogin.show 设置为 false,解决在后台失效token,前端缓存token,登录页卡死的问题 + isRelogin.show = false const refreshTokenRes = await refreshToken() // 2.1 刷新成功,则回放队列的请求 + 当前请求 setToken((await refreshTokenRes).data.data) @@ -246,7 +248,12 @@ const handleAuthorized = () => { if (!isRelogin.show) { // 如果已经到登录页面则不进行弹窗提示 if (window.location.href.includes('login')) { - return + // 后台refreshtoken失效,前台缓存token存在,直接访问Login页面会卡死。 + // 清除掉token,重新走路由守卫,确保本地即使缓存了token也是能正常加载登录页,前提是要确保isRelogin.show为false + // https://wx.zsxq.com/group/88858522214142/topic/45811881251414188 + removeToken() + window.location.href = window.location.href + // return } isRelogin.show = true ElMessageBox.confirm(t('sys.api.timeoutMessage'), t('common.confirmTitle'), { -- Gitee