Showing
1 changed file
with
20 additions
and
7 deletions
@@ -190,12 +190,20 @@ if (+fellowInfo.type === 2) { | @@ -190,12 +190,20 @@ if (+fellowInfo.type === 2) { | ||
190 | }); | 190 | }); |
191 | } | 191 | } |
192 | 192 | ||
193 | - | ||
194 | (function() { | 193 | (function() { |
195 | - let lotteryInfo = $('.js-lottery').data('lottery'); | ||
196 | - let clickFn = function() { | ||
197 | - $('.js-fellow').trigger('click'); | ||
198 | - }; | 194 | + let lotteryInfo = $('.js-lottery').data('lottery') || {}; |
195 | + let clipboardLottery = new Clipboard('.js-lottery', { | ||
196 | + text: function() { | ||
197 | + return lotteryInfo.h5Copy || '潮流有货'; | ||
198 | + } | ||
199 | + }); | ||
200 | + | ||
201 | + clipboardLottery.on('success', function(e) { | ||
202 | + fellow(lotteryInfo.h5Tip); | ||
203 | + e.clearSelection(); | ||
204 | + }); | ||
205 | + | ||
206 | + let clickFn; | ||
199 | 207 | ||
200 | if (lotteryInfo) { | 208 | if (lotteryInfo) { |
201 | if (yoSdk.env === 'app' && lotteryInfo.app) { | 209 | if (yoSdk.env === 'app' && lotteryInfo.app) { |
@@ -204,14 +212,19 @@ if (+fellowInfo.type === 2) { | @@ -204,14 +212,19 @@ if (+fellowInfo.type === 2) { | ||
204 | content: `<div>本期中奖号码: <span style="font-weight: bolder;">${lotteryInfo.app}</span></div>` // eslint-disable-line | 212 | content: `<div>本期中奖号码: <span style="font-weight: bolder;">${lotteryInfo.app}</span></div>` // eslint-disable-line |
205 | }); | 213 | }); |
206 | }; | 214 | }; |
207 | - } else if (yoSdk.env === 'h5' && lotteryInfo.h5) { | 215 | + } else if (yoSdk.env === 'h5' && +lotteryInfo.h5Type) { |
216 | + if (+lotteryInfo.h5Type === 2 && lotteryInfo.h5Link) { | ||
208 | clickFn = function() { | 217 | clickFn = function() { |
209 | - window.location.href = lotteryInfo.h5; | 218 | + window.location.href = lotteryInfo.h5Link; |
210 | }; | 219 | }; |
211 | } | 220 | } |
212 | } | 221 | } |
222 | + } | ||
213 | 223 | ||
224 | + if (clickFn) { | ||
225 | + clipboardLottery.destroy(); | ||
214 | $('.js-lottery').on('click', clickFn); | 226 | $('.js-lottery').on('click', clickFn); |
227 | + } | ||
215 | }()); | 228 | }()); |
216 | 229 | ||
217 | let clipboardShare = new Clipboard('.js-clipbroad', { | 230 | let clipboardShare = new Clipboard('.js-clipbroad', { |
-
Please register or login to post a comment