This commit is contained in:
Your Name
2026-03-27 18:06:12 +08:00
parent 9160c36735
commit 099bc1dd22
645 changed files with 276473 additions and 957 deletions
+9 -1
View File
@@ -13,6 +13,7 @@ export interface UserState {
userInfo: Record<string, any>
routes: RouteRecordRaw[]
perms: string[]
isPaw: number // 0=需要修改密码,1=正常
}
const useUserStore = defineStore({
@@ -24,7 +25,9 @@ const useUserStore = defineStore({
// 路由
routes: [],
// 权限
perms: []
perms: [],
// 是否需要修改密码
isPaw: 1
}),
getters: {},
actions: {
@@ -32,6 +35,7 @@ const useUserStore = defineStore({
this.token = ''
this.userInfo = {}
this.perms = []
this.isPaw = 1
},
login(playload: any) {
const { account, password } = playload
@@ -42,6 +46,7 @@ const useUserStore = defineStore({
})
.then((data) => {
this.token = data.token
this.isPaw = data.is_paw ?? 1
cache.set(TOKEN_KEY, data.token)
resolve(data)
})
@@ -69,6 +74,7 @@ const useUserStore = defineStore({
workWechatLogin({ code })
.then((data) => {
this.token = data.token
this.isPaw = data.is_paw ?? 1
cache.set(TOKEN_KEY, data.token)
resolve(data)
})
@@ -84,6 +90,8 @@ const useUserStore = defineStore({
this.userInfo = data.user
this.perms = data.permissions
this.routes = filterAsyncRoutes(data.menu)
// 更新 isPaw 状态
this.isPaw = data.user.is_paw ?? 1
resolve(data)
})
.catch((error) => {