From cd1bd3461f0d3f8abcd85e03ec3c45e23d1677bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Wed, 8 May 2024 14:46:51 +0800 Subject: [PATCH] fix: GetQuickList --- src/webui/index.ts | 2 +- src/webui/src/api/QQLogin.ts | 4 ++-- static/QQLogin.html | 4 +++- static/login.html | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/webui/index.ts b/src/webui/index.ts index 4ea2bad9..3a071ff2 100644 --- a/src/webui/index.ts +++ b/src/webui/index.ts @@ -12,7 +12,7 @@ const app = express(); * @returns {Promise} 无返回值。 */ export async function InitWebUi() { - let config = WebUiConfig; + let config = await WebUiConfig.GetWebUIConfig(); app.use(express.json()); // 初始服务 app.all('/', (_req, res) => { diff --git a/src/webui/src/api/QQLogin.ts b/src/webui/src/api/QQLogin.ts index 59be3446..f4c1d7e7 100644 --- a/src/webui/src/api/QQLogin.ts +++ b/src/webui/src/api/QQLogin.ts @@ -27,12 +27,12 @@ export const QQGetQRcodeHandler: RequestHandler = async (req, res) => { }); return; }; -export const QQCheckLoginStatusHandler: RequestHandler = (req, res) => { +export const QQCheckLoginStatusHandler: RequestHandler = async (req, res) => { res.send({ code: 0, message: 'success', data: { - isLogin: DataRuntime.getQQLoginStatus() + isLogin: await DataRuntime.getQQLoginStatus() } }); }; diff --git a/static/QQLogin.html b/static/QQLogin.html index a2f176e4..3447b797 100644 --- a/static/QQLogin.html +++ b/static/QQLogin.html @@ -196,12 +196,13 @@ return []; } async function InitPages() { - let QuickLists = GetQQQucickLoginList(localStorage.getItem('auth')); + let QuickLists = await GetQQQucickLoginList(localStorage.getItem('auth')); let QuickListSelect = document.querySelector("#quick-login-select"); QuickLists.forEach(QuickUin => { let optionUinEle = document.createElement('option'); optionUinEle.innerHTML = QuickUin; optionUinEle.value = QuickUin; + QuickListSelect.appendChild(optionUinEle); }); } document.getElementById('quick-login').addEventListener('click', function () { @@ -231,6 +232,7 @@ console.log('QR Code generated!'); }); } + InitPages(); diff --git a/static/login.html b/static/login.html index 4da656b5..96d446c3 100644 --- a/static/login.html +++ b/static/login.html @@ -109,6 +109,7 @@ if (QQLoginResponse.status == 200) { let QQLoginResponseJson = await QQLoginResponse.json(); if (QQLoginResponseJson.code == 0) { + alert(QQLoginResponseJson.data.isLogin.toString()); if (QQLoginResponseJson.data.isLogin) { window.location.href = './config.html'; } else {