优化展示用户名,而不是固定为Tencent (#485)

* Update user.ts

* Update Header.vue

* Update user.ts

* Update user.ts
This commit is contained in:
Gui.H 2023-05-08 22:16:19 +08:00 committed by GitHub
parent 0d70db425d
commit 2794bdcb5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -48,7 +48,7 @@
<template #icon>
<t-icon class="header-user-avatar" name="user-circle" />
</template>
<div class="header-user-account">Tencent</div>
<div class="header-user-account">{{ user.userInfo.name }}</div>
<template #suffix><t-icon name="chevron-down" /></template>
</t-button>
</t-dropdown>
@ -71,7 +71,7 @@ import { useRouter } from 'vue-router';
import LogoFull from '@/assets/assets-logo-full.svg?component';
import { prefix } from '@/config/global';
import { getActive } from '@/router';
import { useSettingStore } from '@/store';
import { useSettingStore, useUserStore } from '@/store';
import type { MenuRoute } from '@/types/interface';
import MenuContent from './MenuContent.vue';
@ -111,6 +111,7 @@ const props = defineProps({
const router = useRouter();
const settingStore = useSettingStore();
const user = useUserStore();
const toggleSettingPanel = () => {
settingStore.updateConfig({

View File

@ -4,6 +4,7 @@ import { TOKEN_NAME } from '@/config/global';
import { store, usePermissionStore } from '@/store';
const InitUserInfo = {
name: '', // 用户名,用于展示在页面右上角头像处
roles: [], // 前端权限模型使用 如果使用请配置modules/permission-fe.ts使用
};
@ -57,7 +58,7 @@ export const useUserStore = defineStore('user', {
const mockRemoteUserInfo = async (token: string) => {
if (token === 'main_token') {
return {
name: 'td_main',
name: 'Tencent',
roles: ['all'], // 前端权限模型使用 如果使用请配置modules/permission-fe.ts使用
};
}