| | |
| | | * 信息完整度检查 |
| | | */ |
| | | submitCheck() { |
| | | //清空缓存的密码 |
| | | this.lastPW = '' |
| | | |
| | | let msg = this.data.msg |
| | | //确认信息完整度 |
| | | for (let i = 0; i < msg.length; i++) { |
| | |
| | | } |
| | | } |
| | | //输入框 |
| | | //必填项空白检测 |
| | | else if (m.value === "" || m.value === null || m.value === undefined) { |
| | | this.showErrorMsg(i) |
| | | return false |
| | | } |
| | | //输入框下的密码类型检测 |
| | | else if (m.type == 'password') { |
| | | //密码一致性确认 |
| | | if (this.lastPW == '') { |
| | | this.lastPW = m.value |
| | | } else if (this.lastPW != m.value) { |
| | | let error = "两次输入的密码不一致" |
| | | this.setData({ |
| | | errorMsg: error, |
| | | }) |
| | | return false |
| | | } |
| | | //密码复杂度确认 |
| | | var pwError |
| | | var pw = m.value |
| | | var regex1 = /[a-zA-Z]/ |
| | | var regex2 = /[0-9]/ |
| | | var r = regex1.test(pw) && regex2.test(pw) |
| | | console.log('regex:' + r); |
| | | if (pw.length < 6) { |
| | | pwError = '密码位数最少6位' |
| | | } else if (!r) { |
| | | pwError = '密码必须包含字母和数字' |
| | | } |
| | | if (pwError) { |
| | | this.setData({ |
| | | errorMsg: pwError, |
| | | }) |
| | | return false |
| | | } |
| | | |
| | | // //密码一致性确认 |
| | | // if (msg[1].value != msg[2].value) { |
| | | // let error = "两次输入的密码不一致" |
| | | // this.setData({ |
| | | // errorMsg: error, |
| | | // }) |
| | | // return false |
| | | // } |
| | | // //密码复杂度确认 |
| | | // var pwError |
| | | // var pw = msg[1].value |
| | | // var regex1 = /[a-zA-Z]/ |
| | | // var regex2 = /[0-9]/ |
| | | // var r = regex1.test(pw) && regex2.test(pw) |
| | | // console.log('regex:' + r); |
| | | // if (pw.length < 6) { |
| | | // pwError = '密码位数最少6位' |
| | | // } else if (!r) { |
| | | // pwError = '密码必须包含字母和数字' |
| | | // } |
| | | // if (pwError) { |
| | | // this.setData({ |
| | | // errorMsg: pwError, |
| | | // }) |
| | | // return false |
| | | // } |
| | | } |
| | | } |
| | | |
| | | return true |
| | | }, |
| | |
| | | }); |
| | | this.setData({info}) |
| | | this.triggerEvent('onSubmit', info) |
| | | if (typeof this._submit === 'function') this._submit() |
| | | if (typeof this._submit === 'function') this._submit(info) |
| | | } |
| | | }, |
| | | } |