shaogen1995 8 months ago
parent
commit
0dc514bbc9
1 changed files with 24 additions and 7 deletions
  1. 24 7
      SWKK/src/views/Home.vue

+ 24 - 7
SWKK/src/views/Home.vue

@@ -236,7 +236,24 @@ export default {
     },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
-  created() {},
+  created() {
+    // 电脑端路径:
+    // http://yhtjyk.travel-yuhuatai.com:9888/YHT/Swkk/index.html#/hotPage/1/ZG
+
+    // 移动端路径
+    // http://yhtjyk.travel-yuhuatai.com:9888/YHTM/index.html#/hotPage/1/ZG
+
+    // 移动端和pc端的切换
+    if (
+      window.navigator.userAgent.match(
+        /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
+      )
+    ) {
+      // 移动端
+      window.location.href = window.location.href.replace("YHT/Swkk", "YHTM");
+      location.reload();
+    }
+  },
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
     let num = this.$route.params.id;
@@ -248,9 +265,9 @@ export default {
       dom: ".box",
       num,
       // 本地化加上
-      deploy:'local',
-      resource:'',
-      server:''
+      deploy: "local",
+      resource: "",
+      server: "",
     });
     kankan.use("MinMap", {
       theme: {
@@ -354,7 +371,7 @@ export default {
     // 全部热点数据
     kankan.store.on("tags", (tags) => {
       this.$refs.RbottomRef.getHotListToFather(tags.tags);
-      this.baseHotData = tags.tags.reverse();      
+      this.baseHotData = tags.tags.reverse();
     });
 
     // 热点
@@ -471,7 +488,7 @@ export default {
   activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
 };
 </script>
-<style lang='less' scoped>
+<style lang="less" scoped>
 @keyframes loading {
   100% {
     left: -900px;
@@ -640,4 +657,4 @@ export default {
     }
   }
 }
-</style>
+</style>