| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- <script setup lang="ts">
- import { useNav } from "@/layout/hooks/useNav";
- import LaySearch from "../lay-search/index.vue";
- import LayNotice from "../lay-notice/index.vue";
- import LayNavMix from "../lay-sidebar/NavMix.vue";
- import LaySwitch from "../lay-switch/index.vue";
- import LaySidebarFullScreen from "../lay-sidebar/components/SidebarFullScreen.vue";
- import LaySidebarBreadCrumb from "../lay-sidebar/components/SidebarBreadCrumb.vue";
- import LaySidebarTopCollapse from "../lay-sidebar/components/SidebarTopCollapse.vue";
- import LogoutCircleRLine from "~icons/ri/logout-circle-r-line";
- import Setting from "~icons/ri/settings-3-line";
- import { hasAuth } from "@/router/utils";
- import { useUserStoreHook } from "@/store/modules/user";
- const {
- layout,
- device,
- logout,
- onPanel,
- pureApp,
- username,
- userAvatar,
- avatarsStyle,
- toggleSideBar
- } = useNav();
- </script>
- <template>
- <div class="navbar bg-[#fff] shadow-xs shadow-[rgba(0,21,41,0.08)]">
- <LaySidebarTopCollapse
- v-if="device === 'mobile'"
- class="hamburger-container"
- :is-active="pureApp.sidebar.opened"
- @toggleClick="toggleSideBar"
- />
- <LaySidebarBreadCrumb
- v-if="layout !== 'mix' && device !== 'mobile'"
- class="breadcrumb-container"
- />
- <LayNavMix v-if="layout === 'mix'" />
- <div v-if="layout === 'vertical'" class="vertical-header-right">
- <div v-if="useUserStoreHook().isChild">
- <LaySwitch id="header-switch" />
- </div>
- <!-- 菜单搜索 -->
- <LaySearch id="header-search" />
- <!-- 全屏 -->
- <LaySidebarFullScreen id="full-screen" />
- <!-- 消息通知 -->
- <LayNotice id="header-notice" />
- <!-- 退出登录 -->
- <el-dropdown trigger="click">
- <span class="el-dropdown-link navbar-bg-hover select-none">
- <img :src="userAvatar" :style="avatarsStyle" />
- <p v-if="username" class="dark:text-white">{{ username }}</p>
- </span>
- <template #dropdown>
- <el-dropdown-menu class="logout">
- <el-dropdown-item @click="logout">
- <IconifyIconOffline
- :icon="LogoutCircleRLine"
- style="margin: 5px"
- />
- 退出系统
- </el-dropdown-item>
- </el-dropdown-menu>
- </template>
- </el-dropdown>
- <span
- class="set-icon navbar-bg-hover"
- title="打开系统配置"
- @click="onPanel"
- >
- <IconifyIconOffline :icon="Setting" />
- </span>
- </div>
- </div>
- </template>
- <style lang="scss" scoped>
- .navbar {
- width: 100%;
- height: 48px;
- overflow: hidden;
- .hamburger-container {
- float: left;
- height: 100%;
- line-height: 48px;
- cursor: pointer;
- }
- .vertical-header-right {
- display: flex;
- align-items: center;
- justify-content: flex-end;
- min-width: 280px;
- height: 48px;
- color: #000000d9;
- .el-dropdown-link {
- display: flex;
- align-items: center;
- justify-content: space-around;
- height: 48px;
- padding: 10px;
- color: #000000d9;
- cursor: pointer;
- p {
- font-size: 14px;
- }
- img {
- width: 22px;
- height: 22px;
- border-radius: 50%;
- }
- }
- }
- .breadcrumb-container {
- float: left;
- margin-left: 16px;
- }
- }
- .logout {
- width: 120px;
- ::v-deep(.el-dropdown-menu__item) {
- display: inline-flex;
- flex-wrap: wrap;
- min-width: 100%;
- }
- }
- </style>
|