祖安之光
2025-08-07 41193d186d157937ba052e73dd04c12018e9ecab
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();
  },