修改登录跳转首页页面;

修改扫码登录逻辑,改为打开新页面
This commit is contained in:
471615499@qq.com 2024-10-28 22:14:56 +08:00
parent 614531e765
commit 84418d9036
2 changed files with 19 additions and 12 deletions

View File

@ -301,7 +301,7 @@ export default {
},
loginSuccess(res) {
if (res.code === 0) {
this.$router.push({ name: 'repairStatistics' }, () => { //
this.$router.push({ name: 'index' }, () => { //
this.$notification.success({
message: '欢迎',
description: `${timeFix()},欢迎回来`

View File

@ -1,9 +1,12 @@
<template>
<div class='main' style='text-align: center'>
<vue-qr
:text="loginUrl"
:size="250"
<vue-qr v-if='!isLogin'
:text='loginUrl'
:size='250'
></vue-qr>
<a-button v-if='isLogin' @click='goIndex()' type="primary" style='margin-top: 20px'>
访问系统
</a-button>
</div>
</template>
@ -15,7 +18,7 @@ import { loginByCode, qrCode } from '@/api/login'
import storage from 'store'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import { timeFix } from '@/utils/util'
import VueQr from "vue-qr"
import VueQr from 'vue-qr'
export default {
components: {
@ -37,6 +40,9 @@ export default {
clearInterval(this.intervalId)
},
methods: {
goIndex() {
window.open('/shoot-hand-html/')
},
getLoginUrl() {
qrCode().then(res => {
if (res.code === 0) {
@ -53,14 +59,15 @@ export default {
if (res.code == 0) {
//
clearInterval(this.intervalId)
console.log('登录成功!')
this.isLogin = true
storage.set(ACCESS_TOKEN, res.token, 14 * 24 * 60 * 60 * 1000) // 14
this.$router.push({ name: 'index' }, () => { //
this.$notification.success({
message: '欢迎',
description: `${timeFix()},欢迎回来`
})
})
this.goIndex()
// this.$router.push({ name: 'index' }, () => { //
// this.$notification.success({
// message: '',
// description: `${timeFix()}`
// })
// })
}
})
}