重写前端

This commit is contained in:
2026-07-02 21:03:51 +08:00
parent 0634cadced
commit 621625ad1e
14 changed files with 541 additions and 548 deletions
+62 -83
View File
@@ -9,92 +9,71 @@ function handleLogout() {
authStore.logout()
router.push('/')
}
const navLinks = [
{ to: '/', label: '首页' },
{ to: '/about', label: '关于' },
]
</script>
<template>
<header>
<img alt="Vue logo" class="logo" src="@/assets/logo.svg" width="125" height="125" />
<div class="min-h-screen flex flex-col bg-gray-50 dark:bg-gray-950">
<header class="bg-sky-600 text-white shadow-md">
<div class="max-w-6xl mx-auto px-4 py-3 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3">
<RouterLink to="/" class="text-xl font-bold tracking-wide hover:text-sky-200 transition-colors">
LmVPN
</RouterLink>
<nav class="flex items-center gap-1 flex-wrap">
<RouterLink
v-for="link in navLinks"
:key="link.to"
:to="link.to"
class="px-3 py-1.5 rounded-md text-sm font-medium transition-colors
hover:bg-sky-500/40"
active-class="bg-sky-700/60"
>
{{ link.label }}
</RouterLink>
<template v-if="authStore.isLoggedIn">
<RouterLink
to="/admin"
class="px-3 py-1.5 rounded-md text-sm font-medium transition-colors
hover:bg-sky-500/40"
active-class="bg-sky-700/60"
>
管理后台
</RouterLink>
<a
href="#"
class="px-3 py-1.5 rounded-md text-sm font-medium transition-colors
hover:bg-red-500/40"
@click.prevent="handleLogout"
>
退出
</a>
</template>
<template v-else>
<RouterLink
to="/login"
class="px-3 py-1.5 rounded-md text-sm font-medium transition-colors
hover:bg-sky-500/40"
active-class="bg-sky-700/60"
>
登录
</RouterLink>
</template>
</nav>
</div>
</header>
<div class="wrapper">
<nav>
<RouterLink to="/">Home</RouterLink>
<RouterLink to="/about">About</RouterLink>
<template v-if="authStore.isLoggedIn">
<RouterLink to="/admin">管理后台</RouterLink>
<a href="#" @click.prevent="handleLogout">退出</a>
</template>
<template v-else>
<RouterLink to="/login">登录</RouterLink>
</template>
</nav>
</div>
</header>
<main class="flex-1">
<RouterView />
</main>
<RouterView />
<footer class="bg-slate-800 text-slate-400 py-6 text-center text-sm">
<div class="max-w-6xl mx-auto px-4">
<p>&copy; {{ new Date().getFullYear() }} LmVPN. All rights reserved.</p>
</div>
</footer>
</div>
</template>
<style scoped>
header {
line-height: 1.5;
max-height: 100vh;
}
.logo {
display: block;
margin: 0 auto 2rem;
}
nav {
width: 100%;
font-size: 12px;
text-align: center;
margin-top: 2rem;
}
nav a.router-link-exact-active {
color: var(--color-text);
}
nav a.router-link-exact-active:hover {
background-color: transparent;
}
nav a {
display: inline-block;
padding: 0 1rem;
border-left: 1px solid var(--color-border);
color: var(--color-text);
text-decoration: none;
}
nav a:first-of-type {
border: 0;
}
@media (min-width: 1024px) {
header {
display: flex;
place-items: center;
padding-right: calc(var(--section-gap) / 2);
}
.logo {
margin: 0 2rem 0 0;
}
header .wrapper {
display: flex;
place-items: flex-start;
flex-wrap: wrap;
}
nav {
text-align: left;
margin-left: -1rem;
font-size: 1rem;
padding: 1rem 0;
margin-top: 1rem;
}
}
</style>
+6 -83
View File
@@ -1,86 +1,9 @@
/* color palette from <https://github.com/vuejs/theme> */
:root {
--vt-c-white: #ffffff;
--vt-c-white-soft: #f8f8f8;
--vt-c-white-mute: #f2f2f2;
@import 'tailwindcss';
--vt-c-black: #181818;
--vt-c-black-soft: #222222;
--vt-c-black-mute: #282828;
--vt-c-indigo: #2c3e50;
--vt-c-divider-light-1: rgba(60, 60, 60, 0.29);
--vt-c-divider-light-2: rgba(60, 60, 60, 0.12);
--vt-c-divider-dark-1: rgba(84, 84, 84, 0.65);
--vt-c-divider-dark-2: rgba(84, 84, 84, 0.48);
--vt-c-text-light-1: var(--vt-c-indigo);
--vt-c-text-light-2: rgba(60, 60, 60, 0.66);
--vt-c-text-dark-1: var(--vt-c-white);
--vt-c-text-dark-2: rgba(235, 235, 235, 0.64);
}
/* semantic color variables for this project */
:root {
--color-background: var(--vt-c-white);
--color-background-soft: var(--vt-c-white-soft);
--color-background-mute: var(--vt-c-white-mute);
--color-border: var(--vt-c-divider-light-2);
--color-border-hover: var(--vt-c-divider-light-1);
--color-heading: var(--vt-c-text-light-1);
--color-text: var(--vt-c-text-light-1);
--section-gap: 160px;
}
@media (prefers-color-scheme: dark) {
:root {
--color-background: var(--vt-c-black);
--color-background-soft: var(--vt-c-black-soft);
--color-background-mute: var(--vt-c-black-mute);
--color-border: var(--vt-c-divider-dark-2);
--color-border-hover: var(--vt-c-divider-dark-1);
--color-heading: var(--vt-c-text-dark-1);
--color-text: var(--vt-c-text-dark-2);
@layer base {
body {
@apply bg-gray-50 text-gray-900 dark:bg-gray-950 dark:text-gray-100;
@apply font-sans text-base leading-relaxed antialiased;
min-height: 100vh;
}
}
*,
*::before,
*::after {
box-sizing: border-box;
margin: 0;
font-weight: normal;
}
body {
min-height: 100vh;
color: var(--color-text);
background: var(--color-background);
transition:
color 0.5s,
background-color 0.5s;
line-height: 1.6;
font-family:
Inter,
-apple-system,
BlinkMacSystemFont,
'Segoe UI',
Roboto,
Oxygen,
Ubuntu,
Cantarell,
'Fira Sans',
'Droid Sans',
'Helvetica Neue',
sans-serif;
font-size: 15px;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
-34
View File
@@ -1,35 +1 @@
@import './base.css';
#app {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
font-weight: normal;
}
a,
.green {
text-decoration: none;
color: hsla(160, 100%, 37%, 1);
transition: 0.4s;
padding: 3px;
}
@media (hover: hover) {
a:hover {
background-color: hsla(160, 100%, 37%, 0.2);
}
}
@media (min-width: 1024px) {
body {
display: flex;
place-items: center;
}
#app {
display: grid;
grid-template-columns: 1fr 1fr;
padding: 0 2rem;
}
}
+9 -32
View File
@@ -5,37 +5,14 @@ defineProps<{
</script>
<template>
<div class="greetings">
<h1 class="green">{{ msg }}</h1>
<h3>
Youve successfully created a project with
<a href="https://vite.dev/" target="_blank" rel="noopener">Vite</a> +
<a href="https://vuejs.org/" target="_blank" rel="noopener">Vue 3</a>. What's next?
</h3>
<div class="py-16 sm:py-24 text-center">
<div class="max-w-3xl mx-auto px-4">
<h1 class="text-4xl sm:text-5xl font-extrabold text-sky-600 dark:text-sky-400 mb-4">
{{ msg }}
</h1>
<p class="text-lg sm:text-xl text-gray-600 dark:text-gray-400 max-w-2xl mx-auto">
安全快速可靠的 VPN 隧道管理系统
</p>
</div>
</div>
</template>
<style scoped>
h1 {
font-weight: 500;
font-size: 2.6rem;
position: relative;
top: -10px;
}
h3 {
font-size: 1.2rem;
}
.greetings h1,
.greetings h3 {
text-align: center;
}
@media (min-width: 1024px) {
.greetings h1,
.greetings h3 {
text-align: left;
}
}
</style>
+39 -86
View File
@@ -1,95 +1,48 @@
<script setup lang="ts">
import WelcomeItem from './WelcomeItem.vue'
import DocumentationIcon from './icons/IconDocumentation.vue'
import ToolingIcon from './icons/IconTooling.vue'
import EcosystemIcon from './icons/IconEcosystem.vue'
import CommunityIcon from './icons/IconCommunity.vue'
import SupportIcon from './icons/IconSupport.vue'
const openReadmeInEditor = () => fetch('/__open-in-editor?file=README.md')
</script>
<template>
<WelcomeItem>
<template #icon>
<DocumentationIcon />
</template>
<template #heading>Documentation</template>
<div class="max-w-6xl mx-auto px-4 py-12 grid gap-6 sm:grid-cols-2 lg:grid-cols-4">
<WelcomeItem>
<template #icon>
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" />
</svg>
</template>
<template #heading>安全隧道</template>
基于 WireGuard/OpenVPN 协议端到端加密传输保障数据安全无泄漏
</WelcomeItem>
Vues
<a href="https://vuejs.org/" target="_blank" rel="noopener">official documentation</a>
provides you with all information you need to get started.
</WelcomeItem>
<WelcomeItem>
<template #icon>
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" />
</svg>
</template>
<template #heading>多设备支持</template>
同时连接多台设备手机电脑路由器全平台覆盖
</WelcomeItem>
<WelcomeItem>
<template #icon>
<ToolingIcon />
</template>
<template #heading>Tooling</template>
<WelcomeItem>
<template #icon>
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M7 12l3-3 3 3 4-4M8 21l4-4 4 4M3 4h18M4 4h16v12a1 1 0 01-1 1H5a1 1 0 01-1-1V4z" />
</svg>
</template>
<template #heading>流量监控</template>
实时流量统计与带宽分析随时掌握网络使用状况
</WelcomeItem>
This project is served and bundled with
<a href="https://vite.dev/guide/features.html" target="_blank" rel="noopener">Vite</a>. The
recommended IDE setup is
<a href="https://code.visualstudio.com/" target="_blank" rel="noopener">VSCode</a>
+
<a href="https://github.com/vuejs/language-tools" target="_blank" rel="noopener"
>Vue - Official</a
>. If you need to test your components and web pages, check out
<a href="https://vitest.dev/" target="_blank" rel="noopener">Vitest</a>
and
<a href="https://www.cypress.io/" target="_blank" rel="noopener">Cypress</a>
/
<a href="https://playwright.dev/" target="_blank" rel="noopener">Playwright</a>.
<br />
More instructions are available in
<a href="javascript:void(0)" @click="openReadmeInEditor"><code>README.md</code></a
>.
</WelcomeItem>
<WelcomeItem>
<template #icon>
<EcosystemIcon />
</template>
<template #heading>Ecosystem</template>
Get official tools and libraries for your project:
<a href="https://pinia.vuejs.org/" target="_blank" rel="noopener">Pinia</a>,
<a href="https://router.vuejs.org/" target="_blank" rel="noopener">Vue Router</a>,
<a href="https://test-utils.vuejs.org/" target="_blank" rel="noopener">Vue Test Utils</a>, and
<a href="https://github.com/vuejs/devtools" target="_blank" rel="noopener">Vue Dev Tools</a>. If
you need more resources, we suggest paying
<a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">Awesome Vue</a>
a visit.
</WelcomeItem>
<WelcomeItem>
<template #icon>
<CommunityIcon />
</template>
<template #heading>Community</template>
Got stuck? Ask your question on
<a href="https://chat.vuejs.org" target="_blank" rel="noopener">Vue Land</a>
(our official Discord server), or
<a href="https://stackoverflow.com/questions/tagged/vue.js" target="_blank" rel="noopener"
>StackOverflow</a
>. You should also follow the official
<a href="https://bsky.app/profile/vuejs.org" target="_blank" rel="noopener">@vuejs.org</a>
Bluesky account or the
<a href="https://x.com/vuejs" target="_blank" rel="noopener">@vuejs</a>
X account for latest news in the Vue world.
</WelcomeItem>
<WelcomeItem>
<template #icon>
<SupportIcon />
</template>
<template #heading>Support Vue</template>
As an independent project, Vue relies on community backing for its sustainability. You can help
us by
<a href="https://vuejs.org/sponsor/" target="_blank" rel="noopener">becoming a sponsor</a>.
</WelcomeItem>
<WelcomeItem>
<template #icon>
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" />
<circle cx="12" cy="12" r="3" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
</svg>
</template>
<template #heading>简易配置</template>
一键部署自动配置无需复杂网络知识即可上线
</WelcomeItem>
</div>
</template>
+10 -80
View File
@@ -1,87 +1,17 @@
<template>
<div class="item">
<i>
<div class="flex gap-4 p-6 bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-200 dark:border-gray-700
hover:shadow-md transition-shadow">
<div class="flex-shrink-0 w-12 h-12 flex items-center justify-center rounded-lg
bg-sky-100 dark:bg-sky-900/40 text-sky-600 dark:text-sky-400">
<slot name="icon"></slot>
</i>
<div class="details">
<h3>
</div>
<div class="flex-1 min-w-0">
<h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-1">
<slot name="heading"></slot>
</h3>
<slot></slot>
<div class="text-sm text-gray-600 dark:text-gray-400 leading-relaxed">
<slot></slot>
</div>
</div>
</div>
</template>
<style scoped>
.item {
margin-top: 2rem;
display: flex;
position: relative;
}
.details {
flex: 1;
margin-left: 1rem;
}
i {
display: flex;
place-items: center;
place-content: center;
width: 32px;
height: 32px;
color: var(--color-text);
}
h3 {
font-size: 1.2rem;
font-weight: 500;
margin-bottom: 0.4rem;
color: var(--color-heading);
}
@media (min-width: 1024px) {
.item {
margin-top: 0;
padding: 0.4rem 0 1rem calc(var(--section-gap) / 2);
}
i {
top: calc(50% - 25px);
left: -26px;
position: absolute;
border: 1px solid var(--color-border);
background: var(--color-background);
border-radius: 8px;
width: 50px;
height: 50px;
}
.item:before {
content: ' ';
border-left: 1px solid var(--color-border);
position: absolute;
left: 0;
bottom: calc(50% + 25px);
height: calc(50% - 25px);
}
.item:after {
content: ' ';
border-left: 1px solid var(--color-border);
position: absolute;
left: 0;
top: calc(50% + 25px);
height: calc(50% - 25px);
}
.item:first-of-type:before {
display: none;
}
.item:last-of-type:after {
display: none;
}
}
</style>
+6 -12
View File
@@ -1,15 +1,9 @@
<template>
<div class="about">
<h1>This is an about page</h1>
<div class="max-w-3xl mx-auto px-4 py-16 text-center">
<h1 class="text-3xl font-bold text-gray-900 dark:text-white mb-4">关于 LmVPN</h1>
<p class="text-gray-600 dark:text-gray-400 leading-relaxed max-w-xl mx-auto">
LmVPN 是一款轻量级 VPN 隧道管理系统采用 Go + Vue 3 技术栈构建
支持多种 VPN 协议提供安全可靠的点对点与点对站点网络连接方案
</p>
</div>
</template>
<style>
@media (min-width: 1024px) {
.about {
min-height: 100vh;
display: flex;
align-items: center;
}
}
</style>
+45 -46
View File
@@ -1,10 +1,16 @@
<script setup lang="ts">
import { onMounted } from 'vue'
import { onMounted, ref } from 'vue'
import { useRouter } from 'vue-router'
import { useAuthStore } from '@/stores/auth'
const router = useRouter()
const authStore = useAuthStore()
const stats = ref([
{ label: '运行时长', value: '--', unit: '', icon: 'M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z' },
{ label: '活跃设备', value: '--', unit: '', icon: 'M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z' },
{ label: '今日流量', value: '--', unit: 'GB', icon: 'M7 12l3-3 3 3 4-4M8 21l4-4 4 4M3 4h18M4 4h16v12a1 1 0 01-1 1H5a1 1 0 01-1-1V4z' },
{ label: '在线节点', value: '--', unit: '', icon: 'M5 12h14M12 5l7 7-7 7' },
])
onMounted(async () => {
await authStore.fetchUser()
@@ -17,51 +23,44 @@ function handleLogout() {
</script>
<template>
<div class="admin-container">
<h2>管理后台</h2>
<div class="user-card">
<p><strong>用户名</strong>{{ authStore.user?.username }}</p>
<p><strong>角色</strong>{{ authStore.user?.role === 'admin' ? '管理员' : '普通用户' }}</p>
<div class="max-w-4xl mx-auto px-4 py-12">
<h2 class="text-2xl font-bold text-gray-900 dark:text-white mb-8">管理后台</h2>
<div class="grid gap-6 sm:grid-cols-2 lg:grid-cols-4 mb-8">
<div
v-for="stat in stats"
:key="stat.label"
class="bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-200 dark:border-gray-700 p-5"
>
<div class="flex items-center gap-3">
<div class="w-10 h-10 rounded-lg bg-sky-100 dark:bg-sky-900/40 flex items-center justify-center">
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-sky-600 dark:text-sky-400" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" :d="stat.icon" />
</svg>
</div>
<div>
<p class="text-xs text-gray-500 dark:text-gray-400">{{ stat.label }}</p>
<p class="text-xl font-bold text-gray-900 dark:text-white">
{{ stat.value }}<span class="text-sm font-normal text-gray-500">{{ stat.unit }}</span>
</p>
</div>
</div>
</div>
</div>
<button class="logout-btn" @click="handleLogout">退出登录</button>
<div class="bg-white dark:bg-gray-800 rounded-xl shadow-sm border border-gray-200 dark:border-gray-700 p-6 mb-6">
<h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4">用户信息</h3>
<div class="space-y-2 text-sm text-gray-700 dark:text-gray-300">
<p><span class="font-medium text-gray-900 dark:text-white">用户名</span>{{ authStore.user?.username }}</p>
<p><span class="font-medium text-gray-900 dark:text-white">角色</span>{{ authStore.user?.role === 'admin' ? '管理员' : '普通用户' }}</p>
</div>
</div>
<button
class="px-6 py-2.5 rounded-lg font-medium text-white bg-red-500 hover:bg-red-600 transition-colors"
@click="handleLogout"
>
退出登录
</button>
</div>
</template>
<style scoped>
.admin-container {
max-width: 600px;
margin: 2rem auto;
padding: 2rem;
}
.admin-container h2 {
margin-bottom: 1.5rem;
color: var(--color-heading);
}
.user-card {
padding: 1rem;
border: 1px solid var(--color-border);
border-radius: 8px;
background: var(--color-background-soft);
}
.user-card p {
margin: 0.5rem 0;
}
.logout-btn {
margin-top: 1.5rem;
padding: 0.6rem 1.5rem;
border: none;
border-radius: 4px;
background: #e74c3c;
color: #fff;
font-size: 0.95rem;
cursor: pointer;
}
.logout-btn:hover {
opacity: 0.9;
}
</style>
+3 -3
View File
@@ -1,9 +1,9 @@
<script setup lang="ts">
import HelloWorld from '../components/HelloWorld.vue'
import TheWelcome from '../components/TheWelcome.vue'
</script>
<template>
<main>
<TheWelcome />
</main>
<HelloWorld msg="LmVPN" />
<TheWelcome />
</template>
+29 -87
View File
@@ -30,112 +30,54 @@ async function handleLogin() {
</script>
<template>
<div class="login-container">
<div class="login-card">
<h2>LmVPN 登录</h2>
<form @submit.prevent="handleLogin">
<div class="form-group">
<label for="username">用户名</label>
<div class="min-h-[calc(100vh-160px)] flex items-center justify-center px-4 py-12">
<div class="w-full max-w-sm bg-white dark:bg-gray-800 rounded-xl shadow-lg p-8">
<h2 class="text-2xl font-bold text-center text-gray-900 dark:text-white mb-6">
LmVPN 登录
</h2>
<form @submit.prevent="handleLogin" class="space-y-4">
<div>
<label for="username" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">
用户名
</label>
<input
id="username"
v-model="username"
type="text"
placeholder="请输入用户名"
autocomplete="username"
class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg
bg-white dark:bg-gray-700 text-gray-900 dark:text-white
focus:outline-none focus:ring-2 focus:ring-sky-500 focus:border-transparent
placeholder-gray-400 dark:placeholder-gray-500 transition-colors"
/>
</div>
<div class="form-group">
<label for="password">密码</label>
<div>
<label for="password" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">
密码
</label>
<input
id="password"
v-model="password"
type="password"
placeholder="请输入密码"
autocomplete="current-password"
class="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg
bg-white dark:bg-gray-700 text-gray-900 dark:text-white
focus:outline-none focus:ring-2 focus:ring-sky-500 focus:border-transparent
placeholder-gray-400 dark:placeholder-gray-500 transition-colors"
/>
</div>
<p v-if="error" class="error-msg">{{ error }}</p>
<button type="submit" :disabled="loading">
<p v-if="error" class="text-sm text-red-500">{{ error }}</p>
<button
type="submit"
:disabled="loading"
class="w-full py-2.5 rounded-lg font-medium text-white transition-colors
bg-sky-600 hover:bg-sky-700 disabled:opacity-50 disabled:cursor-not-allowed"
>
{{ loading ? '登录中...' : '登录' }}
</button>
</form>
</div>
</div>
</template>
<style scoped>
.login-container {
display: flex;
justify-content: center;
align-items: center;
min-height: calc(100vh - 120px);
}
.login-card {
width: 100%;
max-width: 380px;
padding: 2rem;
border-radius: 8px;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
background: var(--color-background);
}
.login-card h2 {
text-align: center;
margin-bottom: 1.5rem;
color: var(--color-heading);
}
.form-group {
margin-bottom: 1rem;
}
.form-group label {
display: block;
margin-bottom: 0.4rem;
font-size: 0.9rem;
color: var(--color-text);
}
.form-group input {
width: 100%;
padding: 0.6rem 0.8rem;
border: 1px solid var(--color-border);
border-radius: 4px;
font-size: 1rem;
background: var(--color-background);
color: var(--color-text);
box-sizing: border-box;
}
.form-group input:focus {
outline: none;
border-color: var(--vt-c-indigo);
}
.error-msg {
color: #e74c3c;
font-size: 0.85rem;
margin-bottom: 0.5rem;
}
button {
width: 100%;
padding: 0.65rem;
border: none;
border-radius: 4px;
background: var(--vt-c-indigo);
color: #fff;
font-size: 1rem;
cursor: pointer;
}
button:hover {
opacity: 0.9;
}
button:disabled {
opacity: 0.6;
cursor: not-allowed;
}
</style>