|
|
|
@ -127,6 +127,7 @@ |
|
|
|
|
:rules="rules" |
|
|
|
|
label-width="80px" |
|
|
|
|
style="padding: 0 20px" |
|
|
|
|
class="changePassword" |
|
|
|
|
> |
|
|
|
|
<el-form-item label="用户昵称" prop="nickName"> |
|
|
|
|
<el-input v-model="userinform.nickName" size="mini" /> |
|
|
|
@ -145,12 +146,12 @@ |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item class="inforbtn" style="text-align: right"> |
|
|
|
|
<el-button size="mini" @click="submit">保存</el-button> |
|
|
|
|
<el-button |
|
|
|
|
<!-- <el-button |
|
|
|
|
style="background: #ebedf0; color: #808080; border: none" |
|
|
|
|
size="mini" |
|
|
|
|
@click="close" |
|
|
|
|
>关闭</el-button |
|
|
|
|
> |
|
|
|
|
> --> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form> |
|
|
|
|
</el-tab-pane> |
|
|
|
@ -168,12 +169,12 @@ |
|
|
|
|
|
|
|
|
|
<el-form-item class="inforbtn" style="text-align: right"> |
|
|
|
|
<el-button size="mini" @click="saveCom">保存</el-button> |
|
|
|
|
<el-button |
|
|
|
|
<!-- <el-button |
|
|
|
|
style="background: #ebedf0; color: #808080; border: none" |
|
|
|
|
size="mini" |
|
|
|
|
@click="passclose" |
|
|
|
|
>关闭</el-button |
|
|
|
|
> |
|
|
|
|
> --> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form> |
|
|
|
|
</el-tab-pane> |
|
|
|
@ -184,26 +185,24 @@ |
|
|
|
|
:rules="passrules" |
|
|
|
|
label-width="80px" |
|
|
|
|
style="padding: 0 20px" |
|
|
|
|
class="changePassword" |
|
|
|
|
> |
|
|
|
|
<el-form-item label="旧密码" prop="oldPassword"> |
|
|
|
|
<!-- <el-form-item label="旧密码" prop="oldPassword"> |
|
|
|
|
<el-input |
|
|
|
|
v-model="passform.oldPassword" |
|
|
|
|
placeholder="请输入旧密码" |
|
|
|
|
type="password" |
|
|
|
|
size="mini" |
|
|
|
|
/> |
|
|
|
|
</el-form-item> --> |
|
|
|
|
<!-- uuid字段sex --> |
|
|
|
|
<el-form-item label="手机号" prop="phonenumber"> |
|
|
|
|
<el-input v-model="passform.phonenumber" placeholder="请输入手机号" size="mini" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
<!-- <el-form-item label="手机号" prop="mobile"> |
|
|
|
|
<el-input |
|
|
|
|
v-model="passform.mobile" |
|
|
|
|
placeholder="请输入手机号" |
|
|
|
|
size="mini" |
|
|
|
|
/> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="验证码" prop="code"> |
|
|
|
|
<el-form-item label="验证码" prop="remark" class="passphone"> |
|
|
|
|
<el-input |
|
|
|
|
style="width: 390px; margin-right: 10px" |
|
|
|
|
v-model="passform.code" |
|
|
|
|
v-model="passform.remark" |
|
|
|
|
placeholder="请输入验证码" |
|
|
|
|
size="mini" |
|
|
|
|
></el-input> |
|
|
|
@ -212,20 +211,20 @@ |
|
|
|
|
isSending ? '发送中...' : countdown > 0 ? `${countdown}秒后重试` : '发送验证码' |
|
|
|
|
}} |
|
|
|
|
</el-button> |
|
|
|
|
</el-form-item> --> |
|
|
|
|
<el-form-item label="新密码" prop="newPassword"> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="新密码" prop="password"> |
|
|
|
|
<el-input |
|
|
|
|
v-model="passform.newPassword" |
|
|
|
|
v-model="passform.password" |
|
|
|
|
placeholder="请输入新密码" |
|
|
|
|
type="password" |
|
|
|
|
size="mini" |
|
|
|
|
show-password |
|
|
|
|
/> |
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
|
<el-form-item label="确认密码" prop="confirmPassword"> |
|
|
|
|
|
|
|
|
|
<el-form-item label="确认密码" prop="checkPass"> |
|
|
|
|
<el-input |
|
|
|
|
v-model="passform.confirmPassword" |
|
|
|
|
v-model="passform.checkPass" |
|
|
|
|
placeholder="请确认密码" |
|
|
|
|
type="password" |
|
|
|
|
size="mini" |
|
|
|
@ -234,12 +233,12 @@ |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item class="inforbtn" style="text-align: right" label-width="100px"> |
|
|
|
|
<el-button size="mini" @click="passsubmit">保存</el-button> |
|
|
|
|
<el-button |
|
|
|
|
<!-- <el-button |
|
|
|
|
style="background: #ebedf0; color: #808080; border: none" |
|
|
|
|
size="mini" |
|
|
|
|
@click="passclose" |
|
|
|
|
>关闭</el-button |
|
|
|
|
> |
|
|
|
|
> --> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form> |
|
|
|
|
</el-tab-pane> |
|
|
|
@ -272,10 +271,11 @@ import userUpgrade from './userUpgrade' |
|
|
|
|
import { updateUserProfile, updateUserPwd, getUserProfile, saveCompanyInfo } from '@/api/system/user' |
|
|
|
|
import { encrypt, decrypt } from '@/util/encrypt' |
|
|
|
|
import { getCodeUserLogin } from '@/api/system/login' |
|
|
|
|
import { changePasswd } from '@/api/system/user' |
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
const equalToPassword = (rule, value, callback) => { |
|
|
|
|
if (this.passform.newPassword !== value) { |
|
|
|
|
if (this.passform.password !== value) { |
|
|
|
|
callback(new Error('两次输入的密码不一致')) |
|
|
|
|
} else { |
|
|
|
|
callback() |
|
|
|
@ -294,7 +294,7 @@ export default { |
|
|
|
|
userGetFlag: false, |
|
|
|
|
userType: '普通用户', |
|
|
|
|
// userinform:{nickName:'',phonenumber:'',email:'',sex:''}, |
|
|
|
|
passform: { oldPassword: '', newPassword: '', confirmPassword: '' }, |
|
|
|
|
passform: {}, |
|
|
|
|
// 修改信息表单校验 |
|
|
|
|
rules: { |
|
|
|
|
nickName: [{ required: true, message: '用户昵称不能为空', trigger: 'blur' }], |
|
|
|
@ -309,12 +309,14 @@ export default { |
|
|
|
|
}, |
|
|
|
|
// 修改密码表单校验 |
|
|
|
|
passrules: { |
|
|
|
|
oldPassword: [{ required: true, message: '旧密码不能为空', trigger: 'blur' }], |
|
|
|
|
newPassword: [ |
|
|
|
|
phonenumber: [{ required: true, message: '请输入手机号', trigger: 'blur' }], |
|
|
|
|
remark: [{ required: true, message: '请输入验证码', trigger: 'blur' }], |
|
|
|
|
// oldPassword: [{ required: true, message: '旧密码不能为空', trigger: 'blur' }], |
|
|
|
|
password: [ |
|
|
|
|
{ required: true, message: '新密码不能为空', trigger: 'blur' }, |
|
|
|
|
{ min: 6, max: 20, message: '长度在 6 到 20 个字符', trigger: 'blur' }, |
|
|
|
|
], |
|
|
|
|
confirmPassword: [ |
|
|
|
|
checkPass: [ |
|
|
|
|
{ required: true, message: '确认密码不能为空', trigger: 'blur' }, |
|
|
|
|
{ required: true, validator: equalToPassword, trigger: 'blur' }, |
|
|
|
|
], |
|
|
|
@ -390,11 +392,21 @@ export default { |
|
|
|
|
this.$refs.passform.validate((valid) => { |
|
|
|
|
if (valid) { |
|
|
|
|
// updateUserPwd(this.passform.oldPassword, this.passform.newPassword).then(response => { |
|
|
|
|
updateUserPwd(encrypt(this.passform.oldPassword), encrypt(this.passform.newPassword)).then( |
|
|
|
|
(response) => { |
|
|
|
|
const data = { |
|
|
|
|
phonenumber: this.passform.phonenumber, |
|
|
|
|
remark: this.passform.remark, |
|
|
|
|
password: encrypt(this.passform.password), |
|
|
|
|
checkPass: encrypt(this.passform.checkPass), |
|
|
|
|
sex: this.passform.sex, |
|
|
|
|
nickName: this.$store.getters.userinform.nickName, |
|
|
|
|
userName: this.$store.getters.userinform.userName, |
|
|
|
|
} |
|
|
|
|
changePasswd(data).then((response) => { |
|
|
|
|
if (response.code == 200) { |
|
|
|
|
this.$message.success('修改成功') |
|
|
|
|
}, |
|
|
|
|
) |
|
|
|
|
this.passform = {} |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
@ -415,7 +427,7 @@ export default { |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
sendCode() { |
|
|
|
|
if (!/^1[34578]\d{9}$/.test(this.passform.mobile)) { |
|
|
|
|
if (!/^1[34578]\d{9}$/.test(this.passform.phonenumber)) { |
|
|
|
|
return this.$message.error('请输入正确的手机号码') |
|
|
|
|
} |
|
|
|
|
if (this.countdown > 0 || this.isSending) { |
|
|
|
@ -429,13 +441,13 @@ export default { |
|
|
|
|
this.isSending = false |
|
|
|
|
}, 100) // 这里使用2秒的延迟来模拟发送过程,你需要替换为实际的发送逻辑 |
|
|
|
|
// 验证码接口 |
|
|
|
|
getCodeUserLogin(this.passform.mobile).then((res) => { |
|
|
|
|
getCodeUserLogin(this.passform.phonenumber).then((res) => { |
|
|
|
|
this.isSending = false |
|
|
|
|
if (res.code == 200) { |
|
|
|
|
this.passform.uuid = res.uuid |
|
|
|
|
this.passform.sex = res.uuid |
|
|
|
|
this.$message.success('短信发送成功,请注意查收') |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
startCountdown() { |
|
|
|
|
this.countdown = 60 |
|
|
|
@ -450,6 +462,20 @@ export default { |
|
|
|
|
} |
|
|
|
|
</script> |
|
|
|
|
<style scoped> |
|
|
|
|
.changePassword >>> .el-input--mini .el-input__inner { |
|
|
|
|
height: 40px; |
|
|
|
|
} |
|
|
|
|
.passphone >>> .el-input { |
|
|
|
|
margin-right: 0 !important; |
|
|
|
|
width: 476px !important; |
|
|
|
|
} |
|
|
|
|
.passphone >>> .el-button { |
|
|
|
|
height: 40px; |
|
|
|
|
border: none; |
|
|
|
|
background: #0066eb; |
|
|
|
|
border-radius: 0px 2px 2px 0px !important; |
|
|
|
|
color: #FFFFFF; |
|
|
|
|
} |
|
|
|
|
.dvied { |
|
|
|
|
width: 4px; |
|
|
|
|
height: 18px; |
|
|
|
@ -481,7 +507,7 @@ export default { |
|
|
|
|
.inforbtn >>> .el-button { |
|
|
|
|
width: 90px; |
|
|
|
|
height: 34px; |
|
|
|
|
background: #0054a7; |
|
|
|
|
background: #0066EB; |
|
|
|
|
border-radius: 4px; |
|
|
|
|
color: #ffffff; |
|
|
|
|
} |
|
|
|
|