From 3ddfab051efb5812e96bc900f4e11423dbce1fcd Mon Sep 17 00:00:00 2001 From: dxc Date: Tue, 19 May 2026 18:47:51 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8F=98=E6=9B=B4V3.28?= =?UTF-8?q?=E4=BD=93=E9=AA=8C=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inventory-web/src/App.vue | 4 +++- inventory-web/src/views/login/index.vue | 17 ++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/inventory-web/src/App.vue b/inventory-web/src/App.vue index 4031ec8..b2baeec 100644 --- a/inventory-web/src/App.vue +++ b/inventory-web/src/App.vue @@ -190,6 +190,8 @@ const handleLogout = () => { userStore.logout() ElMessage({ type: 'success', message: '已安全退出' }) await router.replace('/login') + // 【新增】退出后强制刷新,重置 Dify Embed Token 和聊天窗口状态 + window.location.reload() }) .catch(() => {}) } @@ -234,7 +236,7 @@ const handleLogout = () => { diff --git a/inventory-web/src/views/login/index.vue b/inventory-web/src/views/login/index.vue index dd09076..4fc2ca1 100644 --- a/inventory-web/src/views/login/index.vue +++ b/inventory-web/src/views/login/index.vue @@ -80,11 +80,22 @@ const onLogin = async () => { const success = await userStore.handleLogin(loginForm) if (success) { - // [新增] 2. 登录成功后,立即拉取当前用户的权限字典 - // 这样进入 Dashboard 时,所有按钮/列的显示状态就已经确定了 + // 2. 登录成功后,立即拉取当前用户的权限字典 await permissionStore.loadPermissions() - // 3. 跳转 + // 【新增】防止刷新循环:检查是否已执行过单次刷新 + const hasReloaded = sessionStorage.getItem('__login_reloaded__') + if (!hasReloaded) { + sessionStorage.setItem('__login_reloaded__', '1') + router.push('/dashboard') + window.location.reload() + return + } else { + // 已刷新过,说明是刷新后重复触发,清除标记,正常跳转 + sessionStorage.removeItem('__login_reloaded__') + } + + // 3. 正常跳转(刷新后重复触发或直接登录) router.push('/dashboard') } else { // 失败(业务逻辑拒绝):弹出模态框