Baozhangchao 3 年前
父节点
当前提交
aee14cb690
共有 6 个文件被更改,包括 252 次插入30 次删除
  1. 二进制
      src/assets/popupImg/myShare.png
  2. 23
    4
      src/components/Honghe.vue
  3. 91
    0
      src/components/ImageTrans.vue
  4. 126
    21
      src/components/Popup.vue
  5. 8
    1
      src/router/index.js
  6. 4
    4
      src/utils/wx.js

二进制
src/assets/popupImg/myShare.png 查看文件


+ 23
- 4
src/components/Honghe.vue 查看文件

@@ -10,7 +10,11 @@
10 10
       <div class="outer6 flex-col">
11 11
         <div v-for="item in indexJPG" :key="item" class="section-item">
12 12
           <div @click="baga">
13
-            <img class="section-item-image" src="../assets/coverIndex.jpg" />
13
+            <!-- <img class="section-item-image" src="../assets/coverIndex.jpg" /> -->
14
+            <img
15
+              :class="`section-item-image ${!showPopup?'backImag':''}` "
16
+              src="../assets/popupImg/backImag.jpg"
17
+            />
14 18
           </div>
15 19
         </div>
16 20
       </div>
@@ -28,7 +32,7 @@ export default {
28 32
   },
29 33
   data() {
30 34
     return {
31
-      indexJPG: new Array(12).fill(undefined),
35
+      indexJPG: new Array(12).fill(null),
32 36
       showPopup: false
33 37
     }
34 38
   },
@@ -55,12 +59,13 @@ export default {
55 59
   background-color: #c1172d;
56 60
   background-size: 100% 100%;
57 61
   width: 100%;
58
-  height: 100%;
62
+  height: 100vh;
59 63
   position: relative;
60 64
   top: 0;
61 65
   left: 0;
62 66
   right: 0;
63 67
   bottom: 0;
68
+  overflow: auto;
64 69
 
65 70
   .topImage {
66 71
     width: 90%;
@@ -77,6 +82,7 @@ export default {
77 82
     width: 92vw;
78 83
     border: 1px solid #d0b69a;
79 84
     margin: 16px auto 0;
85
+    margin-bottom: 2em;
80 86
 
81 87
     .outer6 {
82 88
       flex-flow: row wrap;
@@ -91,7 +97,6 @@ export default {
91 97
       overflow: hidden;
92 98
       .section-item {
93 99
         width: 22vw;
94
-
95 100
         border-left: 1px solid #d0b69a;
96 101
         border-top: 1px solid #d0b69a;
97 102
         display: inline-flex;
@@ -100,6 +105,20 @@ export default {
100 105
 
101 106
           background-size: 100% 100%;
102 107
         }
108
+        // .backImag {
109
+        //   position: relative;
110
+        //   animation: change 0.8s linear forwards;
111
+        // }
112
+        // @keyframes change {
113
+        //   from {
114
+        //     width: 50%;
115
+        //     z-index: 1;
116
+        //     transform: rotateY(180deg);
117
+        //   }
118
+        //   to {
119
+        //     width: 22vw;
120
+        //   }
121
+        // }
103 122
       }
104 123
     }
105 124
   }

+ 91
- 0
src/components/ImageTrans.vue 查看文件

@@ -0,0 +1,91 @@
1
+<template>
2
+  <div class="card-wrapper">
3
+    <div :class="`card ${classDivAA?'flipped':''}`" @click="transform">
4
+      <div class="back">
5
+        <img src="../assets/popupImg/popuBody.jpg" alt />
6
+      </div>
7
+      <div class="front">
8
+        <img src="../assets/popupImg/backImag.jpg" alt />
9
+      </div>
10
+    </div>
11
+  </div>
12
+</template>
13
+
14
+<script>
15
+export default {
16
+  name: 'ImageTrans',
17
+  props: {
18
+    classDiv: {
19
+      type: Boolean
20
+    }
21
+  },
22
+  data() {
23
+    return {
24
+      classDivAA: false
25
+    }
26
+  },
27
+
28
+  mounted() {
29
+    if (this.classDiv) {
30
+      this.transform()
31
+    }
32
+  },
33
+  methods: {
34
+    transform() {
35
+      // this.classDiv = true
36
+      console.log(
37
+        '🚀 ~ file: ImageTrans.vue ~ line 34 ~ transform ~  this.classDiv',
38
+        // this.classDiv
39
+        setTimeout(() => {
40
+          this.classDivAA = true
41
+        }, 0)
42
+      )
43
+    }
44
+  }
45
+}
46
+</script>
47
+
48
+<style scoped>
49
+.card-wrapper {
50
+  perspective: 600px;
51
+}
52
+
53
+img {
54
+  width: 48vw;
55
+}
56
+.card {
57
+  position: relative;
58
+  width: 320px;
59
+  height: 320px;
60
+  margin: 200px auto;
61
+  color: #fff;
62
+  font-size: 3em;
63
+  text-align: center;
64
+  line-height: 320px;
65
+  box-shadow: 0 20px 20px rgba(50, 50, 50, 0.2);
66
+  transform-style: preserve-3d;
67
+  transition: all 0.8s ease;
68
+}
69
+
70
+.card > div {
71
+  position: absolute;
72
+  top: 0;
73
+  left: 0;
74
+  width: 100%;
75
+  height: 100%;
76
+
77
+  /* 背面不显示 */
78
+  backface-visibility: hidden;
79
+}
80
+
81
+.flipped {
82
+  transform: rotateY(180deg);
83
+}
84
+
85
+.card .front {
86
+}
87
+
88
+.card .back {
89
+  transform: rotateY(180deg);
90
+}
91
+</style>

+ 126
- 21
src/components/Popup.vue 查看文件

@@ -1,26 +1,48 @@
1 1
 <template>
2 2
   <div v-if="showSelf" class="dialog" :style="{'z-index': zIndex}">
3 3
     <div class="dialog-mark" @click.self="closeMyself" :style="{'z-index': zIndex + 1}">
4
+      <div v-show="myShareShow" class="sharetiptxt" style>
5
+        <img style="width:100%; height:100%;" src="../assets/popupImg/myShare.png" alt />
6
+      </div>
4 7
       <transition name="dialog">
5 8
         <div class="dialog-sprite" :style="{'z-index': zIndex + 2}">
6 9
           <div class="dialog-body">
7
-            <div class="dialog-popuImag">
8
-              <img src="../assets/popupImg/popuBody.jpg" alt />
10
+            <div class="card-wrapper">
11
+              <div :class="`dialog-popuImag ${classDivAA?'flipped':''}`">
12
+                <!-- <img src="../assets/popupImg/popuBody.jpg" alt /> -->
13
+                <!-- <ImageTrans :classDiv="show" /> -->
14
+                <div class="back">
15
+                  <img style="width: 180px; height:492px" src="../assets/popupImg/popuBody.jpg" alt />
16
+                </div>
17
+
18
+                <div class="front">
19
+                  <img
20
+                    style="width: 180px; height:492px "
21
+                    src="../assets/popupImg/backImag.jpg"
22
+                    alt
23
+                  />
24
+                </div>
25
+              </div>
9 26
             </div>
27
+
10 28
             <div class="dialog-footer">
11 29
               <img @click="cancel" class="btn" src="../assets/popupImg/cancelmage.png" alt />
12 30
             </div>
13 31
           </div>
14 32
           <!-- 右侧 -->
15 33
           <div class="section-box">
16
-            <div class="section-box-share">
34
+            <div class="section-box-share" @click="()=>{this.myShareShow=true}">
17 35
               <img src="../assets/popupImg/shareImage.png" alt />
18 36
             </div>
19 37
             <div class="section-box-receive">
20
-              <img src="../assets/popupImg/receiveImage.png" alt />
38
+              <router-link :to="{path:'SaveShare',query: {  states: 0 }}">
39
+                <img src="../assets/popupImg/receiveImage.png" alt />
40
+              </router-link>
21 41
             </div>
22 42
             <div class="section-box-save">
23
-              <img src="../assets/popupImg/saveImage.png" alt />
43
+              <router-link :to="{path:'SaveShare',query: {  states: 1 }}">
44
+                <img src="../assets/popupImg/saveImage.png" alt />
45
+              </router-link>
24 46
             </div>
25 47
           </div>
26 48
         </div>
@@ -32,6 +54,9 @@
32 54
 <script>
33 55
 export default {
34 56
   name: 'Popup',
57
+  components: {
58
+    ImageTrans: () => import('@/components/ImageTrans.vue')
59
+  },
35 60
   props: {
36 61
     show: {
37 62
       type: Boolean,
@@ -69,13 +94,19 @@ export default {
69 94
       name: 'dialog',
70 95
       showSelf: false,
71 96
       zIndex: this.getZIndex(),
72
-      bodyOverflow: ''
97
+      bodyOverflow: '',
98
+      classDivAA: false,
99
+      myShareShow: false
73 100
     }
74 101
   },
75 102
   watch: {
76 103
     show(val) {
77 104
       console.log('🚀 ~ file: Popup.vue ~ line 78 ~ show ~ val', val)
78 105
       this.showSelf = val
106
+      if (this.show === false) {
107
+        this.myShareShow = false
108
+      }
109
+      this.transform()
79 110
 
80 111
       // if (!val) {
81 112
       //   this.closeMyself()
@@ -89,8 +120,28 @@ export default {
89 120
   },
90 121
   mounted() {
91 122
     this.forbidScroll()
123
+    if (this.show === true) {
124
+      this.transform()
125
+    }
92 126
   },
93 127
   methods: {
128
+    shareClick() {
129
+      this.$router.replace({
130
+        path: 'SaveShare',
131
+        query: { states: 0 }
132
+      })
133
+    },
134
+    saveClick() {
135
+      this.$router.replace({
136
+        path: 'SaveShare',
137
+        query: { states: 1 }
138
+      })
139
+    },
140
+    transform() {
141
+      setTimeout(() => {
142
+        this.classDivAA = this.show
143
+      }, 0)
144
+    },
94 145
     /** 禁止页面滚动 */
95 146
     forbidScroll() {
96 147
       this.bodyOverflow = document.body.style.overflow
@@ -128,15 +179,6 @@ export default {
128 179
 
129 180
 <style lang="less" scoped>
130 181
 // 弹窗动画
131
-.dialog-enter-active,
132
-.dialog-leave-active {
133
-  transition: opacity 1s;
134
-}
135
-
136
-.dialog-enter,
137
-.dialog-leave-to {
138
-  opacity: 0;
139
-}
140 182
 
141 183
 // 最外层 设置position定位
142 184
 // 遮罩 设置背景层,z-index值要足够大确保能覆盖,高度 宽度设置满 做到全屏遮罩
@@ -163,6 +205,29 @@ export default {
163 205
     display: flex;
164 206
     align-items: center;
165 207
     justify-content: center;
208
+    .sharetiptxt {
209
+      background-size: 100% auto;
210
+      background-repeat: no-repeat;
211
+      z-index: 55;
212
+      width: 20px;
213
+      height: 320px;
214
+      display: block;
215
+      position: absolute;
216
+      right: 1rem;
217
+      top: 0.5em;
218
+      animation: tipup 1s ease infinite;
219
+    }
220
+  }
221
+}
222
+@keyframes tipup {
223
+  0% {
224
+    transform: translateY(0%);
225
+  }
226
+  50% {
227
+    transform: translateY(5%);
228
+  }
229
+  100% {
230
+    transform: translateY(0%);
166 231
   }
167 232
 }
168 233
 
@@ -185,13 +250,53 @@ export default {
185 250
     overflow-y: scroll;
186 251
     padding: 0 15px 20px 15px;
187 252
     //中间卡片
188
-    .dialog-popuImag {
189
-      position: relative;
253
+    .card-wrapper {
254
+      perspective: 600px;
190 255
 
191
-      display: flex;
192
-      justify-content: center;
193
-      img {
194
-        width: 48vw;
256
+      .dialog-popuImag {
257
+        position: relative;
258
+        display: flex;
259
+        justify-content: center;
260
+        transform-style: preserve-3d;
261
+        transition: all 1.2s ease;
262
+        // div {
263
+        //   // position: relative;
264
+        //   position: absolute;
265
+        //   width: 100%;
266
+        //   height: 100%;
267
+        //   /* 背面不显示 */
268
+        //   // backface-visibility: hidden;
269
+        // }
270
+        .front {
271
+        }
272
+        .back {
273
+          position: absolute;
274
+          transform: rotateY(180deg);
275
+
276
+          // animation: change 0.8s linear forwards;
277
+        }
278
+
279
+        img {
280
+          width: 48vw;
281
+        }
282
+      }
283
+      .flipped {
284
+        animation: change 0.8s linear forwards;
285
+      }
286
+    }
287
+    @keyframes change {
288
+      from {
289
+        top: -20vh;
290
+        left: -20vw;
291
+        opacity: 0;
292
+        transform: scale(0.5);
293
+      }
294
+      to {
295
+        top: -0;
296
+        left: -0;
297
+        opacity: 2;
298
+        transform: scale(1);
299
+        transform: rotateY(180deg);
195 300
       }
196 301
     }
197 302
     //底部按钮

+ 8
- 1
src/router/index.js 查看文件

@@ -3,7 +3,7 @@
3 3
 import Vue from 'vue'
4 4
 import Router from 'vue-router'
5 5
 import Honghe from '@/components/Honghe'
6
-
6
+import SaveShare from '@/components/SaveShare'
7 7
 // import Login from '@/Login.vue'
8 8
 
9 9
 Vue.use(Router)
@@ -25,6 +25,13 @@ export default new Router({
25 25
       component: Honghe,
26 26
 
27 27
     },
28
+    {
29
+      path: '/SaveShare',
30
+      name: 'SaveShare',
31
+      component: SaveShare,
32
+
33
+    },
34
+
28 35
 
29 36
 
30 37
 

+ 4
- 4
src/utils/wx.js 查看文件

@@ -54,7 +54,7 @@ export function share (opt) {
54 54
  * 获取 code
55 55
  * @returns 
56 56
  */
57
-function getCode() {
57
+function getCode () {
58 58
   const matched = /[?&]*code=([^&]+)/.exec(location.search)
59 59
   if (matched) {
60 60
     return decodeURIComponent(matched[1])
@@ -64,14 +64,14 @@ function getCode() {
64 64
 /**
65 65
  * 跳转授权页面
66 66
  */
67
-export function redirect() {
67
+export function redirect () {
68 68
   if (process.env.NODE_ENV === 'development') return;
69 69
 
70 70
   const originCode = localStorage.getItem('wxcode');
71 71
   const queryCode = getCode();
72 72
   localStorage.setItem('wxcode', queryCode)
73 73
 
74
-  if (!queryCode || queryCode !== originCode) {
74
+  if (!queryCode || queryCode === originCode) {
75 75
     const local = encodeURIComponent(location.origin + location.pathname)
76 76
     const url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxd3bab568bc42d1de&redirect_uri=${local}&response_type=code&scope=snsapi_base&state=123#wechat_redirect`
77 77
     window.location.href = url
@@ -82,7 +82,7 @@ export function redirect() {
82 82
  * 获取 openid
83 83
  * @returns 
84 84
  */
85
-export function getOpenId() {
85
+export function getOpenId () {
86 86
   if (process.env.NODE_ENV === 'development') return Promise.resolve('123');
87 87
 
88 88
   const code = getCode()