feat: 恢复个人中心头像入口
This commit is contained in:
parent
5f018449e6
commit
e3870981b8
@ -20,6 +20,7 @@ const SUPPORTED_ADMIN_MENU_NAMES = new Set([
|
|||||||
'BlogTheme',
|
'BlogTheme',
|
||||||
'BlogThemeImport',
|
'BlogThemeImport',
|
||||||
'BlogThemeSave',
|
'BlogThemeSave',
|
||||||
|
'Profile',
|
||||||
'QqBot',
|
'QqBot',
|
||||||
'QqBotAccount',
|
'QqBotAccount',
|
||||||
'QqBotAccountConfig',
|
'QqBotAccountConfig',
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, onBeforeMount, watch } from 'vue';
|
import { computed, onBeforeMount, watch } from 'vue';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
|
||||||
import { AuthenticationLoginExpiredModal } from '@vben/common-ui';
|
import { AuthenticationLoginExpiredModal } from '@vben/common-ui';
|
||||||
import { useWatermark } from '@vben/hooks';
|
import { useWatermark } from '@vben/hooks';
|
||||||
@ -7,6 +8,7 @@ import { BasicLayout, LockScreen, UserDropdown } from '@vben/layouts';
|
|||||||
import { preferences } from '@vben/preferences';
|
import { preferences } from '@vben/preferences';
|
||||||
import { useAccessStore, useTabbarStore, useUserStore } from '@vben/stores';
|
import { useAccessStore, useTabbarStore, useUserStore } from '@vben/stores';
|
||||||
|
|
||||||
|
import { $t } from '#/locales';
|
||||||
import { useAuthStore } from '#/store';
|
import { useAuthStore } from '#/store';
|
||||||
import LoginForm from '#/views/_core/authentication/login.vue';
|
import LoginForm from '#/views/_core/authentication/login.vue';
|
||||||
|
|
||||||
@ -26,12 +28,25 @@ setMenuList([
|
|||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const authStore = useAuthStore();
|
const authStore = useAuthStore();
|
||||||
const accessStore = useAccessStore();
|
const accessStore = useAccessStore();
|
||||||
|
const router = useRouter();
|
||||||
const { destroyWatermark, updateWatermark } = useWatermark();
|
const { destroyWatermark, updateWatermark } = useWatermark();
|
||||||
|
|
||||||
const avatar = computed(() => {
|
const avatar = computed(() => {
|
||||||
return userStore.userInfo?.avatar ?? preferences.app.defaultAvatar;
|
return userStore.userInfo?.avatar ?? preferences.app.defaultAvatar;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const userDropdownMenus = computed(() => [
|
||||||
|
{
|
||||||
|
handler: handleOpenProfile,
|
||||||
|
icon: 'lucide:user',
|
||||||
|
text: $t('page.auth.profile'),
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
async function handleOpenProfile() {
|
||||||
|
await router.push({ name: 'Profile' });
|
||||||
|
}
|
||||||
|
|
||||||
async function handleLogout() {
|
async function handleLogout() {
|
||||||
await authStore.logout(false);
|
await authStore.logout(false);
|
||||||
}
|
}
|
||||||
@ -75,6 +90,7 @@ onBeforeMount(() => {
|
|||||||
<UserDropdown
|
<UserDropdown
|
||||||
:avatar
|
:avatar
|
||||||
:description="userStore.userInfo?.username"
|
:description="userStore.userInfo?.username"
|
||||||
|
:menus="userDropdownMenus"
|
||||||
:text="userStore.userInfo?.realName"
|
:text="userStore.userInfo?.realName"
|
||||||
trigger="both"
|
trigger="both"
|
||||||
@logout="handleLogout"
|
@logout="handleLogout"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user