Prechádzať zdrojové kódy

修改不是谷歌的存储和判断

秦鹏 3 rokov pred
rodič
commit
59e2c8c73b
2 zmenil súbory, kde vykonal 36 pridanie a 31 odobranie
  1. 26 26
      src/App.vue
  2. 10 5
      src/components/Header.vue

+ 26 - 26
src/App.vue

@@ -44,14 +44,15 @@ export default {
   methods: {
     // 判断是否为chrome浏览器
     handleUserAgentRoot() {
-      if (navigator.userAgent.indexOf("Chrome") > -1) {
-        localStorage.setItem("useragent_root_type", true);
-      } else {
-        localStorage.setItem("useragent_root_type", false);
+      if (
+        !sessionStorage.getItem("useragent_root_close") &&
+        navigator.userAgent.indexOf("Chrome") == -1
+      ) {
+        this.userAgentTipShow = true;
       }
     },
     handleClickUserAgent() {
-      localStorage.setItem("useragent_root_close", true);
+      sessionStorage.setItem("useragent_root_close", true);
       this.userAgentTipShow = false;
     },
   },
@@ -72,28 +73,27 @@ body {
   height: 100%;
   min-width: 1200px;
 }
-
 </style>
 <style lang="scss" scoped>
-.userAgentTips{
-    position: fixed;
-    top: 62px;
-    left: 50%;
-    // width: 624px;
-    margin-left: -312px;
-    background: #FFFFFF;
-    border-radius: 8px;
-    padding: 12px 16px 12px 8px;
-    display: flex;
-    align-items: center;
-    justify-content: space-between;
-    font-size: 16px;
-    line-height: 24px;
-    :nth-child(1){
-        margin-right: 8px;
-    }
-    :nth-child(3){
-        cursor: pointer;
-    }
+.userAgentTips {
+  position: fixed;
+  top: 62px;
+  left: 50%;
+  // width: 624px;
+  margin-left: -312px;
+  background: #ffffff;
+  border-radius: 8px;
+  padding: 12px 16px 12px 8px;
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  font-size: 16px;
+  line-height: 24px;
+  :nth-child(1) {
+    margin-right: 8px;
+  }
+  :nth-child(3) {
+    cursor: pointer;
+  }
 }
 </style>

+ 10 - 5
src/components/Header.vue

@@ -57,7 +57,9 @@
           "
           alt=""
         />
-        <span @click="userShow = !userShow">{{ userMessage.user_real_name }}</span>
+        <span @click="userShow = !userShow">{{
+          userMessage.user_real_name
+        }}</span>
         <div class="userShow" v-show="userShow">
           <p @click="gotoPersonalcenter">
             <img src="../assets/login/project7.png" alt="" />
@@ -71,7 +73,11 @@
       </div>
       <!-- 消息 铃铛图片 -->
       <div class="message">
-        <img @click="gotoPersonalcenter" src="../assets/login/Vector.png" alt="" />
+        <img
+          @click="gotoPersonalcenter"
+          src="../assets/login/Vector.png"
+          alt=""
+        />
         <span class="redDot" v-if="is_exist == 'true'"></span>
       </div>
     </div>
@@ -160,7 +166,7 @@ export default {
       lang: "",
       headTimer: null,
       configInfor: null,
-      isData:false,
+      isData: false,
     };
   },
   watch: {},
@@ -210,8 +216,7 @@ export default {
       Cookies.remove("JSESSIONID");
       this.userShow = false;
       this.userMessage = null;
-      localStorage.removeItem("useragent_root_close");
-
+      sessionStorage.removeItem("useragent_root_close");
     },
     getLangList() {
       let MethodName = "language_manager-GetLanguageList";