|
|
@ -28,7 +28,9 @@ |
|
|
|
<el-button type="text" size="small" @click="bindPassword">更换</el-button> |
|
|
|
<el-button type="text" size="small" @click="bindPassword">更换</el-button> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item prop="email" label="电子邮箱"> |
|
|
|
<el-form-item prop="email" label="电子邮箱"> |
|
|
|
<el-input v-model.trim="form.email" placeholder="请输入电子邮箱"></el-input> |
|
|
|
<el-input class="m-r-10" style="width: 243px;" v-model.trim="form.email" placeholder="请输入电子邮箱" |
|
|
|
|
|
|
|
disabled></el-input> |
|
|
|
|
|
|
|
<el-button type="text" size="small" @click="bindEmail">{{ form.email ? '更换' : '绑定' }}</el-button> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item prop="sex" label="性别"> |
|
|
|
<el-form-item prop="sex" label="性别"> |
|
|
|
<el-radio v-model="form.sex" :label="1">男</el-radio> |
|
|
|
<el-radio v-model="form.sex" :label="1">男</el-radio> |
|
|
@ -64,16 +66,22 @@ |
|
|
|
<el-button type="primary" size="small" @click="submit">更新</el-button> |
|
|
|
<el-button type="primary" size="small" @click="submit">更新</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<el-dialog :title="form.email ? '更换邮箱' : '绑定邮箱'" :visible.sync="emailVisible" :close-on-click-modal="false" |
|
|
|
<el-dialog :title="form.email ? '更换邮箱' : '绑定邮箱'" :visible.sync="emailVisible" :close-on-click-modal="false" |
|
|
|
@close="closeEmail" width="30%"> |
|
|
|
@close="closeEmail" width="400px"> |
|
|
|
<el-form ref="form" :model="form" label-width="60px"> |
|
|
|
<el-form ref="form" :model="form" label-width="60px"> |
|
|
|
<el-form-item label="邮箱"> |
|
|
|
<el-form-item label="邮箱" ref="diaEmailItem"> |
|
|
|
<el-input placeholder="请输入邮箱" v-model="email"></el-input> |
|
|
|
<el-input placeholder="请输入邮箱" v-model="email" @input="checkAccountByEmail"> |
|
|
|
|
|
|
|
<img v-if="diaClientExist" slot="suffix" class="correct-icon" src="@/assets/images/login/correct.svg" |
|
|
|
|
|
|
|
alt=""> |
|
|
|
|
|
|
|
</el-input> |
|
|
|
|
|
|
|
<p v-if="diaClientMsg" class="el-form-item__error">{{ diaClientMsg }}</p> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="验证码"> |
|
|
|
<el-form-item label="验证码"> |
|
|
|
<div class="flex-between"> |
|
|
|
<div class="flex-between"> |
|
|
|
<el-input v-model="emailCode" placeholder="请输入验证码" maxlength="6"></el-input> |
|
|
|
<el-input v-model="emailCode" placeholder="请输入验证码" maxlength="6" :disabled="!diaClientExist"></el-input> |
|
|
|
<el-button style="margin-left: 10px" type="text" @click="sendEmailCode" :disabled="emailDisabled">{{ |
|
|
|
<el-button style="margin-left: 10px" type="text" @click="sendEmailCode" |
|
|
|
|
|
|
|
:disabled="emailDisabled || !diaClientExist">{{ |
|
|
|
emailBtnText }}</el-button> |
|
|
|
emailBtnText }}</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
@ -83,6 +91,7 @@ |
|
|
|
<el-button type="primary" @click="emailSubmit">确 定</el-button> |
|
|
|
<el-button type="primary" @click="emailSubmit">确 定</el-button> |
|
|
|
</span> |
|
|
|
</span> |
|
|
|
</el-dialog> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
|
|
<el-dialog :title="form.phone ? '更换手机号' : '绑定手机号'" :visible.sync="phoneVisible" :close-on-click-modal="false" |
|
|
|
<el-dialog :title="form.phone ? '更换手机号' : '绑定手机号'" :visible.sync="phoneVisible" :close-on-click-modal="false" |
|
|
|
@close="closePhone" width="400px"> |
|
|
|
@close="closePhone" width="400px"> |
|
|
|
<el-form ref="form" :model="form" label-width="60px"> |
|
|
|
<el-form ref="form" :model="form" label-width="60px"> |
|
|
@ -95,8 +104,9 @@ |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="验证码"> |
|
|
|
<el-form-item label="验证码"> |
|
|
|
<div class="flex-between"> |
|
|
|
<div class="flex-between"> |
|
|
|
<el-input v-model="phoneCode" placeholder="请输入验证码" maxlength="6"></el-input> |
|
|
|
<el-input v-model="phoneCode" placeholder="请输入验证码" maxlength="6" :disabled="!diaClientExist"></el-input> |
|
|
|
<el-button style="margin-left: 10px" type="text" @click="sendPhoneCode" :disabled="phoneDisabled">{{ |
|
|
|
<el-button style="margin-left: 10px" type="text" @click="sendPhoneCode" |
|
|
|
|
|
|
|
:disabled="phoneDisabled || !diaClientExist">{{ |
|
|
|
phoneBtnText }}</el-button> |
|
|
|
phoneBtnText }}</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
@ -106,6 +116,7 @@ |
|
|
|
<el-button type="primary" @click="phoneSubmit">确 定</el-button> |
|
|
|
<el-button type="primary" @click="phoneSubmit">确 定</el-button> |
|
|
|
</span> |
|
|
|
</span> |
|
|
|
</el-dialog> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
|
|
<el-dialog title="更换密码" :visible.sync="pwdVisible" :close-on-click-modal="false" @close="closePassword" width="30%"> |
|
|
|
<el-dialog title="更换密码" :visible.sync="pwdVisible" :close-on-click-modal="false" @close="closePassword" width="30%"> |
|
|
|
<el-form ref="pwdForm" :model="form" label-width="60px"> |
|
|
|
<el-form ref="pwdForm" :model="form" label-width="60px"> |
|
|
|
<el-form-item label="原密码"> |
|
|
|
<el-form-item label="原密码"> |
|
|
@ -125,17 +136,6 @@ |
|
|
|
<el-button type="primary" @click="editPassword">确 定</el-button> |
|
|
|
<el-button type="primary" @click="editPassword">确 定</el-button> |
|
|
|
</span> |
|
|
|
</span> |
|
|
|
</el-dialog> |
|
|
|
</el-dialog> |
|
|
|
<el-dialog title="修改账号" :visible.sync="accountVisible" :close-on-click-modal="false" width="30%"> |
|
|
|
|
|
|
|
<el-form label-width="70px"> |
|
|
|
|
|
|
|
<el-form-item label="账号"> |
|
|
|
|
|
|
|
<el-input v-model="editUsername" placeholder="请输入账号"></el-input> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
</el-form> |
|
|
|
|
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
|
|
|
|
<el-button size="small" @click="accountVisible = false">取 消</el-button> |
|
|
|
|
|
|
|
<el-button size="small" type="primary" @click="confirmAccount">确 定</el-button> |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
@ -151,10 +151,9 @@ export default { |
|
|
|
headers: { |
|
|
|
headers: { |
|
|
|
token: localStorage.getItem('expert_token') |
|
|
|
token: localStorage.getItem('expert_token') |
|
|
|
}, |
|
|
|
}, |
|
|
|
editUsername: '', |
|
|
|
|
|
|
|
accountVisible: false, |
|
|
|
|
|
|
|
updateTime: 0, |
|
|
|
updateTime: 0, |
|
|
|
phoneReg: /^1[3456789]\d{9}$/, |
|
|
|
phoneReg: /^1[3456789]\d{9}$/, |
|
|
|
|
|
|
|
mailReg: /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/, |
|
|
|
form: { |
|
|
|
form: { |
|
|
|
accountId: '', |
|
|
|
accountId: '', |
|
|
|
userName: '', |
|
|
|
userName: '', |
|
|
@ -273,26 +272,7 @@ export default { |
|
|
|
changeAvatar (res) { |
|
|
|
changeAvatar (res) { |
|
|
|
this.setAvatar(res.message) |
|
|
|
this.setAvatar(res.message) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 显示修改账号弹框 |
|
|
|
|
|
|
|
showAccount () { |
|
|
|
|
|
|
|
this.accountVisible = true |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 修改账号 |
|
|
|
|
|
|
|
confirmAccount () { |
|
|
|
|
|
|
|
if (this.editUsername) { |
|
|
|
|
|
|
|
form.username = this.editUsername |
|
|
|
|
|
|
|
this.accountVisible = false |
|
|
|
|
|
|
|
const { form } = this |
|
|
|
|
|
|
|
this.$put(this.api.user, form).then(res => { |
|
|
|
|
|
|
|
this.setUserName(form.username) |
|
|
|
|
|
|
|
this.$message.success("提交成功!") |
|
|
|
|
|
|
|
}).catch(res => { }) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
Util.errorMsg('请输入账号') |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
bindEmail () { |
|
|
|
bindEmail () { |
|
|
|
this.email = this.form.email |
|
|
|
|
|
|
|
this.emailVisible = true |
|
|
|
this.emailVisible = true |
|
|
|
}, |
|
|
|
}, |
|
|
|
bindPhone () { |
|
|
|
bindPhone () { |
|
|
@ -367,10 +347,31 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
closeEmail () { |
|
|
|
closeEmail () { |
|
|
|
|
|
|
|
this.email = '' |
|
|
|
|
|
|
|
this.emailCode = '' |
|
|
|
|
|
|
|
this.diaClientMsg = '' |
|
|
|
|
|
|
|
this.diaClientExist = false |
|
|
|
if (!this.emailDisabled) { |
|
|
|
if (!this.emailDisabled) { |
|
|
|
this.emailCode = ""; |
|
|
|
this.emailCode = ""; |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
// 邮箱输入完回调 |
|
|
|
|
|
|
|
async checkAccountByEmail (val) { |
|
|
|
|
|
|
|
if (!this.mailReg.test(val)) { |
|
|
|
|
|
|
|
this.$refs.diaEmailItem.clearValidate() |
|
|
|
|
|
|
|
this.diaClientMsg = '请输入正确的邮箱' |
|
|
|
|
|
|
|
this.diaClientExist = false |
|
|
|
|
|
|
|
this.emailCode = '' |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
const { message } = await this.$get(`${this.api.forgotPreVerification}?phoneOrEmail=${val}&platform=${Setting.platformId}`) |
|
|
|
|
|
|
|
const exist = message !== 'success' // 用户已存在 |
|
|
|
|
|
|
|
this.diaClientExist = exist |
|
|
|
|
|
|
|
this.diaClientMsg = exist ? '' : '该邮箱已注册!' |
|
|
|
|
|
|
|
} catch (e) { } |
|
|
|
|
|
|
|
}, |
|
|
|
sendEmailCode () { |
|
|
|
sendEmailCode () { |
|
|
|
if (!this.email) return Util.warningMsg("请输入邮箱") |
|
|
|
if (!this.email) return Util.warningMsg("请输入邮箱") |
|
|
|
if (!/^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(this.email)) return Util.warningMsg("请输入正确的邮箱") |
|
|
|
if (!/^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(this.email)) return Util.warningMsg("请输入正确的邮箱") |
|
|
@ -390,7 +391,7 @@ export default { |
|
|
|
if (!this.email) return Util.warningMsg("请输入邮箱") |
|
|
|
if (!this.email) return Util.warningMsg("请输入邮箱") |
|
|
|
if (!/^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(this.email)) return Util.warningMsg("请输入正确的邮箱") |
|
|
|
if (!/^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(this.email)) return Util.warningMsg("请输入正确的邮箱") |
|
|
|
if (!this.emailCode) return Util.warningMsg("请输入验证码") |
|
|
|
if (!this.emailCode) return Util.warningMsg("请输入验证码") |
|
|
|
this.$put(this.api.bindPhoneOrEmail, { |
|
|
|
this.$post(this.api.bindPhoneOrEmail, { |
|
|
|
userId: this.userId, |
|
|
|
userId: this.userId, |
|
|
|
email: this.email, |
|
|
|
email: this.email, |
|
|
|
types: 1, |
|
|
|
types: 1, |
|
|
@ -403,21 +404,26 @@ export default { |
|
|
|
}).catch(res => { }) |
|
|
|
}).catch(res => { }) |
|
|
|
}, |
|
|
|
}, |
|
|
|
closePhone () { |
|
|
|
closePhone () { |
|
|
|
if (!this.emailDisabled) { |
|
|
|
this.phone = '' |
|
|
|
this.emailCode = '' |
|
|
|
this.phoneCode = '' |
|
|
|
|
|
|
|
this.diaClientMsg = '' |
|
|
|
|
|
|
|
this.diaClientExist = false |
|
|
|
|
|
|
|
if (!this.phoneDisabled) { |
|
|
|
|
|
|
|
this.phoneCode = '' |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 手机号输入完回调。有账号才能继续操作。type:0手机验证码登录,1重置密码 |
|
|
|
// 手机号输入完回调 |
|
|
|
async checkAccountByPhone (val) { |
|
|
|
async checkAccountByPhone (val) { |
|
|
|
if (!this.phoneReg.test(val)) { |
|
|
|
if (!this.phoneReg.test(val)) { |
|
|
|
this.$refs.diaPhoneItem.clearValidate() |
|
|
|
this.$refs.diaPhoneItem.clearValidate() |
|
|
|
this.diaClientMsg = '请输入正确的手机号' |
|
|
|
this.diaClientMsg = '请输入正确的手机号' |
|
|
|
this.diaClientExist = false |
|
|
|
this.diaClientExist = false |
|
|
|
|
|
|
|
this.phoneCode = '' |
|
|
|
return false |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
const { message } = await this.$get(`${this.api.forgotPreVerification}?phoneOrEmail=${val}&platform=4`) |
|
|
|
const { message } = await this.$get(`${this.api.forgotPreVerification}?phoneOrEmail=${val}&platform=${Setting.platformId}`) |
|
|
|
const exist = message !== 'success' // 用户已存在 |
|
|
|
const exist = message !== 'success' // 用户已存在 |
|
|
|
this.diaClientExist = exist |
|
|
|
this.diaClientExist = exist |
|
|
|
this.diaClientMsg = exist ? '' : '该手机号已注册!' |
|
|
|
this.diaClientMsg = exist ? '' : '该手机号已注册!' |
|
|
@ -456,8 +462,7 @@ export default { |
|
|
|
Util.successMsg("绑定成功"); |
|
|
|
Util.successMsg("绑定成功"); |
|
|
|
this.form.phone = this.phone; |
|
|
|
this.form.phone = this.phone; |
|
|
|
this.phoneVisible = false; |
|
|
|
this.phoneVisible = false; |
|
|
|
}).catch(res => { |
|
|
|
}).catch(res => { }) |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|