|
|
|
@ -158,11 +158,19 @@ export default { |
|
|
|
|
// 处理登录成功 |
|
|
|
|
setLogin() { |
|
|
|
|
util.local.set(Setting.tokenKey, this.token, Setting.tokenExpires) |
|
|
|
|
util.successMsg('登录成功') |
|
|
|
|
util.cookies.remove('serverLogin') |
|
|
|
|
this.reloadIndex() |
|
|
|
|
const redirect = this.$route.query.redirect ? decodeURIComponent(this.$route.query.redirect) : "/station" |
|
|
|
|
this.$router.replace(redirect) |
|
|
|
|
// 查询是否有更新日志,如果返回了true,则直接跳转到日志页 |
|
|
|
|
this.$get(this.api.logNotification).then(res => { |
|
|
|
|
const history = this.$route.query.redirect |
|
|
|
|
const redirect = res.notification ? |
|
|
|
|
'/log' : |
|
|
|
|
history ? |
|
|
|
|
decodeURIComponent(history) : |
|
|
|
|
'/station' |
|
|
|
|
util.successMsg('登录成功') |
|
|
|
|
this.$router.replace(redirect) |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
submitFormLogin() { // 提交登录 |
|
|
|
|
this.$refs.form.validate(valid => { |
|
|
|
@ -267,13 +275,9 @@ export default { |
|
|
|
|
util.successMsg("绑定成功"); |
|
|
|
|
this.form.phone = this.phone; |
|
|
|
|
this.phoneVisible = false; |
|
|
|
|
|
|
|
|
|
util.local.set(Setting.tokenKey, res.token, Setting.tokenExpires); |
|
|
|
|
let redirect = this.$route.query.redirect ? decodeURIComponent(this.$route.query.redirect) : "/index"; |
|
|
|
|
this.$router.replace(redirect); |
|
|
|
|
util.successMsg("登录成功"); |
|
|
|
|
}).catch(res => { |
|
|
|
|
}); |
|
|
|
|
this.token = res.token |
|
|
|
|
this.setLogin() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|