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)
|
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 {
|
export default {
|
||||||
login,
|
login,
|
||||||
register,
|
register,
|
||||||
@ -134,5 +141,6 @@ export default {
|
|||||||
sendEmailToCurrent,
|
sendEmailToCurrent,
|
||||||
resetCurrentUserPassword,
|
resetCurrentUserPassword,
|
||||||
logout,
|
logout,
|
||||||
getUserList
|
getUserList,
|
||||||
|
getVersion
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@ export interface userStateTypes {
|
|||||||
userType: number // 1 系统操作者 2 对话用户
|
userType: number // 1 系统操作者 2 对话用户
|
||||||
userInfo: User | null
|
userInfo: User | null
|
||||||
token: any
|
token: any
|
||||||
|
version?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const useUserStore = defineStore({
|
const useUserStore = defineStore({
|
||||||
@ -13,7 +14,8 @@ const useUserStore = defineStore({
|
|||||||
state: (): userStateTypes => ({
|
state: (): userStateTypes => ({
|
||||||
userType: 1,
|
userType: 1,
|
||||||
userInfo: null,
|
userInfo: null,
|
||||||
token: ''
|
token: '',
|
||||||
|
version: ''
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
getToken(): String | null {
|
getToken(): String | null {
|
||||||
@ -42,9 +44,17 @@ const useUserStore = defineStore({
|
|||||||
changeUserType(num: number) {
|
changeUserType(num: number) {
|
||||||
this.userType = num
|
this.userType = num
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async asyncGetVersion() {
|
||||||
|
return UserApi.getVersion().then((ok) => {
|
||||||
|
this.version = ok.data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
async profile() {
|
async profile() {
|
||||||
return UserApi.profile().then((ok) => {
|
return UserApi.profile().then((ok) => {
|
||||||
this.userInfo = ok.data
|
this.userInfo = ok.data
|
||||||
|
this.asyncGetVersion()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user