沙盘演示系统应用的微信小程序
zuoxiao
2024-11-01 ddbd8c7ea87b66d5a9c4362ce284d12a4ae970d1
pages/wxbind/wxbind.js
@@ -15,7 +15,13 @@
    phoneCode: '',
    codeSent: false,
    countdown: 60,
    isButtonEnabled: false
    isButtonEnabled: false,
    showErrorDialog: false,
    errorData: "",
    errorDialogTitle: "错误提示",
    confirmBtn: {
      content: '确认'
    }
  },
  onLoad(options) {
@@ -62,11 +68,7 @@
    }
    // 在这里处理发送验证码的逻辑,可以调用后台接口实现
    this.postCode();
    this.setData({
      codeSent: true,
    });
    // 启动倒计时
    this.startCountdown();
  },
  //倒计时
  startCountdown: function () {
@@ -109,8 +111,17 @@
          icon: 'success',
          duration: 2000,
        });
        this.setData({
          codeSent: true,
        });
        // 启动倒计时
        this.startCountdown();
      })
      .catch((error) => {
        this.setData({
          showErrorDialog: true,
          errorData: error.msg
        })
        console.error('Failed to add item:', error);
      });
  },
@@ -143,10 +154,10 @@
    };
    post(params)
      .then((data) => {
        getApp().globalData.sessionId = data.content.sessionId
        storage.setItem("sessionId", data.content.sessionId)
        getApp().globalData.clientId = data.content.clientId
        storage.setItem("clientId", data.content.clientId)
        getApp().globalData.sessionId = String(data.content.sessionId)
        storage.setItem("sessionId", String(data.content.sessionId))
        getApp().globalData.clientId = String(data.content.clientId)
        storage.setItem("clientId", String(data.content.clientId))
        this.bindSuccess();
      })
      .catch((error) => {
@@ -157,5 +168,10 @@
        });
        console.error('Failed to add item:', error);
      });
  },
  closeDialog() {
    this.setData({
      showErrorDialog: false
    })
  }
})