张延森 3 years ago
parent
commit
ca5cb95a5c
4 changed files with 141 additions and 90 deletions
  1. 109
    67
      src/components/FireFlies/index.vue
  2. 17
    15
      src/pages/Honghe.vue
  3. 5
    0
      src/router/index.js
  4. 10
    8
      src/utils/wx.js

+ 109
- 67
src/components/FireFlies/index.vue View File

1
 <template>
1
 <template>
2
   <div class="fireflies-box">
2
   <div class="fireflies-box">
3
     <div class="fireflies">
3
     <div class="fireflies">
4
-      <div class="firefly"></div>
5
-      <div class="firefly"></div>
6
-      <div class="firefly"></div>
7
-      <div class="firefly"></div>
8
-      <div class="firefly"></div>
9
-      <div class="firefly"></div>
4
+      <div class="firefly fly1"></div>
5
+      <div class="firefly fly2"></div>
6
+      <div class="firefly fly3"></div>
7
+      <div class="firefly fly4"></div>
8
+      <div class="firefly fly5"></div>
9
+      <div class="firefly fly6"></div>
10
     </div>
10
     </div>
11
   </div>
11
   </div>
12
 </template>
12
 </template>
35
       position:absolute;
35
       position:absolute;
36
       top:50%;
36
       top:50%;
37
       left:50%;
37
       left:50%;
38
-      width:0.3em;
39
-      height:0.3em;
40
-      background-color:rgb(255, 244, 48);
38
+      width: 0.3em;
39
+      height: 0.3em;
40
+      background-color:rgb(244,219,98);
41
       border-radius:50%;
41
       border-radius:50%;
42
-      box-shadow:0 0 1.4em rgb(200, 244, 66);
42
+      box-shadow:0 0 1.4em rgb(244,219,98);
43
+      opacity: 0;
43
     }
44
     }
44
 
45
 
46
+    @tm-dur: 3s;
47
+    @tm-dly: .3s;
48
+
45
     .fly1 {
49
     .fly1 {
46
-      animation: flight1 7s ease-in-out alternate infinite;
50
+      animation-delay: @tm-dly;
51
+      animation-name: shake, flight1;
52
+      animation-duration: @tm-dur - .6;
53
+      animation-iteration-count: infinite;
54
+      animation-timing-function: linear;
47
     }
55
     }
48
     .fly2 {
56
     .fly2 {
49
-      animation: flight2 9s ease-in-out alternate infinite;
57
+      animation-delay: @tm-dly;
58
+      animation-name: shake, flight2;
59
+      animation-duration: @tm-dur + .5;
60
+      animation-iteration-count: infinite;
61
+      animation-timing-function: linear;
50
     }
62
     }
51
     .fly3 {
63
     .fly3 {
52
-      animation: flight3 8s ease-in-out alternate infinite;
64
+      animation-delay: @tm-dly;
65
+      animation-name: shake, flight3;
66
+      animation-duration: @tm-dur + .8;
67
+      animation-iteration-count: infinite;
68
+      animation-timing-function: linear;
53
     }
69
     }
54
     .fly4 {
70
     .fly4 {
55
-      animation: flight4 8s ease-in-out alternate infinite;
71
+      animation-delay: @tm-dly;
72
+      animation-name: shake, flight4;
73
+      animation-duration: @tm-dur + .5;
74
+      animation-iteration-count: infinite;
75
+      animation-timing-function: linear;
56
     }
76
     }
57
     .fly5 {
77
     .fly5 {
58
-      animation: flight5 6s ease-in-out alternate infinite;
78
+      animation-delay: @tm-dly;
79
+      animation-name: shake, flight5;
80
+      animation-duration: @tm-dur + .2;
81
+      animation-iteration-count: infinite;
82
+      animation-timing-function: linear;
59
     }
83
     }
60
     .fly6 {
84
     .fly6 {
61
-      animation:flight6 9s ease-in-out alternate infinite;
85
+      animation-delay: @tm-dly;
86
+      animation-name: shake, flight6;
87
+      animation-duration: @tm-dur - .3;
88
+      animation-iteration-count: infinite;
89
+      animation-timing-function: linear;
62
     }
90
     }
63
   }
91
   }
64
 
92
 
66
     0% { 
94
     0% { 
67
       opacity: 0.1;
95
       opacity: 0.1;
68
     }
96
     }
69
-    30% {
97
+    85% {
70
       opacity: 1;
98
       opacity: 1;
71
-      width: 0.5em;
72
-      height: 0.5em;
73
-    }
74
-    70% {
75
-      opacity: 0.7;
76
-      width: 0.4em;
77
-      height: 0.4em;
99
+      width: 0.6em;
100
+      height: 0.6em;
78
     }
101
     }
79
     100% {
102
     100% {
80
       opacity: 0;
103
       opacity: 0;
85
     0% { 
108
     0% { 
86
       top: 50%;
109
       top: 50%;
87
       left: 50%;
110
       left: 50%;
88
-      opacity: 0.1;
89
-    }
90
-    10% {
91
-      top: 40%;
92
-      left: 40%;
93
-      opacity:0.5;
94
-      width:0.4em;
95
-      height:0.4em;
96
-    }
97
-    20% {
98
-      top: 32%;
99
-      left: 35%;
100
-      opacity: 1;
101
-    }
102
-    30% {
103
-      top: 25%;
104
-      left: 25%;
105
-      opacity:1;
106
-      width:0.1em;
107
-      height:0.1em;
108
-    }
109
-    40% {
110
-      top: 20%;
111
-      left: 20%;
112
-      opacity: 1;
113
     }
111
     }
114
     60% {
112
     60% {
115
-      top: 25%;
113
+      top: 35%;
116
       left: 16%;
114
       left: 16%;
117
-      opacity: 0.5;
118
-      width:0.4em;
119
-      height:0.4em;
120
-    }
121
-    70% {
122
-      top: 10%;
123
-      left: 10%;
124
-      opacity:0.1;
125
-      width:0.3em;
126
-      height:0.3em;
127
     }
115
     }
128
     100% {
116
     100% {
129
-      top:5%;
117
+      top:15%;
130
       left:5%;
118
       left:5%;
131
-      opacity:0;
132
     }
119
     }
133
   }
120
   }
134
   @keyframes flight2 {
121
   @keyframes flight2 {
135
-    
122
+    0% { 
123
+      top: 50%;
124
+      left: 50%;
125
+    }
126
+    60% {
127
+      top: 45%;
128
+      left: 15%;
129
+    }
130
+    100% {
131
+      top: 55%;
132
+      left:3%;
133
+    }
136
   }
134
   }
137
   @keyframes flight3 {
135
   @keyframes flight3 {
138
-    
136
+    0% { 
137
+      top: 50%;
138
+      left: 50%;
139
+    }
140
+    50% {
141
+      top: 65%;
142
+      left: 25%;
143
+    }
144
+    100% {
145
+      top: 85%;
146
+      left:8%;
147
+    }
139
   }
148
   }
140
   @keyframes flight4 {
149
   @keyframes flight4 {
141
-    
150
+    0% { 
151
+      top: 50%;
152
+      left: 50%;
153
+    }
154
+    60% {
155
+      top: 35%;
156
+      left: 76%;
157
+    }
158
+    100% {
159
+      top: 15%;
160
+      left: 95%;
161
+    }
142
   }
162
   }
143
   @keyframes flight5 {
163
   @keyframes flight5 {
144
-    
164
+    0% { 
165
+      top: 50%;
166
+      left: 50%;
167
+    }
168
+    60% {
169
+      top: 52%;
170
+      left: 80%;
171
+    }
172
+    100% {
173
+      top: 55%;
174
+      left: 95%;
175
+    }
145
   }
176
   }
146
   @keyframes flight6 {
177
   @keyframes flight6 {
147
-    
178
+    0% { 
179
+      top: 50%;
180
+      left: 50%;
181
+    }
182
+    50% {
183
+      top: 65%;
184
+      left: 75%;
185
+    }
186
+    100% {
187
+      top: 85%;
188
+      left: 88%;
189
+    }
148
   }
190
   }
149
 }
191
 }
150
 </style>
192
 </style>

+ 17
- 15
src/pages/Honghe.vue View File

210
   created() {
210
   created() {
211
     this.getPrizes()
211
     this.getPrizes()
212
     this.noShowMy()
212
     this.noShowMy()
213
-    // 设置微信分享
214
-    share({ title: '抽取幸运签,解锁隐藏福利', desc: '每月都有欢乐发生' })
215
   },
213
   },
216
   watch: {
214
   watch: {
217
-    binggo(newValue, oldValue) {
218
-      // 微信分享
219
-      // 1、正常情况下, 分享主题是 抽取幸运签,解锁隐藏福利
220
-      // 2、中奖弹出情况下, 分享主题是 我中奖啦! 来试试你的运气吧
221
-      if (newValue && !oldValue) {
222
-        share({
223
-          title: '我中奖啦! 来试试你的运气吧',
224
-          desc: '抽取幸运签,解锁隐藏福利'
225
-        })
226
-      } else if (newValue !== oldValue) {
227
-        share({ title: '抽取幸运签,解锁隐藏福利', desc: '每月都有欢乐发生' })
228
-      }
229
-    }
215
+    binggo: {
216
+      handler(val) {
217
+        console.log('-------binggo---->', val)
218
+        // 微信分享
219
+        // 1、正常情况下, 分享主题是 抽取幸运签,解锁隐藏福利
220
+        // 2、中奖弹出情况下, 分享主题是 我中奖啦! 来试试你的运气吧
221
+        if (val) {
222
+          share({
223
+            title: '我中奖啦! 来试试你的运气吧',
224
+            desc: '抽取幸运签,解锁隐藏福利'
225
+          })
226
+        } else {
227
+          share({ title: '抽取幸运签,解锁隐藏福利', desc: '每月都有欢乐发生' })
228
+        }
229
+      },
230
+      immediate: true,
231
+    },
230
   },
232
   },
231
   methods: {
233
   methods: {
232
     noShowMy() {
234
     noShowMy() {

+ 5
- 0
src/router/index.js View File

37
   // 未登录
37
   // 未登录
38
   if (!person.personId) {
38
   if (!person.personId) {
39
     getUserInfo().then(userinfo => {
39
     getUserInfo().then(userinfo => {
40
+      if (!userinfo || !userinfo.openid) {
41
+        redirect(true)
42
+        return
43
+      }
44
+
40
       login(userinfo).then(res => {
45
       login(userinfo).then(res => {
41
         const { user, token } = res;
46
         const { user, token } = res;
42
         setPerson(user)
47
         setPerson(user)

+ 10
- 8
src/utils/wx.js View File

30
  */
30
  */
31
 export function share (opt) {
31
 export function share (opt) {
32
   const { origin, pathname } = window.location
32
   const { origin, pathname } = window.location
33
-  const defaultLink = origin + pathname
33
+  // const defaultLink = origin + pathname
34
   const defaultImg = `${origin}${pathname}images/share.jpg`
34
   const defaultImg = `${origin}${pathname}images/share.jpg`
35
 
35
 
36
   const link = window.location.href // opt.link || defaultLink
36
   const link = window.location.href // opt.link || defaultLink
39
   initSDK(link)
39
   initSDK(link)
40
   window.wx.ready(function () {
40
   window.wx.ready(function () {
41
     jsApiList.map((apiName) => {
41
     jsApiList.map((apiName) => {
42
-      const api = window.wx[apiName]
43
-      api({
44
-        title: opt.title || '', // 分享标题
45
-        link, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
46
-        imgUrl, // 分享图标
47
-        desc: opt.desc || ''
48
-      })
42
+      const fn = window.wx[apiName]
43
+      if (typeof fn === 'function') {
44
+        fn({
45
+          title: opt.title || '', // 分享标题
46
+          link, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
47
+          imgUrl, // 分享图标
48
+          desc: opt.desc || ''
49
+        })
50
+      }
49
     })
51
     })
50
   })
52
   })
51
 }
53
 }