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 { ...@@ -43,6 +43,7 @@ export default {
Authentication:{ Authentication:{
qqAuth:'/api/auth/qq',//qq认证 qqAuth:'/api/auth/qq',//qq认证
authsList:'/api/auth/auths',//获取我的认证列表
}, },
Sms:{ Sms:{
......
...@@ -9,11 +9,11 @@ ...@@ -9,11 +9,11 @@
</div> </div>
<div class="info"> <div class="info">
<p>手机号</p> <p>手机号</p>
<h6>{{mobile || '未绑定'}}</h6> <h6>{{this.hasOwnProperty('mobile') ? mobile : '未绑定'}}</h6>
</div> </div>
</div> </div>
<div class="item__right" @click="handleChange('手机号')"> <div class="item__right" @click="handleChange('手机号')" v-if="!this.hasOwnProperty('mobile')">
更换 更换
</div> </div>
...@@ -26,18 +26,18 @@ ...@@ -26,18 +26,18 @@
</div> </div>
<div class="info"> <div class="info">
<p>邮箱</p> <p>邮箱</p>
<h6>{{email || '未绑定'}}</h6> <h6>{{this.hasOwnProperty('email') ? email : '未绑定'}}</h6>
</div> </div>
</div> </div>
<div class="item__right" @click="handleChange('邮箱')"> <div class="item__right" @click="handleChange('邮箱')" v-if="!this.hasOwnProperty('email')">
更换 绑定
</div> </div>
</div> </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="bind-account-item">
<div class="item__left"> <div class="item__left">
<div class="avatar"> <div class="avatar">
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
</div> </div>
<div class="bind-account-item"> <div class="bind-account-item" v-if="false">
<div class="item__left"> <div class="item__left">
<div class="avatar"> <div class="avatar">
<embed src="../../../assets/svg/qq.svg" width="18" height="21" <embed src="../../../assets/svg/qq.svg" width="18" height="21"
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
</div> </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="bind-account-item">
<div class="item__left"> <div class="item__left">
<div class="avatar"> <div class="avatar">
...@@ -109,13 +109,34 @@ ...@@ -109,13 +109,34 @@
<p class="submit-button">保存</p> <p class="submit-button">保存</p>
</card-container> </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"> <div class="bind-account-item__wrap">
<input type="text" placeholder="请输入旧密码"> <login-input
<input type="text" placeholder="请输入新密码"> :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> </div>
<p class="submit-button">保存</p> <p class="submit-button" @click="savePassword" v-if="disabled === 'auto'">保存</p>
</card-container> </card-container>
<div class="popup-box__wrap" v-if="isShow"> <div class="popup-box__wrap" v-if="isShow">
...@@ -143,7 +164,10 @@ ...@@ -143,7 +164,10 @@
></login-input> ></login-input>
<div class="popup-box-button"> <div class="popup-box-button">
<button style="margin-right: 20px" @click="handleChangeAccount">确定</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> </div>
</div> </div>
...@@ -156,7 +180,7 @@ ...@@ -156,7 +180,7 @@
import CardContainer from '../../../components/pc/cardContainer'; import CardContainer from '../../../components/pc/cardContainer';
import LoginInput from "../../../components/pc/loginCard/loginInput"; import LoginInput from "../../../components/pc/loginCard/loginInput";
import config from '../../../action/config'; import config from '../../../action/config';
import {checkPhone, checkVerification, checkEmail} from '../../users/checkfrom' import {checkPhone, checkPassword, checkVerification, checkEmail} from '../../users/checkfrom'
export default { export default {
name:'setting', name:'setting',
...@@ -165,9 +189,16 @@ ...@@ -165,9 +189,16 @@
CardContainer CardContainer
}, },
async asyncData({$axios}) { 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); 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() { data() {
return { return {
...@@ -178,7 +209,10 @@ ...@@ -178,7 +209,10 @@
placeholder: '', placeholder: '',
accountErrMsg: '', accountErrMsg: '',
verifyErrMsg: '', verifyErrMsg: '',
isCount: false isCount: false,
newPassword: '',
newPasswordMsg: '',
disabled: 'none'
} }
}, },
methods: { methods: {
...@@ -195,6 +229,9 @@ ...@@ -195,6 +229,9 @@
this.accountErrMsg = checkEmail(this.account); this.accountErrMsg = checkEmail(this.account);
} }
}, },
handleCheckPassword() {
this.newPasswordMsg = checkPassword(this.newPassword);
},
handleCheckVerifyCode() { handleCheckVerifyCode() {
this.verifyErrMsg = checkVerification(this.verifyCode); this.verifyErrMsg = checkVerification(this.verifyCode);
}, },
...@@ -202,7 +239,8 @@ ...@@ -202,7 +239,8 @@
sendVerifyCode() { sendVerifyCode() {
if (this.title === '绑定手机号') { if (this.title === '绑定手机号') {
this.isCount = false; this.isCount = false;
this.accountErrMsg = checkPhone(this.account); let account = this.account !== '' ? this.account : this.mobile;
this.accountErrMsg = checkPhone(account);
if (this.accountErrMsg === '') { if (this.accountErrMsg === '') {
this.getSms(); this.getSms();
this.verifyErrMsg = ''; this.verifyErrMsg = '';
...@@ -225,9 +263,10 @@ ...@@ -225,9 +263,10 @@
} }
}, },
async getSms() { async getSms() {
let account = this.account !== '' ? this.account : this.mobile;
let smsResponse = await this.$axios.$get(config.api.get.Sms.send, { let smsResponse = await this.$axios.$get(config.api.get.Sms.send, {
params: { params: {
mobile: this.account mobile: account
} }
}); });
if (smsResponse.code === 0) { if (smsResponse.code === 0) {
...@@ -252,7 +291,7 @@ ...@@ -252,7 +291,7 @@
if (emailResponse.code === 0) { if (emailResponse.code === 0) {
this.$message({ this.$message({
type: 'success', type: 'success',
message: '短信发送成功!' message: '邮件发送成功!'
}); });
} else { } else {
this.verifyErrMsg = emailResponse.msg; this.verifyErrMsg = emailResponse.msg;
...@@ -282,6 +321,7 @@ ...@@ -282,6 +321,7 @@
}); });
this.mobile = this.account; this.mobile = this.account;
this.isShow = false; this.isShow = false;
Object.assign(this.$data, this.$options.data());
} else { } else {
this.$message({ this.$message({
type: 'info', type: 'info',
...@@ -303,6 +343,7 @@ ...@@ -303,6 +343,7 @@
}); });
this.email = this.account; this.email = this.account;
this.isShow = false; this.isShow = false;
Object.assign(this.$data, this.$options.data());
} else { } else {
this.$message({ this.$message({
type: 'info', type: 'info',
...@@ -310,8 +351,47 @@ ...@@ -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> </script>
...@@ -324,14 +404,6 @@ ...@@ -324,14 +404,6 @@
margin:32*$length auto 0; margin:32*$length auto 0;
@extend %flex-row-spb; @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{ .bind-account-item{
width:334*$length; width:334*$length;
......
...@@ -9,25 +9,25 @@ ...@@ -9,25 +9,25 @@
</div> </div>
</div> </div>
<div> <div>
<p><span>昵称:</span>{{nickName || ''}}</p> <p><span>昵称:</span>{{nickName ? nickName : '暂无'}}</p>
</div> </div>
<div> <div>
<p><span>性别:</span>{{genderInfo}}</p> <p><span>性别:</span>{{genderInfo}}</p>
</div> </div>
<div> <div>
<p><span>生日:</span>{{birthday || ''}}</p> <p><span>生日:</span>暂无</p>
</div> </div>
<div> <div>
<p><span>签名:</span>{{signature || ''}}</p> <p><span>签名:</span>{{signature ? signature : '暂无'}}</p>
</div> </div>
<div> <div>
<p><span>微信:</span>{{wxNumber || ''}}</p> <p><span>微信:</span>{{wxNumber ? wxNumber : '暂无'}}</p>
</div> </div>
<div> <div>
<p><span>QQ号:</span>{{qqNumber || ''}}</p> <p><span>QQ号:</span>{{qqNumber ? qqNumber : '暂无'}}</p>
</div> </div>
<div> <div>
<p><span>手机号:</span>{{mobile || ''}}</p> <p><span>手机号:</span>{{mobile ? mobile : '暂无'}}</p>
</div> </div>
</div> </div>
</card-container> </card-container>
...@@ -55,11 +55,11 @@ ...@@ -55,11 +55,11 @@
computed: { computed: {
genderInfo: function () { genderInfo: function () {
if (this.gender === 0) { if (this.gender === 0) {
return '' return '保密'
} else if (this.gender === 1) { } else if (this.gender === 1) {
return '' return ''
} else { } 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