...
|
...
|
@@ -28,16 +28,8 @@ Page({ |
|
|
TimeInterval[i].start_times = time.timestampToTime(res.data.data[i].start_time,0)
|
|
|
TimeInterval[i].end_times = time.timestampToTime(res.data.data[i].end_time,1)
|
|
|
TimeInterval[i].currentday = time.timestampToTime(res.data.data[i].start_time,2);
|
|
|
TimeInterval[i].statefag = false;
|
|
|
if (TimeInterval[i].state == 1) {
|
|
|
TimeInterval[i].statefag = true;
|
|
|
this.setData({
|
|
|
endTime: TimeInterval[i].end_times,
|
|
|
currentid: TimeInterval[i].id
|
|
|
})
|
|
|
that.countTime();
|
|
|
that.secondsKill(TimeInterval[i].currentday, TimeInterval[i].id,
|
|
|
TimeInterval[i].state);
|
|
|
}else{
|
|
|
TimeInterval[i].statefag = false;
|
|
|
}
|
...
|
...
|
@@ -49,14 +41,17 @@ Page({ |
|
|
let state;
|
|
|
for (var i = 0; i<TimeInterval.length;i++){
|
|
|
if (TimeInterval[i].state == 1) {
|
|
|
TimeInterval[i].statefag = true;
|
|
|
this.setData({
|
|
|
endTime: TimeInterval[i].end_times,
|
|
|
currentid: TimeInterval[i].id
|
|
|
})
|
|
|
currentday = TimeInterval[i].currentday;
|
|
|
id = TimeInterval[i].id;
|
|
|
state = TimeInterval[i].id;
|
|
|
state = 1;
|
|
|
if(i != 0){
|
|
|
TimeInterval[0].statefag = false;
|
|
|
}
|
|
|
break;
|
|
|
} else {
|
|
|
TimeInterval[0].statefag = true;
|
|
|
this.setData({
|
...
|
...
|
@@ -65,7 +60,7 @@ Page({ |
|
|
})
|
|
|
currentday = TimeInterval[0].currentday;
|
|
|
id = TimeInterval[0].id;
|
|
|
state = TimeInterval[0].id;
|
|
|
state = 0;
|
|
|
}
|
|
|
}
|
|
|
that.countTime();
|
...
|
...
|
@@ -103,14 +98,15 @@ Page({ |
|
|
})
|
|
|
//递归每秒调用countTime方法,显示动态时间效果
|
|
|
setTimeout(that.countTime, 100);
|
|
|
} else {
|
|
|
} else {//容易出现死循环
|
|
|
console.log('999999999999999')
|
|
|
that.setData({
|
|
|
countdown: '00:00:00',
|
|
|
hour: '00',
|
|
|
minute: '00',
|
|
|
second: '00',
|
|
|
})
|
|
|
// that.getTimeInterval();
|
|
|
// that.getTimeInterval();
|
|
|
}
|
|
|
},
|
|
|
//点击顶部tab调接口
|
...
|
...
|
@@ -135,7 +131,7 @@ Page({ |
|
|
},
|
|
|
//秒杀专场商品列表
|
|
|
secondsKill(day = '', id = '', seckillstatus='') {
|
|
|
|
|
|
console.log(seckillstatus);
|
|
|
let url = 'goods/snapUpList'
|
|
|
let params = {
|
|
|
day: day,
|
...
|
...
|
@@ -176,20 +172,14 @@ Page({ |
|
|
icon: 'none'
|
|
|
}, 2000)
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function(options) {
|
|
|
let that=this;
|
|
|
that.getTimeInterval()
|
|
|
|
|
|
|
|
|
this.getTimeInterval()
|
|
|
|
|
|
//倒计时
|
|
|
this.countTime()
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
*/
|
...
|
...
|
@@ -201,10 +191,9 @@ Page({ |
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
|
onShow: function() {
|
|
|
this.getTimeInterval()
|
|
|
// countdown(this);
|
|
|
var that = this;
|
|
|
this.countTime()
|
|
|
that.getTimeInterval()
|
|
|
that.countTime()
|
|
|
},
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -218,9 +207,7 @@ Page({ |
|
|
* 生命周期函数--监听页面卸载
|
|
|
*/
|
|
|
onUnload: function() {
|
|
|
wx.reLaunch({
|
|
|
url: '../start/start'
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -241,6 +228,30 @@ Page({ |
|
|
* 用户点击右上角分享
|
|
|
*/
|
|
|
onShareAppMessage: function() {
|
|
|
let that = this;
|
|
|
var shareObj = {
|
|
|
title: '金钻手机商场', // 默认是小程序的名称(可以写slogan等)
|
|
|
path: 'pages/start/start', // 默认是当前页面,必须是以‘/’开头的完整路径
|
|
|
imgUrl: '',//自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
|
|
|
success: function (res) {
|
|
|
// 转发成功之后的回调
|
|
|
if (res.errMsg == 'shareAppMessage:ok') { }
|
|
|
},
|
|
|
fail: function () {
|
|
|
// 转发失败之后的回调
|
|
|
if (res.errMsg == 'shareAppMessage:fail cancel') {
|
|
|
// 用户取消转发
|
|
|
} else if (res.errMsg == 'shareAppMessage:fail') {
|
|
|
// 转发失败,其中 detail message 为详细失败信息
|
|
|
}
|
|
|
},
|
|
|
complete: function () {
|
|
|
// 转发结束之后的回调(转发成不成功都会执行)
|
|
|
}
|
|
|
} // 来自页面内的按钮的转发
|
|
|
return shareObj;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}) |
|
|
\ No newline at end of file |
...
|
...
|
|