mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
feat: 版本号信息
This commit is contained in:
parent
ee270a8fa9
commit
e5e68ed8a8
|
|
@ -124,6 +124,13 @@ const getUserList: (email_or_username: string, loading?: Ref<boolean>) => Promis
|
|||
return get('/user/list', { email_or_username }, loading)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取version
|
||||
*/
|
||||
const getVersion: (loading?: Ref<boolean>) => Promise<Result<any>> = (loading) => {
|
||||
return get('/api/profile', undefined, loading)
|
||||
}
|
||||
|
||||
export default {
|
||||
login,
|
||||
register,
|
||||
|
|
@ -134,5 +141,6 @@ export default {
|
|||
sendEmailToCurrent,
|
||||
resetCurrentUserPassword,
|
||||
logout,
|
||||
getUserList
|
||||
getUserList,
|
||||
getVersion
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ export interface userStateTypes {
|
|||
userType: number // 1 系统操作者 2 对话用户
|
||||
userInfo: User | null
|
||||
token: any
|
||||
version?: string
|
||||
}
|
||||
|
||||
const useUserStore = defineStore({
|
||||
|
|
@ -13,7 +14,8 @@ const useUserStore = defineStore({
|
|||
state: (): userStateTypes => ({
|
||||
userType: 1,
|
||||
userInfo: null,
|
||||
token: ''
|
||||
token: '',
|
||||
version: ''
|
||||
}),
|
||||
actions: {
|
||||
getToken(): String | null {
|
||||
|
|
@ -42,9 +44,17 @@ const useUserStore = defineStore({
|
|||
changeUserType(num: number) {
|
||||
this.userType = num
|
||||
},
|
||||
|
||||
async asyncGetVersion() {
|
||||
return UserApi.getVersion().then((ok) => {
|
||||
this.version = ok.data
|
||||
})
|
||||
},
|
||||
|
||||
async profile() {
|
||||
return UserApi.profile().then((ok) => {
|
||||
this.userInfo = ok.data
|
||||
this.asyncGetVersion()
|
||||
})
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue