Browse Source

个人中心 退出登录 相同文件打开提示

liuQiang 1 year ago
parent
commit
a44d495146

BIN
src/assets/images/newIndex/edit.png


BIN
src/assets/images/newIndex/userInfo.png


+ 15 - 10
src/layout/NewIndex.vue

@@ -2,6 +2,7 @@
   <div class="common-layout">
     <TopMenu
       @openMaxmin="openMaxmin"
+      @goIndex="goIndex"
       :systemPath="systemPath"
       :hasRole="hasRole"
     ></TopMenu>
@@ -57,16 +58,16 @@ const openMaxmin = (title, path) => {
   const storage = sessionStorage.getItem("tagList");
   if (storage) {
     //如果标签数量超过11个,提示超出最大限制
-    if (JSON.parse(storage).length >= 11) {
+    if (JSON.parse(storage).length >= 10) {
       ElMessage({ message: "标签数量超出最大限制", type: "error" });
       return;
     }
     const oldStorage = JSON.parse(storage);
     // 判断是否存在相同的标签
-    // if (oldStorage.find((item) => item.path === path)) {
-    //   //这里应该是打开旧的标签
-    //   return;
-    // }
+    if (oldStorage.find((item) => item.path === path)) {
+      ElMessage({ message: "该页面已经打开", type: "error" });
+      return;
+    }
     const thisId = layer.open({
       type: "iframe", //类型
       // move: true, //拖拽
@@ -133,16 +134,16 @@ const openTab = (title, path) => {
   const storage = sessionStorage.getItem("tagList");
   if (storage) {
     //如果标签数量超过11个,提示超出最大限制
-    if (JSON.parse(storage).length >= 11) {
+    if (JSON.parse(storage).length >= 10) {
       ElMessage({ message: "标签数量超出最大限制", type: "error" });
       return;
     }
     const oldStorage = JSON.parse(storage);
     // 判断是否存在相同的标签
-    // if (oldStorage.find((item) => item.path === path)) {
-    //   //这里应该是打开旧的标签
-    //   return;
-    // }
+    if (oldStorage.find((item) => item.path === path)) {
+      ElMessage({ message: "该页面已经打开", type: "error" });
+      return;
+    }
     const thisId = layer.open({
       type: "iframe", //类型
       // move: true, //拖拽
@@ -189,6 +190,10 @@ const openTab = (title, path) => {
     sessionStorage.setItem("tagList", JSON.stringify([item]));
   }
 };
+// 点击logo回到主页
+const goIndex = () => {
+  showSearch.value = false
+};
 
 // 页面刷新后清除标签
 onMounted(() => {

+ 3 - 3
src/layout/components/DefaultPage/DefaultPage.vue

@@ -48,7 +48,7 @@
       <div class="highSearch">
         <div class="title">共查询到{{ props.hightDataTotal }}个相关结果</div>
         <div class="list">
-          <div class="oneBox" v-for="item in hightData" :key="item.id">
+          <div class="oneBox" v-for="item in hightData" :key="item.id" @click="toFile(item.content.docInfo)">
             <span class="fileName">{{ item.content.docInfo.fileName }}</span>
             <div class="flieTime">
               <span>创建时间:</span>
@@ -76,8 +76,7 @@
           ref="container"
           height="584"
           scrollbar-always-on
-          @scroll="handleScroll"
-          @row-click="clickRow"
+          @row-click="toFile"
         >
           <el-table-column type="index" width="70" />
           <el-table-column label="名称" width="200">
@@ -824,6 +823,7 @@ onMounted(() => {
           color: #2e6bc8;
           text-decoration: underline;
           font-family: Inter-SemiBold;
+          cursor: pointer;
         }
 
         .flieTime {

+ 93 - 4
src/layout/components/TopMenu/TopMenu.vue

@@ -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 {

+ 2 - 1
src/views/liveChat/index.vue

@@ -457,6 +457,7 @@ const loadPreviousPage = async () => {
   await nextTick();
   const mainContainer = document.querySelector(".right-container");
   const newMessages = document.querySelectorAll(".message-container");
+  // console.log('mainContainer',mainContainer);
   const firstNewMessage = newMessages[previousPageData.length];
   // const firstNewMessageTop = mainContainer.offsetHeight + 100;
   const firstNewMessageTop = mainContainer.offsetHeight-10;
@@ -548,7 +549,7 @@ const headError=(ind,item)=>{
 };
 // 滚动翻页========
 onMounted(() => {
-  height.value = document.documentElement.clientHeight - document.getElementsByClassName("tab_box")[0].offsetHeight-8-document.getElementsByClassName("nav")[0].offsetHeight -26 + "px";
+  // height.value = document.documentElement.clientHeight - document.getElementsByClassName("tab_box")[0].offsetHeight-8-document.getElementsByClassName("nav")[0].offsetHeight -26 + "px";
   height2.value = height.value.replace('px','') - 48 + 'px';
   getMsgList();
   websoctStore.connect();

+ 1 - 1
src/views/system/user/profile/index.vue

@@ -120,7 +120,7 @@ const chengeUser = (number)=>{
 }
 getUser();
 onMounted(() => {
-   height.value = document.documentElement.clientHeight - document.getElementsByClassName("tab_box")[0].offsetHeight-8-document.getElementsByClassName("nav")[0].offsetHeight -26 + "px";
+   // height.value = document.documentElement.clientHeight - document.getElementsByClassName("tab_box")[0].offsetHeight-8-document.getElementsByClassName("nav")[0].offsetHeight -26 + "px";
 })
 </script>
 <style lang="scss" scoped>