Commit bd0c992f by Jianli Ou

对接修改登录密码接口

parent 5286e90b
...@@ -17,9 +17,14 @@ const saveMemberInfo = (params = {}) => { ...@@ -17,9 +17,14 @@ const saveMemberInfo = (params = {}) => {
const saveTycpdmFirmInfo = (params = {}) => { const saveTycpdmFirmInfo = (params = {}) => {
return POST(`${Prefix}/office/tycpdmfirm/api/save`, params) return POST(`${Prefix}/office/tycpdmfirm/api/save`, params)
} }
// 修改登录密码
const saveUpdatePass = (params = {}) => {
return POST(`${Prefix}/office/member/api/updatePass`, params)
}
export default { export default {
memberInfo, memberInfo,
saveMemberInfo, saveMemberInfo,
saveTycpdmFirmInfo saveTycpdmFirmInfo,
saveUpdatePass
} }
...@@ -10,36 +10,36 @@ ...@@ -10,36 +10,36 @@
label-width='160px' label-width='160px'
:model='form'> :model='form'>
<el-form-item label='原密码' <el-form-item label='原密码'
prop='rePassword' prop='oldPass'
type='password' type='password'
:rules="[{required: true,message: '不能为空',}, :rules="[{required: true,message: '不能为空',},
{ pattern: pwdPattern, message: '密码需要6~16位数字+字母组合',}, { pattern: pwdPattern, message: '密码需要6~16位数字+字母组合',},
{ validator:validatePass,}]"> { validator:validatePass,}]">
<el-input type='password' placeholder="请输入原密码" v-model='form.rePassword'></el-input> <el-input type='password' placeholder="请输入原密码" v-model='form.oldPass'></el-input>
</el-form-item> </el-form-item>
<el-form-item label='新密码' <el-form-item label='新密码'
prop='password' prop='newPass'
type='password' type='password'
:rules="[{required: true,message: '不能为空',}, :rules="[{required: true,message: '不能为空',},
{ pattern: pwdPattern, message: '密码需要6~16位数字+字母组合',}, { pattern: pwdPattern, message: '密码需要6~16位数字+字母组合',},
{ validator:validatePass,}]"> { validator:validatePass,}]">
<el-input type='password' placeholder="请输入新密码" v-model='form.password'></el-input> <el-input type='password' placeholder="请输入新密码" v-model='form.newPass'></el-input>
</el-form-item> </el-form-item>
<el-form-item label='验证密码' <el-form-item label='验证密码'
prop='checkPassword' prop='affirmPass'
:rules="[ :rules="[
{ required: true,message: '不能为空',}, { required: true,message: '不能为空',},
{ validator: validatePass2 } { validator: validatePass2 }
]"> ]">
<el-input type='password' placeholder="请再次输入密码" v-model='form.checkPassword' <el-input type='password' placeholder="请再次输入密码" v-model='form.affirmPass'
></el-input> ></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<div class="btn-div"> <div class="btn-div">
<el-button type="primary" style="width: 110px">保 存</el-button> <el-button type="primary" @click="save" style="width: 110px">保 存</el-button>
</div> </div>
</div> </div>
</div> </div>
...@@ -51,40 +51,58 @@ export default { ...@@ -51,40 +51,58 @@ export default {
name: "index", name: "index",
data() { data() {
return { return {
loginInfo: {},
hasSent: false, hasSent: false,
timer: null, timer: null,
time: 60, time: 60,
form: { form: {
rePassword:'', oldPass:'',
password:'', newPass:'',
checkPassword:'', affirmPass:''
}, },
pwdPattern: /^(?=.*[a-zA-Z])(?=.*[0-9])[A-Za-z0-9]{6,16}$/, pwdPattern: /^(?=.*[a-zA-Z])(?=.*[0-9])[A-Za-z0-9]{6,16}$/,
} }
}, },
methods: { methods: {
save() {
this.$refs['ruleForm'].validate((valid) => {
if (valid) {
this.saveUpdatePass()
} else {
return false;
}
});
},
resetForm() {
this.$refs['ruleForm'].resetFields()
},
validatePass(rule, value, callback) { validatePass(rule, value, callback) {
if (this.form.checkPassword !== '') { if (this.form.affirmPass !== '') {
this.$refs.ruleForm.validateField('checkPassword'); this.$refs.ruleForm.validateField('affirmPass');
} }
callback(); callback();
}, },
validatePass2(rule, value, callback) { validatePass2(rule, value, callback) {
if (value !== this.form.password) { if (value !== this.form.newPass) {
callback(new Error('两次输入密码不一致!')); callback(new Error('两次输入密码不一致!'));
} else { } else {
callback(); callback();
} }
}, },
async saveUpdatePass() {
this.form['id'] = this.loginInfo.id
const result = await this.$api.myManage.saveUpdatePass(this.form)
if (result.success) {
this.$message.success('密码修改成功')
this.resetForm()
} else {
this.$message.error(result.returnMsg)
}
}
}, },
mounted() {
this.loginInfo = JSON.parse(localStorage.getItem('loginInfo'))
}
} }
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment