更新
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user