|
|
|
@ -19,7 +19,12 @@ Page({
|
|
|
|
pickerValue: [0, 0],
|
|
|
|
pickerValue: [0, 0],
|
|
|
|
prayerContent:'', //祈祷内容
|
|
|
|
prayerContent:'', //祈祷内容
|
|
|
|
showSexLogo:false,//不展示形象修改按钮
|
|
|
|
showSexLogo:false,//不展示形象修改按钮
|
|
|
|
showPray:false //显示祈祷弹层
|
|
|
|
showPray:false, //显示祈祷弹层
|
|
|
|
|
|
|
|
showIsPray:false, //显示取消祈祷弹层
|
|
|
|
|
|
|
|
showEnergy:false, //显示赠送能量弹层
|
|
|
|
|
|
|
|
showEnergyToast:false, //显示赠送能量提示
|
|
|
|
|
|
|
|
showEnergySuccess:false, //赠送成功提示
|
|
|
|
|
|
|
|
showEnergyFail:false, //赠送成功提示
|
|
|
|
},
|
|
|
|
},
|
|
|
|
ShowOrNotLogoS(){
|
|
|
|
ShowOrNotLogoS(){
|
|
|
|
this.setData({singleShow:!this.data.singleShow})
|
|
|
|
this.setData({singleShow:!this.data.singleShow})
|
|
|
|
@ -93,11 +98,33 @@ Page({
|
|
|
|
})
|
|
|
|
})
|
|
|
|
console.log(this.data.prayerContent);
|
|
|
|
console.log(this.data.prayerContent);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
openEnergy(){
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
|
|
|
|
showEnergy:!this.data.showEnergy
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
cancelEnergy(){
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
|
|
|
|
showEnergy:!this.data.showEnergy
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
cancelEnergyToast(){
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
|
|
|
|
showEnergyToast:false,
|
|
|
|
|
|
|
|
showEnergyFail:false
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
},
|
|
|
|
openPray(){
|
|
|
|
openPray(){
|
|
|
|
|
|
|
|
if(this.data.userInfo.prayerEndTime){
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
|
|
|
|
showIsPray:!this.data.showIsPray
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}else{
|
|
|
|
this.setData({
|
|
|
|
this.setData({
|
|
|
|
showPray:!this.data.showPray,
|
|
|
|
showPray:!this.data.showPray,
|
|
|
|
prayerContent:''
|
|
|
|
prayerContent:''
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
onPickerChange(e){
|
|
|
|
onPickerChange(e){
|
|
|
|
if(e.detail.value[0] === this.data.hours){
|
|
|
|
if(e.detail.value[0] === this.data.hours){
|
|
|
|
@ -115,8 +142,7 @@ Page({
|
|
|
|
},
|
|
|
|
},
|
|
|
|
getUserInfo(){
|
|
|
|
getUserInfo(){
|
|
|
|
req.getRequest('/api/user/curt',{}).then((res)=>{
|
|
|
|
req.getRequest('/api/user/curt',{}).then((res)=>{
|
|
|
|
if(res.data.code==200){
|
|
|
|
if(res.data.code===200){
|
|
|
|
console.log(res.data.data);
|
|
|
|
|
|
|
|
const pendantEnergy = res.data.data.pendantEnergy
|
|
|
|
const pendantEnergy = res.data.data.pendantEnergy
|
|
|
|
const minute = pendantEnergy * 6
|
|
|
|
const minute = pendantEnergy * 6
|
|
|
|
const hours = Math.floor(pendantEnergy / 60); // 计算小时数
|
|
|
|
const hours = Math.floor(pendantEnergy / 60); // 计算小时数
|
|
|
|
@ -131,7 +157,7 @@ Page({
|
|
|
|
minute:minute,
|
|
|
|
minute:minute,
|
|
|
|
pendantEnergy:pendantEnergy
|
|
|
|
pendantEnergy:pendantEnergy
|
|
|
|
})
|
|
|
|
})
|
|
|
|
console.log(this.data.userInfo);
|
|
|
|
// console.log(this.data.userInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).catch((err)=>{
|
|
|
|
}).catch((err)=>{
|
|
|
|
console.log(err);
|
|
|
|
console.log(err);
|
|
|
|
@ -151,12 +177,17 @@ Page({
|
|
|
|
message: '能量不足',
|
|
|
|
message: '能量不足',
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
console.log(prayerEnergy);
|
|
|
|
if(this.data.prayerContent.length > 11){
|
|
|
|
|
|
|
|
return Toast({
|
|
|
|
|
|
|
|
context: this,
|
|
|
|
|
|
|
|
selector: '#t-toast',
|
|
|
|
|
|
|
|
message: '祈祷内容不能超过11个字',
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
req.patchRequest('/api/user/curt/prayer',{
|
|
|
|
req.patchRequest('/api/user/curt/prayer',{
|
|
|
|
prayerContent:this.data.prayerContent,
|
|
|
|
prayerContent:this.data.prayerContent,
|
|
|
|
prayerEnergy:prayerEnergy
|
|
|
|
prayerEnergy:prayerEnergy
|
|
|
|
}).then((res) => {
|
|
|
|
}).then((res) => {
|
|
|
|
console.log(res);
|
|
|
|
|
|
|
|
if(res.data.code === 200){
|
|
|
|
if(res.data.code === 200){
|
|
|
|
Toast({
|
|
|
|
Toast({
|
|
|
|
context: this,
|
|
|
|
context: this,
|
|
|
|
@ -170,11 +201,52 @@ Page({
|
|
|
|
message: res.data.msg,
|
|
|
|
message: res.data.msg,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this.getUserInfo()
|
|
|
|
this.openPray()
|
|
|
|
this.openPray()
|
|
|
|
}).catch((err) => {
|
|
|
|
}).catch((err) => {
|
|
|
|
console.log('祈祷失败',err);
|
|
|
|
console.log('祈祷失败',err);
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
btnCancel(){
|
|
|
|
|
|
|
|
console.log('111');
|
|
|
|
|
|
|
|
req.patchRequest('/api/user/curt/prayer/stop',{}).then((res)=>{
|
|
|
|
|
|
|
|
Toast({
|
|
|
|
|
|
|
|
context: this,
|
|
|
|
|
|
|
|
selector: '#t-toast',
|
|
|
|
|
|
|
|
message: '已结束祈祷',
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
this.openPray()
|
|
|
|
|
|
|
|
this.getUserInfo()
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
btnShare(){
|
|
|
|
|
|
|
|
console.log('赠送能量');
|
|
|
|
|
|
|
|
req.patchRequest('/api/user/curt/give-crystalline-energy-to-lover',{}).then((res)=>{
|
|
|
|
|
|
|
|
console.log(res);
|
|
|
|
|
|
|
|
if(res.data.code === 200){
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
|
|
|
|
showEnergySuccess:!this.data.showEnergySuccess,
|
|
|
|
|
|
|
|
showEnergy:!this.data.showEnergy
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
return setTimeout(()=>{
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
|
|
|
|
showEnergySuccess:!this.data.showEnergySuccess,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
},2000)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
|
|
|
|
showEnergy:!this.data.showEnergy,
|
|
|
|
|
|
|
|
showEnergyToast:!this.data.showEnergyToast,
|
|
|
|
|
|
|
|
toast:res.data.msg
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}).catch((err)=>{
|
|
|
|
|
|
|
|
console.log('111');
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
|
|
|
|
showEnergyFail:!this.data.showEnergyFail,
|
|
|
|
|
|
|
|
showEnergy:!this.data.showEnergy
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
|