diff --git a/pages/web.ts b/pages/web.ts index 6cff3e3..064904c 100644 --- a/pages/web.ts +++ b/pages/web.ts @@ -10,22 +10,14 @@ loginEmitter.once('login-success', async (data) => { // const local = await queryLogin.checkLocalUser() // console.log('本地用户信息:', local); if (res.code === 400) { - if (res.data.redirectUrl) { - window.open(res.data.redirectUrl, '_self'); - } else { - const me = await queryLogin.getMe(); - console.log('用户信息:', me); - window.open('/root/home/', '_self'); - } - } else { redirectHome() } }) -const test = async () => { - const me = await queryLogin.getToken(); - console.log('获取token:', me); -} -setTimeout(() => { - test() -}, 2000) \ No newline at end of file +// const test = async () => { +// const me = await queryLogin.getToken(); +// console.log('获取token:', me); +// } +// setTimeout(() => { +// test() +// }, 2000) \ No newline at end of file diff --git a/src/modules/login-handle.ts b/src/modules/login-handle.ts index e8960b5..a445e61 100644 --- a/src/modules/login-handle.ts +++ b/src/modules/login-handle.ts @@ -17,7 +17,8 @@ export const redirectHome = () => { if (redirect) { setTimeout(() => { const href = decodeURIComponent(redirect); - window.open(href, '_self'); + // window.open(href, '_self'); + console.log('重定向到:', href); }, 2000); return; } diff --git a/src/modules/wx-mp/qr.ts b/src/modules/wx-mp/qr.ts index bbdb2b4..cb29605 100644 --- a/src/modules/wx-mp/qr.ts +++ b/src/modules/wx-mp/qr.ts @@ -1,5 +1,5 @@ import QRCode, { QRCodeToDataURLOptions } from 'qrcode'; -import { redirectHome } from '../login-handle.ts'; +import { logginSuccess } from '../login-handle.ts'; import { query } from '../query.ts'; export const useCreateLoginQRCode = (el?: HTMLCanvasElement) => { var opts: QRCodeToDataURLOptions = { @@ -27,9 +27,7 @@ export const useCreateLoginQRCode = (el?: HTMLCanvasElement) => { await query.setLoginToken(token); } clear(); - setTimeout(() => { - redirectHome(); - }, 1000); + logginSuccess(); } else { timer = setTimeout(() => { checkLogin(state);