// pages/home/password/index.js import $wuxCountDown from '../../../utils/countdown/index' Page({ /** * 页面的初始数据 */ data: { second: null, pwdType: 'password', pwd_icon: 'attention' }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { }, BindPwd: function (e) { this.setData({ password: e.detail.value }) }, changePwd: function (e) { if (this.data.pwdType === 'password') { this.setData({ pwdType: 'text' }) this.setData({ pwd_icon: 'attentionforbid' }) } else { this.setData({ pwdType: 'password' }) this.setData({ pwd_icon: 'attention' }) } }, fetchCode: function (e) { if (this.second && this.second.interval) return !1 this.second = new $wuxCountDown({ date: +(new Date) + 60000, onEnd() { this.setData({ second: '重新获取验证码', }) }, render(date) { const sec = this.leadingZeros(date.sec, 2) + ' 秒 ' date.sec !== 0 && this.setData({ second: sec, }) }, }) }, resetPassword: function (e) { } })