| | |
| | | data: { |
| | | userInfo: {}, |
| | | defaultAvatarUrl: 'https://cdn-we-retail.ym.tencent.com/miniapp/usercenter/icon-user-center-avatar@2x.png', |
| | | userInfoBox: false, |
| | | |
| | | editType: '', |
| | | userInfoForm: { |
| | | icon: '', |
| | |
| | | emailError: false, |
| | | imgCode: '', |
| | | countDown: 0, |
| | | mailCountDown: 0, |
| | | userInfoBox: false, |
| | | height: '', //屏幕高度 |
| | | }, |
| | | |
| | | /** |
| | |
| | | * 生命周期函数--监听页面显示 |
| | | */ |
| | | onShow() { |
| | | |
| | | var that = this; |
| | | // 动态获取屏幕高度 |
| | | wx.getSystemInfo({ |
| | | success: (result) => { |
| | | that.setData({ |
| | | height: result.windowHeight |
| | | }); |
| | | }, |
| | | }) |
| | | }, |
| | | // 获取登录用户身份 |
| | | getUserInfo() { |
| | |
| | | editType: info, |
| | | "userInfoForm.captcha": "", |
| | | "userInfoForm.code": "", |
| | | "userInfoForm.nickName": '' |
| | | "userInfoForm.nickName": this.data.userInfo.nickName, |
| | | }); |
| | | } |
| | | this.getImgCapcha() |
| | |
| | | this.setData({ |
| | | userInfoBox: e.detail.visible, |
| | | countDown: 0, |
| | | mailCountDown: 0 |
| | | }); |
| | | }, |
| | | editIconInfo(e) { |
| | |
| | | }, |
| | | |
| | | getPhoneCode() { |
| | | if (this.data.countDown > 0) return false |
| | | if (this.data.userInfoForm.phone && this.data.userInfoForm.captcha) { |
| | | app.MG.identity |
| | | .getPhoneCode({ |
| | |
| | | icon: 'none', |
| | | duration: 1000 |
| | | }) |
| | | // 开启短信验证倒计时 |
| | | this.getSecondEmail(60) |
| | | } else { |
| | | wx.showToast({ |
| | | title: '邮箱验证码发送失败', |
| | |
| | | }) |
| | | } |
| | | }, |
| | | 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') { |