This commit is contained in:
2024-02-01 08:53:44 +08:00
parent d862a75205
commit 053a431fdb
3 changed files with 37 additions and 10 deletions

View File

@ -7,7 +7,7 @@ var request = function(config) {
if (config.url != '/nurseApplet/chatRecord/updateReadStatus' && config.url !=
"/nurseApplet/chatRecord/sendMessage" && config.url !=
`/applet/sign/apply/checkSignApply/` + uni.getStorageSync('userinfo').cardNo && urls !=
`/nurseApplet/chatRecord/getChatRecord`) {
`/nurseApplet/chatRecord/getChatRecord` && urls != '/applet/register/wxSportDecrypt') {
uni.showLoading({
title: ''
});

View File

@ -108,6 +108,7 @@
address: '',
openid: '',
baseurl: '',
sportlist: [],
}
},
onLoad() {},
@ -134,8 +135,15 @@
month >= 1 && month <= 9 ? (month = "0" + month) : "";
day >= 0 && day <= 9 ? (day = "0" + day) : "";
let time = `${year}-${month}-${day}`
let wxsportaddtime = uni.getStorageSync('wxsportaddtime');
if (wxsportaddtime != time) {
let identtime = `${this.userinfo.cardNo}${year}-${month}-${day}`
if (uni.getStorageSync('sportlist')) {
if (uni.getStorageSync('sportlist')[0].date != time) {
uni.removeStorageSync('sportlist');
} else {
this.sportlist = uni.getStorageSync('sportlist');
}
}
if (!this.sportlist.some(e => e.text == identtime)) {
wx.getSetting({
success: function(res) {
//
@ -164,10 +172,15 @@
iv: resp.iv
}
wxSportDecrypt(obj).then(Sportres => {
if (Sportres.data && Sportres.data[0].step >= 5000) {
if (Sportres.data && Sportres.data[0].step >= 100) {
wxsportadd(this.userinfo.cardNo).then(sportaddres => {
if (sportaddres.code == 200) {
uni.setStorageSync('wxsportaddtime', Sportres.data[0].date);
let sportitem = {
text: `${this.userinfo.cardNo}${Sportres.data[0].date}`,
date: Sportres.data[0].date
}
this.sportlist.unshift(sportitem)
uni.setStorageSync('sportlist', this.sportlist);
}
})
}

View File

@ -29,6 +29,7 @@
return {
list: undefined,
userinfo: undefined,
sportlist: [],
};
},
onShow() {
@ -44,7 +45,14 @@
month >= 1 && month <= 9 ? (month = "0" + month) : "";
day >= 0 && day <= 9 ? (day = "0" + day) : "";
let time = `${year}-${month}-${day}`
let wxsportaddtime = uni.getStorageSync('wxsportaddtime');
let identtime = `${this.userinfo.cardNo}${year}-${month}-${day}`
if (uni.getStorageSync('sportlist')) {
if (uni.getStorageSync('sportlist')[0].date != time) {
uni.removeStorageSync('sportlist');
} else {
this.sportlist = uni.getStorageSync('sportlist');
}
}
let obj = {
code: res.code,
encryptedData: resp.encryptedData,
@ -52,11 +60,16 @@
}
wxSportDecrypt(obj).then(Sportres => {
this.list = Sportres.data
if (wxsportaddtime != time) {
if (Sportres.data && Sportres.data[0].step >= 5000) {
if (!this.sportlist.some(e => e.text == identtime)) {
if (Sportres.data && Sportres.data[0].step >= 100) {
wxsportadd(this.userinfo.cardNo).then(sportaddres => {
if (sportaddres.code == 200) {
uni.setStorageSync('wxsportaddtime', Sportres.data[0].date);
let sportitem = {
text: `${this.userinfo.cardNo}${Sportres.data[0].date}`,
date: Sportres.data[0].date
}
this.sportlist.unshift(sportitem)
uni.setStorageSync('sportlist', this.sportlist);
}
})
}
@ -87,7 +100,8 @@
if (loginres.code) {
wx.getWeRunData({
success: function(WeRunDatares) {
that.wxSport(loginres, WeRunDatares)
that.wxSport(loginres,
WeRunDatares)
}
});
}