瀏覽代碼

二维码修改和pc网址移动网址互相跳转

shaogen1995 3 年之前
父節點
當前提交
0084a1da1f

+ 20 - 0
web/src/pages/Home.vue

@@ -175,6 +175,26 @@ export default {
       });
     });
   },
+  created() {
+    // 移动端和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
+      )
+    ) {
+      // 移动端
+      if (window.location.href.includes("web")&&!(window.location.href.includes("webM"))) {
+        window.location.href = window.location.href.replace("web", "webM");
+        location.reload(true);
+      }
+    } else {
+      // PC端
+      if (window.location.href.includes("webM")) {
+        window.location.href = window.location.href.replace("webM", "web");
+        location.reload(true);
+      }
+    }
+  },
 };
 </script>
 

+ 11 - 4
web/src/views/gui/compomemt/share.vue

@@ -3,7 +3,7 @@
     <div class="main">
       <h3>分享页面</h3>
       <div class="code">
-        <img src="@/assets/img/code.png" alt="" />
+        <img :src="require(`@/assets/img/code${urlNum}.png`)" alt="" />
         <p>保存二维码,或点击复制链接</p>
       </div>
       <div class="btnn" @click="copyPcTxt">复制分享链接</div>
@@ -25,7 +25,9 @@ export default {
   components: {},
   data() {
     //这里存放数据
-    return {};
+    return {
+      urlNum: "1185",
+    };
   },
   //监听属性 类似于data概念
   computed: {},
@@ -53,11 +55,16 @@ export default {
       // 清空输入框
       newInput.remove();
       // 下面是element的弹窗 不需要的自行删除就好
-      alert("复制成功")
+      alert("复制成功");
     },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
-  created() {},
+  created() {
+    let temp = window.location.hash;
+    if (temp.includes("1186")) this.urlNum = "1186";
+    else if (temp.includes("1187")) this.urlNum = "1187";
+    else if (temp.includes("1188")) this.urlNum = "1188";
+  },
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {},
   beforeCreate() {}, //生命周期 - 创建之前

二進制
webM/src/assets/img/code.png


二進制
webM/src/assets/img/code1185.png


二進制
webM/src/assets/img/code1186.png


二進制
webM/src/assets/img/code1187.png


二進制
webM/src/assets/img/code1188.png


+ 29 - 9
webM/src/pages/Home.vue

@@ -4,17 +4,14 @@
     <!-- <hot/> -->
     <!-- 热点弹出框 -->
 
-
     <!-- 顶部固定栏目 -->
-    
-
 
     <popup />
     <!-- 加载初始页面 -->
     <div id="gui-thumb"></div>
 
     <!-- 主容器 -->
-     <!-- @touchstart="musicPlay" -->
+    <!-- @touchstart="musicPlay" -->
     <div id="player"></div>
     <div id="gui-parent">
       <!-- 进度条加载 -->
@@ -33,7 +30,7 @@
         <v-title />
 
         <!-- 底部菜单 -->
-        <v-menu @musicOne='musicOne'/>
+        <v-menu @musicOne="musicOne" />
 
         <!-- 导览 -->
         <v-guide />
@@ -125,14 +122,14 @@ export default {
   },
 
   methods: {
-    musicOne(){
+    musicOne() {
       // this.musicFlag ++;
       // this.musicPlay()
     },
     musicPlay() {
-      if(this.musicFlag>5) return
-      if (this.musicFlag<=2) window.manage.switchBgmState(true);
-      this.musicFlag ++;
+      if (this.musicFlag > 5) return;
+      if (this.musicFlag <= 2) window.manage.switchBgmState(true);
+      this.musicFlag++;
     },
     // 控制背景音乐播放👆
     hideWelcome() {
@@ -178,6 +175,29 @@ export default {
       });
     });
   },
+  created() {
+    // 移动端和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
+      )
+    ) {
+      // 移动端
+      if (
+        window.location.href.includes("web") &&
+        !window.location.href.includes("webM")
+      ) {
+        window.location.href = window.location.href.replace("web", "webM");
+        location.reload(true);
+      }
+    } else {
+      // PC端
+      if (window.location.href.includes("webM")) {
+        window.location.href = window.location.href.replace("webM", "web");
+        location.reload(true);
+      }
+    }
+  },
 };
 </script>
 

+ 10 - 3
webM/src/views/gui/component/share.vue

@@ -3,7 +3,7 @@
     <div class="main">
       <h3>分享页面</h3>
       <div class="code">
-        <img src="@/assets/img/code.png" alt="" />
+        <img :src="require(`@/assets/img/code${urlNum}.png`)" alt="" />
         <p>长按保存二维码<br />或点击 复制链接</p>
       </div>
       <div class="btnn" @click="copyPcTxt">复制分享链接</div>
@@ -19,7 +19,9 @@ export default {
   components: {},
   data() {
     //这里存放数据
-    return {};
+    return {
+       urlNum: "1185",
+    };
   },
   //监听属性 类似于data概念
   computed: {},
@@ -51,7 +53,12 @@ export default {
     },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
-  created() {},
+  created() {
+    let temp = window.location.hash;
+    if (temp.includes("1186")) this.urlNum = "1186";
+    else if (temp.includes("1187")) this.urlNum = "1187";
+    else if (temp.includes("1188")) this.urlNum = "1188";
+  },
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {},
   beforeCreate() {}, //生命周期 - 创建之前