|
|
@@ -1,9 +1,7 @@
|
|
|
<script lang="ts" setup>
|
|
|
import type { NotificationItem } from '@vben/layouts';
|
|
|
-import type { MenuRecordRaw } from '@vben/types';
|
|
|
|
|
|
import { computed, ref, watch } from 'vue';
|
|
|
-import { useRouter } from 'vue-router';
|
|
|
|
|
|
import { AuthenticationLoginExpiredModal } from '@vben/common-ui';
|
|
|
import { useWatermark } from '@vben/hooks';
|
|
|
@@ -12,7 +10,6 @@ import { preferences } from '@vben/preferences';
|
|
|
import { useAccessStore, useUserStore } from '@vben/stores';
|
|
|
|
|
|
import LoginForm from '#/core/authentication/login.vue';
|
|
|
-import { $t } from '#/locales';
|
|
|
import { useAuthStore } from '#/store';
|
|
|
|
|
|
const notifications = ref<NotificationItem[]>([]);
|
|
|
@@ -20,7 +17,6 @@ const notifications = ref<NotificationItem[]>([]);
|
|
|
const userStore = useUserStore();
|
|
|
const authStore = useAuthStore();
|
|
|
const accessStore = useAccessStore();
|
|
|
-const router = useRouter();
|
|
|
const { destroyWatermark, updateWatermark } = useWatermark();
|
|
|
|
|
|
computed(() => notifications.value.some((item) => !item.isRead));
|
|
|
@@ -40,20 +36,6 @@ async function handleLogout() {
|
|
|
await authStore.logout(false);
|
|
|
}
|
|
|
|
|
|
-function collectLeafMenus(menus: MenuRecordRaw[]): MenuRecordRaw[] {
|
|
|
- return menus.flatMap((menu) =>
|
|
|
- menu.children?.length ? collectLeafMenus(menu.children) : [menu],
|
|
|
- );
|
|
|
-}
|
|
|
-
|
|
|
-const dropdownMenus = computed(() =>
|
|
|
- collectLeafMenus(accessStore.accessMenus).map((menu) => ({
|
|
|
- text: $t(menu.name),
|
|
|
- icon: menu.icon ?? 'mdi:circle-small',
|
|
|
- handler: () => router.push(menu.path),
|
|
|
- })),
|
|
|
-);
|
|
|
-
|
|
|
watch(
|
|
|
() => preferences.app.watermark,
|
|
|
async (enable) => {
|
|
|
@@ -77,7 +59,7 @@ watch(
|
|
|
<UserDropdown
|
|
|
:avatar
|
|
|
:text
|
|
|
- :menus="dropdownMenus"
|
|
|
+ :menus="[]"
|
|
|
:description="userStore.userInfo?.desc"
|
|
|
@logout="handleLogout"
|
|
|
/>
|