Commit 89a319f6 by yanju

Merge branch 'yoona' into 'master'

Yoona

See merge request pigbigbig/beyond-clouds-front!56
parents 3151bc7a c4c01375
<template>
<div>
<card-container style="margin-top: 16px;padding-bottom: 32px" title="账号绑定" label="账号注册">
<card-container style="margin-top: 16px;padding-bottom: 32px" title="账号绑定" label="账号注册" @listenCardConLabel="() => {this.$router.push('/users/register')}">
<div class="bind-account-item__wrap">
<div class="bind-account-item">
<div class="item__left">
......@@ -124,14 +124,14 @@
></login-input>
<login-input
:style="{pointerEvents: disabled, width: '334px'}"
v-model="verifyCode"
v-model="verifyCode2"
input-type="3"
placeholder="请输入验证码"
:error-message="verifyErrMsg"
:error-message="verify2ErrMsg"
:is-count="isCount"
@handleCheck="handleCheckVerifyCode"
@cancelCheck="verifyErrMsg = ''"
@sendSms="sendVerifyCode"
@handleCheck="handleCheckVerifyCode('password')"
@cancelCheck="verify2ErrMsg = ''"
@sendSms="sendVerifyCode('password')"
@keyup.enter.native="savePassword"
></login-input>
</div>
......@@ -194,7 +194,6 @@
let local = infoResponse.data.local;
let auths = {};
for(let [key, item] of Object.entries(local)) {
console.log(key);
auths[key] = item.account
}
console.log(auths);
......@@ -212,6 +211,8 @@
isCount: false,
newPassword: '',
newPasswordMsg: '',
verifyCode2: '',
verify2ErrMsg: '',
disabled: 'none'
}
},
......@@ -232,15 +233,36 @@
handleCheckPassword() {
this.newPasswordMsg = checkPassword(this.newPassword);
},
handleCheckVerifyCode() {
this.verifyErrMsg = checkVerification(this.verifyCode);
handleCheckVerifyCode(type = '') {
if (type === 'password') {
this.verify2ErrMsg = checkVerification(this.verifyCode2);
} else {
this.verifyErrMsg = checkVerification(this.verifyCode);
}
},
// 发送验证码
sendVerifyCode() {
sendVerifyCode(type = '') {
if (type === 'password') {
if (!this.hasOwnProperty('mobile')) {
this.$message({
type: 'warning',
message: '请先绑定手机号'
});
return false
} else {
this.isCount = false;
this.getSms(type);
this.verify2ErrMsg = '';
this.isCount = true;
setTimeout(() => {
this.isCount = false;
}, 60000);
return false
}
}
if (this.title === '绑定手机号') {
this.isCount = false;
let account = this.account !== '' ? this.account : this.mobile;
this.accountErrMsg = checkPhone(account);
this.accountErrMsg = checkPhone(this.account);
if (this.accountErrMsg === '') {
this.getSms();
this.verifyErrMsg = '';
......@@ -262,7 +284,7 @@
}
}
},
async getSms() {
async getSms(type = '') {
let account = this.account !== '' ? this.account : this.mobile;
let smsResponse = await this.$axios.$get(config.api.get.Sms.send, {
params: {
......@@ -275,7 +297,11 @@
message: '短信发送成功!'
});
} else {
this.verifyErrMsg = smsResponse.msg;
if (type === 'password') {
this.verify2ErrMsg = smsResponse.msg;
} else {
this.verifyErrMsg = smsResponse.msg;
}
this.$message({
type: 'info',
message: smsResponse.msg
......@@ -354,28 +380,22 @@
},
handleRevise() {
this.disabled = this.disabled === 'auto' ? 'none' : 'auto';
// 取消时 清空输入框 错误提示
if (this.disabled === 'none') {
Object.assign(this.$data, this.$options.data());
}
},
async savePassword() {
this.handleCheckPassword();
this.handleCheckVerifyCode();
this.verify2ErrMsg = checkVerification(this.verifyCode2);
if (!this.hasOwnProperty('mobile')) {
this.$message({
type: 'warning',
message: '请先绑定手机号'
});
return false
}
if (this.newPasswordMsg !== '' && this.verifyErrMsg !== '') return false;
if (this.newPasswordMsg !== '' && this.verify2ErrMsg !== '') return false;
let resetResponse;
resetResponse = await this.$axios.$put(config.api.put.User.revisePassword, {
mobile: this.mobile,
password: this.newPassword,
verifyCode: this.verifyCode
verifyCode: this.verifyCode2
});
console.log(resetResponse);
if (resetResponse.code === 0) {
......@@ -385,8 +405,9 @@
});
Object.assign(this.$data, this.$options.data());
} else {
this.verify2ErrMsg = resetResponse.msg;
this.$message({
type: 'info',
type: 'error',
message: resetResponse.msg
});
}
......
......@@ -15,7 +15,7 @@
<p><span>性别:</span>{{genderInfo}}</p>
</div>
<div>
<p><span>生日:</span>{{birthday || '暂无'}}</p>
<p><span>生日:</span>暂无</p>
</div>
<div>
<p><span>签名:</span>{{signature || '暂无'}}</p>
......@@ -54,9 +54,9 @@ export default {
},
computed: {
genderInfo: function () {
if (this.gender === 0) {
if (this.gender === 1) {
return '男'
} else if (this.gender === 1) {
} else if (this.gender === 2) {
return '女'
} else {
return '保密'
......
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