lisenzhou 2 years ago
parent
commit
2da2a98e47

BIN
public/images/pg1/md1-1.jpg View File


BIN
public/images/pg1/md1-1.png View File


BIN
public/images/pg1/videocover.jpg View File


BIN
public/images/pg2-2/照片1.png View File


BIN
public/images/pg2-2/照片2.png View File


BIN
public/images/pg2-2/照片3.png View File


BIN
public/images/pg2-2/照片4.png View File


BIN
public/video/9年活动.mp4 View File


+ 1
- 1
src/pages/pg1/Md2.vue View File

@@ -12,7 +12,7 @@
12 12
           9年来,20万人加入“紫金草行动”,<br />
13 13
           把紫金草徽章佩戴在离心脏最近的地方。
14 14
         </p>
15
-        <img class="animate__animated animate__fadeInDown" style="animation-delay: 300ms;" src="/images/pg1/md1-1.jpg" alt="">
15
+        <img class="animate__animated animate__fadeInDown" style="animation-delay: 300ms;" src="/images/pg1/md1-1.png" alt="">
16 16
         <p class="txt animate__animated animate__fadeInDown" style="animation-delay: 600ms; text-align: right">
17 17
           在2亿人心中,和平的愿景被播撒。
18 18
         </p>

+ 15
- 17
src/pages/pg1/Md3.vue View File

@@ -1,7 +1,7 @@
1 1
 <template>
2 2
   <Modal>
3 3
     <div class="md3-box md-bg">
4
-      <div class="md3-header ">
4
+      <div class="md3-header">
5 5
         <Animate
6 6
           comp="img"
7 7
           name="animate__fadeInDown"
@@ -10,28 +10,26 @@
10 10
           :ready="true"
11 11
         />
12 12
       </div>
13
-      <div class="md3-context">
14
-        <video
15
-          webkit-playsinline
16
-          playsinline
17
-          preload="auto"
18
-          autoplay="autoplay"
19
-          controls="controls"
20
-          src="/video/9年活动.mp4"
21
-          @play="pause()"
22
-          @pause="play()"
23
-        ></video>
13
+      <div class="md3-context" @click="router.push('/pg1/video')">
14
+        <img
15
+          class="animate__animated animate__fadeInDown"
16
+          style="animation-delay: 300ms"
17
+          src="/images/pg1/videocover.jpg"
18
+          alt=""
19
+        />
24 20
       </div>
25 21
     </div>
26 22
   </Modal>
27 23
 </template>
28 24
 
29 25
 <script setup>
30
-  import { useModel } from '@zjxpcyc/vue-tiny-store';
31
-  import Modal from '@/components/Modal.vue';
32
-  import Animate from '@/components/Animate.vue';
26
+import { useModel } from "@zjxpcyc/vue-tiny-store";
27
+import Modal from "@/components/Modal.vue";
28
+import Animate from "@/components/Animate.vue";
29
+import { useRouter } from "vue-router";
33 30
 
34
-  const { play, pause } = useModel('audio');
31
+const router = useRouter();
32
+const { play, pause } = useModel("audio");
35 33
 </script>
36 34
 
37 35
 <style lang="less" scoped>
@@ -59,4 +57,4 @@
59 57
     }
60 58
   }
61 59
 }
62
-</style>
60
+</style>

+ 96
- 0
src/pages/pg1/video.vue View File

@@ -0,0 +1,96 @@
1
+<template>
2
+  <div class="page pg-bg video-pg">
3
+    <GoBack class="goback abs" @click.stop="router.go(-1)" />
4
+    <div class="content">
5
+      <video
6
+        webkit-playsinline
7
+        playsinline
8
+        preload="auto"
9
+        autoplay="autoplay"
10
+        controls="controls"
11
+        ref="mediaRef"
12
+        src="/video/9年活动.mp4"
13
+      ></video>
14
+    </div>
15
+  </div>
16
+</template>
17
+
18
+<script setup>
19
+import { onMounted, ref } from "vue";
20
+import { useRouter } from "vue-router";
21
+import { useModel } from "@zjxpcyc/vue-tiny-store";
22
+import GoBack from "@/components/GoBack.vue";
23
+
24
+const router = useRouter();
25
+const mediaRef = ref();
26
+const show = ref(false);
27
+const controls = ref();
28
+
29
+onMounted(() => {
30
+  // 自动播放
31
+  try {
32
+    const t = setTimeout(() => {
33
+      clearTimeout(t);
34
+
35
+      // 可能抛出异步异常
36
+      const p = mediaRef.value.play();
37
+      if (p) {
38
+        p.then(() => {
39
+          mediaRef.value.play();
40
+        }).catch((err) => {
41
+          console.log("--play-err---", err);
42
+          controls.value = "controls";
43
+        });
44
+      }
45
+    }, 300);
46
+  } catch (err) {
47
+    console.log("---err---", err);
48
+    controls.value = "controls";
49
+  }
50
+});
51
+</script>
52
+
53
+<style lang="less" scoped>
54
+.video-pg {
55
+  position: relative;
56
+  background-color: #000;
57
+  display: flex;
58
+  align-items: center;
59
+
60
+  .goback {
61
+    z-index: 100;
62
+    left: 10px;
63
+    top: 10px;
64
+  }
65
+  .content {
66
+    position: relative;
67
+    video {
68
+      // width: 100%;
69
+      width: 100vw;
70
+      z-index: 1;
71
+    }
72
+    .play-action {
73
+      position: absolute;
74
+      z-index: 2;
75
+      bottom: -80px;
76
+      width: 100%;
77
+      height: 80px;
78
+      display: flex;
79
+      align-items: center;
80
+      justify-content: center;
81
+
82
+      img {
83
+        width: 100px;
84
+        width: 30vw;
85
+        height: 10vw;
86
+      }
87
+      img:first-child {
88
+        margin-right: 20px;
89
+      }
90
+      img:last-child {
91
+        margin-left: 20px;
92
+      }
93
+    }
94
+  }
95
+}
96
+</style>

+ 13
- 9
src/pages/pg2-2/index.vue View File

@@ -1,12 +1,12 @@
1 1
 <template>
2 2
   <div class="page pg-bg pg2-2">
3 3
     <GoBack class="goback abs" style="z-index: 100" @click="router.go(-1)" />
4
-    <div class="bk-pd content">
4
+    <div class="bk-pd content" >
5 5
       <Animate
6 6
         class="txt"
7 7
         comp="p"
8 8
         name="animate__fadeIn"
9
-        delay="1000ms"
9
+
10 10
         :ready="true"
11 11
       >
12 12
         85年前,
@@ -27,7 +27,7 @@
27 27
         class="txt bottom"
28 28
         comp="p"
29 29
         name="animate__fadeIn"
30
-        delay="2000ms"
30
+        delay="1000ms"
31 31
         :ready="true"
32 32
       >
33 33
         1939年,一名日本军医带着对战争的反思和忏悔,
@@ -93,8 +93,8 @@
93 93
     <!-- <img class="photo-img" src="/images/pg2-2/照片4.png" /> -->
94 94
     <!-- </div> -->
95 95
 
96
-    <div class="bk-pd content">
97
-      <Animate name="animate__fadeIn" delay="3000ms" :ready="true">
96
+    <div class="bk-pd content" ref="pgRef1">
97
+      <Animate name="animate__fadeIn" delay="300ms" :ready="show1">
98 98
         <p class="txt bottom">
99 99
           紫金草,它耐寒、耐旱,
100 100
           <br />在贫瘠的土地上也能顽强生长, <br />蕴含着无穷的草根力量,
@@ -105,15 +105,15 @@
105 105
         </p>
106 106
       </Animate>
107 107
     </div>
108
-    <div class="bk-pd content">
108
+    <div class="bk-pd content" ref="pgRef2">
109 109
       <Ink
110 110
         class="slide-ink chart-img"
111
-        :active="true"
111
+        :active="show2"
112 112
         src="/images/pg2-2/图.png"
113 113
       />
114 114
     </div>
115
-    <div class="bk-pd content">
116
-      <Animate name="animate__fadeIn" delay="4000ms" :ready="true">
115
+    <div class="bk-pd content" ref="pgRef3">
116
+      <Animate name="animate__fadeIn" delay="300ms" :ready="show3">
117 117
         <p class="txt topbottom">
118 118
           2014年,在国家首个公祭日来临之际,
119 119
           <br />为了深切缅怀惨遭日军屠戮遇难同胞,
@@ -138,7 +138,11 @@ import Animate from "@/components/Animate.vue";
138 138
 import GoBack from "@/components/GoBack.vue";
139 139
 import { useRouter } from "vue-router";
140 140
 import Ink from "./Ink.vue";
141
+import usePageShow from '../usePageShow';
141 142
 
143
+const [pgRef1, show1] = usePageShow(0.3);
144
+const [pgRef2, show2] = usePageShow(0.3);
145
+const [pgRef3, show3] = usePageShow(0.3);
142 146
 const router = useRouter();
143 147
 const inkActive = ref(false);
144 148
 const slideIndexRef = ref(0);

+ 40
- 0
src/pages/pg2-2/useShow.js View File

@@ -0,0 +1,40 @@
1
+import { onBeforeUnmount, onMounted, ref } from 'vue';
2
+
3
+export default function useIntersection(param) {
4
+  const pageRef = ref();
5
+  const showRef = ref(false);
6
+  let intersectionObserver = null;
7
+
8
+  let breakRatio = 0.5;
9
+  if (typeof param === 'number') {
10
+    breakRatio = param;
11
+  }
12
+
13
+  let callback = null;
14
+  if (typeof param === 'function') {
15
+    callback = param;
16
+  }
17
+
18
+  onMounted(() => {
19
+    intersectionObserver = new IntersectionObserver((entries) => {
20
+      const { intersectionRatio } = entries[0];
21
+      if (intersectionRatio <= 0.1) {
22
+        showRef.value = false;
23
+      } else if (intersectionRatio >= breakRatio)  {
24
+        showRef.value = true;
25
+      }
26
+
27
+      if (typeof callback === 'function') {
28
+        callback(entries[0]);
29
+      }
30
+    }, {threshold: [0.0, 0.1, 0.3, 0.5, 0.8, 0.9]});
31
+
32
+    intersectionObserver.observe(pageRef.value);
33
+  })
34
+
35
+  onBeforeUnmount(() => {
36
+    intersectionObserver.disconnect();
37
+  })
38
+
39
+  return [pageRef, showRef];
40
+}

+ 1
- 0
src/router.js View File

@@ -6,6 +6,7 @@ const routes = [
6 6
   // { path: '/', component: () => import('@/pages/FirstVideo.vue') },
7 7
   { path: '/', component: () => import('@/pages/index.vue') },
8 8
   { path: '/bk1', component: () => import('@/pages/bk1/index.vue') },
9
+  { path: '/pg1/video', component: () => import('@/pages/pg1/video.vue') },
9 10
   { path: '/pg2-2', component: () => import('@/pages/pg2-2/index.vue') },
10 11
   { path: '/pg4', component: () => import('@/pages/pg4/video.vue') },
11 12
   { path: '/pg4/next', component: () => import('@/pages/pg4/index.vue') },