Commit 0ce069e0 by yanju

Merge branch 'yoona' into 'master'

完善绑定邮箱和手机号 修改密码 个人中心资料页

See merge request pigbigbig/beyond-clouds-front!55
parents 16f4c3e6 528cdfd0
......@@ -43,6 +43,7 @@ export default {
Authentication:{
qqAuth:'/api/auth/qq',//qq认证
authsList:'/api/auth/auths',//获取我的认证列表
},
Sms:{
......
......@@ -9,11 +9,11 @@
</div>
<div class="info">
<p>手机号</p>
<h6>{{mobile || '未绑定'}}</h6>
<h6>{{this.hasOwnProperty('mobile') ? mobile : '未绑定'}}</h6>
</div>
</div>
<div class="item__right" @click="handleChange('手机号')">
<div class="item__right" @click="handleChange('手机号')" v-if="!this.hasOwnProperty('mobile')">
更换
</div>
......@@ -26,18 +26,18 @@
</div>
<div class="info">
<p>邮箱</p>
<h6>{{email || '未绑定'}}</h6>
<h6>{{this.hasOwnProperty('email') ? email : '未绑定'}}</h6>
</div>
</div>
<div class="item__right" @click="handleChange('邮箱')">
更换
<div class="item__right" @click="handleChange('邮箱')" v-if="!this.hasOwnProperty('email')">
绑定
</div>
</div>
</div>
<div class="bind-account-item__wrap">
<div class="bind-account-item__wrap" v-if="false">
<div class="bind-account-item">
<div class="item__left">
<div class="avatar">
......@@ -57,7 +57,7 @@
</div>
<div class="bind-account-item">
<div class="bind-account-item" v-if="false">
<div class="item__left">
<div class="avatar">
<embed src="../../../assets/svg/qq.svg" width="18" height="21"
......@@ -78,7 +78,7 @@
</div>
</div>
<div class="bind-account-item__wrap">
<div class="bind-account-item__wrap" v-if="false">
<div class="bind-account-item">
<div class="item__left">
<div class="avatar">
......@@ -109,13 +109,34 @@
<p class="submit-button">保存</p>
</card-container>
<card-container style="margin-top: 16px;padding-bottom: 32px" title="修改登录密码" label="忘记密码" v-if="false">
<card-container style="margin-top: 16px;padding-bottom: 32px" title="修改登录密码" :label="disabled === 'auto' ? '返回':'修改'" @listenCardConLabel="handleRevise">
<div class="bind-account-item__wrap">
<input type="text" placeholder="请输入旧密码">
<input type="text" placeholder="请输入新密码">
<login-input
:style="{pointerEvents: disabled, width: '334px'}"
:error-message="newPasswordMsg"
placeholder="请输入新的密码"
input-type="2"
type="password"
v-model="newPassword"
@handleCheck="handleCheckPassword"
@cancelCheck="newPasswordMsg = ''"
@keyup.enter.native="savePassword"
></login-input>
<login-input
:style="{pointerEvents: disabled, width: '334px'}"
v-model="verifyCode"
input-type="3"
placeholder="请输入验证码"
:error-message="verifyErrMsg"
:is-count="isCount"
@handleCheck="handleCheckVerifyCode"
@cancelCheck="verifyErrMsg = ''"
@sendSms="sendVerifyCode"
@keyup.enter.native="savePassword"
></login-input>
</div>
<p class="submit-button">保存</p>
<p class="submit-button" @click="savePassword" v-if="disabled === 'auto'">保存</p>
</card-container>
<div class="popup-box__wrap" v-if="isShow">
......@@ -143,7 +164,10 @@
></login-input>
<div class="popup-box-button">
<button style="margin-right: 20px" @click="handleChangeAccount">确定</button>
<button @click="() => this.isShow = false">取消</button>
<button @click="() => {
Object.assign(this.$data, this.$options.data());
this.isShow = false
}">取消</button>
</div>
</div>
</div>
......@@ -156,7 +180,7 @@
import CardContainer from '../../../components/pc/cardContainer';
import LoginInput from "../../../components/pc/loginCard/loginInput";
import config from '../../../action/config';
import {checkPhone, checkVerification, checkEmail} from '../../users/checkfrom'
import {checkPhone, checkPassword, checkVerification, checkEmail} from '../../users/checkfrom'
export default {
name:'setting',
......@@ -165,9 +189,16 @@
CardContainer
},
async asyncData({$axios}) {
let infoResponse = await $axios.$get(config.api.get.User.myInfo);
let infoResponse = await $axios.$get(config.api.get.Authentication.authsList);
console.log(infoResponse);
return { ...infoResponse.data }
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);
return { ...auths }
},
data() {
return {
......@@ -178,7 +209,10 @@
placeholder: '',
accountErrMsg: '',
verifyErrMsg: '',
isCount: false
isCount: false,
newPassword: '',
newPasswordMsg: '',
disabled: 'none'
}
},
methods: {
......@@ -195,6 +229,9 @@
this.accountErrMsg = checkEmail(this.account);
}
},
handleCheckPassword() {
this.newPasswordMsg = checkPassword(this.newPassword);
},
handleCheckVerifyCode() {
this.verifyErrMsg = checkVerification(this.verifyCode);
},
......@@ -202,7 +239,8 @@
sendVerifyCode() {
if (this.title === '绑定手机号') {
this.isCount = false;
this.accountErrMsg = checkPhone(this.account);
let account = this.account !== '' ? this.account : this.mobile;
this.accountErrMsg = checkPhone(account);
if (this.accountErrMsg === '') {
this.getSms();
this.verifyErrMsg = '';
......@@ -225,9 +263,10 @@
}
},
async getSms() {
let account = this.account !== '' ? this.account : this.mobile;
let smsResponse = await this.$axios.$get(config.api.get.Sms.send, {
params: {
mobile: this.account
mobile: account
}
});
if (smsResponse.code === 0) {
......@@ -252,7 +291,7 @@
if (emailResponse.code === 0) {
this.$message({
type: 'success',
message: '短信发送成功!'
message: '邮件发送成功!'
});
} else {
this.verifyErrMsg = emailResponse.msg;
......@@ -282,6 +321,7 @@
});
this.mobile = this.account;
this.isShow = false;
Object.assign(this.$data, this.$options.data());
} else {
this.$message({
type: 'info',
......@@ -303,6 +343,7 @@
});
this.email = this.account;
this.isShow = false;
Object.assign(this.$data, this.$options.data());
} else {
this.$message({
type: 'info',
......@@ -310,8 +351,47 @@
});
}
}
},
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();
if (!this.hasOwnProperty('mobile')) {
this.$message({
type: 'warning',
message: '请先绑定手机号'
});
return false
}
if (this.newPasswordMsg !== '' && this.verifyErrMsg !== '') return false;
let resetResponse;
resetResponse = await this.$axios.$put(config.api.put.User.revisePassword, {
mobile: this.mobile,
password: this.newPassword,
verifyCode: this.verifyCode
});
console.log(resetResponse);
if (resetResponse.code === 0) {
this.$message({
type: 'success',
message: '修改密码成功!'
});
Object.assign(this.$data, this.$options.data());
} else {
this.$message({
type: 'info',
message: resetResponse.msg
});
}
}
}
},
}
</script>
......@@ -324,14 +404,6 @@
margin:32*$length auto 0;
@extend %flex-row-spb;
& input{
width:334*$length;
height:48*$length;
border-radius: 4*$length;
padding:14*$length 16*$length;
@include fontStyle(14,48,500,#999,left);
background-color: #F4F8FA;
}
.bind-account-item{
width:334*$length;
......
......@@ -9,25 +9,25 @@
</div>
</div>
<div>
<p><span>昵称:</span>{{nickName || ''}}</p>
<p><span>昵称:</span>{{nickName ? nickName : '暂无'}}</p>
</div>
<div>
<p><span>性别:</span>{{genderInfo}}</p>
</div>
<div>
<p><span>生日:</span>{{birthday || ''}}</p>
<p><span>生日:</span>暂无</p>
</div>
<div>
<p><span>签名:</span>{{signature || ''}}</p>
<p><span>签名:</span>{{signature ? signature : '暂无'}}</p>
</div>
<div>
<p><span>微信:</span>{{wxNumber || ''}}</p>
<p><span>微信:</span>{{wxNumber ? wxNumber : '暂无'}}</p>
</div>
<div>
<p><span>QQ号:</span>{{qqNumber || ''}}</p>
<p><span>QQ号:</span>{{qqNumber ? qqNumber : '暂无'}}</p>
</div>
<div>
<p><span>手机号:</span>{{mobile || ''}}</p>
<p><span>手机号:</span>{{mobile ? mobile : '暂无'}}</p>
</div>
</div>
</card-container>
......@@ -55,11 +55,11 @@
computed: {
genderInfo: function () {
if (this.gender === 0) {
return ''
return '保密'
} else if (this.gender === 1) {
return ''
return ''
} else {
return '保密'
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