版本变更V3.29体验优化

This commit is contained in:
dxc
2026-05-20 09:09:33 +08:00
parent 6d044b234c
commit 621431dcb9
4 changed files with 62 additions and 26 deletions

View File

@ -189,7 +189,8 @@ const handleLogout = () => {
.then(async () => {
userStore.logout()
ElMessage({ type: 'success', message: '已安全退出' })
await router.replace('/login')
// 直接原生跳转,重置一切
window.location.href = '/login'
})
.catch(() => {})
}
@ -234,7 +235,7 @@ const handleLogout = () => {
<footer v-if="!isLoginPage" class="app-footer">
<span class="version-tag">
<el-icon style="vertical-align: middle; margin-right: 4px"><InfoFilled /></el-icon>
当前版本:V3.26添加AI助手版
当前版本:V3.29添加AI助手版
</span>
</footer>

View File

@ -84,6 +84,11 @@ export const useUserStore = defineStore('user', () => {
localStorage.setItem('refresh_token', data.refresh_token)
}
// [Dify] 登录成功,重新初始化 DifyToken 变化时 Dify 会开辟新会话,解决会话串号问题)
if (typeof window.initDifyChatbot === 'function') {
window.initDifyChatbot()
}
// 登录成功后,根据角色获取权限
if (role.value) {
try {
@ -110,6 +115,11 @@ export const useUserStore = defineStore('user', () => {
const setToken = (newToken: string) => {
token.value = newToken
localStorage.setItem('access_token', newToken)
// [Dify] Token 刷新后,重新初始化 Dify 以更新用户会话
if (typeof window.initDifyChatbot === 'function') {
window.initDifyChatbot()
}
}
// 退出逻辑
@ -123,6 +133,11 @@ export const useUserStore = defineStore('user', () => {
// 2. 清空 LocalStorage (硬盘)
localStorage.removeItem('access_token')
// [Dify] 退出登录时,彻底销毁桌面上的 Dify 聊天窗口,防止信息泄露或报错
document.querySelectorAll('[id^="dify-chatbot-"]').forEach(el => el.remove())
// 清空其他本地存储
localStorage.removeItem('refresh_token')
localStorage.removeItem('token')
localStorage.removeItem('role')

View File

@ -80,12 +80,9 @@ const onLogin = async () => {
const success = await userStore.handleLogin(loginForm)
if (success) {
// [新增] 2. 登录成功后,立即拉取当前用户的权限字典
// 这样进入 Dashboard 时,所有按钮/列的显示状态就已经确定了
await permissionStore.loadPermissions()
// 3. 跳转
router.push('/dashboard')
// 直接跳转并触发完整页面重载,干净重置 Dify Embed Token
window.location.href = '/dashboard'
} else {
// 失败(业务逻辑拒绝):弹出模态框
showLoginFailAlert('用户名或密码错误')