From 4ff2e4b83f2169661bee7ae099da67212ecbd186 Mon Sep 17 00:00:00 2001
From: Surpriseplus <845948745@qq.com>
Date: 星期一, 04 九月 2023 15:44:11 +0800
Subject: [PATCH] 添加用户显示,退出按钮;修改顶部菜单,投影管理页面

---
 src/views/baseMapSwitching/baseMapSwitching.vue |    9 ++
 src/views/login.vue                             |    2 
 src/components/thematicMap/thematicMap.vue      |    5 -
 src/components/topBtn.vue                       |    8 +-
 src/views/plotting/plotting.vue                 |    6 +-
 src/views/menus.vue                             |   79 ++++++++++++++++++++++++--
 src/utils/auth.js                               |    7 ++
 src/App.vue                                     |    6 +
 src/views/export/exportMap.vue                  |   12 ++-
 src/assets/img/图层 18.png                        |    0 
 src/store/index.ts                              |    6 +
 11 files changed, 112 insertions(+), 28 deletions(-)

diff --git a/src/App.vue b/src/App.vue
index 88c7e4c..9226795 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -11,9 +11,13 @@
   defineEmits,
 } from "vue";
 import router from "./router";
-
+import store from "@/store";
 onMounted(() => {
   // router.push("/Login");
+  var val = window.sessionStorage.getItem("Admin-Token");
+  if (val) {
+    store.state.uname = JSON.parse(val).uname;
+  }
 });
 </script>
 
diff --git "a/src/assets/img/\345\233\276\345\261\202 18.png" "b/src/assets/img/\345\233\276\345\261\202 18.png"
new file mode 100644
index 0000000..250588b
--- /dev/null
+++ "b/src/assets/img/\345\233\276\345\261\202 18.png"
Binary files differ
diff --git a/src/components/thematicMap/thematicMap.vue b/src/components/thematicMap/thematicMap.vue
index 38cebc8..cdce51a 100644
--- a/src/components/thematicMap/thematicMap.vue
+++ b/src/components/thematicMap/thematicMap.vue
@@ -56,12 +56,9 @@
 
 <style lang="less" scoped>
 .top_btn {
-  position: absolute;
-  top: 23px;
-  right: 0px;
   display: flex;
   cursor: pointer;
-  z-index: 40;
+
   .menu_Box {
     margin-right: 104px;
     display: flex;
diff --git a/src/components/topBtn.vue b/src/components/topBtn.vue
index cd267ab..6676c4e 100644
--- a/src/components/topBtn.vue
+++ b/src/components/topBtn.vue
@@ -101,7 +101,7 @@
   } else {
     if (res.level == 1) {
       checkFlag.value = null;
-
+      // console.log(res);
       if (res.name == "娓呴櫎") {
         menuTool.clearALL(checkArr);
       }
@@ -121,9 +121,9 @@
 
 <style lang="less" scoped>
 .top_btn {
-  position: absolute;
-  top: 23px;
-  right: 0px;
+  // position: absolute;
+  // top: 23px;
+  // right: 0px;
   display: flex;
   cursor: pointer;
   z-index: 30;
diff --git a/src/store/index.ts b/src/store/index.ts
index 9dd0789..bc1b009 100644
--- a/src/store/index.ts
+++ b/src/store/index.ts
@@ -46,7 +46,11 @@
     },
     SET_TOKEN(state, token) {
       state.token = token;
-      setToken(token);
+      var obj = {
+        token: token,
+        uname: state.uname,
+      };
+      setToken(JSON.stringify(obj));
     },
     SET_CHECKLAYER(state, layers) {
       state.chekNowLayers = layers;
diff --git a/src/utils/auth.js b/src/utils/auth.js
index bff89e4..ea1ceff 100644
--- a/src/utils/auth.js
+++ b/src/utils/auth.js
@@ -2,10 +2,15 @@
 
 export function getToken() {
     // console.log(window.sessionStorage.getItem(TokenKey));
-    return window.sessionStorage.getItem(TokenKey);
+    var val = window.sessionStorage.getItem(TokenKey)
+    if (val) {
+        return JSON.parse(val).token;
+    }
+    return val;
 }
 
 export function setToken(token) {
+    debugger
     return window.sessionStorage.setItem(TokenKey, token);
 }
 
diff --git a/src/views/baseMapSwitching/baseMapSwitching.vue b/src/views/baseMapSwitching/baseMapSwitching.vue
index a101b79..6abcbf8 100644
--- a/src/views/baseMapSwitching/baseMapSwitching.vue
+++ b/src/views/baseMapSwitching/baseMapSwitching.vue
@@ -2,7 +2,10 @@
   <div class="baseMapSwitching">
     <div class="baseMapSwitchingTitle">
       <div class="tileLeft">
-        <div class="titleImg">
+        <div
+          class="titleImg"
+          @click="setCloseBaseMap"
+        >
           <ArrowLeft />
         </div>
         <div class="titleLable">鎶曞奖鍥惧眰绠$悊</div>
@@ -42,6 +45,7 @@
 import projection from "@/assets/js/Map/projectionServer";
 
 import olMap from "@/assets/js/Map/olMap";
+const emits = defineEmits(["setCloseBaseMap"]);
 let list = ref([]);
 const activceIndex = ref();
 const setProjectionLayerChange = (res) => {
@@ -85,6 +89,9 @@
   // }
 };
 getProjectionLayer();
+const setCloseBaseMap = () => {
+  emits("setCloseBaseMap", false);
+};
 </script>
 
 <style lang="less" scoped>
diff --git a/src/views/export/exportMap.vue b/src/views/export/exportMap.vue
index bafcabc..24de1f8 100644
--- a/src/views/export/exportMap.vue
+++ b/src/views/export/exportMap.vue
@@ -113,7 +113,6 @@
     </div>
   </div>
 </template>
-
 <script lang="ts" setup>
 import store from "@/store";
 import {
@@ -183,7 +182,7 @@
   overflow: auto;
 
   .contentTitle {
-    font-size: 20px;
+    font-size: 16px;
     font-family: Source Han Sans CN;
     font-weight: 300;
     color: #ffffff;
@@ -220,6 +219,8 @@
     margin-top: 9px;
     margin-left: 16px;
     margin-right: 9px;
+    font-size: 16px;
+    font-family: Source Han Sans CN;
   }
 }
 .menuButton {
@@ -227,6 +228,7 @@
   display: flex;
   justify-content: center;
   align-items: center;
+
   .el-button {
     height: 37px;
     background: rgba(104, 156, 255, 0.2);
@@ -247,13 +249,13 @@
 
 .menuTitle {
   width: calc(100% - 30px);
-  height: 42px;
-  background: #0e151f;
 
-  font-size: 24px;
+  background: #0e151f;
+  font-size: 18px;
   font-family: Source Han Sans CN;
   font-weight: 400;
   color: #ffffff;
+  padding: 10px;
   padding-left: 28px;
 }
 ::-webkit-scrollbar {
diff --git a/src/views/login.vue b/src/views/login.vue
index 6bf00ee..c0a8d36 100644
--- a/src/views/login.vue
+++ b/src/views/login.vue
@@ -156,7 +156,6 @@
       setLogin();
     } else {
       emitter.emit("handleDraw", true);
-
       return false;
     }
   });
@@ -168,6 +167,7 @@
   };
   sign_login(data).then((res) => {
     if (res.code != 200) return;
+
     store.commit("SET_UNAME", res.result.uname);
     store.commit("SET_TOKEN", res.result.token);
     router.push("/");
diff --git a/src/views/menus.vue b/src/views/menus.vue
index 0c7afb4..99684b7 100644
--- a/src/views/menus.vue
+++ b/src/views/menus.vue
@@ -64,18 +64,12 @@
       <plotting @setCloseplotting="setCloseplotting"> </plotting>
     </div>
     <div v-show="checkMenuFlag == 'l5'">
-      <baseMapSwitching> </baseMapSwitching>
+      <baseMapSwitching @setCloseBaseMap="setCloseBaseMap"> </baseMapSwitching>
     </div>
 
     <search v-if="thematicMapBtnState"> </search>
   </div>
 
-  <top-btn
-    v-show="fullScreen"
-    v-if="thematicMapBtnState"
-  ></top-btn>
-
-  <thematic-map v-show="!thematicMapBtnState"></thematic-map>
   <div
     class="fullScreen_btn"
     v-show="!fullScreen"
@@ -94,6 +88,31 @@
   >
     <double-layer></double-layer>
   </div>
+  <div style="display: flex; position: absolute; z-index: 30; top: 23px; right: 23px;">
+    <thematic-map v-show="!thematicMapBtnState"></thematic-map>
+    <top-btn
+      v-show="fullScreen"
+      v-if="thematicMapBtnState"
+    ></top-btn>
+    <div>
+      <div
+        class="setUserLogo"
+        @click="setLogMeu =!setLogMeu"
+      >
+        <div class="setUserImage"></div>
+        <div class="setUserTitle"> {{store.state.uname}} </div>
+      </div>
+      <div
+        v-show="setLogMeu"
+        class="setLogContent"
+        @click="setUserLogOut"
+      >
+        閫�鍑�
+      </div>
+    </div>
+
+  </div>
+
 </template>
 
 <script lang="ts" setup>
@@ -123,15 +142,23 @@
 import baseMapSwitching from "@/views/baseMapSwitching/baseMapSwitching.vue";
 //鍒嗗睆鑿滃崟
 import doubleLayer from "@/views/layer/doubleLayer.vue";
+import { removeToken } from "@/utils/auth";
 import store from "@/store";
+//Router
+import router from "@/router";
 const menuOptions = ref([]);
 const checkMenuFlag = ref("");
 let fullScreen = ref(true);
 let thematicMapState = ref(true);
 let thematicMapBtnState = ref(true);
+const setLogMeu = ref(false);
 const setDoubleScreenMap = () => {
   store.state.doubleMenu = false;
   store.state.doubleMap = true;
+};
+const setUserLogOut = () => {
+  removeToken();
+  router.push("/Login");
 };
 const setDobuleCloseLayer = () => {
   store.state.doubleMenu = true;
@@ -176,6 +203,11 @@
 const setCloseplotting = (res) => {
   checkMenuFlag.value = null;
 };
+
+const setCloseBaseMap = (res) => {
+  checkMenuFlag.value = null;
+};
+
 // 鍒囨崲娴忚鍣ㄥ叏灞�
 const screen = () => {
   fullScreen.value = !fullScreen.value;
@@ -314,4 +346,37 @@
   background-size: 100% 100%;
   cursor: pointer;
 }
+.setUserLogo {
+  height: 46px;
+
+  display: flex;
+  .setUserImage {
+    width: 46px;
+    height: 46px;
+    background: url("../assets/img/鍥惧眰 18.png") no-repeat center;
+    background-size: 100% 100%;
+    cursor: pointer;
+  }
+  .setUserTitle {
+    height: 100%;
+    align-items: center;
+    display: flex;
+    font-size: 15px;
+    font-family: Microsoft YaHei;
+    font-weight: 400;
+    color: #d6e4ff;
+    margin-left: 10px;
+  }
+}
+.setLogContent {
+  width: calc(100% - 10px);
+  padding: 5px;
+  background: rgba(7, 8, 14, 0.8);
+  box-shadow: inset 0px 10px 40px 10px rgba(38, 47, 71, 1);
+  margin-top: 10px;
+  font-size: 14px;
+  font-family: Microsoft YaHei;
+  font-weight: 400;
+  color: #d6e4ff;
+}
 </style>
diff --git a/src/views/plotting/plotting.vue b/src/views/plotting/plotting.vue
index 3426ac5..0833867 100644
--- a/src/views/plotting/plotting.vue
+++ b/src/views/plotting/plotting.vue
@@ -103,7 +103,7 @@
       align-items: center;
 
       .titleLable {
-        font-size: 24px;
+        font-size: 18px;
         font-family: Source Han Sans CN;
         font-weight: 400;
         color: #ffffff;
@@ -121,7 +121,7 @@
     margin-top: 3px;
 
     .plotting_content_title {
-      font-size: 20px;
+      font-size: 16px;
       font-weight: 300;
       color: #ffffff;
     }
@@ -190,7 +190,7 @@
           height: 27px;
         }
         span {
-          font-size: 16px;
+          font-size: 14px;
           font-weight: 300;
           color: #ffffff;
           margin-left: 10px;

--
Gitblit v1.9.3