|
|
|
|
@ -33,10 +33,9 @@ Page({
|
|
|
|
|
showScsEnergy:false, //显示注册成功提示
|
|
|
|
|
showTiming:false, //显示祈祷时间弹层
|
|
|
|
|
jmEnergy:false,
|
|
|
|
|
jmEnergy2: true,
|
|
|
|
|
showInjectBkc: false, //显示注入能量按钮动画
|
|
|
|
|
inPrayer: true,
|
|
|
|
|
qdTime: '',
|
|
|
|
|
qdTime: null,
|
|
|
|
|
ysTime: ''
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
@ -57,7 +56,7 @@ Page({
|
|
|
|
|
this.doSetXxt('female')
|
|
|
|
|
},
|
|
|
|
|
closeJmEnergy(){
|
|
|
|
|
this.setData({jmEnergy2: false})
|
|
|
|
|
this.setData({jmEnergy: false})
|
|
|
|
|
},
|
|
|
|
|
doSetXxt(e){
|
|
|
|
|
req.patchRequest('/api/user/curt',{spriteType:e}).then((res)=>{
|
|
|
|
|
@ -109,7 +108,9 @@ Page({
|
|
|
|
|
if(res.data.code==200){
|
|
|
|
|
this.setData({loverInfo:res.data.data})
|
|
|
|
|
|
|
|
|
|
this.getQdTime(res.data.data)
|
|
|
|
|
if (res.data.data.prayerStartTime) {
|
|
|
|
|
this.getQdTime(res.data.data)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}).catch((err)=>{
|
|
|
|
|
console.log(err);
|
|
|
|
|
@ -139,6 +140,7 @@ Page({
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
openPray(){
|
|
|
|
|
this.getUserInfo()
|
|
|
|
|
if(this.data.userInfo.isInPrayer){
|
|
|
|
|
this.setData({
|
|
|
|
|
showIsPray:!this.data.showIsPray
|
|
|
|
|
@ -219,7 +221,7 @@ Page({
|
|
|
|
|
setTimeout(()=>{
|
|
|
|
|
this.setData({
|
|
|
|
|
showInEnergy:!this.data.showInEnergy,
|
|
|
|
|
showScsEnergy:true
|
|
|
|
|
showScsEnergy:true
|
|
|
|
|
})
|
|
|
|
|
this.getUserInfo()
|
|
|
|
|
},2000)
|
|
|
|
|
@ -253,11 +255,36 @@ Page({
|
|
|
|
|
getUserInfo(){
|
|
|
|
|
req.getRequest('/api/user/curt',{}).then((res)=>{
|
|
|
|
|
if(res.data.code===200){
|
|
|
|
|
this.getQdTime(res.data.data)
|
|
|
|
|
if (res.data.data.prayerStartTime) {
|
|
|
|
|
this.getQdTime(res.data.data)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取可以祈祷的时间
|
|
|
|
|
const pendantEnergy = res.data.data.crystallineEnergy
|
|
|
|
|
const hours = Math.floor(pendantEnergy * 6 / 60); // 计算小时数
|
|
|
|
|
const minute = pendantEnergy * 6 - hours * 60
|
|
|
|
|
if(hours>0){
|
|
|
|
|
this.setData({
|
|
|
|
|
minutes:59
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
if(hours<=0){
|
|
|
|
|
this.setData({
|
|
|
|
|
minutes:minute
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
|
hours:hours,
|
|
|
|
|
minute:minute,
|
|
|
|
|
pendantEnergy:pendantEnergy
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 能量集满显示提示
|
|
|
|
|
if(res.data.data.crystallineEnergy >= 100){
|
|
|
|
|
this.setData({jmEnergy: true})
|
|
|
|
|
this.setData({
|
|
|
|
|
jmEnergy: true
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
|
@ -303,10 +330,8 @@ Page({
|
|
|
|
|
},
|
|
|
|
|
// 计算祈祷时间
|
|
|
|
|
getQdTime(data){
|
|
|
|
|
if (!data.prayerStartTime) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
const qdTime = setInterval(() => {
|
|
|
|
|
clearInterval(this.data.qdTime)
|
|
|
|
|
this.data.qdTime = setInterval(() => {
|
|
|
|
|
// 获取已经祈祷时间
|
|
|
|
|
const now = new Date();
|
|
|
|
|
const startTime = new Date(data.prayerStartTime)
|
|
|
|
|
@ -327,30 +352,9 @@ Page({
|
|
|
|
|
energy: Math.floor(TimeDiff / 360000),
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const pendantEnergy = data.crystallineEnergy
|
|
|
|
|
const hours = Math.floor(pendantEnergy * 6 / 60); // 计算小时数
|
|
|
|
|
const minute = pendantEnergy * 6 - hours * 60
|
|
|
|
|
if(hours>0){
|
|
|
|
|
this.setData({
|
|
|
|
|
minutes:59
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
if(hours<=0){
|
|
|
|
|
this.setData({
|
|
|
|
|
minutes:minute
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
|
hours:hours,
|
|
|
|
|
minute:minute,
|
|
|
|
|
pendantEnergy:pendantEnergy
|
|
|
|
|
})
|
|
|
|
|
console.log('定时器执行');
|
|
|
|
|
|
|
|
|
|
}, 1000);
|
|
|
|
|
|
|
|
|
|
this.setData({qdTime: qdTime})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
go2Jlai(){
|
|
|
|
|
@ -411,17 +415,20 @@ Page({
|
|
|
|
|
this.setData({showTiming: false})
|
|
|
|
|
},
|
|
|
|
|
btnCancel(){
|
|
|
|
|
// 更新数据后清除定时器
|
|
|
|
|
clearInterval(this.data.qdTime)
|
|
|
|
|
this.data.qdTime = null
|
|
|
|
|
console.log('清除定时器');
|
|
|
|
|
req.patchRequest('/api/user/curt/prayer/stop',{}).then((res)=>{
|
|
|
|
|
console.log(res,'2222');
|
|
|
|
|
if(res.data.code === 200){
|
|
|
|
|
wx.showToast({
|
|
|
|
|
title: '已结束祈祷',
|
|
|
|
|
icon: 'success'
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
this.setData({prayTime : '00:00:00'})
|
|
|
|
|
this.openPray()
|
|
|
|
|
this.getUserInfo()
|
|
|
|
|
clearInterval(this.data.qdTime)
|
|
|
|
|
this.setData({prayTime : '00:00:00'})
|
|
|
|
|
}else {
|
|
|
|
|
wx.showToast({
|
|
|
|
|
title: '结束祈祷失败',
|
|
|
|
|
@ -522,7 +529,6 @@ Page({
|
|
|
|
|
*/
|
|
|
|
|
onHide() {
|
|
|
|
|
this.getUserInfo()
|
|
|
|
|
clearInterval(this.data.ysTime)
|
|
|
|
|
clearInterval(this.data.qdTime)
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
@ -532,6 +538,7 @@ Page({
|
|
|
|
|
onUnload() {
|
|
|
|
|
this.getUserInfo()
|
|
|
|
|
clearInterval(this.data.setInterval)
|
|
|
|
|
clearInterval(this.data.qdTime)
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|