2023-07-24 10:05:07 +08:00
|
|
|
<template>
|
|
|
|
|
<div class="navbar">
|
2023-07-27 18:48:15 +08:00
|
|
|
<!-- 左侧按钮 -->
|
2023-07-24 10:05:07 +08:00
|
|
|
<div class="left-side">
|
|
|
|
|
<a-space>
|
2023-07-27 18:48:15 +08:00
|
|
|
<!-- FIXME -->
|
|
|
|
|
<!-- LOGO -->
|
2023-07-24 10:05:07 +08:00
|
|
|
<img
|
|
|
|
|
alt="logo"
|
|
|
|
|
src="//p3-armor.byteimg.com/tos-cn-i-49unhts6dw/dfdba5317c0c20ce20e64fac803d52bc.svg~tplv-49unhts6dw-image.image"
|
|
|
|
|
/>
|
2023-07-27 18:48:15 +08:00
|
|
|
<!-- 标头 -->
|
2023-07-24 10:05:07 +08:00
|
|
|
<a-typography-title
|
|
|
|
|
:style="{ margin: 0, fontSize: '18px' }"
|
2023-07-27 18:48:15 +08:00
|
|
|
:heading="5">
|
|
|
|
|
Orion Ops Pro
|
2023-07-24 10:05:07 +08:00
|
|
|
</a-typography-title>
|
2023-07-27 18:48:15 +08:00
|
|
|
<!-- 收缩菜单 -->
|
2023-07-24 10:05:07 +08:00
|
|
|
<icon-menu-fold
|
|
|
|
|
v-if="!topMenu && appStore.device === 'mobile'"
|
|
|
|
|
style="font-size: 22px; cursor: pointer"
|
|
|
|
|
@click="toggleDrawerMenu"
|
|
|
|
|
/>
|
|
|
|
|
</a-space>
|
|
|
|
|
</div>
|
2023-07-27 18:48:15 +08:00
|
|
|
<!-- 顶部菜单 -->
|
2023-07-24 10:05:07 +08:00
|
|
|
<div class="center-side">
|
|
|
|
|
<Menu v-if="topMenu" />
|
|
|
|
|
</div>
|
2023-07-27 18:48:15 +08:00
|
|
|
<!-- 右侧按钮 -->
|
2023-07-24 10:05:07 +08:00
|
|
|
<ul class="right-side">
|
2023-07-27 18:48:15 +08:00
|
|
|
<!-- 搜索 -->
|
|
|
|
|
<li v-if="false">
|
2023-07-24 10:05:07 +08:00
|
|
|
<a-tooltip :content="$t('settings.search')">
|
2023-07-27 18:48:15 +08:00
|
|
|
<a-button class="nav-btn" type="outline" shape="circle">
|
2023-07-24 10:05:07 +08:00
|
|
|
<template #icon>
|
|
|
|
|
<icon-search />
|
|
|
|
|
</template>
|
|
|
|
|
</a-button>
|
|
|
|
|
</a-tooltip>
|
|
|
|
|
</li>
|
2023-07-27 18:48:15 +08:00
|
|
|
<!-- 切换语言 -->
|
|
|
|
|
<li v-if="false">
|
2023-07-24 10:05:07 +08:00
|
|
|
<a-tooltip :content="$t('settings.language')">
|
|
|
|
|
<a-button
|
|
|
|
|
class="nav-btn"
|
|
|
|
|
type="outline"
|
|
|
|
|
:shape="'circle'"
|
2023-07-27 18:48:15 +08:00
|
|
|
@click="setUserInfoVisible">
|
2023-07-24 10:05:07 +08:00
|
|
|
<template #icon>
|
|
|
|
|
<icon-language />
|
|
|
|
|
</template>
|
|
|
|
|
</a-button>
|
|
|
|
|
</a-tooltip>
|
2023-07-27 18:48:15 +08:00
|
|
|
<a-dropdown trigger="click" @select="changeLocale">
|
|
|
|
|
<div ref="refUserInfoTrigger" class="trigger-btn"></div>
|
2023-07-24 10:05:07 +08:00
|
|
|
<template #content>
|
2023-07-27 18:48:15 +08:00
|
|
|
<a-doption v-for="item in locales"
|
|
|
|
|
:key="item.value"
|
|
|
|
|
:value="item.value">
|
2023-07-24 10:05:07 +08:00
|
|
|
<template #icon>
|
|
|
|
|
<icon-check v-show="item.value === currentLocale" />
|
|
|
|
|
</template>
|
|
|
|
|
{{ item.label }}
|
|
|
|
|
</a-doption>
|
|
|
|
|
</template>
|
|
|
|
|
</a-dropdown>
|
|
|
|
|
</li>
|
2023-07-27 18:48:15 +08:00
|
|
|
<!-- 暗色模式 -->
|
2023-07-24 10:05:07 +08:00
|
|
|
<li>
|
2023-07-27 18:48:15 +08:00
|
|
|
<a-tooltip :content="theme === 'light'
|
2023-07-24 10:05:07 +08:00
|
|
|
? $t('settings.navbar.theme.toDark')
|
2023-07-27 18:48:15 +08:00
|
|
|
: $t('settings.navbar.theme.toLight')">
|
2023-07-24 10:05:07 +08:00
|
|
|
<a-button
|
|
|
|
|
class="nav-btn"
|
|
|
|
|
type="outline"
|
|
|
|
|
:shape="'circle'"
|
2023-07-27 18:48:15 +08:00
|
|
|
@click="handleToggleTheme">
|
2023-07-24 10:05:07 +08:00
|
|
|
<template #icon>
|
|
|
|
|
<icon-moon-fill v-if="theme === 'dark'" />
|
|
|
|
|
<icon-sun-fill v-else />
|
|
|
|
|
</template>
|
|
|
|
|
</a-button>
|
|
|
|
|
</a-tooltip>
|
|
|
|
|
</li>
|
2023-07-27 18:48:15 +08:00
|
|
|
<!-- 消息列表 -->
|
|
|
|
|
<li v-if="false">
|
2023-07-24 10:05:07 +08:00
|
|
|
<a-tooltip :content="$t('settings.navbar.alerts')">
|
|
|
|
|
<div class="message-box-trigger">
|
|
|
|
|
<a-badge :count="9" dot>
|
|
|
|
|
<a-button
|
|
|
|
|
class="nav-btn"
|
|
|
|
|
type="outline"
|
|
|
|
|
:shape="'circle'"
|
2023-07-27 18:48:15 +08:00
|
|
|
@click="setMessageBoxVisible">
|
2023-07-24 10:05:07 +08:00
|
|
|
<icon-notification />
|
|
|
|
|
</a-button>
|
|
|
|
|
</a-badge>
|
|
|
|
|
</div>
|
|
|
|
|
</a-tooltip>
|
|
|
|
|
<a-popover
|
|
|
|
|
trigger="click"
|
|
|
|
|
:arrow-style="{ display: 'none' }"
|
|
|
|
|
:content-style="{ padding: 0, minWidth: '400px' }"
|
2023-07-27 18:48:15 +08:00
|
|
|
content-class="message-popover">
|
|
|
|
|
<div ref="refMessageBoxTrigger" class="ref-btn"></div>
|
2023-07-24 10:05:07 +08:00
|
|
|
<template #content>
|
|
|
|
|
<message-box />
|
|
|
|
|
</template>
|
|
|
|
|
</a-popover>
|
|
|
|
|
</li>
|
2023-07-27 18:48:15 +08:00
|
|
|
<!-- 全屏模式 -->
|
2023-07-24 10:05:07 +08:00
|
|
|
<li>
|
2023-07-27 18:48:15 +08:00
|
|
|
<a-tooltip :content="isFullscreen
|
2023-07-24 10:05:07 +08:00
|
|
|
? $t('settings.navbar.screen.toExit')
|
2023-07-27 18:48:15 +08:00
|
|
|
: $t('settings.navbar.screen.toFull')">
|
2023-07-24 10:05:07 +08:00
|
|
|
<a-button
|
|
|
|
|
class="nav-btn"
|
|
|
|
|
type="outline"
|
2023-07-27 18:48:15 +08:00
|
|
|
shape="circle"
|
|
|
|
|
@click="toggleFullScreen">
|
2023-07-24 10:05:07 +08:00
|
|
|
<template #icon>
|
|
|
|
|
<icon-fullscreen-exit v-if="isFullscreen" />
|
|
|
|
|
<icon-fullscreen v-else />
|
|
|
|
|
</template>
|
|
|
|
|
</a-button>
|
|
|
|
|
</a-tooltip>
|
|
|
|
|
</li>
|
2023-07-27 18:48:15 +08:00
|
|
|
<!-- 页面配置 -->
|
|
|
|
|
<li v-if="false">
|
2023-07-24 10:05:07 +08:00
|
|
|
<a-tooltip :content="$t('settings.title')">
|
|
|
|
|
<a-button
|
|
|
|
|
class="nav-btn"
|
|
|
|
|
type="outline"
|
2023-07-27 18:48:15 +08:00
|
|
|
shape="circle"
|
|
|
|
|
@click="setSettingVisible">
|
2023-07-24 10:05:07 +08:00
|
|
|
<template #icon>
|
|
|
|
|
<icon-settings />
|
|
|
|
|
</template>
|
|
|
|
|
</a-button>
|
|
|
|
|
</a-tooltip>
|
|
|
|
|
</li>
|
2023-07-27 18:48:15 +08:00
|
|
|
<!-- 用户信息 -->
|
2023-07-24 10:05:07 +08:00
|
|
|
<li>
|
|
|
|
|
<a-dropdown trigger="click">
|
2023-07-27 18:48:15 +08:00
|
|
|
<!-- 头像 -->
|
2023-07-24 10:05:07 +08:00
|
|
|
<a-avatar
|
|
|
|
|
:size="32"
|
2023-07-27 18:48:15 +08:00
|
|
|
:style="{ cursor: 'pointer', backgroundColor: '#3370ff' }">
|
|
|
|
|
{{ nickname }}
|
2023-07-24 10:05:07 +08:00
|
|
|
</a-avatar>
|
|
|
|
|
<template #content>
|
2023-07-27 18:48:15 +08:00
|
|
|
<!-- 用户信息 -->
|
2023-07-24 10:05:07 +08:00
|
|
|
<a-doption>
|
|
|
|
|
<a-space @click="$router.push({ name: 'Info' })">
|
|
|
|
|
<icon-user />
|
|
|
|
|
<span>
|
|
|
|
|
{{ $t('messageBox.userCenter') }}
|
|
|
|
|
</span>
|
|
|
|
|
</a-space>
|
|
|
|
|
</a-doption>
|
2023-07-27 18:48:15 +08:00
|
|
|
<!-- 用户设置 -->
|
2023-07-24 10:05:07 +08:00
|
|
|
<a-doption>
|
|
|
|
|
<a-space @click="$router.push({ name: 'Setting' })">
|
|
|
|
|
<icon-settings />
|
|
|
|
|
<span>
|
|
|
|
|
{{ $t('messageBox.userSettings') }}
|
|
|
|
|
</span>
|
|
|
|
|
</a-space>
|
|
|
|
|
</a-doption>
|
2023-07-27 18:48:15 +08:00
|
|
|
<!-- 退出登录 -->
|
2023-07-24 10:05:07 +08:00
|
|
|
<a-doption>
|
|
|
|
|
<a-space @click="handleLogout">
|
|
|
|
|
<icon-export />
|
|
|
|
|
<span>
|
|
|
|
|
{{ $t('messageBox.logout') }}
|
|
|
|
|
</span>
|
|
|
|
|
</a-space>
|
|
|
|
|
</a-doption>
|
|
|
|
|
</template>
|
|
|
|
|
</a-dropdown>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2023-07-29 13:11:19 +08:00
|
|
|
import { computed, inject, ref } from 'vue';
|
|
|
|
|
import { useDark, useFullscreen, useToggle } from '@vueuse/core';
|
2023-07-24 10:05:07 +08:00
|
|
|
import { useAppStore, useUserStore } from '@/store';
|
|
|
|
|
import { LOCALE_OPTIONS } from '@/locale';
|
|
|
|
|
import useLocale from '@/hooks/locale';
|
|
|
|
|
import useUser from '@/hooks/user';
|
2023-07-27 18:48:15 +08:00
|
|
|
import { triggerMouseEvent } from '@/utils';
|
2023-07-24 10:05:07 +08:00
|
|
|
import Menu from '@/components/menu/index.vue';
|
|
|
|
|
import MessageBox from '../message-box/index.vue';
|
|
|
|
|
|
|
|
|
|
const appStore = useAppStore();
|
|
|
|
|
const userStore = useUserStore();
|
|
|
|
|
const { logout } = useUser();
|
|
|
|
|
const { changeLocale, currentLocale } = useLocale();
|
|
|
|
|
const { isFullscreen, toggle: toggleFullScreen } = useFullscreen();
|
|
|
|
|
const locales = [...LOCALE_OPTIONS];
|
2023-07-27 18:48:15 +08:00
|
|
|
const nickname = computed(() => {
|
|
|
|
|
return userStore.nickname?.substring(0, 1);
|
2023-07-24 10:05:07 +08:00
|
|
|
});
|
2023-07-27 18:48:15 +08:00
|
|
|
const topMenu = computed(() => appStore.topMenu && appStore.menu);
|
|
|
|
|
|
|
|
|
|
// 当前主题
|
2023-07-24 10:05:07 +08:00
|
|
|
const theme = computed(() => {
|
|
|
|
|
return appStore.theme;
|
|
|
|
|
});
|
2023-07-27 18:48:15 +08:00
|
|
|
|
|
|
|
|
// 主题
|
|
|
|
|
const darkTheme = useDark({
|
2023-07-24 10:05:07 +08:00
|
|
|
selector: 'body',
|
|
|
|
|
attribute: 'arco-theme',
|
|
|
|
|
valueDark: 'dark',
|
|
|
|
|
valueLight: 'light',
|
|
|
|
|
storageKey: 'arco-theme',
|
|
|
|
|
onChanged(dark: boolean) {
|
|
|
|
|
appStore.toggleTheme(dark);
|
|
|
|
|
},
|
|
|
|
|
});
|
2023-07-27 18:48:15 +08:00
|
|
|
|
|
|
|
|
// 切换主题
|
2023-07-24 10:05:07 +08:00
|
|
|
const handleToggleTheme = () => {
|
2023-07-27 18:48:15 +08:00
|
|
|
useToggle(darkTheme)();
|
2023-07-24 10:05:07 +08:00
|
|
|
};
|
2023-07-27 18:48:15 +08:00
|
|
|
|
|
|
|
|
// 打开系统设置
|
|
|
|
|
const setSettingVisible = () => {
|
2023-07-24 10:05:07 +08:00
|
|
|
appStore.updateSettings({ globalSettings: true });
|
|
|
|
|
};
|
2023-07-27 18:48:15 +08:00
|
|
|
|
|
|
|
|
// 消息触发器 ref
|
|
|
|
|
const refMessageBoxTrigger = ref();
|
|
|
|
|
const setMessageBoxVisible = () => {
|
|
|
|
|
triggerMouseEvent(refMessageBoxTrigger);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 个人信息触发器 ref
|
|
|
|
|
const refUserInfoTrigger = ref();
|
|
|
|
|
const setUserInfoVisible = () => {
|
|
|
|
|
triggerMouseEvent(refUserInfoTrigger);
|
2023-07-24 10:05:07 +08:00
|
|
|
};
|
2023-07-27 18:48:15 +08:00
|
|
|
|
|
|
|
|
// 退出登录
|
2023-07-24 10:05:07 +08:00
|
|
|
const handleLogout = () => {
|
|
|
|
|
logout();
|
|
|
|
|
};
|
2023-07-27 18:48:15 +08:00
|
|
|
|
|
|
|
|
// 注入收缩菜单
|
2023-07-24 10:05:07 +08:00
|
|
|
const toggleDrawerMenu = inject('toggleDrawerMenu') as () => void;
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="less">
|
|
|
|
|
.navbar {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
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;
|
|
|
|
|
list-style: none;
|
|
|
|
|
|
|
|
|
|
: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 {
|
|
|
|
|
border-color: rgb(var(--gray-2));
|
|
|
|
|
color: rgb(var(--gray-8));
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.trigger-btn,
|
|
|
|
|
.ref-btn {
|
|
|
|
|
position: absolute;
|
|
|
|
|
bottom: 14px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.trigger-btn {
|
|
|
|
|
margin-left: 14px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
<style lang="less">
|
|
|
|
|
.message-popover {
|
|
|
|
|
.arco-popover-content {
|
|
|
|
|
margin-top: 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|