|
|
@@ -190,7 +190,7 @@ export default {
|
|
|
userinfo().then(data => {
|
|
|
// this.avatar = this.getOrCreateAttribute(data, 'avatar', '')
|
|
|
this.phone = this.getOrCreateAttribute(data, 'phone', '')
|
|
|
- this.email = data.email || ''
|
|
|
+ this.email = data.email ?? ''
|
|
|
this.wechat = this.getOrCreateAttribute(data, 'wechat', '')
|
|
|
this.user = data
|
|
|
}, () => {
|
|
|
@@ -208,7 +208,7 @@ export default {
|
|
|
},
|
|
|
changeAttribute (key, value, meesage) {
|
|
|
if (this.user.attributes[key][0] !== value) {
|
|
|
- return this.updateUser({
|
|
|
+ this.updateUser({
|
|
|
attributes: {
|
|
|
...this.user.attributes,
|
|
|
[key]: [value]
|
|
|
@@ -217,17 +217,18 @@ export default {
|
|
|
() => {
|
|
|
this.user.attributes[key][0] = value
|
|
|
},
|
|
|
- e => {
|
|
|
+ () => {
|
|
|
this.resetAttribute(key)
|
|
|
- return Promise.reject(e)
|
|
|
}
|
|
|
)
|
|
|
}
|
|
|
- return Promise.resolve()
|
|
|
},
|
|
|
resetAttribute (key) {
|
|
|
this[key] = this.user.attributes[key][0]
|
|
|
},
|
|
|
+ resetProp (key) {
|
|
|
+ this[key] = this.user[key] ?? ''
|
|
|
+ },
|
|
|
onPhoneChange () {
|
|
|
if (!this.phone) {
|
|
|
this.$message({
|
|
|
@@ -253,7 +254,7 @@ export default {
|
|
|
type: 'warning',
|
|
|
message: '邮箱不能为空'
|
|
|
})
|
|
|
- this.resetAttribute('email')
|
|
|
+ this.resetProp('email')
|
|
|
return
|
|
|
}
|
|
|
if (!(/^([a-zA-Z0-9]+[_|.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/.test(this.email))) {
|
|
|
@@ -261,7 +262,7 @@ export default {
|
|
|
type: 'warning',
|
|
|
message: '邮箱格式错误'
|
|
|
})
|
|
|
- this.resetAttribute('email')
|
|
|
+ this.resetProp('email')
|
|
|
return
|
|
|
}
|
|
|
this.updateUser({ email: this.email }, '更新邮箱').then(
|
|
|
@@ -269,7 +270,7 @@ export default {
|
|
|
this.user.email = this.email
|
|
|
},
|
|
|
() => {
|
|
|
- this.email = this.user.email
|
|
|
+ this.resetProp('email')
|
|
|
}
|
|
|
)
|
|
|
},
|
|
|
@@ -277,10 +278,7 @@ export default {
|
|
|
if (this.wechat) {
|
|
|
this.$confirm('解除绑定后将无法再收到消息推送', '确定解绑微信?', { type: 'warning' }).then(
|
|
|
() => {
|
|
|
- this.changeAttribute('wechat', '', '解绑微信').then(() => {
|
|
|
- this.wechat = ''
|
|
|
- this.user.attributes.wechat[0] = ''
|
|
|
- })
|
|
|
+ this.changeAttribute('wechat', this.wechat = '', '解绑微信')
|
|
|
}
|
|
|
)
|
|
|
} else {
|
|
|
@@ -319,6 +317,7 @@ export default {
|
|
|
}).then(
|
|
|
() => {
|
|
|
if (!this.wechat) {
|
|
|
+ // https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=gQHt7zwAAAAAAAAAAS5odHRwOi8vd2VpeGluLnFxLmNvbS9xLzAycDBEMms4OGZmb0QxbVRONmh5Y0IAAgQ3Nz1iAwSAOgkA
|
|
|
this.qr = Math.random()
|
|
|
this.$timer = setTimeout(this.fetchQr, 5000)
|
|
|
this.checkBind()
|