角色列表添加

This commit is contained in:
仲么了
2024-01-19 14:08:07 +08:00
parent 343bda8c70
commit 9b75f5b38c
19 changed files with 515 additions and 378 deletions

View File

@@ -5,14 +5,18 @@ import type { AdminInfo } from '@/stores/interface'
export const useAdminInfo = defineStore('adminInfo', {
state: (): AdminInfo => {
return {
id: 0,
username: '',
nickname: '',
avatar: '',
last_login_time: '',
token: '',
access_token: '',
token_type: '',
refresh_token: '',
super: false
expires_in: 0,
scope: '',
nickname: '',
userType: 1,
deptIndex: '',
userIndex: '',
client_id: '',
headSculpture: '',
jti: ''
}
},
actions: {
@@ -20,7 +24,7 @@ export const useAdminInfo = defineStore('adminInfo', {
this.$state = { ...this.$state, ...state }
},
removeToken() {
this.token = ''
this.access_token = ''
this.refresh_token = ''
},
setToken(token: string, type: 'auth' | 'refresh') {
@@ -28,7 +32,7 @@ export const useAdminInfo = defineStore('adminInfo', {
this[field] = token
},
getToken(type: 'auth' | 'refresh' = 'auth') {
return type === 'auth' ? this.token : this.refresh_token
return type === 'auth' ? this.token_type + ' ' + this.access_token : this.refresh_token
}
},
persist: {