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
} }
<template> <template>
<div class="container2"> <div class="container2">
<div class="content"> <div class="content">
<div class="title">个人资料</div> <div class="title">个人资料</div>
<div class="content-from"> <div class="content-from">
<el-form ref='ruleForm' <el-form ref='ruleForm'
label-position='right' label-position='right'
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,47 +51,65 @@ export default { ...@@ -51,47 +51,65 @@ 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>
<style lang="scss" scoped> <style lang="scss" scoped>
.container2{ .container2{
.content{ .content{
@include module-box; @include module-box;
margin-top: 14px; margin-top: 14px;
...@@ -108,7 +126,7 @@ export default { ...@@ -108,7 +126,7 @@ export default {
color: #F26335; color: #F26335;
} }
} }
.content-from{ .content-from{
padding:0 40px; padding:0 40px;
width: 70%; width: 70%;
...@@ -120,10 +138,10 @@ export default { ...@@ -120,10 +138,10 @@ export default {
margin: 40px 0; margin: 40px 0;
} }
.content-from-title::before{ .content-from-title::before{
content: "◆"; content: "◆";
color: #F26335; color: #F26335;
margin-right: 5px; margin-right: 5px;
} }
.el-form { .el-form {
...@@ -134,7 +152,7 @@ export default { ...@@ -134,7 +152,7 @@ export default {
/deep/.el-input{ /deep/.el-input{
font-size: 13px; font-size: 13px;
} }
.smallselect{ .smallselect{
width: 100px!important; width: 100px!important;
...@@ -150,7 +168,7 @@ export default { ...@@ -150,7 +168,7 @@ export default {
padding: 0; padding: 0;
border-radius: 4px; border-radius: 4px;
} }
.el-select{ .el-select{
width: 100%; width: 100%;
} }
...@@ -162,7 +180,7 @@ export default { ...@@ -162,7 +180,7 @@ export default {
.el-input-group__append { .el-input-group__append {
border-color: transparent; border-color: transparent;
border: none; border: none;
button.el-button--primary { button.el-button--primary {
background-color: $theme-color1; background-color: $theme-color1;
border-color: $theme-color1; border-color: $theme-color1;
...@@ -188,7 +206,7 @@ export default { ...@@ -188,7 +206,7 @@ export default {
font-size: 13px; font-size: 13px;
} }
} }
} }
} }
.btn-div{ .btn-div{
...@@ -211,10 +229,10 @@ export default { ...@@ -211,10 +229,10 @@ export default {
.container2 .content .content-from { .container2 .content .content-from {
width: 100%; width: 100%;
margin: 0; margin: 0;
padding:0 10px; padding:0 10px;
} }
} }
</style> </style>
\ No newline at end of file
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