瀏覽代碼

Merge branch 'master' of http://face3d.4dage.com:7005/shaogen1995/YFYC-H5

任一存 2 年之前
父節點
當前提交
ae1073f265
共有 8 個文件被更改,包括 125 次插入12 次删除
  1. 1 1
      public/index.html
  2. 9 2
      src/App.vue
  3. 二進制
      src/assets/img/home/btn.png
  4. 二進制
      src/assets/img/home/logo.png
  5. 二進制
      src/assets/media/home.mp4
  6. 9 1
      src/router/index.js
  7. 104 6
      src/views/Home/index.vue
  8. 2 2
      src/views/Layout/index.vue

+ 1 - 1
public/index.html

@@ -5,7 +5,7 @@
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta name="viewport" content="width=device-width,initial-scale=1.0">
     <link rel="icon" href="<%= BASE_URL %>favicon.ico">
-    <title><%= htmlWebpackPlugin.options.title %></title>
+    <title>一房一册</title>
   </head>
   <body>
     <noscript>

+ 9 - 2
src/App.vue

@@ -3,11 +3,18 @@
     <Router-view />
   </div>
 </template>
-
+<script>
+export default {
+  mounted() {
+    document.querySelector("#app").style.height = window.innerHeight + "px";
+  },
+};
+</script>
 <style lang="less">
 #app {
+  width: 100vw;
   max-width: 500px;
   margin: 0 auto;
-  height: 100vh;
+  overflow: hidden;
 }
 </style>

二進制
src/assets/img/home/btn.png


二進制
src/assets/img/home/logo.png


二進制
src/assets/media/home.mp4


+ 9 - 1
src/router/index.js

@@ -6,7 +6,10 @@ Vue.use(VueRouter)
 const routes = [{
     path: '/',
     name: 'home',
-    component: () => import('../views/Home/index.vue')
+    component: () => import('../views/Home/index.vue'),
+    meta: {
+      myTitle:'徽韵江城'
+    },
   },
   {
     path: '/layout',
@@ -51,5 +54,10 @@ const routes = [{
 const router = new VueRouter({
   routes
 })
+// 全局后置钩子,设置title
+router.afterEach(to => {
+  // 设置title
+  window.document.title = to.meta.myTitle;
+})
 
 export default router

+ 104 - 6
src/views/Home/index.vue

@@ -1,6 +1,16 @@
 <template>
-  <div class='Home' @click="$router.push('/layout/construct')">
-    首页,任意点击跳到Layout
+  <div class='Home'>
+    <img class="logo" src="../../assets/img/home/logo.png" alt="">
+    <img class="btn" @click="videoShow = true" src="../../assets/img/home/btn.png" alt="">
+    <div class="ifrBox">
+      <iframe src="http://zzbbh.4dage.com/SWKK/show.html?id=WK1592095910366638080" frameborder="0"></iframe>
+    </div>
+
+    <!-- 视频盒子 -->
+    <div class="videoBox" :class="{ videoAc: videoShow }">
+      <video muted src="../../assets/media/home.mp4"></video>
+      <div v-show="videoBtnShow" class="videoBtn" @click="$router.push('/layout/construct')">点击跳过视频</div>
+    </div>
   </div>
 </template>
 
@@ -11,11 +21,25 @@ export default {
   components: {},
   data() {
     return {
-
+      videoShow: false,
+      videoBtnShow: false
     };
   },
   computed: {},
-  watch: {},
+  watch: {
+    videoShow(val) {
+      if (val) {
+        let dom = document.querySelector('video')
+        dom.play()
+        dom.addEventListener('ended', () => { //结束
+          this.$router.push('/layout/construct')
+        }, false);
+        setTimeout(() => {
+          this.videoBtnShow = true
+        }, 1000);
+      }
+    }
+  },
   methods: {
 
   },
@@ -35,9 +59,83 @@ export default {
 }
 </script>
 <style lang='less' scoped>
-  .Home{
+.Home {
+  width: 100%;
+  height: 100%;
+  position: relative;
+
+  .ifrBox {
+    position: absolute;
+    top: 0;
+    left: 0;
+    width: 100%;
+    height: 100%;
+
+    iframe {
+      width: 100%;
+      height: 100%;
+    }
+  }
+
+  .logo {
+    position: absolute;
+    z-index: 2;
+    width: 300px;
+    top: 60px;
+    left: 50%;
+    transform: translateX(-50%);
+  }
+
+  .btn {
+    position: absolute;
+    bottom: 40px;
+    width: 200px;
+    z-index: 2;
+    left: 50%;
+    transform: translateX(-50%);
+  }
+
+  .videoBox {
+    opacity: 0;
+    pointer-events: none;
+    transition: opacity .3s;
+    position: absolute;
+    top: 0;
+    left: 0;
+    z-index: 3;
     width: 100%;
     height: 100%;
-    background-color: aquamarine;
+
+    video {
+      position: absolute;
+      top: 50%;
+      left: 50%;
+      transform: translate(-50%, -50%);
+      width: 100%;
+      height: 100%;
+    }
+
+    .videoBtn {
+      background-color: rgba(255, 89, 89, .6);
+      font-size: 20px;
+      color: #fff;
+      display: flex;
+      justify-content: center;
+      align-items: center;
+      position: absolute;
+      bottom: 40px;
+      width: 200px;
+      height: 48px;
+      border-radius: 24px;
+      z-index: 2;
+      left: 50%;
+      transform: translateX(-50%);
+    }
+  }
+
+  .videoAc {
+    opacity: 1;
+    pointer-events: auto;
   }
+}
 </style>

+ 2 - 2
src/views/Layout/index.vue

@@ -2,8 +2,8 @@
   <div class='Layout'>
 
     <div class="bottom">
-      <div class="row" @click="$router.push(item.path).catch(() => { })" :class="{ active: item.id === $route.meta.myInd }"
-        v-for="item in data" :key="item.id">{{ item.name }}
+      <div class="row" @click="$router.push(item.path).catch(() => { })"
+        :class="{ active: item.id === $route.meta.myInd }" v-for="item in data" :key="item.id">{{ item.name }}
       </div>
     </div>