ADD: 模块激活流程

This commit is contained in:
贾同学
2025-10-14 19:00:47 +08:00
parent 7afccb58fd
commit 55ff45f9a9
16 changed files with 976 additions and 811 deletions

View File

@@ -96,12 +96,20 @@ const login = (formEl: FormInstance | undefined) => {
username: forge.util.encode64(loginForm.username),
password: encryptPassword(loginForm.password)
})
ElNotification({
title: getTimeState(),
message: '登录成功',
type: 'success',
duration: 3000
})
userStore.setAccessToken(data.accessToken)
userStore.setRefreshToken(data.refreshToken)
userStore.setUserInfo(data.userInfo)
if (loginForm.checked) {
userStore.setExp(Date.now() + 1000 * 60 * 60 * 24 * 30)
}
// 设置激活信息
await authStore.setActivateInfo()
const response = await getDictList()
const dictData = response.data as unknown as Dict[]
await dictStore.initDictData(dictData)
@@ -109,19 +117,12 @@ const login = (formEl: FormInstance | undefined) => {
await initDynamicRouter()
// 3.清空 tabs、keepAlive 数据
tabsStore.setTabs([])
keepAliveStore.setKeepAliveName([])
// 4.跳转到首页
router.push(HOME_URL)
// 5.登录默认不显示菜单和导航栏
authStore.resetAuthStore()
ElNotification({
title: getTimeState(),
message: '登录成功',
type: 'success',
duration: 3000
})
await tabsStore.setTabs([])
await keepAliveStore.setKeepAliveName([])
// 登录默认不显示菜单和导航栏
await authStore.resetAuthStore()
// 跳转到首页
await router.push(HOME_URL)
} finally {
loading.value = false
}