Commit bd0c992f by Jianli Ou

对接修改登录密码接口

parent 5286e90b
......@@ -17,9 +17,14 @@ const saveMemberInfo = (params = {}) => {
const saveTycpdmFirmInfo = (params = {}) => {
return POST(`${Prefix}/office/tycpdmfirm/api/save`, params)
}
// 修改登录密码
const saveUpdatePass = (params = {}) => {
return POST(`${Prefix}/office/member/api/updatePass`, params)
}
export default {
memberInfo,
saveMemberInfo,
saveTycpdmFirmInfo
saveTycpdmFirmInfo,
saveUpdatePass
}
<template>
<div class="container2">
<div class="content">
<div class="title">个人资料</div>
<div class="content-from">
<el-form ref='ruleForm'
label-position='right'
label-width='160px'
:model='form'>
<el-form-item label='原密码'
prop='rePassword'
prop='oldPass'
type='password'
:rules="[{required: true,message: '不能为空',},
{ pattern: pwdPattern, message: '密码需要6~16位数字+字母组合',},
{ 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 label='新密码'
prop='password'
prop='newPass'
type='password'
:rules="[{required: true,message: '不能为空',},
{ pattern: pwdPattern, message: '密码需要6~16位数字+字母组合',},
{ 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 label='验证密码'
prop='checkPassword'
prop='affirmPass'
:rules="[
{ required: true,message: '不能为空',},
{ validator: validatePass2 }
]">
<el-input type='password' placeholder="请再次输入密码" v-model='form.checkPassword'
<el-input type='password' placeholder="请再次输入密码" v-model='form.affirmPass'
></el-input>
</el-form-item>
</el-form>
</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>
......@@ -51,47 +51,65 @@ export default {
name: "index",
data() {
return {
loginInfo: {},
hasSent: false,
timer: null,
time: 60,
form: {
rePassword:'',
password:'',
checkPassword:'',
oldPass:'',
newPass:'',
affirmPass:''
},
pwdPattern: /^(?=.*[a-zA-Z])(?=.*[0-9])[A-Za-z0-9]{6,16}$/,
}
},
methods: {
save() {
this.$refs['ruleForm'].validate((valid) => {
if (valid) {
this.saveUpdatePass()
} else {
return false;
}
});
},
resetForm() {
this.$refs['ruleForm'].resetFields()
},
validatePass(rule, value, callback) {
if (this.form.checkPassword !== '') {
this.$refs.ruleForm.validateField('checkPassword');
if (this.form.affirmPass !== '') {
this.$refs.ruleForm.validateField('affirmPass');
}
callback();
},
validatePass2(rule, value, callback) {
if (value !== this.form.password) {
if (value !== this.form.newPass) {
callback(new Error('两次输入密码不一致!'));
} else {
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>
<style lang="scss" scoped>
.container2{
.content{
@include module-box;
margin-top: 14px;
......@@ -108,7 +126,7 @@ export default {
color: #F26335;
}
}
.content-from{
padding:0 40px;
width: 70%;
......@@ -120,10 +138,10 @@ export default {
margin: 40px 0;
}
.content-from-title::before{
content: "◆";
content: "◆";
color: #F26335;
margin-right: 5px;
}
.el-form {
......@@ -134,7 +152,7 @@ export default {
/deep/.el-input{
font-size: 13px;
}
.smallselect{
width: 100px!important;
......@@ -150,7 +168,7 @@ export default {
padding: 0;
border-radius: 4px;
}
.el-select{
width: 100%;
}
......@@ -162,7 +180,7 @@ export default {
.el-input-group__append {
border-color: transparent;
border: none;
button.el-button--primary {
background-color: $theme-color1;
border-color: $theme-color1;
......@@ -188,7 +206,7 @@ export default {
font-size: 13px;
}
}
}
}
.btn-div{
......@@ -211,10 +229,10 @@ export default {
.container2 .content .content-from {
width: 100%;
margin: 0;
padding:0 10px;
}
}
</style>
\ No newline at end of file
</style>
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