From 9cafd5ca784e36529891a16d783c7c631c685669 Mon Sep 17 00:00:00 2001 From: Agent Date: Tue, 14 Jul 2026 20:10:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=94=B9=E7=94=A8hash=E8=B7=AF=E7=94=B1?= =?UTF-8?q?=E8=A7=A3=E5=86=B3SPA=E5=9B=9E=E9=80=80=E5=88=B0=E9=A6=96?= =?UTF-8?q?=E9=A1=B5=E9=97=AE=E9=A2=98=20+=20=E4=BF=AE=E5=A4=8D=E7=99=BB?= =?UTF-8?q?=E5=BD=95API=E5=93=8D=E5=BA=94=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/router/index.ts | 4 ++-- frontend/src/views/admin/Login.vue | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index 4c36294..31dea0e 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -1,4 +1,4 @@ -import { createRouter, createWebHistory } from 'vue-router' +import { createRouter, createWebHashHistory } from 'vue-router' import Home from '@/views/Home.vue' import AdminLayout from '@/views/admin/AdminLayout.vue' import AdminDashboard from '@/views/admin/Dashboard.vue' @@ -8,7 +8,7 @@ import AdminSettings from '@/views/admin/Settings.vue' import AdminLogin from '@/views/admin/Login.vue' const router = createRouter({ - history: createWebHistory(), + history: createWebHashHistory(), routes: [ { path: '/', name: 'home', component: Home }, { path: '/admin/login', name: 'login', component: AdminLogin }, diff --git a/frontend/src/views/admin/Login.vue b/frontend/src/views/admin/Login.vue index af70b0f..3285755 100644 --- a/frontend/src/views/admin/Login.vue +++ b/frontend/src/views/admin/Login.vue @@ -41,7 +41,8 @@ async function handleLogin() { loading.value = true try { const res = await authApi.login(form.value) - store.setToken(res.data.token) + const token = res.result.token + store.setToken(token) await store.fetchProfile() ElMessage.success('登录成功') router.push('/admin/dashboard')