闫增涛
2024-05-06 e8ec903206cb82e4dbb4687291d5f7788e7ff046
packagePersonal/pages/userSetting/index.js
@@ -10,7 +10,7 @@
  data: {
    userInfo: {},
    defaultAvatarUrl: 'https://cdn-we-retail.ym.tencent.com/miniapp/usercenter/icon-user-center-avatar@2x.png',
    userInfoBox: false,
    editType: '',
    userInfoForm: {
      icon: '',
@@ -24,6 +24,9 @@
    emailError: false,
    imgCode: '',
    countDown: 0,
    mailCountDown: 0,
    userInfoBox: false,
    height: '', //屏幕高度
  },
  /**
@@ -46,7 +49,15 @@
   * 生命周期函数--监听页面显示
   */
  onShow() {
    var that = this;
    // 动态获取屏幕高度
    wx.getSystemInfo({
      success: (result) => {
        that.setData({
          height: result.windowHeight
        });
      },
    })
  },
  // 获取登录用户身份
  getUserInfo() {
@@ -107,7 +118,7 @@
        editType: info,
        "userInfoForm.captcha": "",
        "userInfoForm.code": "",
        "userInfoForm.nickName": ''
        "userInfoForm.nickName": this.data.userInfo.nickName,
      });
    }
    this.getImgCapcha()
@@ -116,6 +127,7 @@
    this.setData({
      userInfoBox: e.detail.visible,
      countDown: 0,
      mailCountDown: 0
    });
  },
  editIconInfo(e) {
@@ -265,6 +277,7 @@
  },
  getPhoneCode() {
    if (this.data.countDown > 0) return false
    if (this.data.userInfoForm.phone && this.data.userInfoForm.captcha) {
      app.MG.identity
        .getPhoneCode({
@@ -333,6 +346,8 @@
              icon: 'none',
              duration: 1000
            })
            // 开启短信验证倒计时
            this.getSecondEmail(60)
          } else {
            wx.showToast({
              title: '邮箱验证码发送失败',
@@ -350,6 +365,24 @@
      })
    }
  },
  getSecondEmail(time) {
    if (this.data.mailCountDown <= 0) {
      this.setData({
        mailCountDown: time,
      });
      let timer = setInterval(() => {
        let count = this.data.mailCountDown - 1;
        this.setData({
          mailCountDown: count,
        });
        if (count === 0) {
          clearInterval(timer);
        }
      }, 1000);
    }
  },
  confirmInfo() {
    if (this.data.editType == 'nickName') {