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 != if (config.url != '/nurseApplet/chatRecord/updateReadStatus' && config.url !=
"/nurseApplet/chatRecord/sendMessage" && config.url != "/nurseApplet/chatRecord/sendMessage" && config.url !=
`/applet/sign/apply/checkSignApply/` + uni.getStorageSync('userinfo').cardNo && urls != `/applet/sign/apply/checkSignApply/` + uni.getStorageSync('userinfo').cardNo && urls !=
`/nurseApplet/chatRecord/getChatRecord`) { `/nurseApplet/chatRecord/getChatRecord` && urls != '/applet/register/wxSportDecrypt') {
uni.showLoading({ uni.showLoading({
title: '' title: ''
}); });

View File

@ -108,6 +108,7 @@
address: '', address: '',
openid: '', openid: '',
baseurl: '', baseurl: '',
sportlist: [],
} }
}, },
onLoad() {}, onLoad() {},
@ -134,8 +135,15 @@
month >= 1 && month <= 9 ? (month = "0" + month) : ""; month >= 1 && month <= 9 ? (month = "0" + month) : "";
day >= 0 && day <= 9 ? (day = "0" + day) : ""; day >= 0 && day <= 9 ? (day = "0" + day) : "";
let time = `${year}-${month}-${day}` let time = `${year}-${month}-${day}`
let wxsportaddtime = uni.getStorageSync('wxsportaddtime'); let identtime = `${this.userinfo.cardNo}${year}-${month}-${day}`
if (wxsportaddtime != time) { 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({ wx.getSetting({
success: function(res) { success: function(res) {
// //
@ -164,10 +172,15 @@
iv: resp.iv iv: resp.iv
} }
wxSportDecrypt(obj).then(Sportres => { 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 => { wxsportadd(this.userinfo.cardNo).then(sportaddres => {
if (sportaddres.code == 200) { 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 { return {
list: undefined, list: undefined,
userinfo: undefined, userinfo: undefined,
sportlist: [],
}; };
}, },
onShow() { onShow() {
@ -44,7 +45,14 @@
month >= 1 && month <= 9 ? (month = "0" + month) : ""; month >= 1 && month <= 9 ? (month = "0" + month) : "";
day >= 0 && day <= 9 ? (day = "0" + day) : ""; day >= 0 && day <= 9 ? (day = "0" + day) : "";
let time = `${year}-${month}-${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 = { let obj = {
code: res.code, code: res.code,
encryptedData: resp.encryptedData, encryptedData: resp.encryptedData,
@ -52,11 +60,16 @@
} }
wxSportDecrypt(obj).then(Sportres => { wxSportDecrypt(obj).then(Sportres => {
this.list = Sportres.data this.list = Sportres.data
if (wxsportaddtime != time) { if (!this.sportlist.some(e => e.text == identtime)) {
if (Sportres.data && Sportres.data[0].step >= 5000) { if (Sportres.data && Sportres.data[0].step >= 100) {
wxsportadd(this.userinfo.cardNo).then(sportaddres => { wxsportadd(this.userinfo.cardNo).then(sportaddres => {
if (sportaddres.code == 200) { 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) { if (loginres.code) {
wx.getWeRunData({ wx.getWeRunData({
success: function(WeRunDatares) { success: function(WeRunDatares) {
that.wxSport(loginres, WeRunDatares) that.wxSport(loginres,
WeRunDatares)
} }
}); });
} }