Browse Source

浏览器

natasha 3 years ago
parent
commit
4d1d472a18
4 changed files with 50 additions and 0 deletions
  1. 49 0
      src/App.vue
  2. BIN
      src/assets/userAgentClose.png
  3. BIN
      src/assets/userAgentWarning.png
  4. 1 0
      src/components/Header.vue

+ 49 - 0
src/App.vue

@@ -4,6 +4,11 @@
       <router-view v-if="$route.meta.keepAlive" />
     </keep-alive>
     <router-view v-if="!$route.meta.keepAlive" />
+    <div class="userAgentTips" v-if="userAgentTipShow">
+        <img src="./assets/userAgentWarning.png" width="32px" />
+        <span>当前浏览器可能与网站不兼容!建议使用 chrome 浏览器获得最佳使用体验。 </span>
+        <img src="./assets/userAgentClose.png" width="16px" @click="handleClickUserAgent" />
+    </div>
   </div>
 </template>
 <script>
@@ -12,6 +17,7 @@ export default {
   data() {
     return {
       dir: "ltr",
+      userAgentTipShow: false,
     };
   },
   created() {
@@ -19,7 +25,27 @@ export default {
     if (lang_type == "AR") {
       this.dir = "rtl";
     }
+    if(localStorage.getItem("useragent_root_type")&&localStorage.getItem("useragent_root_type")!=='true'&&!localStorage.getItem("useragent_root_close")){
+        this.userAgentTipShow = true
+    }else{
+        this.handleUserAgentRoot()
+    }
+    debugger
   },
+    methods:{
+      // 判断是否为chrome浏览器 
+      handleUserAgentRoot(){
+          if(navigator.userAgent.indexOf('Chrome') > -1){
+              localStorage.setItem("useragent_root_type", true);
+          }else{
+              localStorage.setItem("useragent_root_type", false);
+          }
+      },
+      handleClickUserAgent(){
+          localStorage.setItem("useragent_root_close", true);
+          this.userAgentTipShow = false
+      },
+  }
 };
 </script>
 <style>
@@ -37,3 +63,26 @@ body {
   height: 100%;
 }
 </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;
+    }
+}
+</style>

BIN
src/assets/userAgentClose.png


BIN
src/assets/userAgentWarning.png


+ 1 - 0
src/components/Header.vue

@@ -207,6 +207,7 @@ export default {
       window.location.href = "/";
     },
     QuitLogin() {
+      localStorage.removeItem("useragent_root_close");
       window.location.href = "/";
       removeToken();
       removeSession("SysList");