| | |
| | | :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 |
| | |
| | | <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"> |
| | |
| | | <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> |
| | |
| | | }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 |
| | |
| | | ) { |
| | | this.level.push('low') |
| | | this.level.push('middle') |
| | | return callback() |
| | | return callback('密码强度过低') |
| | | }else if( |
| | | /^[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘',。、A-Za-z]+$/.test( |
| | | value |
| | |
| | | ) { |
| | | this.level.push('low') |
| | | this.level.push('middle') |
| | | return callback() |
| | | return callback('密码强度过低') |
| | | } else if ( |
| | | /^[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘',。、A-Za-z\d]+$/.test( |
| | | value |
| | |
| | | return callback() |
| | | }; |
| | | return { |
| | | isShowPassword: true, |
| | | level:[], //密码强度数组 |
| | | userInfo: {}, |
| | | checkboxValue: [], |
| | |
| | | modelForm: { |
| | | originalPassword:'', //原始密码 |
| | | password: '', //新密码 |
| | | secondPassword: '' //二次确认密码 |
| | | secondPassword: '', //二次确认密码 |
| | | username:'', |
| | | userId:'' |
| | | }, |
| | | processLoading: false, |
| | | rules: { |
| | | originalPassword: [{ |
| | | type: 'string', |
| | | required: true, |
| | | required: this.isShowPassword, |
| | | message: '请填写密码', |
| | | trigger: ['blur', 'change'] |
| | | } |
| | |
| | | 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') |
| | | } |
| | | }, |
| | |
| | | } else { |
| | | 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) |
| | |
| | | } |
| | | 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('修改成功,即将回到首页') |
| | |
| | | }).finally(() => { |
| | | this.processLoading = false; |
| | | }) |
| | | }).catch(errors => { |
| | | uni.$u.toast('请填写完整信息') |
| | | }) |
| | | |
| | | // }).catch(errors => { |
| | | // uni.$u.toast('校验失败') |
| | | // }) |