Baozhangchao 3 年前
父节点
当前提交
c37e2b267f

+ 1
- 1
src/App.vue 查看文件

28
   -moz-osx-font-smoothing: grayscale;
28
   -moz-osx-font-smoothing: grayscale;
29
   text-align: center;
29
   text-align: center;
30
   color: #2c3e50;
30
   color: #2c3e50;
31
-  margin-top: 60px;
31
+  /* margin-top: 60px; */
32
 }
32
 }
33
 </style>
33
 </style>

二进制
src/assets/popupImg/backImag.jpg 查看文件


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


二进制
src/assets/popupImg/popuBody.jpg 查看文件


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


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


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


+ 78
- 11
src/components/Honghe.vue 查看文件

1
 <template>
1
 <template>
2
   <div class="index-box">
2
   <div class="index-box">
3
-    <div v-for="item in indexJPG" :key="item">
4
-      <img src="../assets/coverIndex.jpg" />
3
+    <popup :show="showPopup" @cancel="cancelFrom" />
4
+    <div>
5
+      <div>
6
+        <img class="topImage" src="../assets/hareTop.png" alt />
7
+      </div>
8
+    </div>
9
+    <div class="outer6-wrapper">
10
+      <div class="outer6 flex-col">
11
+        <div v-for="item in indexJPG" :key="item" class="section-item">
12
+          <div @click="baga">
13
+            <img class="section-item-image" src="../assets/coverIndex.jpg" />
14
+          </div>
15
+        </div>
16
+      </div>
5
     </div>
17
     </div>
6
   </div>
18
   </div>
7
 </template>
19
 </template>
11
 
23
 
12
 export default {
24
 export default {
13
   name: 'Honghe',
25
   name: 'Honghe',
26
+  components: {
27
+    Popup: () => import('@/components/Popup.vue')
28
+  },
14
   data() {
29
   data() {
15
     return {
30
     return {
16
-      indexJPG: new Array(12).fill(0)
17
-      // indexJPG: [
18
-      //   {
19
-      //     id: 1,
20
-      //     img: "background: url('../assets/coverIndex.jpg') no-repeat;"
21
-      //   }
22
-      // ]
31
+      indexJPG: new Array(12).fill(undefined),
32
+      showPopup: false
33
+    }
34
+  },
35
+  methods: {
36
+    //关闭
37
+    cancelFrom() {
38
+      this.showPopup = false
39
+    },
40
+    baga(e) {
41
+      console.log(e)
42
+      this.showPopup = true
23
     }
43
     }
24
   }
44
   }
25
 }
45
 }
26
 </script>
46
 </script>
27
 
47
 
28
 <style lang="less" scoped>
48
 <style lang="less" scoped>
49
+.flex-col {
50
+  display: flex;
51
+  flex-direction: column;
52
+}
29
 .index-box {
53
 .index-box {
30
-  background: url('../assets/backgroung.jpg') no-repeat;
54
+  // background: url('../assets/backgroung.jpg') no-repeat;
55
+  background-color: #c1172d;
31
   background-size: 100% 100%;
56
   background-size: 100% 100%;
32
   width: 100%;
57
   width: 100%;
33
   height: 100%;
58
   height: 100%;
34
-  position: fixed;
59
+  position: relative;
35
   top: 0;
60
   top: 0;
36
   left: 0;
61
   left: 0;
37
   right: 0;
62
   right: 0;
38
   bottom: 0;
63
   bottom: 0;
64
+
65
+  .topImage {
66
+    width: 90%;
67
+    z-index: 8;
68
+    overflow-wrap: break-word;
69
+    text-align: center;
70
+    white-space: nowrap;
71
+    align-self: center;
72
+    margin-top: 20px;
73
+    background-size: 100% auto;
74
+    background-repeat: no-repeat;
75
+  }
76
+  .outer6-wrapper {
77
+    width: 92vw;
78
+    border: 1px solid #d0b69a;
79
+    margin: 16px auto 0;
80
+
81
+    .outer6 {
82
+      flex-flow: row wrap;
83
+      align-content: flex-start;
84
+      z-index: 2;
85
+      background-color: #9c0014;
86
+      align-self: center;
87
+      width: 90vw;
88
+      margin: 3px auto;
89
+      border-right: 1px solid #d0b69a;
90
+      border-bottom: 1px solid #d0b69a;
91
+      overflow: hidden;
92
+      .section-item {
93
+        width: 22vw;
94
+
95
+        border-left: 1px solid #d0b69a;
96
+        border-top: 1px solid #d0b69a;
97
+        display: inline-flex;
98
+        &-image {
99
+          width: 22vw;
100
+
101
+          background-size: 100% 100%;
102
+        }
103
+      }
104
+    }
105
+  }
39
 }
106
 }
40
 </style>
107
 </style>

+ 243
- 0
src/components/Popup.vue 查看文件

1
+<template>
2
+  <div v-if="showSelf" class="dialog" :style="{'z-index': zIndex}">
3
+    <div class="dialog-mark" @click.self="closeMyself" :style="{'z-index': zIndex + 1}">
4
+      <transition name="dialog">
5
+        <div class="dialog-sprite" :style="{'z-index': zIndex + 2}">
6
+          <div class="dialog-body">
7
+            <div class="dialog-popuImag">
8
+              <img src="../assets/popupImg/popuBody.jpg" alt />
9
+            </div>
10
+            <div class="dialog-footer">
11
+              <img @click="cancel" class="btn" src="../assets/popupImg/cancelmage.png" alt />
12
+            </div>
13
+          </div>
14
+          <!-- 右侧 -->
15
+          <div class="section-box">
16
+            <div class="section-box-share">
17
+              <img src="../assets/popupImg/shareImage.png" alt />
18
+            </div>
19
+            <div class="section-box-receive">
20
+              <img src="../assets/popupImg/receiveImage.png" alt />
21
+            </div>
22
+            <div class="section-box-save">
23
+              <img src="../assets/popupImg/saveImage.png" alt />
24
+            </div>
25
+          </div>
26
+        </div>
27
+      </transition>
28
+    </div>
29
+  </div>
30
+</template>
31
+
32
+<script>
33
+export default {
34
+  name: 'Popup',
35
+  props: {
36
+    show: {
37
+      type: Boolean,
38
+      default: false,
39
+      required: true
40
+    },
41
+    title: {
42
+      type: String,
43
+      required: true
44
+    },
45
+    showCancel: {
46
+      typs: Boolean,
47
+      default: false,
48
+      required: false
49
+    },
50
+    cancelText: {
51
+      type: String,
52
+      default: '取消',
53
+      required: false
54
+    },
55
+    confirmText: {
56
+      type: String,
57
+      default: '确定',
58
+      required: false
59
+    },
60
+    LoadingShow: {
61
+      type: Boolean,
62
+      default: false,
63
+      required: true
64
+    }
65
+  },
66
+
67
+  data() {
68
+    return {
69
+      name: 'dialog',
70
+      showSelf: false,
71
+      zIndex: this.getZIndex(),
72
+      bodyOverflow: ''
73
+    }
74
+  },
75
+  watch: {
76
+    show(val) {
77
+      console.log('🚀 ~ file: Popup.vue ~ line 78 ~ show ~ val', val)
78
+      this.showSelf = val
79
+
80
+      // if (!val) {
81
+      //   this.closeMyself()
82
+      // } else {
83
+      //   this.showSelf = val
84
+      // }
85
+    }
86
+  },
87
+  created() {
88
+    this.showSelf = this.show
89
+  },
90
+  mounted() {
91
+    this.forbidScroll()
92
+  },
93
+  methods: {
94
+    /** 禁止页面滚动 */
95
+    forbidScroll() {
96
+      this.bodyOverflow = document.body.style.overflow
97
+      document.body.style.overflow = 'hidden'
98
+    },
99
+
100
+    /**  每次获取之后 zindex 自动增加 */
101
+    getZIndex() {
102
+      let zIndexInit = 2022112
103
+      return zIndexInit++
104
+    },
105
+
106
+    /** 取消按钮操作 */
107
+    cancel() {
108
+      this.$emit('cancel', true)
109
+    },
110
+
111
+    /** 确认按钮操作 */
112
+    confirm() {
113
+      this.$emit('confirm', true)
114
+    },
115
+
116
+    /** 点击遮罩关闭弹窗 */
117
+    closeMyself(event) {
118
+      // this.sloveBodyOverflow()
119
+    },
120
+
121
+    /** 恢复页面的滚动 */
122
+    sloveBodyOverflow() {
123
+      document.body.style.overflow = this.bodyOverflow
124
+    }
125
+  }
126
+}
127
+</script>
128
+
129
+<style lang="less" scoped>
130
+// 弹窗动画
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
+
141
+// 最外层 设置position定位
142
+// 遮罩 设置背景层,z-index值要足够大确保能覆盖,高度 宽度设置满 做到全屏遮罩
143
+
144
+.dialog {
145
+  position: fixed;
146
+  top: 0;
147
+  right: 0;
148
+  width: 100%;
149
+  height: 100%;
150
+  transition: opacity 1s;
151
+
152
+  // 内容层 z-index要比遮罩大,否则会被遮盖
153
+  .dialog-mark {
154
+    position: absolute;
155
+    top: 0;
156
+    height: 0;
157
+    width: 100%;
158
+    height: 100%;
159
+    background: rgba(0, 0, 0, 0.6);
160
+    left: 0;
161
+    top: 0;
162
+    z-index: 99;
163
+    display: flex;
164
+    align-items: center;
165
+    justify-content: center;
166
+  }
167
+}
168
+
169
+.dialog-sprite {
170
+  width: 100vw;
171
+  display: flex;
172
+  justify-content: center;
173
+  position: relative;
174
+
175
+  .header {
176
+    padding: 15px;
177
+    text-align: center;
178
+    font-size: 18px;
179
+    font-weight: 700;
180
+    color: #333;
181
+  }
182
+  .dialog-body {
183
+    flex: 1;
184
+    overflow-x: hidden;
185
+    overflow-y: scroll;
186
+    padding: 0 15px 20px 15px;
187
+    //中间卡片
188
+    .dialog-popuImag {
189
+      position: relative;
190
+
191
+      display: flex;
192
+      justify-content: center;
193
+      img {
194
+        width: 48vw;
195
+      }
196
+    }
197
+    //底部按钮
198
+    .dialog-footer {
199
+      width: 100%;
200
+      background-size: 100% auto;
201
+      margin: 10px auto 0;
202
+      .btn {
203
+        padding-top: 0;
204
+        width: 32px;
205
+        height: 32px;
206
+      }
207
+    }
208
+  }
209
+  .section-box {
210
+    position: absolute;
211
+    right: 15vw;
212
+    top: 98px;
213
+    height: 394px;
214
+    display: flex;
215
+    flex-direction: column;
216
+    width: 36px;
217
+    justify-content: space-between;
218
+
219
+    img {
220
+      width: 36px;
221
+      background-size: 100% auto;
222
+      margin-top: 0;
223
+      border-radius: 18px;
224
+    }
225
+
226
+    &-receive {
227
+      width: 36px;
228
+      background-size: 100% auto;
229
+      margin-top: 0;
230
+    }
231
+    &-save {
232
+      width: 36px;
233
+      border-radius: 18px;
234
+      background-size: 100% auto;
235
+      width: 36px;
236
+      margin-top: 0;
237
+
238
+      // background: url('../assets/popupImg/receiveImage.png') no-repeat;
239
+    }
240
+  }
241
+}
242
+</style>
243
+