From cf46dd0d554f6951cf60f3fe6a878aa6111bf9bc Mon Sep 17 00:00:00 2001 From: dalaolala Date: Thu, 12 Feb 2026 14:19:50 +0800 Subject: [PATCH] update index --- README.md | 4 +- frontend/src/router/index.js | 12 +- frontend/src/views/Login.vue | 2 +- frontend/src/views/Welcome.vue | 622 +++++++++++++++++++++++++++++++++ 4 files changed, 635 insertions(+), 5 deletions(-) create mode 100644 frontend/src/views/Welcome.vue diff --git a/README.md b/README.md index 0c74f39..03c6211 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,9 @@ docker run -d \ dalaolala/webssh:latest ``` -**密钥生成方法:** +*导入初始化数据请查看 [install.sql](install.sql)* + +**最后两个参数相关密钥生成方法:** ```bash # 生成32字节JWT密钥(推荐使用强随机字符串) openssl rand -base64 32 diff --git a/frontend/src/router/index.js b/frontend/src/router/index.js index b25d4c7..8e2c329 100644 --- a/frontend/src/router/index.js +++ b/frontend/src/router/index.js @@ -2,6 +2,12 @@ import { createRouter, createWebHistory } from 'vue-router' import { useAuthStore } from '@/stores/auth' const routes = [ + { + path: '/', + name: 'Welcome', + component: () => import('@/views/Welcome.vue'), + meta: { requiresGuest: true } + }, { path: '/login', name: 'Login', @@ -15,7 +21,7 @@ const routes = [ meta: { requiresGuest: true } }, { - path: '/', + path: '/dashboard', name: 'Dashboard', component: () => import('@/views/Dashboard.vue'), meta: { requiresAuth: true } @@ -65,10 +71,10 @@ router.beforeEach((to, from, next) => { if (to.meta.requiresAuth && !authStore.isAuthenticated) { next('/login') } else if (to.meta.requiresGuest && authStore.isAuthenticated) { - next('/') + next('/dashboard') } else if (to.meta.requiresAdmin && (!authStore.isAuthenticated || !authStore.user?.is_admin)) { // 检查管理员权限 - next('/') + next('/dashboard') } else { next() } diff --git a/frontend/src/views/Login.vue b/frontend/src/views/Login.vue index faa9402..746e805 100644 --- a/frontend/src/views/Login.vue +++ b/frontend/src/views/Login.vue @@ -89,7 +89,7 @@ const handleLogin = async () => { if (result.success) { ElMessage.success('登录成功') - router.push('/') + router.push('/dashboard') } else { ElMessage.error(result.error) } diff --git a/frontend/src/views/Welcome.vue b/frontend/src/views/Welcome.vue new file mode 100644 index 0000000..6505db5 --- /dev/null +++ b/frontend/src/views/Welcome.vue @@ -0,0 +1,622 @@ + + + + + \ No newline at end of file