File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
components/common/UserAvatar Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change 22import { computed , onMounted , ref } from ' vue'
33import { NAvatar , NButton , NTag } from ' naive-ui'
44import { useRoute } from ' vue-router'
5+ import { UserRole } from ' ../Setting/model'
56import { useAuthStore , useUserStore } from ' @/store'
67import defaultAvatar from ' @/assets/avatar.jpg'
78import { isString } from ' @/utils/is'
@@ -43,8 +44,8 @@ onMounted(async () => {
4344 <div class =" flex-1 min-w-0 ml-2" >
4445 <h2 v-if =" userInfo.name" class =" " >
4546 {{ userInfo.name }}
46- <NTag size =" small" :bordered =" false" type =" success" >
47- Admin
47+ <NTag v-if = " userInfo.roles.length > 0 " size =" small" :bordered =" false" type =" success" >
48+ {{ UserRole[userInfo.roles[0]] }}
4849 </NTag >
4950 </h2 >
5051 <p v-if =" userInfo.name" class =" overflow-hidden text-xs text-gray-500 text-ellipsis whitespace-nowrap" >
Original file line number Diff line number Diff line change 1+ import type { UserRole } from '@/components/common/Setting/model'
12import { UserConfig } from '@/components/common/Setting/model'
23import { ss } from '@/utils/storage'
34
@@ -9,6 +10,7 @@ export interface UserInfo {
910 description : string
1011 root : boolean
1112 config : UserConfig
13+ roles : UserRole [ ]
1214}
1315
1416export interface UserState {
@@ -23,6 +25,7 @@ export function defaultSetting(): UserState {
2325 description : '' ,
2426 root : false ,
2527 config : { chatModel : 'gpt-3.5-turbo' } ,
28+ roles : [ ] ,
2629 } ,
2730 }
2831}
You can’t perform that action at this time.
0 commit comments