From 0436220a2f5951b27e1bba9c0cf53d5651d54d0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=8A=E9=87=8C?= <1227971437@qq.com> Date: Thu, 22 Apr 2021 15:54:40 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E9=99=86=E7=95=8C=E9=9D=A2=E8=A1=A8?= =?UTF-8?q?=E5=8D=95=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/uni-forms/uni-forms.vue | 3 +- .../uni-login-page/common/loginPage.mixin.js | 23 +++++++++- .../pages/pwd-login/pwd-login.vue | 27 ++++++++---- .../pages/pwd-retrieve/pwd-retrieve.vue | 43 ++++++++++++------- 4 files changed, 69 insertions(+), 27 deletions(-) diff --git a/uni_modules/uni-forms/components/uni-forms/uni-forms.vue b/uni_modules/uni-forms/components/uni-forms/uni-forms.vue index af83748f..1a6ee31b 100644 --- a/uni_modules/uni-forms/components/uni-forms/uni-forms.vue +++ b/uni_modules/uni-forms/components/uni-forms/uni-forms.vue @@ -353,7 +353,8 @@ this.formData[i] = this._getValue(i, this.value[i]) } } - } + } + console.log(this.formData, this.formRules); return this.validateAll(this.formData, 'submit', callback) }, diff --git a/uni_modules/uni-login-page/common/loginPage.mixin.js b/uni_modules/uni-login-page/common/loginPage.mixin.js index 0c492e29..fc342a81 100644 --- a/uni_modules/uni-login-page/common/loginPage.mixin.js +++ b/uni_modules/uni-login-page/common/loginPage.mixin.js @@ -21,7 +21,8 @@ let mixin = { formData:{ phone:'', code:'', - pwd:'' + pwd:'', + pwd2:'' }, rules: { phone:{ @@ -56,6 +57,26 @@ let mixin = { errorMessage: '密码应为6到20位', } ] + }, + pwd2:{ + rules:[{ + required: true, + errorMessage: '请确认密码', + }, + { + pattern: /^.{6,20}$/, + errorMessage: '密码应为6到20位', + }, + { + validateFunction:function(rule,value,data,callback){ + console.log(value); + if(value!=data.pwd){ + callback('两次输入密码不一致') + }; + return true + } + } + ] } } } diff --git a/uni_modules/uni-login-page/pages/pwd-login/pwd-login.vue b/uni_modules/uni-login-page/pages/pwd-login/pwd-login.vue index ea5ae8d2..368cc986 100644 --- a/uni_modules/uni-login-page/pages/pwd-login/pwd-login.vue +++ b/uni_modules/uni-login-page/pages/pwd-login/pwd-login.vue @@ -16,19 +16,23 @@ {{currenPhoneArea}} - + + + - - - 忘记了? - 找回密码 - - + + + + + + + 注册账号 + @@ -131,9 +135,14 @@ .phone-input-box { margin-top: 20rpx; } - .auth-box { - justify-content: flex-start; + .auth-box { + flex-direction: row; + justify-content: space-between; + align-items: center; margin-top: 20rpx; + } + .auth-box-left{ + flex-direction: row; } .login-text-sub { color: #8a8f8b; diff --git a/uni_modules/uni-login-page/pages/pwd-retrieve/pwd-retrieve.vue b/uni_modules/uni-login-page/pages/pwd-retrieve/pwd-retrieve.vue index b782937f..3c98b798 100644 --- a/uni_modules/uni-login-page/pages/pwd-retrieve/pwd-retrieve.vue +++ b/uni_modules/uni-login-page/pages/pwd-retrieve/pwd-retrieve.vue @@ -3,22 +3,30 @@ - 重置密码 - + 重置密码 + + + + + + + + @@ -52,7 +60,7 @@ import mixin from '../../common/loginPage.mixin.js'; }, onReady() { if(this.formData.phone){ - this.$refs.shortCode.start(); + // this.$refs.shortCode.start(); } }, methods: { @@ -60,19 +68,22 @@ import mixin from '../../common/loginPage.mixin.js'; * 完成并提交 */ submit(){ - this.request('user-center/resetPwdBySmsCode',{ - "mobile":this.formData.phone, - "code":this.formData.code, - "password":this.formData.pwd - },(data,result)=>{ - console.log(result); - uni.showToast({ - title: result.msg, - icon: 'none' - }); - if(result.code === 0){ - uni.navigateBack() - } + this.$refs.form.submit() + .then(res=>{ + this.request('user-center/resetPwdBySmsCode',{ + "mobile":this.formData.phone, + "code":this.formData.code, + "password":this.formData.pwd + },(data,result)=>{ + console.log(result); + uni.showToast({ + title: result.msg, + icon: 'none' + }); + if(result.code === 0){ + uni.navigateBack() + } + }) }) } } -- GitLab