修改登录跳转首页页面;

修改扫码登录逻辑,改为打开新页面
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) { loginSuccess(res) {
if (res.code === 0) { if (res.code === 0) {
this.$router.push({ name: 'repairStatistics' }, () => { // this.$router.push({ name: 'index' }, () => { //
this.$notification.success({ this.$notification.success({
message: '欢迎', message: '欢迎',
description: `${timeFix()},欢迎回来` description: `${timeFix()},欢迎回来`

View File

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