优化报销管理增加挂靠
This commit is contained in:
1 parent
7b1c94b5ff
commit
ee49ef15b5
24 files changed
+1267
-70
No files matched your search
+25
-19
@@ -14,7 +14,7 @@ import router from './router'
|
||||
import { loadAndAddDynamicRoutes } from './router'
|
||||
import { createPinia } from 'pinia'
|
||||
import { useAuthStore } from './stores/auth'
|
||||
import { redirectToAuthorize } from '@/utils/authClient'
|
||||
import { redirectToAuthorize, isAuthHandoff } from '@/utils/authClient'
|
||||
// import { initTheme } from './utils/theme'
|
||||
// 导入全局组件
|
||||
import UmoEditor from '@/views/components/UmoEditor.vue';
|
||||
@@ -40,26 +40,32 @@ app.use(VueViewer)
|
||||
// 初始化主题(必须在挂载前执行)
|
||||
// initTheme()
|
||||
|
||||
// 初始化时检查认证状态
|
||||
// 初始化时检查认证状态。
|
||||
// 认证交接页(/auth/callback、/app-login、/mp-login)正在兑换令牌,此时
|
||||
// localStorage 里还是旧 token。启动期请求带旧 token 打到后端会触发 401 自动
|
||||
// 恢复,进而清掉刚换到的新令牌并重新跳回登录页。交接页一律跳过启动期的
|
||||
// 登录态请求与自动跳转,由交接页写完令牌后整页重载。
|
||||
const authStore = useAuthStore()
|
||||
authStore.checkAuth()
|
||||
if (!isAuthHandoff()) {
|
||||
authStore.checkAuth()
|
||||
|
||||
// 如果用户已登录,在应用启动时加载动态路由
|
||||
if (authStore.isLoggedIn) {
|
||||
loadAndAddDynamicRoutes()
|
||||
.catch(err => {
|
||||
console.error('应用启动时加载动态路由失败:', err);
|
||||
})
|
||||
.then(() => {
|
||||
// 检查是否因为 token 无效而导致路由加载失败
|
||||
const token = localStorage.getItem('token');
|
||||
if (!token) {
|
||||
// 本地登录已停用:直接回认证中心重新登录(不再跳 #/login)
|
||||
redirectToAuthorize().catch((err) => {
|
||||
console.error('跳转统一认证失败:', err);
|
||||
});
|
||||
}
|
||||
});
|
||||
// 如果用户已登录,在应用启动时加载动态路由
|
||||
if (authStore.isLoggedIn) {
|
||||
loadAndAddDynamicRoutes()
|
||||
.catch(err => {
|
||||
console.error('应用启动时加载动态路由失败:', err);
|
||||
})
|
||||
.then(() => {
|
||||
// 检查是否因为 token 无效而导致路由加载失败
|
||||
const token = localStorage.getItem('token');
|
||||
if (!token) {
|
||||
// 本地登录已停用:直接回认证中心重新登录(不再跳 #/login)
|
||||
redirectToAuthorize().catch((err) => {
|
||||
console.error('跳转统一认证失败:', err);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
app.mount('#app')
|
||||
Reference in new issue
Block a user