增加手机端登录判断token功能

This commit is contained in:
wulin 2021-03-22 14:40:31 +08:00
parent b350cd86d7
commit 9663037e24

View File

@ -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(() => {