From 9663037e241bdadbf044633148d470ef0069079f Mon Sep 17 00:00:00 2001 From: wulin Date: Mon, 22 Mar 2021 14:40:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=89=8B=E6=9C=BA=E7=AB=AF?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E5=88=A4=E6=96=ADtoken=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/common/phoneweblogin.vue | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/views/common/phoneweblogin.vue b/src/views/common/phoneweblogin.vue index cd2d333..f61780a 100644 --- a/src/views/common/phoneweblogin.vue +++ b/src/views/common/phoneweblogin.vue @@ -43,6 +43,7 @@ import { getUUID } from '@/utils' import { apiLogin, apiSsysSendSMS } from '@/api/api_sys' import { apiDingtalkLogin } from '@/api/api_staff' import * as dd from 'dingtalk-jsapi' +import Vue from 'vue' var dingCode = '' export default { data () { @@ -71,6 +72,11 @@ export default { // this.handleGetImgCaptcha() }, mounted () { + if (this.checkToken()) { + if (this.$route.query.do) { + this.$router.replace({ name: this.$route.query.do }) + } + } }, methods: { // // 获取图像验证码 @@ -78,6 +84,14 @@ export default { // this.dataForm.uuid = getUUID() // this.captchaPath = `/lz_management/captcha.jpg?uuid=${this.dataForm.uuid}` // }, + checkToken() { + console.log('检查token') + let token = Vue.cookie.get('token') + if (!token || !/\S/.test(token)) { + return false; + } + return true + }, // 登录提交表单 handleLogin () { let param = Object.assign(this.dataForm, {'userName': this.dataForm.userName}, {'uuid': this.dataForm.uuid}, {'verifyCode': this.dataForm.verify}) @@ -119,7 +133,7 @@ export default { uuid: this.dataForm.uuid } apiSsysSendSMS(parmse).then(res => { - if (res.code == 200) { + if (res.code === 200) { this.time = 60 this.hasSendCode = true this.timer = setInterval(() => {