更新密码找回uniapp
This commit is contained in:
1 parent
7f9a66da0f
commit
3fdda89833
1304 files changed
+3503
-26132
No files matched your search
@@ -1,9 +1,7 @@
|
||||
import { createApp } from 'vue'
|
||||
import App from '@/App.vue'
|
||||
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
|
||||
// 导入 Element Plus 样式(必须)
|
||||
import 'element-plus/dist/index.css'
|
||||
// 导入 Element Plus 暗黑模式样式
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css'
|
||||
import 'viewerjs/dist/viewer.css'
|
||||
import VueViewer from 'v-viewer'
|
||||
@@ -15,18 +13,14 @@ import { loadAndAddDynamicRoutes } from './router'
|
||||
import { createPinia } from 'pinia'
|
||||
import { useAuthStore } from './stores/auth'
|
||||
import { redirectToAuthorize, isAuthHandoff } from '@/utils/authClient'
|
||||
// import { initTheme } from './utils/theme'
|
||||
// 导入全局组件
|
||||
import UmoEditor from '@/views/components/UmoEditor.vue';
|
||||
|
||||
// 兼容某些依赖(如 HTML→docx 转换库)对 Node 全局变量 global 的引用
|
||||
if (typeof window !== 'undefined' && !window.global) {
|
||||
window.global = window;
|
||||
}
|
||||
|
||||
const app = createApp(App)
|
||||
const pinia = createPinia()
|
||||
// 全局注册 UmoEditor 组件
|
||||
app.component('UmoEditor', UmoEditor);
|
||||
|
||||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||||
@@ -37,29 +31,18 @@ app.use(pinia)
|
||||
app.use(router)
|
||||
app.use(VueViewer)
|
||||
|
||||
// 初始化主题(必须在挂载前执行)
|
||||
// initTheme()
|
||||
|
||||
// 初始化时检查认证状态。
|
||||
// 认证交接页(/auth/callback、/app-login、/mp-login)正在兑换令牌,此时
|
||||
// localStorage 里还是旧 token。启动期请求带旧 token 打到后端会触发 401 自动
|
||||
// 恢复,进而清掉刚换到的新令牌并重新跳回登录页。交接页一律跳过启动期的
|
||||
// 登录态请求与自动跳转,由交接页写完令牌后整页重载。
|
||||
const authStore = useAuthStore()
|
||||
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);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user