From ad5c4cc086a40708e66040574ff1d465b66304b6 Mon Sep 17 00:00:00 2001 From: 祖安之光 <11848914+light-of-zuan@user.noreply.gitee.com> Date: 星期四, 07 八月 2025 10:36:25 +0800 Subject: [PATCH] 新增 --- pages/tabBar/count/count.js | 139 ++++++++++++++++++++++----------------------- 1 files changed, 68 insertions(+), 71 deletions(-) diff --git a/pages/tabBar/count/count.js b/pages/tabBar/count/count.js index 4281629..f9f6803 100644 --- a/pages/tabBar/count/count.js +++ b/pages/tabBar/count/count.js @@ -55,25 +55,23 @@ content: '是否确认退出该账号?', success: (res) => { if (res.confirm) { - wx.clearStorageSync(); - wx.navigateTo({ - url: '/pages/index/index' - }); // api接口 - // api.loginOut().then(res => { - // if(res.code == 200) { - // wx.showToast({ - // title: '账户已退出', - // duration: 800 - // }); - // setTimeout(() => { - // wx.clearStorageSync(); - // wx.navigateTo({ - // url: '/pages/index/index' - // }); - // }, 800); - // } - // }); + api.loginOut().then(res => { + if(res.code == 200) { + wx.showToast({ + title: '账户已退出', + duration: 800 + }); + setTimeout(() => { + if(!wx.getStorageSync('isSave') || wx.getStorageSync('isSave') == false){ + wx.clearStorageSync(); + } + wx.navigateTo({ + url: '/pages/index/index' + }); + }, 800); + } + }); } } }); @@ -130,26 +128,25 @@ }); return; } - const Id = wx.getStorageSync("uid") - - cloudApi.updateKey('userList',Id,{password: this.base64Encode(this.data.pwdForm.password)}).then(res=>{ - if(res.result == 'success'){ - wx.showToast({ - title: '密码已修改,请重新登录', - icon: 'none', - duration: 1500 - }); - wx.clearStorageSync(); - wx.navigateTo({ - url: '/pages/index/index' - }); - }else{ - wx.showToast({ - title: 密码修改失败, - duration: 2000 - }); - } - }) + // const Id = wx.getStorageSync("uid") + // cloudApi.updateKey('userList',Id,{password: this.base64Encode(this.data.pwdForm.password)}).then(res=>{ + // if(res.result == 'success'){ + // wx.showToast({ + // title: '密码已修改,请重新登录', + // icon: 'none', + // duration: 1500 + // }); + // wx.clearStorageSync(); + // wx.navigateTo({ + // url: '/pages/index/index' + // }); + // }else{ + // wx.showToast({ + // title: 密码修改失败, + // duration: 2000 + // }); + // } + // }) // const db = wx.cloud.database() // db.collection('userList').doc(Id).update({ // data: { @@ -175,39 +172,39 @@ // }) // api请求 - // let data = { - // id: wx.getStorageSync("uid"), - // password: this.base64Encode(this.data.pwdForm.password) - // }; - // api.resetPwd(data).then((r) => { - // if(r.code == 200) { - // wx.showToast({ - // title: '密码已修改,请重新登录', - // icon: 'none', - // duration: 1000 - // }); - // loginOut().then(res => { - // if(res.code == 200) { - // setTimeout(() => { - // wx.clearStorageSync(); - // wx.navigateTo({ - // url: '/pages/index/index' - // }); - // }, 1000); - // } - // }); - // } else { - // wx.showToast({ - // title: r.message, - // icon: 'none' - // }); - // } - // }).catch((err) => { - // wx.showToast({ - // title: err, - // duration: 2000 - // }); - // }); + let data = { + id: wx.getStorageSync("uid"), + password: this.base64Encode(this.data.pwdForm.password) + }; + api.resetPwd(data).then((r) => { + if(r.code == 200) { + wx.showToast({ + title: '密码已修改,请重新登录', + icon: 'none', + duration: 1000 + }); + loginOut().then(res => { + if(res.code == 200) { + setTimeout(() => { + wx.clearStorageSync(); + wx.navigateTo({ + url: '/pages/index/index' + }); + }, 1000); + } + }); + } else { + wx.showToast({ + title: r.message, + icon: 'none' + }); + } + }).catch((err) => { + wx.showToast({ + title: err, + duration: 2000 + }); + }); this.closeModal(); }, -- Gitblit v1.9.2