|
|
import 'scss/activity/yoluck/yoluck-detail.page.scss';
|
|
|
|
|
|
const cookie = require('yoho-cookie');
|
|
|
let Swiper = require('yoho-swiper');
|
|
|
const loading = require('js/plugin/loading');
|
|
|
let timeCountDownTpl = require('hbs/activity/yoluck/time-countdown.hbs');
|
|
|
let luckAlertTpl = require('hbs/activity/yoluck/luck-alert.hbs');
|
|
|
let formatCountDown = require('./yoluck/formatCountDown');
|
...
|
...
|
@@ -12,6 +14,7 @@ let yoho = require('js/yoho-app'); |
|
|
|
|
|
let Clipboard = require('clipboard');
|
|
|
let makeShareData = require('./yoluck/share');
|
|
|
let versionCompare = require('./yoluck/version');
|
|
|
|
|
|
function reload() {
|
|
|
location = location; //eslint-disable-line
|
...
|
...
|
@@ -21,7 +24,9 @@ require('js/plugin/modal.alert'); |
|
|
|
|
|
let store = {
|
|
|
running: false,
|
|
|
shareUid: window.queryString.shareUid || ''
|
|
|
shareUid: window.queryString.shareUid || '',
|
|
|
currentVersion: cookie.get('app_version'),
|
|
|
targetVersion: '6.8.3',
|
|
|
};
|
|
|
|
|
|
let $product = $('.product_name');
|
...
|
...
|
@@ -32,6 +37,7 @@ let id = $product.data('id'); |
|
|
let user;
|
|
|
let shareData;
|
|
|
|
|
|
loading.init($(document.body), {timeout: 20000});
|
|
|
new Swiper('.swiper-container', {
|
|
|
direction: 'vertical',
|
|
|
lazyLoading: true,
|
...
|
...
|
@@ -40,7 +46,6 @@ new Swiper('.swiper-container', { |
|
|
autoplay: 4000
|
|
|
});
|
|
|
|
|
|
|
|
|
function fellow() {
|
|
|
$.yAlert({
|
|
|
content: `<div>公众号
|
...
|
...
|
@@ -49,6 +54,10 @@ function fellow() { |
|
|
});
|
|
|
}
|
|
|
|
|
|
function alertVersion() {
|
|
|
$.yAlert({content: '您的版本较低,请更新最新版本体验'});
|
|
|
}
|
|
|
|
|
|
function getUser() {
|
|
|
try {
|
|
|
if (user) {
|
...
|
...
|
@@ -74,7 +83,25 @@ getUser(); |
|
|
|
|
|
function share() {
|
|
|
if (yoSdk.env === 'app') {
|
|
|
yoho.invokeMethod('go.showshareaction', shareData && shareData.app);
|
|
|
// 由于app版本兼容性问题
|
|
|
if (versionCompare(store.currentVersion, store.targetVersion) < 0) {
|
|
|
alertVersion();
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
loading.showLoading();
|
|
|
|
|
|
if (store.running) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
store.running = true;
|
|
|
|
|
|
getUser().then(() => {
|
|
|
yoho.invokeMethod('go.showshareaction', shareData && shareData.app);
|
|
|
loading.hideLoading();
|
|
|
store.running = false;
|
|
|
});
|
|
|
} else if (yoSdk.env === 'h5') {
|
|
|
$('.js-clipbroad').trigger('click');
|
|
|
}
|
...
|
...
|
|