Baozhangchao 3 年前
父节点
当前提交
0a54c02c67
共有 4 个文件被更改,包括 316 次插入7 次删除
  1. 299
    0
      src/components/ClickDIV.vue
  2. 9
    4
      src/components/Popup.vue
  3. 2
    2
      src/pages/Honghe.vue
  4. 6
    1
      src/pages/SaveShare.vue

+ 299
- 0
src/components/ClickDIV.vue 查看文件

@@ -0,0 +1,299 @@
1
+<template>
2
+  <div v-if="showSelf" class="dialog" :style="{'z-index': zIndex}">
3
+    <div style=" height:100vh; width:100%;">
4
+      <!-- 弹窗 -->
5
+      <ShaerPopup :show="shaerShow" @closeMyself="cancelFrom" />
6
+      <!-- 弹窗 -->
7
+
8
+      <router-link :to="{path:'/'}">
9
+        <div class="backhome" :style="`background:url('${backimg}');background-size: 100% auto;`"></div>
10
+      </router-link>
11
+
12
+      <div>
13
+        <div v-if="item==0">
14
+          <!-- 领取屏保 -->
15
+          <div class="outer3 flex-col">
16
+            <div class="haibao">
17
+              <img class="haibao" src="~@/assets/saverShaerImg/haibao.jpg" alt />
18
+            </div>
19
+            <div class="mod2 flex-col">
20
+              <div class="block1 flex-col">
21
+                <div
22
+                  class="section1 flex-col"
23
+                  @click="()=>{this.shaerShow=true}"
24
+                  :style="`background-image: url(${shaerBut});`"
25
+                ></div>
26
+                <span :style="`background-image: url(${pressImage});`" class="info2"></span>
27
+              </div>
28
+            </div>
29
+          </div>
30
+        </div>
31
+        <div v-else>
32
+          <!-- 挂历 -->
33
+          <div class="page flex-col">
34
+            <div class="group1 flex-col">
35
+              <div class="wrap3 flex-col">
36
+                <img src="~@/assets/saverShaerImg/calendar.jpg" class="subhaibao" />
37
+              </div>
38
+              <div class="wrap5 flex-col">
39
+                <span class="txt1" :style="`background-image: url(${pressLucky});`"></span>
40
+                <div
41
+                  class="main5 flex-col"
42
+                  :style="`background-image: url(${shaerButRed});`"
43
+                  @click="()=>{this.shaerShow=true}"
44
+                ></div>
45
+              </div>
46
+            </div>
47
+          </div>
48
+        </div>
49
+      </div>
50
+    </div>
51
+  </div>
52
+</template>
53
+
54
+<script>
55
+import { hideLoading } from '@/utils'
56
+
57
+export default {
58
+  name: 'SaveShare',
59
+  components: {
60
+    ShaerPopup: () => import('@/components/ShaerPopup.vue')
61
+  },
62
+  props: {
63
+    show: {
64
+      type: Boolean,
65
+      default: false,
66
+      required: true
67
+    },
68
+    cancelText: {
69
+      type: String,
70
+      default: '取消',
71
+      required: false
72
+    }
73
+  },
74
+
75
+  data() {
76
+    return {
77
+      item: null,
78
+      shaerShow: false,
79
+      backimg: require('../assets/saverShaerImg/back.png'),
80
+      shaerBut: require('../assets/saverShaerImg/shaerLucky.png'),
81
+      pressImage: require('../assets/saverShaerImg/PressImage.png'),
82
+      shaerButRed: require('../assets/saverShaerImg/shaerLuckyRed.png'),
83
+      pressLucky: require('../assets/saverShaerImg/PressLucky.png')
84
+    }
85
+  },
86
+
87
+  watch: {
88
+    show(val) {
89
+      console.log('🚀 ~ file: ClickDIV.vue ~ line 89 ~ show ~ val', val)
90
+      this.showSelf = val
91
+      this.transform()
92
+    }
93
+  },
94
+  created() {
95
+    this.showSelf = this.show
96
+  },
97
+  mounted() {
98
+    hideLoading()
99
+
100
+    this.forbidScroll()
101
+    if (this.show === true) {
102
+      this.transform()
103
+    }
104
+  },
105
+  methods: {
106
+    cancelFrom() {
107
+      this.shaerShow = false
108
+    },
109
+    shareClick() {
110
+      this.$router.replace({
111
+        path: 'SaveShare',
112
+        query: { states: 0 }
113
+      })
114
+    },
115
+    saveClick() {
116
+      this.$router.replace({
117
+        path: 'SaveShare',
118
+        query: { states: 1 }
119
+      })
120
+    },
121
+    transform() {
122
+      setTimeout(() => {
123
+        this.classDivAA = this.show
124
+      }, 0)
125
+    },
126
+    /** 禁止页面滚动 */
127
+    forbidScroll() {
128
+      this.bodyOverflow = document.body.style.overflow
129
+      document.body.style.overflow = 'hidden'
130
+    },
131
+
132
+    /**  每次获取之后 zindex 自动增加 */
133
+    getZIndex() {
134
+      let zIndexInit = 2022112
135
+      return zIndexInit++
136
+    },
137
+
138
+    /** 取消按钮操作 */
139
+    cancel() {
140
+      // this.$emit('cancel', true)
141
+    },
142
+
143
+    /** 确认按钮操作 */
144
+    confirm() {
145
+      this.$emit('confirm', true)
146
+    },
147
+
148
+    /** 点击遮罩关闭弹窗 */
149
+    closeMyself(event) {
150
+      // this.sloveBodyOverflow()
151
+      this.$emit('closeMyself', true)
152
+    },
153
+
154
+    /** 恢复页面的滚动 */
155
+    sloveBodyOverflow() {
156
+      this.showSelf = false
157
+
158
+      document.body.style.overflow = this.bodyOverflow
159
+    }
160
+  }
161
+}
162
+</script>
163
+
164
+<style lang="less" scoped>
165
+// 弹窗动画
166
+
167
+// 最外层 设置position定位
168
+// 遮罩 设置背景层,z-index值要足够大确保能覆盖,高度 宽度设置满 做到全屏遮罩
169
+
170
+.flex-col {
171
+  display: flex;
172
+  flex-direction: column;
173
+}
174
+.dialog {
175
+  position: fixed;
176
+  top: 0;
177
+  right: 0;
178
+  width: 100%;
179
+  height: 100%;
180
+  transition: opacity 1s;
181
+
182
+  // 内容层 z-index要比遮罩大,否则会被遮盖
183
+  .backhome {
184
+    width: 75px;
185
+    height: 42px;
186
+    position: fixed;
187
+    left: 1rem;
188
+    top: 1rem;
189
+    z-index: 19;
190
+    background-repeat: no-repeat;
191
+  }
192
+  .outer3 {
193
+    width: 100vw;
194
+    height: 100vh;
195
+    justify-content: flex-end;
196
+    .haibao {
197
+      width: 100vw;
198
+      position: absolute;
199
+      left: 0;
200
+      top: 0;
201
+    }
202
+    .mod2 {
203
+      z-index: 35;
204
+      height: 210px;
205
+      background-image: linear-gradient(
206
+        180deg,
207
+        transparent,
208
+        rgba(0, 0, 0, 0.6)
209
+      );
210
+      width: 100vw;
211
+      justify-content: flex-end;
212
+      padding-bottom: 33px;
213
+      align-items: center;
214
+      .block1 {
215
+        width: 180px;
216
+        height: 113px;
217
+        .section1 {
218
+          height: 48px;
219
+          border-radius: 8px;
220
+          background-size: 100% auto;
221
+          background-color: #fff;
222
+          width: 180px;
223
+          justify-content: center;
224
+          align-items: center;
225
+          border: 0;
226
+        }
227
+        .info2 {
228
+          width: 152px;
229
+          height: 54px;
230
+          display: block;
231
+          color: #fff;
232
+          text-align: center;
233
+          align-self: center;
234
+          margin-top: 12px;
235
+          background-size: 100% auto;
236
+          background-repeat: no-repeat;
237
+        }
238
+      }
239
+    }
240
+  }
241
+
242
+  // 第二个页面
243
+  .page {
244
+    // z-index: 1;
245
+    // position: relative;
246
+    // overflow-y: auto;
247
+    // width: 100vw;
248
+    // height: 100vh;
249
+
250
+    .group1 {
251
+      .wrap3 {
252
+        z-index: 13;
253
+        width: 98vw;
254
+        overflow: hidden;
255
+        align-self: center;
256
+        margin-top: 1vw;
257
+        margin-left: 0;
258
+        .subhaibao {
259
+          // position: absolute;
260
+          width: 100%;
261
+          left: 0;
262
+          top: 0;
263
+        }
264
+      }
265
+      .wrap5 {
266
+        height: 137px;
267
+        background-color: #efe9e0;
268
+        margin-top: 19px;
269
+        width: 100vw;
270
+        justify-content: center;
271
+        align-items: center;
272
+        display: flex;
273
+        .txt1 {
274
+          background-size: 100% auto;
275
+          background-repeat: no-repeat;
276
+          width: 112px;
277
+          height: 18px;
278
+          margin-bottom: 80px;
279
+        }
280
+      }
281
+
282
+      .main5 {
283
+        background-size: 100% auto;
284
+        background-repeat: no-repeat;
285
+        height: 48px;
286
+        border-radius: 8px;
287
+        margin-top: 11px;
288
+        width: 343px;
289
+        background-color: #c1172d;
290
+        border: 0;
291
+        position: fixed;
292
+        z-index: 15;
293
+        bottom: 5vh;
294
+      }
295
+    }
296
+  }
297
+}
298
+</style>
299
+

+ 9
- 4
src/components/Popup.vue 查看文件

@@ -1,6 +1,8 @@
1 1
 <template>
2 2
   <div v-if="showSelf" class="dialog" :style="{'z-index': zIndex}">
3
-    <div class="dialog-mark" @click.self="closeMyself" :style="{'z-index': zIndex + 1}">
3
+    <ClickDIV :show="showPopupClickDIV" @cancel="cancelFrom" />
4
+
5
+    <div class="dialog-mark" @click.self="closeMyself">
4 6
       <div v-show="myShareShow" class="sharetiptxt" style>
5 7
         <img style="width:100%; height:100%;" src="../assets/popupImg/myShare.png" alt />
6 8
       </div>
@@ -30,7 +32,7 @@
30 32
           </div>
31 33
           <!-- 右侧 -->
32 34
           <div class="section-box">
33
-            <div class="section-box-share" @click="()=>{this.myShareShow=true}">
35
+            <div class="section-box-share" @click="()=>{this.showPopupClickDIV=true}">
34 36
               <img src="../assets/popupImg/shareImage.png" alt />
35 37
             </div>
36 38
             <div class="section-box-receive">
@@ -53,7 +55,9 @@
53 55
 <script>
54 56
 export default {
55 57
   name: 'Popup',
56
-
58
+  components: {
59
+    ClickDIV: () => import('@/components/ClickDIV.vue')
60
+  },
57 61
   props: {
58 62
     show: {
59 63
       type: Boolean,
@@ -93,7 +97,8 @@ export default {
93 97
       zIndex: this.getZIndex(),
94 98
       bodyOverflow: '',
95 99
       classDivAA: false,
96
-      myShareShow: false
100
+      myShareShow: false,
101
+      showPopupClickDIV: false
97 102
     }
98 103
   },
99 104
   watch: {

+ 2
- 2
src/pages/Honghe.vue 查看文件

@@ -1,6 +1,7 @@
1 1
 <template>
2 2
   <div class="index-box">
3 3
     <popup :show="showPopup" @cancel="cancelFrom" :current-month="currentMonth" />
4
+
4 5
     <div>
5 6
       <div>
6 7
         <img class="topImage" src="../assets/hareTop.png" alt />
@@ -131,8 +132,7 @@ const monthList = [
131 132
 export default {
132 133
   name: 'Honghe',
133 134
   components: {
134
-    Popup: () => import('@/components/Popup.vue'),
135
-    SaveShare: () => import('./SaveShare.vue')
135
+    Popup: () => import('@/components/Popup.vue')
136 136
   },
137 137
   data() {
138 138
     return {

+ 6
- 1
src/pages/SaveShare.vue 查看文件

@@ -50,6 +50,8 @@
50 50
 </template>
51 51
 
52 52
 <script>
53
+import { hideLoading } from '@/utils'
54
+
53 55
 export default {
54 56
   name: 'SaveShare',
55 57
   components: {
@@ -61,8 +63,8 @@ export default {
61 63
       default: false,
62 64
       required: true
63 65
     },
66
+    type: String,
64 67
     cancelText: {
65
-      type: String,
66 68
       default: '取消',
67 69
       required: false
68 70
     }
@@ -78,6 +80,9 @@ export default {
78 80
       pressLucky: require('../assets/saverShaerImg/PressLucky.png')
79 81
     }
80 82
   },
83
+  mounted() {
84
+    hideLoading()
85
+  },
81 86
 
82 87
   watch: {
83 88
     '$route.query.states': {