| | |
| | | phoneCode: '', |
| | | codeSent: false, |
| | | countdown: 60, |
| | | isButtonEnabled: false |
| | | isButtonEnabled: false, |
| | | showErrorDialog: false, |
| | | errorData: "", |
| | | errorDialogTitle: "错误提示", |
| | | confirmBtn: { |
| | | content: '确认' |
| | | } |
| | | }, |
| | | onLoad(options) { |
| | | |
| | |
| | | } |
| | | // 在这里处理发送验证码的逻辑,可以调用后台接口实现 |
| | | this.postCode(); |
| | | this.setData({ |
| | | codeSent: true, |
| | | }); |
| | | // 启动倒计时 |
| | | this.startCountdown(); |
| | | |
| | | }, |
| | | //倒计时 |
| | | startCountdown: function () { |
| | |
| | | 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); |
| | | }); |
| | | }, |
| | |
| | | }; |
| | | 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) => { |
| | |
| | | }); |
| | | console.error('Failed to add item:', error); |
| | | }); |
| | | }, |
| | | closeDialog() { |
| | | this.setData({ |
| | | showErrorDialog: false |
| | | }) |
| | | } |
| | | }) |