|
@@ -148,8 +148,8 @@ export default {
|
|
|
}
|
|
|
return this.arrErrorList.length <= 0
|
|
|
},
|
|
|
- funSubmit () {
|
|
|
- const { phone, code } = this.postData
|
|
|
+ async funSubmit () {
|
|
|
+ const { phone, code, msg } = this.postData
|
|
|
if (!this.verifyData()) {
|
|
|
Toast({
|
|
|
message: this.arrErrorList[0],
|
|
@@ -161,17 +161,18 @@ export default {
|
|
|
duration: 1000 * 100,
|
|
|
forbidClick: true
|
|
|
})
|
|
|
- login(phone, code).then(res => {
|
|
|
+ try {
|
|
|
+ const { status, data } = await login(phone, code)
|
|
|
myToast.clear()
|
|
|
- if (res.status) {
|
|
|
- const { token } = res.data
|
|
|
+ if (status) {
|
|
|
+ const { token } = data
|
|
|
clearLoginInfo()
|
|
|
this.$nextTick(() => {
|
|
|
this.$store.commit('common/UPDATE_PHONE', phone)
|
|
|
this.$store.commit('common/UPDATE_TOKEN', token)
|
|
|
|
|
|
- this.$cookie.set('phone', phone, '30d')
|
|
|
- this.$cookie.set('token', token, '30d')
|
|
|
+ this.$cookie.set('afhousephone', phone, '30d')
|
|
|
+ this.$cookie.set('afhousetoken', token, '30d')
|
|
|
})
|
|
|
|
|
|
Toast({
|
|
@@ -184,11 +185,10 @@ export default {
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
- Toast(res.msg)
|
|
|
- }).catch(err => {
|
|
|
+ Toast(msg)
|
|
|
+ } catch (err) {
|
|
|
myToast.clear()
|
|
|
- Toast(err.msg)
|
|
|
- })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|