|
@@ -0,0 +1,234 @@
|
|
|
+<template>
|
|
|
+ <div class="headerSection">
|
|
|
+ <div class="header-left">
|
|
|
+ <div class="menu">
|
|
|
+ <div
|
|
|
+ v-for="(item, index) in menuState.leftMenu"
|
|
|
+ :key="index"
|
|
|
+ :class="activeMenu === 'left' && activeMenuIndex === index ? 'menu-item active' : 'menu-item'"
|
|
|
+ :style="{ left: 400 * index + 'px' }"
|
|
|
+ @click="clickMenu(item)"
|
|
|
+ >
|
|
|
+ <div class="text">{{ item.label }}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="header-middle">
|
|
|
+ <div class="title"></div>
|
|
|
+ </div>
|
|
|
+ <div class="header-right">
|
|
|
+ <div class="menu">
|
|
|
+ <div
|
|
|
+ v-for="(item, index) in menuState.rightMenu"
|
|
|
+ :key="index"
|
|
|
+ :class="activeMenu === 'right' && activeMenuIndex === index ? 'menu-item active' : 'menu-item'"
|
|
|
+ :style="{ right: 400 * index + 'px' }"
|
|
|
+ @click="clickMenu(item)"
|
|
|
+ >
|
|
|
+ <div class="text">{{ item.label }}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div ref="userRef" class="userIcon" @click="handleShowBox">
|
|
|
+ <div v-show="showBox" class="log-out-box">
|
|
|
+ <div class="log-out" @click="handleShowTip">退出登录</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <Dialog v-model="showTip" class="tip" type="xs" title="提示" @close="showTip = false" @confirm="logout">确定注销并退出系统吗?</Dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script lang="ts" setup name="headerSection">
|
|
|
+import usePermissionStore from '@/store/modules/permission';
|
|
|
+import useUserStore from '@/store/modules/user';
|
|
|
+import { onClickOutside } from '@vueuse/core';
|
|
|
+
|
|
|
+const router = useRouter();
|
|
|
+const userStore = useUserStore();
|
|
|
+const permissionStore = usePermissionStore();
|
|
|
+const userRef = ref();
|
|
|
+// type 1 系统内地址 2 外链
|
|
|
+const menuState = computed(() => {
|
|
|
+ return permissionStore.menuState;
|
|
|
+});
|
|
|
+const activeMenu = computed(() => {
|
|
|
+ return permissionStore.activeMenu;
|
|
|
+});
|
|
|
+const activeMenuIndex = computed(() => {
|
|
|
+ return permissionStore.menuIndex;
|
|
|
+});
|
|
|
+
|
|
|
+// 点击菜单事件
|
|
|
+const clickMenu = (item) => {
|
|
|
+ if (!item.path) return;
|
|
|
+ if (item.type === '1') {
|
|
|
+ router.push({ path: item.path2 });
|
|
|
+ } else if (item.type === '2') {
|
|
|
+ window.location.href = item.path;
|
|
|
+ }
|
|
|
+};
|
|
|
+let showBox = ref(false);
|
|
|
+let showTip = ref(false);
|
|
|
+onClickOutside(userRef, (event) => {
|
|
|
+ showBox.value = false;
|
|
|
+});
|
|
|
+const handleShowBox = () => {
|
|
|
+ showBox.value = true;
|
|
|
+};
|
|
|
+const handleShowTip = () => {
|
|
|
+ showBox.value = false;
|
|
|
+ showTip.value = true;
|
|
|
+};
|
|
|
+const logout = async () => {
|
|
|
+ await userStore.logout();
|
|
|
+ location.href = import.meta.env.VITE_APP_CONTEXT_PATH + '#/';
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.headerSection {
|
|
|
+ width: 100%;
|
|
|
+ height: 228px;
|
|
|
+ padding: 0 69px;
|
|
|
+ display: flex;
|
|
|
+ //justify-content: space-between;
|
|
|
+ animation: fade 2s;
|
|
|
+ position: relative;
|
|
|
+ color: #fff;
|
|
|
+ font-family: 'YouSheBiaoTiHei';
|
|
|
+ .menu {
|
|
|
+ display: flex;
|
|
|
+ align-items: flex-start;
|
|
|
+ margin-top: 103px;
|
|
|
+ position: relative;
|
|
|
+ .menu-item {
|
|
|
+ width: 476px;
|
|
|
+ height: 120px;
|
|
|
+ position: absolute;
|
|
|
+ background-repeat: no-repeat;
|
|
|
+ background-size: 100% 100%;
|
|
|
+ cursor: pointer;
|
|
|
+ &:hover {
|
|
|
+ height: 166px;
|
|
|
+ }
|
|
|
+ .text {
|
|
|
+ width: 100%;
|
|
|
+ position: absolute;
|
|
|
+ top: 12px;
|
|
|
+ left: 0;
|
|
|
+ font-weight: 400;
|
|
|
+ font-size: 64px;
|
|
|
+ letter-spacing: 3px;
|
|
|
+ text-align: center;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .active {
|
|
|
+ height: 166px;
|
|
|
+ .text {
|
|
|
+ top: 17px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .header-left {
|
|
|
+ position: absolute;
|
|
|
+ left: 0;
|
|
|
+ z-index: 1;
|
|
|
+ .menu {
|
|
|
+ margin-left: 81px;
|
|
|
+ .menu-item {
|
|
|
+ background-image: url('@/assets/images/header/leftMenu.png');
|
|
|
+ background-repeat: no-repeat;
|
|
|
+ background-size: 100% 100%;
|
|
|
+ &:hover {
|
|
|
+ background-image: url('@/assets/images/header/leftMenuActive.png');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .active {
|
|
|
+ background-image: url('@/assets/images/header/leftMenuActive.png');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .header-middle {
|
|
|
+ position: absolute;
|
|
|
+ top: 0;
|
|
|
+ left: 50%;
|
|
|
+ transform: translateX(-50%);
|
|
|
+ background: url('@/assets/images/header/header.png') no-repeat;
|
|
|
+ background-size: 100% 100%;
|
|
|
+ width: 6814px;
|
|
|
+ height: 444px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ pointer-events: none;
|
|
|
+ .title {
|
|
|
+ margin-top: 60px;
|
|
|
+ width: 1314px;
|
|
|
+ height: 126px;
|
|
|
+ background: url('@/assets/images/header/title.png') no-repeat;
|
|
|
+ background-size: 100% 100%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .header-right {
|
|
|
+ position: absolute;
|
|
|
+ right: 58px;
|
|
|
+ z-index: 1;
|
|
|
+ display: flex;
|
|
|
+ .menu {
|
|
|
+ .menu-item {
|
|
|
+ background-image: url('@/assets/images/header/rightMenu.png');
|
|
|
+ background-repeat: no-repeat;
|
|
|
+ background-size: 100% 100%;
|
|
|
+ &:hover {
|
|
|
+ background-image: url('@/assets/images/header/rightMenuActive.png');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .active {
|
|
|
+ background-image: url('@/assets/images/header/rightMenuActive.png');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .userIcon {
|
|
|
+ width: 68px;
|
|
|
+ height: 68px;
|
|
|
+ background-image: url('@/assets/images/header/user.png');
|
|
|
+ background-repeat: no-repeat;
|
|
|
+ background-size: 100% 100%;
|
|
|
+ margin-top: 54px;
|
|
|
+ margin-left: 57px;
|
|
|
+ margin-right: 57px;
|
|
|
+ cursor: pointer;
|
|
|
+ position: relative;
|
|
|
+ .log-out-box {
|
|
|
+ position: absolute;
|
|
|
+ bottom: -100px;
|
|
|
+ left: -30px;
|
|
|
+ border: 1px solid #2db3e9;
|
|
|
+ .log-out {
|
|
|
+ width: 200px;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ padding: 20px 0;
|
|
|
+ color: #ffffff;
|
|
|
+ font-size: 38px;
|
|
|
+ background: #0d2c70;
|
|
|
+ cursor: pointer;
|
|
|
+ &:hover {
|
|
|
+ background: #1b4ea5;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+@keyframes fade {
|
|
|
+ from {
|
|
|
+ opacity: 0;
|
|
|
+ }
|
|
|
+ to {
|
|
|
+ opacity: 1;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|