From 83b6d61b9e8d0360bb3aa363610a38e680c7b1c9 Mon Sep 17 00:00:00 2001 From: yangan <yangan0921@163.com> Date: 星期五, 23 八月 2024 11:10:31 +0800 Subject: [PATCH] feat:一键登录loading问题 --- pages/login/resetPassword/resetPassword.vue | 82 ++++++++++++++++++++++++---------------- 1 files changed, 49 insertions(+), 33 deletions(-) diff --git a/pages/login/resetPassword/resetPassword.vue b/pages/login/resetPassword/resetPassword.vue index 3dcfc2b..4ab6b80 100644 --- a/pages/login/resetPassword/resetPassword.vue +++ b/pages/login/resetPassword/resetPassword.vue @@ -5,21 +5,24 @@ :rules="rules" ref="uForm" label-width="80px"> - <u-form-item prop="originalPassword" - label="鍘熷瘑鐮�" - required - borderBottom> - <u-input v-if='inputType==="password"' - v-model="modelForm.originalPassword" - border="surround" - placeholder="璇疯緭鍏ュ瘑鐮�(浠呮敮鎸佹暟瀛楀瓧姣嶄笅鍒掔嚎)" - :type='inputType' /> - <u-input v-else - v-model="modelForm.originalPassword" - border="surround" - placeholder="璇疯緭鍏ュ瘑鐮�(浠呮敮鎸佹暟瀛楀瓧姣嶄笅鍒掔嚎)" - :type='inputType' /> - </u-form-item> + <template v-if="isShowPassword"> + <u-form-item + prop="originalPassword" + label="鍘熷瘑鐮�" + required + borderBottom> + <u-input v-if='inputType==="password"' + v-model="modelForm.originalPassword" + border="surround" + placeholder="瀵嗙爜搴旂敱8-16浣嶆暟瀛椼�佸瓧姣嶃�佺鍙风粍鎴愩��" + :type='inputType' /> + <u-input v-else + v-model="modelForm.originalPassword" + border="surround" + placeholder="瀵嗙爜搴旂敱8-16浣嶆暟瀛椼�佸瓧姣嶃�佺鍙风粍鎴愩��" + :type='inputType' /> + </u-form-item> + </template> <u-form-item prop="password" label="鏂板瘑鐮�" required @@ -27,12 +30,12 @@ <u-input v-if='inputType==="password"' v-model="modelForm.password" border="surround" - placeholder="璇疯緭鍏ュ瘑鐮�(浠呮敮鎸佹暟瀛楀瓧姣嶄笅鍒掔嚎)" + placeholder="瀵嗙爜搴旂敱8-16浣嶆暟瀛椼�佸瓧姣嶃�佺鍙风粍鎴愩��" :type='inputType' /> <u-input v-else v-model="modelForm.password" border="surround" - placeholder="璇疯緭鍏ュ瘑鐮�(浠呮敮鎸佹暟瀛楀瓧姣嶄笅鍒掔嚎)" + placeholder="瀵嗙爜搴旂敱8-16浣嶆暟瀛椼�佸瓧姣嶃�佺鍙风粍鎴愩��" :type='inputType' /> </u-form-item> <view class="intensity"> @@ -57,12 +60,12 @@ <u-input v-if='inputType==="password"' v-model="modelForm.secondPassword" border="surround" - placeholder="璇峰啀娆¤緭鍏ュ瘑鐮�(浠呮敮鎸佹暟瀛楀瓧姣嶄笅鍒掔嚎)" + placeholder="璇峰啀娆¤緭鍏ュ瘑鐮�" type='password' /> <u-input v-else v-model="modelForm.secondPassword" border="surround" - placeholder="璇峰啀娆¤緭鍏ュ瘑鐮�(浠呮敮鎸佹暟瀛楀瓧姣嶄笅鍒掔嚎)" + placeholder="璇峰啀娆¤緭鍏ュ瘑鐮�" type='text' /> </u-form-item> <u-form-item> @@ -139,7 +142,7 @@ }else if(/^[A-Za-z\d]+$/.test(value)) { this.level.push('low') this.level.push('middle') - return callback() + return callback('瀵嗙爜寮哄害杩囦綆') }else if( /^[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]路~锛丂#锟�%鈥︹��&*锛堬級鈥斺�擻-+={}|銆娿�嬶紵锛氣�溾�濄�愩�戙�侊紱鈥�'锛屻�傘�乗d]+$/.test( value @@ -147,7 +150,7 @@ ) { this.level.push('low') this.level.push('middle') - return callback() + return callback('瀵嗙爜寮哄害杩囦綆') }else if( /^[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]路~锛丂#锟�%鈥︹��&*锛堬級鈥斺�擻-+={}|銆娿�嬶紵锛氣�溾�濄�愩�戙�侊紱鈥�'锛屻�傘�丄-Za-z]+$/.test( value @@ -155,7 +158,7 @@ ) { this.level.push('low') this.level.push('middle') - return callback() + return callback('瀵嗙爜寮哄害杩囦綆') } else if ( /^[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]路~锛丂#锟�%鈥︹��&*锛堬級鈥斺�擻-+={}|銆娿�嬶紵锛氣�溾�濄�愩�戙�侊紱鈥�'锛屻�傘�丄-Za-z\d]+$/.test( value @@ -168,6 +171,7 @@ return callback() }; return { + isShowPassword: true, level:[], //瀵嗙爜寮哄害鏁扮粍 userInfo: {}, checkboxValue: [], @@ -176,13 +180,15 @@ modelForm: { originalPassword:'', //鍘熷瀵嗙爜 password: '', //鏂板瘑鐮� - secondPassword: '' //浜屾纭瀵嗙爜 + secondPassword: '', //浜屾纭瀵嗙爜 + username:'', + userId:'' }, processLoading: false, rules: { originalPassword: [{ type: 'string', - required: true, + required: this.isShowPassword, message: '璇峰~鍐欏瘑鐮�', trigger: ['blur', 'change'] } @@ -205,7 +211,9 @@ return uni.getStorageSync('roleType') }, userId() { - console.log(uni.getStorageSync('userId'),'userId=========') + if(uni.getStorageSync('userId')) { + this.modelForm.userId = uni.getStorageSync('userId') + } return uni.getStorageSync('userId') } }, @@ -213,9 +221,22 @@ if (this.roleType === 3) { this.userInfo = JSON.parse(params.userInfo) } else { - this.getUserInfo(params.phone, params.idCard) + if(params.phone && params.idCard){ + this.getUserInfo(params.phone, params.idCard) + } } - + if(params.userInfo) { + console.log(JSON.parse(params.userInfo),'userInfo====') + this.modelForm.username = JSON.parse(params.userInfo).username + this.modelForm.userId = JSON.parse(params.userInfo).userId.toString() //userId + if(JSON.parse(params.userInfo).isShowPassword) { + this.isShowPassword = false + }else { + this.isShowPassword = true + } + }else { + this.isShowPassword = true + } }, onReady() { this.$refs.uForm.setRules(this.rules) @@ -250,9 +271,7 @@ } this.$refs.uForm.validate().then(res => { this.processLoading = true; - let params = Object.assign({},this.modelForm, {userId:this.userId.toString()}) - console.log(params,'params=====') - this.$reqAllJson('appUpdateById', params, { method: 'PUT', 'Content-type': 'application/json' }).then(res => { + this.$reqAllJson('appUpdateById', this.modelForm, { method: 'PUT', 'Content-type': 'application/json' }).then(res => { this.processLoading = false; if (res.code === 0) { this.$u.toast('淇敼鎴愬姛,鍗冲皢鍥炲埌棣栭〉') @@ -269,10 +288,7 @@ }).finally(() => { this.processLoading = false; }) - }).catch(errors => { - uni.$u.toast('璇峰~鍐欏畬鏁翠俊鎭�') }) - // }).catch(errors => { // uni.$u.toast('鏍¢獙澶辫触') // }) -- Gitblit v1.9.1