mirror of
https://github.com/Tencent/tdesign-vue-next-starter.git
synced 2024-11-10 07:28:24 +08:00
优化展示用户名,而不是固定为Tencent (#485)
* Update user.ts * Update Header.vue * Update user.ts * Update user.ts
This commit is contained in:
parent
0d70db425d
commit
2794bdcb5c
|
@ -48,7 +48,7 @@
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<t-icon class="header-user-avatar" name="user-circle" />
|
<t-icon class="header-user-avatar" name="user-circle" />
|
||||||
</template>
|
</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>
|
<template #suffix><t-icon name="chevron-down" /></template>
|
||||||
</t-button>
|
</t-button>
|
||||||
</t-dropdown>
|
</t-dropdown>
|
||||||
|
@ -71,7 +71,7 @@ import { useRouter } from 'vue-router';
|
||||||
import LogoFull from '@/assets/assets-logo-full.svg?component';
|
import LogoFull from '@/assets/assets-logo-full.svg?component';
|
||||||
import { prefix } from '@/config/global';
|
import { prefix } from '@/config/global';
|
||||||
import { getActive } from '@/router';
|
import { getActive } from '@/router';
|
||||||
import { useSettingStore } from '@/store';
|
import { useSettingStore, useUserStore } from '@/store';
|
||||||
import type { MenuRoute } from '@/types/interface';
|
import type { MenuRoute } from '@/types/interface';
|
||||||
|
|
||||||
import MenuContent from './MenuContent.vue';
|
import MenuContent from './MenuContent.vue';
|
||||||
|
@ -111,6 +111,7 @@ const props = defineProps({
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const settingStore = useSettingStore();
|
const settingStore = useSettingStore();
|
||||||
|
const user = useUserStore();
|
||||||
|
|
||||||
const toggleSettingPanel = () => {
|
const toggleSettingPanel = () => {
|
||||||
settingStore.updateConfig({
|
settingStore.updateConfig({
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { TOKEN_NAME } from '@/config/global';
|
||||||
import { store, usePermissionStore } from '@/store';
|
import { store, usePermissionStore } from '@/store';
|
||||||
|
|
||||||
const InitUserInfo = {
|
const InitUserInfo = {
|
||||||
|
name: '', // 用户名,用于展示在页面右上角头像处
|
||||||
roles: [], // 前端权限模型使用 如果使用请配置modules/permission-fe.ts使用
|
roles: [], // 前端权限模型使用 如果使用请配置modules/permission-fe.ts使用
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -57,7 +58,7 @@ export const useUserStore = defineStore('user', {
|
||||||
const mockRemoteUserInfo = async (token: string) => {
|
const mockRemoteUserInfo = async (token: string) => {
|
||||||
if (token === 'main_token') {
|
if (token === 'main_token') {
|
||||||
return {
|
return {
|
||||||
name: 'td_main',
|
name: 'Tencent',
|
||||||
roles: ['all'], // 前端权限模型使用 如果使用请配置modules/permission-fe.ts使用
|
roles: ['all'], // 前端权限模型使用 如果使用请配置modules/permission-fe.ts使用
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user