|
|
@@ -1,86 +1,94 @@
|
|
|
<template>
|
|
|
- <div class="navbar" :style="{ width: currentWidth }">
|
|
|
- <div class="left-side">
|
|
|
- <a-button
|
|
|
- type="text"
|
|
|
- :style="{
|
|
|
- padding: '0 7px',
|
|
|
- height: '25px',
|
|
|
- lineHeight: '25px',
|
|
|
- color: 'var(--color-text-3)',
|
|
|
- }"
|
|
|
- @click="toggleCollapse"
|
|
|
- >
|
|
|
- <icon-menu-unfold v-if="collapsed" />
|
|
|
- <icon-menu-fold v-else />
|
|
|
- </a-button>
|
|
|
- </div>
|
|
|
- <GlobalBreadcrumb v-show="!topMenu" />
|
|
|
-
|
|
|
- <div class="center-side">
|
|
|
- <Menu v-if="topMenu" />
|
|
|
- </div>
|
|
|
- <ul class="right-side">
|
|
|
- <li>
|
|
|
- <a-tooltip :content="$t('settings.search')">
|
|
|
- <a-button class="nav-btn" type="outline" :shape="'circle'">
|
|
|
- <template #icon>
|
|
|
- <icon-search />
|
|
|
+ <div
|
|
|
+ class="navbar-container"
|
|
|
+ :style="{ width: topMenu ? '100%' : currentWidth }"
|
|
|
+ >
|
|
|
+ <div class="navbar">
|
|
|
+ <div class="left-side">
|
|
|
+ <a-button
|
|
|
+ type="text"
|
|
|
+ :style="{
|
|
|
+ padding: '0 7px',
|
|
|
+ height: '25px',
|
|
|
+ lineHeight: '25px',
|
|
|
+ color: 'var(--color-text-3)',
|
|
|
+ }"
|
|
|
+ @click="toggleCollapse"
|
|
|
+ v-show="!topMenu"
|
|
|
+ >
|
|
|
+ <icon-menu-unfold v-if="collapsed" />
|
|
|
+ <icon-menu-fold v-else />
|
|
|
+ </a-button>
|
|
|
+ </div>
|
|
|
+ <GlobalBreadcrumb v-show="!topMenu" />
|
|
|
+ <div class="center-side">
|
|
|
+ <NavMenu
|
|
|
+ v-if="topMenu"
|
|
|
+ :internalHoveredItem="internalHoveredItem"
|
|
|
+ @menuHover="handleMenuHover"
|
|
|
+ ></NavMenu>
|
|
|
+ </div>
|
|
|
+ <ul class="right-side">
|
|
|
+ <li>
|
|
|
+ <a-tooltip :content="$t('settings.search')">
|
|
|
+ <a-button class="nav-btn" type="outline" :shape="'circle'">
|
|
|
+ <template #icon>
|
|
|
+ <icon-search />
|
|
|
+ </template>
|
|
|
+ </a-button>
|
|
|
+ </a-tooltip>
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <a-tooltip :content="$t('settings.language')">
|
|
|
+ <a-button
|
|
|
+ class="nav-btn"
|
|
|
+ type="outline"
|
|
|
+ :shape="'circle'"
|
|
|
+ @click="setDropDownVisible"
|
|
|
+ >
|
|
|
+ <template #icon>
|
|
|
+ <icon-language />
|
|
|
+ </template>
|
|
|
+ </a-button>
|
|
|
+ </a-tooltip>
|
|
|
+ <a-dropdown trigger="click" @select="changeLocale as any">
|
|
|
+ <div ref="triggerBtn" class="trigger-btn"></div>
|
|
|
+ <template #content>
|
|
|
+ <a-doption
|
|
|
+ v-for="item in locales"
|
|
|
+ :key="item.value"
|
|
|
+ :value="item.value"
|
|
|
+ >
|
|
|
+ <template #icon>
|
|
|
+ <icon-check v-show="item.value === currentLocale" />
|
|
|
+ </template>
|
|
|
+ {{ item.label }}
|
|
|
+ </a-doption>
|
|
|
</template>
|
|
|
- </a-button>
|
|
|
- </a-tooltip>
|
|
|
- </li>
|
|
|
- <li>
|
|
|
- <a-tooltip :content="$t('settings.language')">
|
|
|
- <a-button
|
|
|
- class="nav-btn"
|
|
|
- type="outline"
|
|
|
- :shape="'circle'"
|
|
|
- @click="setDropDownVisible"
|
|
|
+ </a-dropdown>
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <a-tooltip
|
|
|
+ :content="
|
|
|
+ theme === 'light'
|
|
|
+ ? $t('settings.navbar.theme.toDark')
|
|
|
+ : $t('settings.navbar.theme.toLight')
|
|
|
+ "
|
|
|
>
|
|
|
- <template #icon>
|
|
|
- <icon-language />
|
|
|
- </template>
|
|
|
- </a-button>
|
|
|
- </a-tooltip>
|
|
|
- <a-dropdown trigger="click" @select="changeLocale as any">
|
|
|
- <div ref="triggerBtn" class="trigger-btn"></div>
|
|
|
- <template #content>
|
|
|
- <a-doption
|
|
|
- v-for="item in locales"
|
|
|
- :key="item.value"
|
|
|
- :value="item.value"
|
|
|
+ <a-button
|
|
|
+ class="nav-btn"
|
|
|
+ type="outline"
|
|
|
+ :shape="'circle'"
|
|
|
+ @click="handleToggleTheme"
|
|
|
>
|
|
|
<template #icon>
|
|
|
- <icon-check v-show="item.value === currentLocale" />
|
|
|
+ <icon-moon-fill v-if="theme === 'dark'" />
|
|
|
+ <icon-sun-fill v-else />
|
|
|
</template>
|
|
|
- {{ item.label }}
|
|
|
- </a-doption>
|
|
|
- </template>
|
|
|
- </a-dropdown>
|
|
|
- </li>
|
|
|
- <li>
|
|
|
- <a-tooltip
|
|
|
- :content="
|
|
|
- theme === 'light'
|
|
|
- ? $t('settings.navbar.theme.toDark')
|
|
|
- : $t('settings.navbar.theme.toLight')
|
|
|
- "
|
|
|
- >
|
|
|
- <a-button
|
|
|
- class="nav-btn"
|
|
|
- type="outline"
|
|
|
- :shape="'circle'"
|
|
|
- @click="handleToggleTheme"
|
|
|
- >
|
|
|
- <template #icon>
|
|
|
- <icon-moon-fill v-if="theme === 'dark'" />
|
|
|
- <icon-sun-fill v-else />
|
|
|
- </template>
|
|
|
- </a-button>
|
|
|
- </a-tooltip>
|
|
|
- </li>
|
|
|
- <!-- <li>
|
|
|
+ </a-button>
|
|
|
+ </a-tooltip>
|
|
|
+ </li>
|
|
|
+ <!-- <li>
|
|
|
<a-tooltip :content="$t('settings.navbar.alerts')">
|
|
|
<div class="message-box-trigger">
|
|
|
<a-badge :count="9" dot>
|
|
|
@@ -107,51 +115,51 @@
|
|
|
</template>
|
|
|
</a-popover>
|
|
|
</li> -->
|
|
|
- <li>
|
|
|
- <a-tooltip
|
|
|
- :content="
|
|
|
- isFullscreen
|
|
|
- ? $t('settings.navbar.screen.toExit')
|
|
|
- : $t('settings.navbar.screen.toFull')
|
|
|
- "
|
|
|
- >
|
|
|
- <a-button
|
|
|
- class="nav-btn"
|
|
|
- type="outline"
|
|
|
- :shape="'circle'"
|
|
|
- @click="toggleFullScreen"
|
|
|
- >
|
|
|
- <template #icon>
|
|
|
- <icon-fullscreen-exit v-if="isFullscreen" />
|
|
|
- <icon-fullscreen v-else />
|
|
|
- </template>
|
|
|
- </a-button>
|
|
|
- </a-tooltip>
|
|
|
- </li>
|
|
|
- <li>
|
|
|
- <a-tooltip :content="$t('settings.title')">
|
|
|
- <a-button
|
|
|
- class="nav-btn"
|
|
|
- type="outline"
|
|
|
- :shape="'circle'"
|
|
|
- @click="setVisible"
|
|
|
- >
|
|
|
- <template #icon>
|
|
|
- <icon-settings />
|
|
|
- </template>
|
|
|
- </a-button>
|
|
|
- </a-tooltip>
|
|
|
- </li>
|
|
|
- <li>
|
|
|
- <a-dropdown trigger="click">
|
|
|
- <a-avatar
|
|
|
- :size="32"
|
|
|
- :style="{ marginRight: '8px', cursor: 'pointer' }"
|
|
|
+ <li>
|
|
|
+ <a-tooltip
|
|
|
+ :content="
|
|
|
+ isFullscreen
|
|
|
+ ? $t('settings.navbar.screen.toExit')
|
|
|
+ : $t('settings.navbar.screen.toFull')
|
|
|
+ "
|
|
|
>
|
|
|
- <img alt="avatar" :src="avatar" />
|
|
|
- </a-avatar>
|
|
|
- <template #content>
|
|
|
- <!-- <a-doption>
|
|
|
+ <a-button
|
|
|
+ class="nav-btn"
|
|
|
+ type="outline"
|
|
|
+ :shape="'circle'"
|
|
|
+ @click="toggleFullScreen"
|
|
|
+ >
|
|
|
+ <template #icon>
|
|
|
+ <icon-fullscreen-exit v-if="isFullscreen" />
|
|
|
+ <icon-fullscreen v-else />
|
|
|
+ </template>
|
|
|
+ </a-button>
|
|
|
+ </a-tooltip>
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <a-tooltip :content="$t('settings.title')">
|
|
|
+ <a-button
|
|
|
+ class="nav-btn"
|
|
|
+ type="outline"
|
|
|
+ :shape="'circle'"
|
|
|
+ @click="setVisible"
|
|
|
+ >
|
|
|
+ <template #icon>
|
|
|
+ <icon-settings />
|
|
|
+ </template>
|
|
|
+ </a-button>
|
|
|
+ </a-tooltip>
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <a-dropdown trigger="click">
|
|
|
+ <a-avatar
|
|
|
+ :size="32"
|
|
|
+ :style="{ marginRight: '8px', cursor: 'pointer' }"
|
|
|
+ >
|
|
|
+ <img alt="avatar" :src="avatar" />
|
|
|
+ </a-avatar>
|
|
|
+ <template #content>
|
|
|
+ <!-- <a-doption>
|
|
|
<a-space @click="switchRoles">
|
|
|
<icon-tag />
|
|
|
<span>
|
|
|
@@ -159,26 +167,33 @@
|
|
|
</span>
|
|
|
</a-space>
|
|
|
</a-doption> -->
|
|
|
- <a-doption>
|
|
|
- <a-space @click="$router.push({ name: 'Setting' })">
|
|
|
- <icon-settings />
|
|
|
- <span>
|
|
|
- {{ $t('messageBox.userSettings') }}
|
|
|
- </span>
|
|
|
- </a-space>
|
|
|
- </a-doption>
|
|
|
- <a-doption>
|
|
|
- <a-space @click="handleLogout">
|
|
|
- <icon-export />
|
|
|
- <span>
|
|
|
- {{ $t('messageBox.logout') }}
|
|
|
- </span>
|
|
|
- </a-space>
|
|
|
- </a-doption>
|
|
|
- </template>
|
|
|
- </a-dropdown>
|
|
|
- </li>
|
|
|
- </ul>
|
|
|
+ <a-doption>
|
|
|
+ <a-space @click="$router.push({ name: 'Setting' })">
|
|
|
+ <icon-settings />
|
|
|
+ <span>
|
|
|
+ {{ $t('messageBox.userSettings') }}
|
|
|
+ </span>
|
|
|
+ </a-space>
|
|
|
+ </a-doption>
|
|
|
+ <a-doption>
|
|
|
+ <a-space @click="handleLogout">
|
|
|
+ <icon-export />
|
|
|
+ <span>
|
|
|
+ {{ $t('messageBox.logout') }}
|
|
|
+ </span>
|
|
|
+ </a-space>
|
|
|
+ </a-doption>
|
|
|
+ </template>
|
|
|
+ </a-dropdown>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+ <NavSecondMenu
|
|
|
+ v-if="topMenu"
|
|
|
+ :hoveredMenuItem="currentHoveredMenu"
|
|
|
+ @internalHoveredItemFun="internalHoveredItemFun"
|
|
|
+ ></NavSecondMenu>
|
|
|
+ <!-- <div :style="{ width: '100%', height: '50px' }">dddd</div> -->
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -190,9 +205,11 @@ import { useAppStore, useUserStore } from '@/store';
|
|
|
import { LOCALE_OPTIONS } from '@/locale';
|
|
|
import useLocale from '@/hooks/locale';
|
|
|
import useUser from '@/hooks/user';
|
|
|
-import Menu from '@/components/menu/index.vue';
|
|
|
+import NavMenu from '@/components/menu/nav-menu.vue';
|
|
|
+import NavSecondMenu from '@/components/menu/nav-second-menu.vue';
|
|
|
import MessageBox from '../message-box/index.vue';
|
|
|
import GlobalBreadcrumb from '../global-breadcrumb/index.vue';
|
|
|
+import { useRoute, useRouter, RouteRecordNormalized } from 'vue-router';
|
|
|
|
|
|
const appStore = useAppStore();
|
|
|
const userStore = useUserStore();
|
|
|
@@ -269,62 +286,81 @@ const toggleCollapse = () => {
|
|
|
setCollapse(!collapsed.value);
|
|
|
// toggleWidth(collapsed.value);
|
|
|
};
|
|
|
+const currentHoveredMenu = ref<RouteRecordNormalized>(
|
|
|
+ {} as RouteRecordNormalized
|
|
|
+);
|
|
|
+const internalHoveredItem = ref<RouteRecordNormalized>(
|
|
|
+ {} as RouteRecordNormalized
|
|
|
+);
|
|
|
+
|
|
|
+const handleMenuHover = (menuItem: RouteRecordNormalized) => {
|
|
|
+ currentHoveredMenu.value = menuItem;
|
|
|
+};
|
|
|
+const internalHoveredItemFun = (item: RouteRecordNormalized) => {
|
|
|
+ internalHoveredItem.value = item;
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="less">
|
|
|
-.navbar {
|
|
|
+.navbar-container {
|
|
|
display: flex;
|
|
|
- justify-content: space-between;
|
|
|
- justify-self: end;
|
|
|
- height: 100%;
|
|
|
- background-color: var(--color-bg-2);
|
|
|
- border-bottom: 1px solid var(--color-border);
|
|
|
-}
|
|
|
-
|
|
|
-.left-side {
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- padding-left: 20px;
|
|
|
-}
|
|
|
-
|
|
|
-.center-side {
|
|
|
- flex: 1;
|
|
|
-}
|
|
|
-
|
|
|
-.right-side {
|
|
|
- display: flex;
|
|
|
- padding-right: 20px;
|
|
|
- list-style: none;
|
|
|
+ flex-direction: column;
|
|
|
+ width: 100%;
|
|
|
|
|
|
- :deep(.locale-select) {
|
|
|
- border-radius: 20px;
|
|
|
+ .navbar {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ justify-self: end;
|
|
|
+ height: 100%;
|
|
|
+ background-color: var(--color-bg-2);
|
|
|
+ border-bottom: 1px solid var(--color-border);
|
|
|
}
|
|
|
|
|
|
- li {
|
|
|
+ .left-side {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
- padding: 0 10px;
|
|
|
+ padding-left: 20px;
|
|
|
}
|
|
|
|
|
|
- a {
|
|
|
- color: var(--color-text-1);
|
|
|
- text-decoration: none;
|
|
|
+ .center-side {
|
|
|
+ flex: 1;
|
|
|
}
|
|
|
|
|
|
- .nav-btn {
|
|
|
- color: rgb(var(--gray-8));
|
|
|
- font-size: 16px;
|
|
|
- border-color: rgb(var(--gray-2));
|
|
|
- }
|
|
|
+ .right-side {
|
|
|
+ display: flex;
|
|
|
+ padding-right: 20px;
|
|
|
+ list-style: none;
|
|
|
|
|
|
- .trigger-btn,
|
|
|
- .ref-btn {
|
|
|
- position: absolute;
|
|
|
- bottom: 14px;
|
|
|
- }
|
|
|
+ :deep(.locale-select) {
|
|
|
+ border-radius: 20px;
|
|
|
+ }
|
|
|
+
|
|
|
+ li {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ padding: 0 10px;
|
|
|
+ }
|
|
|
+
|
|
|
+ a {
|
|
|
+ color: var(--color-text-1);
|
|
|
+ text-decoration: none;
|
|
|
+ }
|
|
|
+
|
|
|
+ .nav-btn {
|
|
|
+ color: rgb(var(--gray-8));
|
|
|
+ font-size: 16px;
|
|
|
+ border-color: rgb(var(--gray-2));
|
|
|
+ }
|
|
|
+
|
|
|
+ .trigger-btn,
|
|
|
+ .ref-btn {
|
|
|
+ position: absolute;
|
|
|
+ bottom: 14px;
|
|
|
+ }
|
|
|
|
|
|
- .trigger-btn {
|
|
|
- margin-left: 14px;
|
|
|
+ .trigger-btn {
|
|
|
+ margin-left: 14px;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</style>
|