|
@@ -1,5 +1,6 @@
|
|
// pages/luckDraw/detail.js
|
|
// pages/luckDraw/detail.js
|
|
import LuckDraw from '../../api/luck-draw'
|
|
import LuckDraw from '../../api/luck-draw'
|
|
|
|
+import Common from './common'
|
|
import {getMobileCache, getPhoneNumber as getPhoneNumberSync} from '../../utils/user'
|
|
import {getMobileCache, getPhoneNumber as getPhoneNumberSync} from '../../utils/user'
|
|
const app = getApp();
|
|
const app = getApp();
|
|
|
|
|
|
@@ -32,6 +33,12 @@ Page({
|
|
hitRecordList: []
|
|
hitRecordList: []
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 生命周期函数--监听页面初次渲染完成
|
|
|
|
+ */
|
|
|
|
+ onReady: function () {
|
|
|
|
+ },
|
|
|
|
+
|
|
popMessage(message) {
|
|
popMessage(message) {
|
|
app.showToast(message, "none")
|
|
app.showToast(message, "none")
|
|
},
|
|
},
|
|
@@ -40,6 +47,7 @@ Page({
|
|
* 生命周期函数--监听页面加载
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
*/
|
|
onLoad: function (options) {
|
|
onLoad: function (options) {
|
|
|
|
+ Object.assign(this, Common)
|
|
if (!options.id) {
|
|
if (!options.id) {
|
|
this.popMessage ('入参错误');
|
|
this.popMessage ('入参错误');
|
|
wx.navigateTo({
|
|
wx.navigateTo({
|
|
@@ -61,13 +69,10 @@ Page({
|
|
if (resp.code == 200 && resp.data != null) {
|
|
if (resp.code == 200 && resp.data != null) {
|
|
this.mapDataToView(resp.data)
|
|
this.mapDataToView(resp.data)
|
|
}
|
|
}
|
|
- }).catch(_ => {
|
|
|
|
- console.log(_)
|
|
|
|
- this.popMessage('活动不存在');
|
|
|
|
- wx.navigateTo({
|
|
|
|
- url: './index',
|
|
|
|
|
|
+ }).catch(err => {
|
|
|
|
+ this.setData({
|
|
|
|
+ errMessage: err.data.msg
|
|
})
|
|
})
|
|
- return
|
|
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
|
|
@@ -123,8 +128,31 @@ Page({
|
|
opptyMaxVal: activity.opptyMaxVal || 0,
|
|
opptyMaxVal: activity.opptyMaxVal || 0,
|
|
status: activity.status
|
|
status: activity.status
|
|
})
|
|
})
|
|
- },
|
|
|
|
|
|
|
|
|
|
+ if (activity.status == 1 || activity.status ==4 || activity.status == 5) {
|
|
|
|
+
|
|
|
|
+ this.tmpTimeObject = {
|
|
|
|
+ beginTime: activity.beginTime,
|
|
|
|
+ endTime: activity.endTime,
|
|
|
|
+ timeType: activity.timeType,
|
|
|
|
+ dayBeginTime: activity.dayBeginTime,
|
|
|
|
+ dayEndTime: activity.dayEndTime
|
|
|
|
+ }
|
|
|
|
+ this.countDownTimer = setInterval(this.calcCountDownTime, 1000)
|
|
|
|
+ this.calcCountDownTime()
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ calcCountDownTime() {
|
|
|
|
+ this.setActivityCountdownTime(new Date(), this.tmpTimeObject)
|
|
|
|
+ this.setData({
|
|
|
|
+ countDownTime: this.tmpTimeObject.countDownTime,
|
|
|
|
+ status: this.tmpTimeObject.status
|
|
|
|
+ })
|
|
|
|
+ // 删除定时器
|
|
|
|
+ if (this.tmpTimeObject.status == 2 || this.tmpTimeObject.status == 3 && this.countDownTimer != null) {
|
|
|
|
+ clearInterval(this.countDownTimer)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
/**
|
|
/**
|
|
* 开始转动奖品,抽奖
|
|
* 开始转动奖品,抽奖
|
|
*/
|
|
*/
|
|
@@ -354,13 +382,6 @@ Page({
|
|
},
|
|
},
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 生命周期函数--监听页面初次渲染完成
|
|
|
|
- */
|
|
|
|
- onReady: function () {
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
* 生命周期函数--监听页面显示
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
*/
|
|
onShow: function () {
|
|
onShow: function () {
|
|
@@ -424,8 +445,16 @@ Page({
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
|
|
- toExchangePlatform: function() {
|
|
|
|
|
|
+ toLuckDrawPage: function() {
|
|
|
|
+ wx.navigateTo({
|
|
|
|
+ url: '/pages/luckDraw/index',
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
|
|
|
|
+ turnActivityListPage() {
|
|
|
|
+ wx.redirectTo({
|
|
|
|
+ url: '/pages/luckDraw/index',
|
|
|
|
+ })
|
|
}
|
|
}
|
|
|
|
|
|
})
|
|
})
|