张延森 3 years ago
parent
commit
c0489ff388
4 changed files with 94 additions and 2 deletions
  1. 1
    1
      public/index.html
  2. 88
    0
      src/components/Modal.vue
  3. 3
    1
      src/main.js
  4. 2
    0
      src/pages/Honghe.vue

+ 1
- 1
public/index.html View File

@@ -6,7 +6,7 @@
6 6
     <meta name="viewport" content="width=device-width,initial-scale=1.0">
7 7
     <link rel="icon" href="<%= BASE_URL %>favicon.ico">
8 8
     <script src="https://res2.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
9
-    <title>华侨城</title>
9
+    <title>抽取幸运签,解锁隐藏福利</title>
10 10
     <style>
11 11
       .page-loading-wrapper {
12 12
         position: absolute;

+ 88
- 0
src/components/Modal.vue View File

@@ -0,0 +1,88 @@
1
+<template>
2
+  <div class="modal-wrapper" v-show="show">
3
+    <div class="modal" :style="modalStyle" @click.stop="handleMaskClick">
4
+      <fire-flies v-if="showFireflies"></fire-flies>
5
+      <div class="back-btn" v-if="showBack" @click.stop="$emit('close')">
6
+        <img src="~@/assets/buttonImg/backImg.png" alt="">
7
+      </div>
8
+      <div class="modal-body"><slot></slot></div>
9
+      <slot name="action"></slot>
10
+    </div>
11
+
12
+  </div>
13
+</template>
14
+
15
+<script>
16
+export default {
17
+  name: 'Modal',
18
+  components: {
19
+    FireFlies: () => import('@/components/FireFlies')
20
+  },
21
+  props: {
22
+    show: Boolean,
23
+    mask: {
24
+      type: Boolean,
25
+      default: true,
26
+    },
27
+    maskClickCloseable: {
28
+      type: Boolean,
29
+      default: true,
30
+    },
31
+    showBack: Boolean,
32
+    showFireflies: {
33
+      type: Boolean,
34
+      default: true
35
+    }
36
+  },
37
+  computed: {
38
+    modalStyle() {
39
+      return {
40
+        background: 'rgba(0, 0, 0, 0.6)'
41
+      }
42
+    }
43
+  },
44
+  methods: {
45
+    handleMaskClick() {
46
+      if (this.maskClickCloseable) {
47
+        this.$emit('close')
48
+      }
49
+    }
50
+  }
51
+}
52
+</script>
53
+
54
+<style lang="less" scoped>
55
+.modal-wrapper {
56
+  position: fixed;
57
+  overflow: hidden;
58
+  top: 0;
59
+  left: 0;
60
+  z-index: 999;
61
+
62
+  .modal {
63
+    position: relative;
64
+    width: 100vw;
65
+    height: 100vh;
66
+    overflow: hidden;
67
+    display: flex;
68
+    justify-content: center;
69
+    align-items: center;
70
+
71
+    .back-btn {
72
+      position: absolute;
73
+      top: 4em;
74
+      left: 1.5em;
75
+      width: 4em;
76
+
77
+      & > img {
78
+        width: 100%;
79
+      }
80
+    }
81
+
82
+    .modal-body {
83
+      position: relative;
84
+      z-index: 100;
85
+    }
86
+  }
87
+}
88
+</style>

+ 3
- 1
src/main.js View File

@@ -1,6 +1,6 @@
1 1
 import Vue from 'vue'
2
+import Modal from '@/components/Modal.vue'
2 3
 import App from './App.vue'
3
-
4 4
 import router from './router/index'//路由
5 5
 
6 6
 import { redirect } from './utils/wx'
@@ -8,6 +8,8 @@ redirect()
8 8
 
9 9
 Vue.config.productionTip = false
10 10
 
11
+Vue.component('modal', Modal)
12
+
11 13
 const app = new Vue({
12 14
   router,
13 15
   render: h => h(App),

+ 2
- 0
src/pages/Honghe.vue View File

@@ -1,5 +1,7 @@
1 1
 <template>
2 2
   <div class="index-box">
3
+    <modal :show="true" :show-back="true" >      
4
+    </modal>
3 5
     <bg-music />
4 6
     <popup
5 7
       :show="showPopup"