Authored by htoooth

fix loading time

... ... @@ -37,7 +37,7 @@ let id = $product.data('id');
let user;
let shareData;
loading.init($(document.body));
loading.init($(document.body), {timeout: 20000});
new Swiper('.swiper-container', {
direction: 'vertical',
lazyLoading: true,
... ... @@ -90,13 +90,18 @@ function share() {
}
loading.showLoading();
if (store.running) {
return;
}
store.running = true;
getUser().then(() => {
yoho.invokeMethod('go.showshareaction', shareData && shareData.app);
loading.hideLoading();
store.running = false;
});
setTimeout(() => {
loading.hideLoading();
}, 4000);
} else if (yoSdk.env === 'h5') {
$('.js-clipbroad').trigger('click');
}
... ...
... ... @@ -19,7 +19,7 @@ let versionCompare = require('./yoluck/version');
require('js/plugin/modal.alert');
loading.init($(document.body));
loading.init($(document.body), {timeout: 20000});
let footerText = ['内容加载中...', '暂无更多内容'];
let store = {
... ... @@ -230,13 +230,18 @@ function share($el) {
return;
}
loading.showLoading();
if (store.running) {
return;
}
store.running = true;
getUser().then(() => {
yoho.invokeMethod('go.showshareaction', store.shareData && store.shareData.app);
loading.hideLoading();
store.running = false;
});
setTimeout(() => {
loading.hideLoading();
}, 4000);
} else if (yoSdk.env === 'h5') {
$('.js-clipbroad').trigger('click');
}
... ...
... ... @@ -16,6 +16,10 @@ function h5Name(name) {
return `【0元抽奖】${name}`;
}
function h5Desc(name) {
return `【限时抽奖】0元免费拿${name}`;
}
function shareData({name, imgUrl, price, shareUid, actPrizeId}) {
let urls = imgUrl.split('?');
let shareImg = urls[0] || imgUrl;
... ... @@ -32,14 +36,14 @@ function shareData({name, imgUrl, price, shareUid, actPrizeId}) {
miniProgramUrl: miniPath(shareUid, actPrizeId),
miniProgramQCodeUrl: miniQrcode(shareUid, actPrizeId),
link: h5Path(shareUid, actPrizeId),
desc: '限时抽奖活动',
desc: h5Desc(name),
hideType: ['7', '8', '9']
},
h5: {
title: h5Name(name),
imgUrl: imgUrl,
link: h5Path(shareUid, actPrizeId),
desc: '限时抽奖活动'
desc: h5Desc(name)
}
};
}
... ...
... ... @@ -34,6 +34,8 @@ function init($container, options) {
$loading = $container.children('.loading-mask');
timeOut = options && options.timeout || timeOut;
// 产品优化loading时可以滑动
// $('body').on('touchstart touchmove touchend', '.loading-mask', function() {
// return false;
... ...