feat: 重做管理后台的导航、表单和登录页

This commit is contained in:
Nixevol
2026-10-19 16:47:19 +08:00
parent 8beacfb931
commit 9c33ba1431
29 changed files with 794 additions and 321 deletions
+58 -9
View File
@@ -1,8 +1,9 @@
<script setup lang="ts">
import { ref } from "vue";
import { useRoute, useRouter } from "vue-router";
import { NButton, NCard, NForm, NFormItem, NInput, NSpace, NText } from "naive-ui";
import { NButton, NCard, NForm, NFormItem, NInput, NText } from "naive-ui";
import { useAuthStore } from "@/stores/auth";
import BrandMark from "@/components/BrandMark.vue";
const auth = useAuthStore();
const router = useRouter();
@@ -30,14 +31,19 @@ async function onSubmit() {
<template>
<div class="login-page">
<n-card title="NixMsg 管理后台" style="width: 380px" size="small">
<n-form label-placement="left" label-width="72" :show-feedback="false" @submit.prevent="onSubmit">
<n-card class="login-card" :bordered="true">
<div class="login-head">
<BrandMark class="login-mark" />
<h1 class="login-brand">NixMsg</h1>
</div>
<n-form class="login-form" size="large" label-placement="left" label-width="72" :show-feedback="false" @submit.prevent="onSubmit">
<n-form-item label="用户名">
<n-input v-model:value="username" autocomplete="username" placeholder="admin" />
<n-input v-model:value="username" size="large" autocomplete="username" placeholder="请输入用户名" />
</n-form-item>
<n-form-item label="密码">
<n-input
v-model:value="password"
size="large"
type="password"
show-password-on="click"
autocomplete="current-password"
@@ -45,12 +51,23 @@ async function onSubmit() {
@keyup.enter="onSubmit"
/>
</n-form-item>
<n-text v-if="formError" type="error" style="display: block; margin-bottom: 8px">{{ formError }}</n-text>
<n-space justify="end">
<n-button type="primary" :loading="loading" data-testid="login-submit" @click="onSubmit">
<n-form-item v-if="formError">
<n-text type="error">{{ formError }}</n-text>
</n-form-item>
<n-form-item label=" ">
<n-button
class="login-submit"
type="primary"
size="large"
block
attr-type="submit"
:loading="loading"
data-testid="login-submit"
@click="onSubmit"
>
登录
</n-button>
</n-space>
</n-form-item>
</n-form>
</n-card>
</div>
@@ -62,6 +79,38 @@ async function onSubmit() {
display: flex;
align-items: center;
justify-content: center;
background: #f5f5f7;
padding: 40px 16px;
}
.login-card {
width: 440px;
}
.login-card :deep(.n-card__content) {
padding: 36px 32px 32px;
}
.login-head {
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
margin-bottom: 28px;
}
.login-mark {
font-size: 36px;
}
.login-brand {
margin: 0;
font-size: 24px;
font-weight: 650;
line-height: 1;
letter-spacing: 0.01em;
}
.login-form :deep(.n-form-item) {
margin-bottom: 18px;
}
.login-form :deep(.n-form-item-blank) {
min-width: 0;
}
.login-submit {
margin-top: 4px;
}
</style>