|
|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<div class="TopMenu">
|
|
|
- <div class="logo"></div>
|
|
|
+ <div class="logo" @click="toIndex"></div>
|
|
|
<div class="menu">
|
|
|
<div class="menuList">
|
|
|
<div class="oneMenu finger" @click="openTab('我的文件','/myfile')">
|
|
|
@@ -26,9 +26,20 @@
|
|
|
<div class="user">
|
|
|
<img src="@/assets/images/newIndex/clock.png" @click="openTab('会话消息','/chat')" alt="" />
|
|
|
<img v-if="hasRole" src="@/assets/images/newIndex/setting.png" @click="openTab('系统管理',systemPath.path)" alt="" />
|
|
|
- <div class="userInfo">
|
|
|
+ <div class="userInfo" @click="changeShowMenu">
|
|
|
<span>admin</span>
|
|
|
- <img src="@/assets/images/newIndex/arrow.png" alt="" />
|
|
|
+ <img v-if="!showMenu" src="@/assets/images/newIndex/arrow.png" alt="" />
|
|
|
+ <img v-else class="upArrow" src="@/assets/images/newIndex/arrow.png" alt="" />
|
|
|
+ </div>
|
|
|
+ <div class="menu" v-if="showMenu">
|
|
|
+ <div class="oneBox" @click="openTab('个人中心','/user/profile')">
|
|
|
+ <img src="@/assets/images/newIndex/userInfo.png" alt="">
|
|
|
+ <span>个人中心</span>
|
|
|
+ </div>
|
|
|
+ <div class="oneBox" @click="logout">
|
|
|
+ <img src="@/assets/images/newIndex/edit.png" alt="">
|
|
|
+ <span>退出登录</span>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -47,6 +58,8 @@ import {
|
|
|
import bebumen from "@/assets/images/bebumen.png";
|
|
|
import common from "@/assets/images/becommon.png";
|
|
|
import manyBody from "@/assets/images/manyBodyFalse.png";
|
|
|
+import useUserStore from "@/store/modules/user";
|
|
|
+import { ElMessageBox } from "element-plus";
|
|
|
const menuList = ref([
|
|
|
{
|
|
|
name: "部门文件",
|
|
|
@@ -77,8 +90,10 @@ const props = defineProps({
|
|
|
default: false,
|
|
|
}
|
|
|
});
|
|
|
+const userStore = useUserStore();
|
|
|
const showMore = ref(false); // 是否显示更多菜单
|
|
|
-const emit = defineEmits(["openMaxmin"]);
|
|
|
+const showMenu = ref(false); // 是否显示用户菜单
|
|
|
+const emit = defineEmits(["openMaxmin",'goIndex']);
|
|
|
// 鼠标移入 显示更多菜单
|
|
|
const showMoreMenu = () => {
|
|
|
if (!showMore.value) {
|
|
|
@@ -94,16 +109,49 @@ const hideMoreMenu = () => {
|
|
|
}, 0);
|
|
|
}
|
|
|
};
|
|
|
+//
|
|
|
+const changeShowMenu = () => {
|
|
|
+ showMenu.value = true
|
|
|
+};
|
|
|
+const hideShowMenu= () => {
|
|
|
+ if (showMenu.value) {
|
|
|
+ setTimeout(() => {
|
|
|
+ showMenu.value = false;
|
|
|
+ }, 0);
|
|
|
+ }
|
|
|
+};
|
|
|
//打开/新建标签
|
|
|
const openTab = (title,path) => {
|
|
|
emit("openMaxmin",title,path);
|
|
|
};
|
|
|
+//logo点击事件 回到首页
|
|
|
+const toIndex = () => {
|
|
|
+ emit('goIndex')
|
|
|
+};
|
|
|
+
|
|
|
+//退出
|
|
|
+function logout() {
|
|
|
+ ElMessageBox.confirm("确定注销并退出系统吗?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ sessionStorage.clear()
|
|
|
+ localStorage.setItem('passArr','')
|
|
|
+ userStore.logOut().then(() => {
|
|
|
+ location.href = "/index";
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => { });
|
|
|
+}
|
|
|
onMounted(() => {
|
|
|
document.addEventListener("click", (e) => {
|
|
|
if (e.target.className !== "oneMenu finger") {
|
|
|
hideMoreMenu();
|
|
|
}
|
|
|
});
|
|
|
+ window.addEventListener("click", hideShowMenu, true);
|
|
|
});
|
|
|
</script>
|
|
|
|
|
|
@@ -120,6 +168,7 @@ onMounted(() => {
|
|
|
width: 168px;
|
|
|
height: 48px;
|
|
|
background-image: url("@/assets/images/newIndex/logo.png");
|
|
|
+ cursor: pointer;
|
|
|
}
|
|
|
.menu {
|
|
|
width: 350px;
|
|
|
@@ -180,12 +229,14 @@ onMounted(() => {
|
|
|
.user {
|
|
|
width: 220px;
|
|
|
height: 44px;
|
|
|
+ position: relative;
|
|
|
display: flex;
|
|
|
justify-content: space-around;
|
|
|
.userInfo {
|
|
|
width: 104px;
|
|
|
height: 44px;
|
|
|
border-radius: 51px;
|
|
|
+ cursor: pointer;
|
|
|
border: 1px solid #edf0fa;
|
|
|
color: #fff;
|
|
|
font-size: 16px;
|
|
|
@@ -193,6 +244,44 @@ onMounted(() => {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
justify-content: space-around;
|
|
|
+ .upArrow{
|
|
|
+ transform: rotate(180deg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .menu{
|
|
|
+ position: absolute;
|
|
|
+ top: 120%;
|
|
|
+ right: 0;
|
|
|
+ width: 112px;
|
|
|
+ height: 96px;
|
|
|
+ padding: 8px;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ background: #FFFFFF;
|
|
|
+ border-radius: 8px 8px 8px 8px;
|
|
|
+ box-shadow: 0px 3px 26px 1px rgba(191,191,191,0.25), 0px 2px 3px 0px rgba(210,210,210,0.25);
|
|
|
+ .oneBox{
|
|
|
+ width: 96px;
|
|
|
+ height: 36px;
|
|
|
+ display: flex;
|
|
|
+ padding: 0 8px;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ .img{
|
|
|
+ width: 20px;
|
|
|
+ height: 20px;
|
|
|
+ }
|
|
|
+ span{
|
|
|
+ font-weight: 500;
|
|
|
+ font-size: 14px;
|
|
|
+ color: #0D0F39;
|
|
|
+ }
|
|
|
+ &:hover{
|
|
|
+ background: #F5F7F9;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
.finger {
|