Authored by huangyCode

修改详情页

... ... @@ -5,6 +5,7 @@ import $ from 'yoho-jquery';
import Page from 'js/yoho-page';
import lazyLoad from 'yoho-jquery-lazyload';
import tip from 'js/plugin/tip';
let yoSdk = require('yoho-activity-sdk');
let Clipboard = require('clipboard');
let makeShareData = require('./group/share');
... ... @@ -30,6 +31,7 @@ function hiddenTips($ele) {
}
}
}
function getUser(name, imgUrl, activityId, productSkn, groupNo) {
try {
if (user) {
... ... @@ -46,6 +48,7 @@ function getUser(name, imgUrl, activityId, productSkn, groupNo) {
return Promise.resolve();
}
}
function add0(m) {
return m < 10 ? '0' + m : m;
}
... ... @@ -65,6 +68,7 @@ function formatDate(shijianchuo) {
return add0(hr) + ':' + add0(min) + ':' + add0(sec);
}
let clipboardShare = new Clipboard('.js-clipbroad', {
text: function() {
return shareData && shareData.h5.copyDeac;
... ... @@ -231,37 +235,41 @@ class Detail extends Page {
actTimer() {
let date = this.selector.$date[0];
const current = Number(date.getAttribute('data-current'));
const begin = Number(date.getAttribute('data-begin'));
const end = Number(date.getAttribute('data-end'));
let label;
let diff = Math.abs(begin - current > 0 ? begin - current : end - current);
if (current && begin && end) {
label = begin - current > 0 ? '距拼团开始还剩:' : '距拼团结束还剩:';
}
console.log(this.selector.$label);
this.selector.$label[0].innerText = label;
time = setInterval(() => {
let days = Math.floor(diff / (24 * 3600));
let leave1 = diff % (24 * 3600);
let hours = Math.floor(leave1 / (3600));
let leave2 = leave1 % 3600;
let minutes = Math.floor(leave2 / 60);
let seconds = leave2 % 60;
this.selector.$days[0].innerText = days;
this.selector.$hours[0].innerText = hours;
this.selector.$minutes[0].innerText = minutes;
this.selector.$seconds[0].innerText = seconds;
--diff;
if (diff < 0) {
clearInterval(time);
window.location.reload();
if (date) {
const current = Number(date.getAttribute('data-current'));
const begin = Number(date.getAttribute('data-begin'));
const end = Number(date.getAttribute('data-end'));
let label;
let diff = Math.abs(begin - current > 0 ? begin - current : end - current);
if (current && begin && end) {
label = begin - current > 0 ? '距拼团开始还剩:' : '距拼团结束还剩:';
}
}, 1000);
console.log(this.selector.$label);
this.selector.$label[0].innerText = label;
time = setInterval(() => {
let days = Math.floor(diff / (24 * 3600));
let leave1 = diff % (24 * 3600);
let hours = Math.floor(leave1 / (3600));
let leave2 = leave1 % 3600;
let minutes = Math.floor(leave2 / 60);
let seconds = leave2 % 60;
this.selector.$days[0].innerText = days;
this.selector.$hours[0].innerText = hours;
this.selector.$minutes[0].innerText = minutes;
this.selector.$seconds[0].innerText = seconds;
--diff;
if (diff < 0) {
clearInterval(time);
window.location.reload();
}
}, 1000);
}
}
bindClick() {
let selfBuyDom = document.getElementById('selfBuy');
let groupNo = document.getElementById('groupNo').value;
... ... @@ -275,7 +283,7 @@ class Detail extends Page {
this.getProductData(productSkn);
buynow.onclick = this.joinGroup.bind(this);
getUser(goodsName, imgUrl, activityId, productSkn, groupNo).then(()=>{
getUser(goodsName, imgUrl, activityId, productSkn, groupNo).then(() => {
shareDom.onclick = function() {
if (/QQ/i.test(navigator.userAgent) || /MicroMessenger/i.test(navigator.userAgent)) {
dialog.showDialog({hasClass: 'group-guide-mask'});
... ... @@ -307,7 +315,8 @@ class Detail extends Page {
if (!this.pickData.goodsList) {
return;
}
this.pickData.activityId = document.getElementById('activityId').value;
this.pickData.groupNo = document.getElementById('groupNo').value;
chosePanel.show({
data: this.pickData
}).then(result => {
... ... @@ -324,7 +333,8 @@ class Detail extends Page {
}
}
}
}).catch(() => {});
}).catch(() => {
});
}
getProductData(productSkn) {
... ...