Browse Source

更改用户名显示字段

master
parent
commit
4569fc8525
  1. 4
      src/layout/components/UserInfo/src/UserInfo.vue
  2. 10
      src/store/modules/user.ts

4
src/layout/components/UserInfo/src/UserInfo.vue

@ -25,7 +25,7 @@ const prefixCls = getPrefixCls('user-info')
const avatar = computed(() => userStore.user.avatar || avatarImg)
const userName = computed(() => userStore.user.nickname ?? 'Admin')
const realName=computed(()=>userStore.user.realName ?? '管理员')
//
const lockStore = useLockStore()
const getIsLock = computed(() => lockStore.getLockInfo?.isLock ?? false)
@ -59,7 +59,7 @@ const toDocument = () => {
<div class="flex items-center">
<ElAvatar :src="avatar" alt="" class="w-[calc(var(--logo-height)-25px)] rounded-[50%]" />
<span class="pl-[5px] text-14px text-[var(--top-header-text-color)] <lg:hidden">
{{ userName }}
{{ realName }}
</span>
</div>
<template #dropdown>

10
src/store/modules/user.ts

@ -10,7 +10,8 @@ interface UserVO {
id: number
avatar: string
nickname: string
deptId: number
deptId: number,
realName:string
}
interface UserInfoVO {
@ -30,7 +31,8 @@ export const useUserStore = defineStore('admin-user', {
id: 0,
avatar: '',
nickname: '',
deptId: 0
deptId: 0,
realName: '',
}
}),
getters: {
@ -56,6 +58,7 @@ export const useUserStore = defineStore('admin-user', {
let userInfo = wsCache.get(CACHE_KEY.USER)
if (!userInfo) {
userInfo = await getInfo()
console.log(userInfo)
}
this.permissions = userInfo.permissions
this.roles = userInfo.roles
@ -92,7 +95,8 @@ export const useUserStore = defineStore('admin-user', {
id: 0,
avatar: '',
nickname: '',
deptId: 0
deptId: 0,
realName:''
}
}
}

Loading…
Cancel
Save