...
|
...
|
@@ -9,11 +9,13 @@ let formatCountDown = require('./yoluck/formatCountDown'); |
|
|
let YolukcApi = require('./yoluck/api');
|
|
|
let api = new YolukcApi();
|
|
|
let tip = require('js/plugin/tip');
|
|
|
let dialog = require('js/plugin/dialog');
|
|
|
let yoSdk = require('yoho-activity-sdk');
|
|
|
let yoho = require('js/yoho-app');
|
|
|
|
|
|
let Clipboard = require('clipboard');
|
|
|
let makeShareData = require('./yoluck/share');
|
|
|
let Lottery = require('./yoluck/lottery');
|
|
|
let versionCompare = require('./yoluck/version');
|
|
|
|
|
|
function reload() {
|
...
|
...
|
@@ -21,6 +23,7 @@ function reload() { |
|
|
}
|
|
|
|
|
|
require('js/plugin/modal.alert');
|
|
|
require('js/common');
|
|
|
|
|
|
let store = {
|
|
|
running: false,
|
...
|
...
|
@@ -29,6 +32,9 @@ let store = { |
|
|
targetVersion: '6.8.3',
|
|
|
};
|
|
|
|
|
|
let hideInfo = $('#hide-info').remove().data();
|
|
|
|
|
|
let $fellowBar = $('#fellow-bar');
|
|
|
let $product = $('.product_name');
|
|
|
let name = $product.data('name');
|
|
|
let img = $product.data('img');
|
...
|
...
|
@@ -37,6 +43,9 @@ let id = $product.data('id'); |
|
|
let user;
|
|
|
let shareData;
|
|
|
|
|
|
let lottery = new Lottery('#lottery-list');
|
|
|
let sharePlugin = require('js/common/share');
|
|
|
|
|
|
loading.init($(document.body), {timeout: 20000});
|
|
|
new Swiper('.swiper-container', {
|
|
|
direction: 'vertical',
|
...
|
...
|
@@ -46,7 +55,14 @@ new Swiper('.swiper-container', { |
|
|
autoplay: 4000
|
|
|
});
|
|
|
|
|
|
function fellow() {
|
|
|
function fellow(content) {
|
|
|
if (content) {
|
|
|
$.yAlert({
|
|
|
content: `<div class="fellow-tip-content">${content}</div>` // eslint-disable-line
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
$.yAlert({
|
|
|
content: `<div>公众号
|
|
|
<span style="font-weight: bolder">“潮流有货”</span>已经复制成功,</div>
|
...
|
...
|
@@ -71,8 +87,11 @@ function getUser() { |
|
|
imgUrl: img,
|
|
|
price: price,
|
|
|
shareUid: user && user.uid,
|
|
|
userName: hideInfo && hideInfo.username,
|
|
|
actPrizeId: id
|
|
|
});
|
|
|
|
|
|
sharePlugin(shareData.h5);
|
|
|
});
|
|
|
} catch (e) {
|
|
|
return Promise.resolve();
|
...
|
...
|
@@ -81,6 +100,16 @@ function getUser() { |
|
|
|
|
|
getUser();
|
|
|
|
|
|
(function() {
|
|
|
api.getDetailMyCode({id}).then(res => {
|
|
|
if (res.code !== 200) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
lottery.print(res.data);
|
|
|
});
|
|
|
}());
|
|
|
|
|
|
function share() {
|
|
|
if (yoSdk.env === 'app') {
|
|
|
// 由于app版本兼容性问题
|
...
|
...
|
@@ -102,6 +131,9 @@ function share() { |
|
|
loading.hideLoading();
|
|
|
store.running = false;
|
|
|
});
|
|
|
} else if (/QQ/i.test(navigator.userAgent) ||
|
|
|
/MicroMessenger/i.test(navigator.userAgent)) {
|
|
|
dialog.showDialog({hasClass: 'yoluck-guide-mask'});
|
|
|
} else if (yoSdk.env === 'h5') {
|
|
|
$('.js-clipbroad').trigger('click');
|
|
|
}
|
...
|
...
|
@@ -137,20 +169,69 @@ let luckAlert = { |
|
|
}
|
|
|
};
|
|
|
|
|
|
let clipboardFellow = new Clipboard('.js-fellow', {
|
|
|
text: function() {
|
|
|
return '潮流有货';
|
|
|
let fellowInfo = $fellowBar.data() || {};
|
|
|
|
|
|
if (+fellowInfo.type === 2) {
|
|
|
$fellowBar.on('click', '.js-fellow', function() {
|
|
|
if (fellowInfo.link) {
|
|
|
window.location.href = fellowInfo.link;
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
let clipboardFellow = new Clipboard('.js-fellow', {
|
|
|
text: function() {
|
|
|
return fellowInfo.copy || '潮流有货';
|
|
|
}
|
|
|
});
|
|
|
|
|
|
clipboardFellow.on('success', function(e) {
|
|
|
fellow(fellowInfo.tip);
|
|
|
tip.show('内容已复制', 2000);
|
|
|
e.clearSelection();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
(function() {
|
|
|
let lotteryInfo = $('.js-lottery').data('lottery') || {};
|
|
|
let clipboardLottery = new Clipboard('.js-lottery', {
|
|
|
text: function() {
|
|
|
return lotteryInfo.h5Copy || '潮流有货';
|
|
|
}
|
|
|
});
|
|
|
|
|
|
clipboardLottery.on('success', function(e) {
|
|
|
fellow(lotteryInfo.h5Tip);
|
|
|
tip.show('内容已复制', 2000);
|
|
|
e.clearSelection();
|
|
|
});
|
|
|
|
|
|
let clickFn;
|
|
|
|
|
|
if (lotteryInfo) {
|
|
|
if (yoSdk.env === 'app' && lotteryInfo.app) {
|
|
|
clickFn = function() {
|
|
|
$.yAlert({
|
|
|
content: `<div>本期中奖号码: <span style="font-weight: bolder;">${lotteryInfo.app}</span></div>` // eslint-disable-line
|
|
|
});
|
|
|
};
|
|
|
} else if (yoSdk.env === 'h5' && +lotteryInfo.h5Type) {
|
|
|
if (+lotteryInfo.h5Type === 2 && lotteryInfo.h5Link) {
|
|
|
clickFn = function() {
|
|
|
window.location.href = lotteryInfo.h5Link;
|
|
|
};
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
clipboardFellow.on('success', function(e) {
|
|
|
fellow();
|
|
|
e.clearSelection();
|
|
|
});
|
|
|
if (clickFn) {
|
|
|
clipboardLottery.destroy();
|
|
|
$('.js-lottery').on('click', clickFn);
|
|
|
}
|
|
|
}());
|
|
|
|
|
|
let clipboardShare = new Clipboard('.js-clipbroad', {
|
|
|
text: function() {
|
|
|
return shareData && shareData.h5.link;
|
|
|
return shareData && shareData.h5.copyDeac;
|
|
|
}
|
|
|
});
|
|
|
|
...
|
...
|
@@ -163,6 +244,11 @@ clipboardShare.on('success', function(e) { |
|
|
e.clearSelection();
|
|
|
});
|
|
|
|
|
|
if (window.cookie('yoluck_share') && store.shareUid) {
|
|
|
window.setCookie('yoluck_share', null);
|
|
|
share();
|
|
|
}
|
|
|
|
|
|
luckAlert.init();
|
|
|
|
|
|
setInterval(() => {
|
...
|
...
|
@@ -185,6 +271,7 @@ $('.action-bar-comp').on('click', '.js-join', function() { |
|
|
store.running = true;
|
|
|
api.getCode({shareUid: store.shareUid, ...yoSdk.getQueryObj()}).then(result => {
|
|
|
if (result.code === 200) {
|
|
|
lottery.print(result.data);
|
|
|
luckAlert.show(result.data.prizeCode);
|
|
|
} else {
|
|
|
if (result.code === 400) {
|
...
|
...
|
|