From 076fcb9f02dd386a97ca2e0f47cf62f235708b79 Mon Sep 17 00:00:00 2001 From: Nelson <1475262689@qq.com> Date: Fri, 10 Jul 2026 11:55:48 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=8B=86=E5=88=86=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E7=99=BB=E5=BD=95=E9=A1=B5=E9=9D=A2=E8=81=8C=E8=B4=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../apps/admin-web/src/App.vue | 46 ++------------- .../src/components/AdminLoginView.vue | 59 +++++++++++++++++++ 2 files changed, 63 insertions(+), 42 deletions(-) create mode 100644 ai_knowledge_base_v2/apps/admin-web/src/components/AdminLoginView.vue diff --git a/ai_knowledge_base_v2/apps/admin-web/src/App.vue b/ai_knowledge_base_v2/apps/admin-web/src/App.vue index 4de9ad0..3c64565 100644 --- a/ai_knowledge_base_v2/apps/admin-web/src/App.vue +++ b/ai_knowledge_base_v2/apps/admin-web/src/App.vue @@ -2,6 +2,7 @@ import { ElMessage, ElMessageBox } from "element-plus"; import { computed, onMounted, reactive, ref } from "vue"; +import AdminLoginView from "./components/AdminLoginView.vue"; import { api, clearToken, getToken, saveToken } from "./services/api"; import type { AdminProfile, @@ -21,7 +22,6 @@ const admin = ref(null); const activeMenu = ref("dashboard"); const loading = ref(false); -const loginForm = reactive({ username: "", password: "" }); const stats = ref(null); const dashboardFilters = reactive({ start: "", @@ -482,10 +482,10 @@ onMounted(async () => { } }); -async function login() { +async function login(credentials: { username: string; password: string }) { loading.value = true; try { - const result = await api.login(loginForm.username, loginForm.password); + const result = await api.login(credentials.username, credentials.password); saveToken(result.token); admin.value = result.admin; await loadCurrentMenu(); @@ -1052,45 +1052,7 @@ function formatRecordDateTime(value: string, boundary: "start" | "end") {