lanxin 9 месяцев назад
Родитель
Сommit
a2e30a406e

+ 30 - 13
webM/src/App.vue

@@ -1,26 +1,43 @@
 <template>
-    <div class="vvvv">
-        <router-view/>
-        <div class="orientation-tip" v-if="isMobile">
-        <div>
-            <img :src="require('@/assets/images/project/landtip.png')" alt="" />
-            <p>请在竖屏模式观看</p>
-        </div>
-        </div>
+  <div class="vvvv">
+    <router-view />
+    <div class="orientation-tip" v-if="isMobile">
+      <div>
+        <img :src="require('@/assets/images/project/landtip.png')" alt="" />
+        <p>请在竖屏模式观看</p>
+      </div>
     </div>
+  </div>
 </template>
 
 <script>
 import '@/assets/style/reset.less'
 import '@/assets/style/public.less'
 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
+      )
+    ) {
+      return
+    } else {
+      if (process.env.NODE_ENV !== 'development') {
+        window.location.href = window.location.href.replace("webM/index.html", "web/index.html")
+        // 记得强刷一次页面
+        // setTimeout(() => {
+        //   location.reload(true)
+        // }, 200)
+      }
+    }
+  },
 }
 </script>
 <style lang="less">
-.vvvv{
-    width: 100%;
-    height: 100vh;
+.vvvv {
+  width: 100%;
+  height: 100vh;
 }
 
 
@@ -43,7 +60,7 @@ export default {
     transform: translate(-50%, -50%);
     text-align: center;
     > img {
-        width: 20%;
+      width: 20%;
     }
     > p {
       font-size: 16px;

+ 6 - 5
webM/src/router/index.js

@@ -11,11 +11,6 @@ Vue.use(VueRouter)
 
 const routes = [
   {
-    path: '/index',
-    name: 'index',
-    component: Home
-  },
-  {
     path: '/',
     name: 'layout',
     component: () => import('../views/layout/index.vue'),
@@ -26,6 +21,12 @@ const routes = [
         name: 'home',
         component: () => import('../views/home/index.vue')
       },
+      {
+        path: 'tab1',
+        name: 'tab1',
+        meta: { myInd: 1 },
+        component: () => import('../views/tab1/index.vue')
+      },
       // {
       //   path: 'tab2',
       //   name: 'tab2',

+ 19 - 18
webM/src/views/home/index.vue

@@ -13,7 +13,7 @@ export default {
   components: {},
   data() {
     // 这里存放数据
-    return {};
+    return {}
   },
   // 监听属性 类似于data概念
   computed: {},
@@ -22,29 +22,30 @@ export default {
   // 方法集合
   methods: {
     goIndex() {
-      this.$router.replace("/index?m=TEST");
-      this.$nextTick(() => {
-        setTimeout(() => {
-          location.reload(true);
-        }, 300);
-      });
+      this.$router.replace('tab1').catch(() => { })
+      // this.$router.replace("/index?m=TEST");
+      // this.$nextTick(() => {
+      //   setTimeout(() => {
+      //     location.reload(true);
+      //   }, 300);
+      // });
     },
   },
   // 生命周期 - 创建完成(可以访问当前this实例)
-  created() {},
+  created() { },
   // 生命周期 - 挂载完成(可以访问DOM元素)
-  mounted() {},
-  beforeCreate() {}, // 生命周期 - 创建之前
-  beforeMount() {}, // 生命周期 - 挂载之前
-  beforeUpdate() {}, // 生命周期 - 更新之前
-  updated() {}, // 生命周期 - 更新之后
-  beforeDestroy() {}, // 生命周期 - 销毁之前
-  destroyed() {}, // 生命周期 - 销毁完成
-  activated() {}, // 如果页面有keep-alive缓存功能,这个函数会触发
-};
+  mounted() { },
+  beforeCreate() { }, // 生命周期 - 创建之前
+  beforeMount() { }, // 生命周期 - 挂载之前
+  beforeUpdate() { }, // 生命周期 - 更新之前
+  updated() { }, // 生命周期 - 更新之后
+  beforeDestroy() { }, // 生命周期 - 销毁之前
+  destroyed() { }, // 生命周期 - 销毁完成
+  activated() { }, // 如果页面有keep-alive缓存功能,这个函数会触发
+}
 </script>
 <style lang='less' scoped>
-/deep/.all{
+/deep/.all {
   display: none !important;
 }
 .home {

+ 9 - 9
webM/src/views/layout/index.vue

@@ -63,16 +63,16 @@ export default {
   methods: {
     // 点击tab栏
     jump(url) {
-      this.cutTab = false
-      if (url === "tab1") url = "/index?m=TEST"
       this.$router.replace(url).catch(() => { })
-      if (url === "/index?m=TEST") {
-        this.$nextTick(() => {
-          setTimeout(() => {
-            location.reload(true)
-          }, 300)
-        })
-      }
+      // if (url === "tab1") url = "/index?m=TEST";
+      // this.$router.replace(url).catch(() => {});
+      // if (url === "/index?m=TEST") {
+      //   this.$nextTick(() => {
+      //     setTimeout(() => {
+      //       location.reload(true);
+      //     }, 300);
+      //   });
+      // }
     },
   },
   //生命周期 - 创建完成(可以访问当前this实例)

+ 23 - 15
webM/src/views/tab1/index.vue

@@ -1,15 +1,15 @@
 <!--  -->
 <template>
-<div class='tab1'>
-  <iframe src="@/pages/Home.vue" frameborder="0"></iframe>
-</div>
+  <div class='tab1'>
+    <iframe :src="`/scene/index.html?m=1564`" frameborder="0"></iframe>
+  </div>
 </template>
 
 <script>
 export default {
   name: 'tab1',
   components: {},
-  data () {
+  data() {
     // 这里存放数据
     return {
 
@@ -24,27 +24,35 @@ export default {
 
   },
   // 生命周期 - 创建完成(可以访问当前this实例)
-  created () {
+  created() {
+    window.aaaaa = (flag) => {
+      // console.log(123, flag)
+      if (flag) {
+        // 隐藏顶部
+      } else {
+        // 显示顶部
+      }
 
+    }
   },
   // 生命周期 - 挂载完成(可以访问DOM元素)
-  mounted () {
+  mounted() {
 
   },
-  beforeCreate () {}, // 生命周期 - 创建之前
-  beforeMount () {}, // 生命周期 - 挂载之前
-  beforeUpdate () {}, // 生命周期 - 更新之前
-  updated () {}, // 生命周期 - 更新之后
-  beforeDestroy () {}, // 生命周期 - 销毁之前
-  destroyed () {}, // 生命周期 - 销毁完成
-  activated () {} // 如果页面有keep-alive缓存功能,这个函数会触发
+  beforeCreate() { }, // 生命周期 - 创建之前
+  beforeMount() { }, // 生命周期 - 挂载之前
+  beforeUpdate() { }, // 生命周期 - 更新之前
+  updated() { }, // 生命周期 - 更新之后
+  beforeDestroy() { }, // 生命周期 - 销毁之前
+  destroyed() { }, // 生命周期 - 销毁完成
+  activated() { } // 如果页面有keep-alive缓存功能,这个函数会触发
 }
 </script>
 <style lang='less' scoped>
-.tab1{
+.tab1 {
   width: 100%;
   height: 100%;
-  iframe{
+  iframe {
     width: 100%;
     height: 100%;
   }