<!--
|
* @Author: 小明丶
|
* @Date: 2019-08-20 18:12:00
|
* @LastEditors: 小明丶
|
* @LastEditTime: 2020-11-19 16:41:42
|
* @Description:
|
-->
|
<!--
|
修改密码
|
-->
|
<template>
|
<div class="reset-pwd h-100-g">
|
<v-navbar title="修改密码" fixed></v-navbar>
|
|
|
<div class="cell-group">
|
<v-cell v-model="form.oldPwd" label='原密码' placeholder="请输入原密码"></v-cell>
|
<v-cell v-model="form.newPwd" label='新密码' placeholder="请输入8-16位数字字母组合密码"></v-cell>
|
<v-cell v-model="form.rePwd" label='确认新密码' placeholder="请再次输入新密码"></v-cell>
|
</div>
|
|
|
<footer class="flex-center-g footer">
|
<van-button class="btn" :color="$store.state.backColor" @click="reSetPwd">确认修改</van-button>
|
</footer>
|
</div>
|
</template>
|
|
<script>
|
import md5 from 'blueimp-md5';
|
import {
|
SET_SESSION_ID,
|
SET_USER_INFO
|
} from '@/store/mutations-types';
|
import {
|
mapState,
|
mapMutations
|
} from 'vuex';
|
export default {
|
name: "reset-pwd",
|
data() {
|
return {
|
form: {
|
oldPwd: '',
|
newPwd: '',
|
rePwd: ''
|
},
|
|
rule: [{
|
key: "oldPwd",
|
message: "请输入原密码",
|
type: "isEmpty"
|
},
|
{
|
key: "newPwd",
|
message: "请输入新密码",
|
type: "isEmpty"
|
},
|
{
|
key: "newPwd",
|
message: "请设置8-16位数字+字母组合密码",
|
type: "isPassword"
|
},
|
]
|
}
|
},
|
computed: {
|
...mapState(['userinfo'])
|
},
|
methods: {
|
...mapMutations([SET_USER_INFO, SET_SESSION_ID]),
|
// 验证form参数
|
validatorForm() {
|
return this.$validator(this.form, this.rule).check(item => {
|
this.$notify(item.message)
|
})
|
},
|
|
reSetPwd() {
|
if (!this.validatorForm()) return
|
if (this.form.newPwd === this.form.oldPwd) {
|
this.$notify('新密码不能与旧密码相同');
|
return;
|
}
|
if (this.form.newPwd !== this.form.rePwd) {
|
this.$notify('两次输入新密码不一致');
|
return;
|
}
|
|
let _mblNo = this.userinfo.mblNo;
|
let obj = {
|
newPwd: md5(_mblNo + this.form.newPwd),
|
oldPwd: md5(_mblNo + this.form.oldPwd)
|
};
|
this.$api.userUpdatePwd(obj).then(res => {
|
this.$notify('修改成功!')
|
//删除信息 重新登录
|
this.SET_USER_INFO({});
|
this.SET_SESSION_ID('');
|
localStorage.removeItem('user_account')
|
localStorage.removeItem('user_pwd')
|
if(sessionStorage.isddxt == 1){
|
this.$router.push('/?platNo=ddxt')
|
}else{
|
this.$router.push('/')
|
}
|
|
})
|
},
|
}
|
}
|
</script>
|
|
<style scoped lang="less">
|
.reset-pwd {
|
padding-top: 44px;
|
background-color: @c-f5;
|
|
.cell-group {
|
margin: 10px auto 0 auto;
|
width: 360px;
|
}
|
|
|
.btn {
|
width: 340px;
|
height: 44px;
|
border: none;
|
font-size: @font-16;
|
border-radius: 22px;
|
background-color: @c-bg-default;
|
color: @c-text-fff;
|
|
}
|
|
.footer {
|
margin-top: 25px;
|
padding-bottom: 30px;
|
}
|
|
}
|
</style>
|