style: 登录样式更新

This commit is contained in:
Wenjie Zhang 2025-10-15 22:24:33 +08:00
parent 5d8101a502
commit 8514f18985
3 changed files with 324 additions and 259 deletions

View File

@ -114,7 +114,7 @@ def get_default_info_config():
"description": "结合知识库与知识图谱,提供更准确、更全面的回答", "description": "结合知识库与知识图谱,提供更准确、更全面的回答",
}, },
"features": ["📚 灵活知识库", "🕸️ 知识图谱集成", "🤖 多模型支持"], "features": ["📚 灵活知识库", "🕸️ 知识图谱集成", "🤖 多模型支持"],
"footer": {"copyright": "© 江南语析 2025 [WIP] v0.2.0"}, "footer": {"copyright": "© 江南语析 2025 [WIP] v0.3.0"},
} }

View File

@ -23,4 +23,4 @@ features:
# 页脚信息 # 页脚信息
footer: footer:
copyright: "© 江南语析 2025 v0.2.0" copyright: "© 江南语析 2025 v0.3.0"

View File

@ -26,9 +26,9 @@
<img :src="loginBgImage" alt="登录背景" class="login-bg-image" /> <img :src="loginBgImage" alt="登录背景" class="login-bg-image" />
<div class="image-overlay"> <div class="image-overlay">
<div class="brand-info"> <div class="brand-info">
<h1 class="brand-title">{{ infoStore.branding?.name || 'Yuxi-Know' }}</h1> <h1 class="brand-title">{{ brandName }}</h1>
<p class="brand-subtitle">{{ infoStore.branding?.subtitle || '大模型驱动的知识库管理工具' }}</p> <p class="brand-subtitle">{{ brandSubtitle }}</p>
<p class="brand-description">{{ infoStore.branding?.description || '结合知识库与知识图谱,提供更准确、更全面的回答' }}</p> <p class="brand-description">{{ brandDescription }}</p>
</div> </div>
<div class="brand-copyright"> <div class="brand-copyright">
<p>{{ infoStore.footer?.copyright || 'Yuxi-Know' }}. {{ infoStore.branding?.copyright || '版权所有' }}</p> <p>{{ infoStore.footer?.copyright || 'Yuxi-Know' }}. {{ infoStore.branding?.copyright || '版权所有' }}</p>
@ -39,177 +39,175 @@
<!-- 右侧登录表单区域 --> <!-- 右侧登录表单区域 -->
<div class="login-form-section"> <div class="login-form-section">
<div class="login-container"> <div class="login-container">
<div class="login-logo"> <header class="login-header">
<h1>欢迎登录 {{ infoStore.branding.name }}</h1> <p class="login-title">欢迎登录</p>
</div> <h1 class="login-brand">{{ brandName }}</h1>
<p v-if="!isFirstRun && brandSubtitle" class="login-subtitle">{{ brandSubtitle }}</p>
</header>
<!-- 初始化管理员表单 --> <div class="login-content" :class="{ 'is-initializing': isFirstRun }">
<div v-if="isFirstRun" class="login-form"> <!-- 初始化管理员表单 -->
<h2>系统初始化请创建超级管理员账户</h2> <div v-if="isFirstRun" class="login-form login-form--init">
<div class="init-tips"> <h2>系统初始化请创建超级管理员</h2>
<p> 请输入用户ID仅支持字母数字和下划线</p> <a-form
<p> 手机号可选填写用于后续登录</p> :model="adminForm"
<p> 请妥善保管管理员账户信息</p> @finish="handleInitialize"
</div> layout="vertical"
>
<a-form-item
label="用户ID"
name="user_id"
:rules="[
{ required: true, message: '请输入用户ID' },
{
pattern: /^[a-zA-Z0-9_]+$/,
message: '用户ID只能包含字母、数字和下划线'
},
{
min: 3,
max: 20,
message: '用户ID长度必须在3-20个字符之间'
}
]"
>
<a-input
v-model:value="adminForm.user_id"
placeholder="请输入用户ID3-20个字符"
:maxlength="20"
/>
</a-form-item>
<a-form <a-form-item
:model="adminForm" label="手机号(可选)"
@finish="handleInitialize" name="phone_number"
layout="vertical" :rules="[
> {
<a-form-item validator: async (rule, value) => {
label="用户ID" if (!value || value.trim() === '') {
name="user_id" return; //
:rules="[ }
{ required: true, message: '请输入用户ID' }, const phoneRegex = /^1[3-9]\d{9}$/;
{ if (!phoneRegex.test(value)) {
pattern: /^[a-zA-Z0-9_]+$/, throw new Error('请输入正确的手机号格式');
message: '用户ID只能包含字母、数字和下划线' }
}, }
{ }
min: 3, ]"
max: 20, >
message: '用户ID长度必须在3-20个字符之间' <a-input
} v-model:value="adminForm.phone_number"
]" placeholder="可用于登录,可不填写"
> :max-length="11"
<a-input />
v-model:value="adminForm.user_id" </a-form-item>
placeholder="请输入用户ID3-20个字符"
:maxlength="20"
/>
</a-form-item>
<a-form-item <a-form-item
label="手机号(可选)" label="密码"
name="phone_number" name="password"
:rules="[ :rules="[{ required: true, message: '请输入密码' }]"
{ >
validator: async (rule, value) => { <a-input-password v-model:value="adminForm.password" prefix-icon="lock" />
if (!value || value.trim() === '') { </a-form-item>
return; //
}
const phoneRegex = /^1[3-9]\d{9}$/;
if (!phoneRegex.test(value)) {
throw new Error('请输入正确的手机号格式');
}
}
}
]"
>
<a-input
v-model:value="adminForm.phone_number"
placeholder="可用于登录,可不填写"
:max-length="11"
/>
</a-form-item>
<a-form-item <a-form-item
label="密码" label="确认密码"
name="password" name="confirmPassword"
:rules="[{ required: true, message: '请输入密码' }]" :rules="[
> { required: true, message: '请确认密码' },
<a-input-password v-model:value="adminForm.password" prefix-icon="lock" /> { validator: validateConfirmPassword }
</a-form-item> ]"
>
<a-input-password v-model:value="adminForm.confirmPassword" prefix-icon="lock" />
</a-form-item>
<a-form-item <a-form-item>
label="确认密码" <a-button type="primary" html-type="submit" :loading="loading" block>创建管理员账户</a-button>
name="confirmPassword" </a-form-item>
:rules="[ </a-form>
{ required: true, message: '请确认密码' },
{ validator: validateConfirmPassword }
]"
>
<a-input-password v-model:value="adminForm.confirmPassword" prefix-icon="lock" />
</a-form-item>
<a-form-item>
<a-button type="primary" html-type="submit" :loading="loading" block>创建管理员账户</a-button>
</a-form-item>
</a-form>
</div>
<!-- 登录表单 -->
<div v-else class="login-form">
<a-form
:model="loginForm"
@finish="handleLogin"
layout="vertical"
>
<a-form-item
label="登录账号"
name="loginId"
:rules="[{ required: true, message: '请输入用户ID或手机号' }]"
>
<a-input v-model:value="loginForm.loginId" placeholder="用户ID或手机号">
<template #prefix>
<user-outlined />
</template>
</a-input>
</a-form-item>
<a-form-item
label="密码"
name="password"
:rules="[{ required: true, message: '请输入密码' }]"
>
<a-input-password v-model:value="loginForm.password">
<template #prefix>
<lock-outlined />
</template>
</a-input-password>
</a-form-item>
<a-form-item>
<div class="login-options">
<a-checkbox v-model:checked="rememberMe" @click="showDevMessage">记住我</a-checkbox>
<a class="forgot-password" @click="showDevMessage">忘记密码?</a>
</div> </div>
</a-form-item>
<a-form-item> <!-- 登录表单 -->
<a-button <div v-else class="login-form">
type="primary" <a-form
html-type="submit" :model="loginForm"
:loading="loading" @finish="handleLogin"
:disabled="isLocked" layout="vertical"
block >
> <a-form-item
<span v-if="isLocked">账户已锁定 {{ formatTime(lockRemainingTime) }}</span> label="登录账号"
<span v-else>登录</span> name="loginId"
</a-button> :rules="[{ required: true, message: '请输入用户ID或手机号' }]"
</a-form-item> >
<a-input v-model:value="loginForm.loginId" placeholder="用户ID或手机号">
<template #prefix>
<user-outlined />
</template>
</a-input>
</a-form-item>
<!-- 第三方登录选项 --> <a-form-item
<div class="third-party-login"> label="密码"
<div class="divider"> name="password"
<span>其他登录方式</span> :rules="[{ required: true, message: '请输入密码' }]"
>
<a-input-password v-model:value="loginForm.password">
<template #prefix>
<lock-outlined />
</template>
</a-input-password>
</a-form-item>
<a-form-item>
<div class="login-options">
<a-checkbox v-model:checked="rememberMe" @click="showDevMessage">记住我</a-checkbox>
<a class="forgot-password" @click="showDevMessage">忘记密码?</a>
</div>
</a-form-item>
<a-form-item>
<a-button
type="primary"
html-type="submit"
:loading="loading"
:disabled="isLocked"
block
>
<span v-if="isLocked">账户已锁定 {{ formatTime(lockRemainingTime) }}</span>
<span v-else>登录</span>
</a-button>
</a-form-item>
<!-- 第三方登录选项 -->
<div class="third-party-login">
<div class="divider">
<span>其他登录方式</span>
</div>
<div class="login-icons">
<a-tooltip title="微信登录">
<a-button shape="circle" class="login-icon" @click="showDevMessage">
<template #icon><wechat-outlined /></template>
</a-button>
</a-tooltip>
<a-tooltip title="企业微信登录">
<a-button shape="circle" class="login-icon" @click="showDevMessage">
<template #icon><qrcode-outlined /></template>
</a-button>
</a-tooltip>
<a-tooltip title="飞书登录">
<a-button shape="circle" class="login-icon" @click="showDevMessage">
<template #icon><thunderbolt-outlined /></template>
</a-button>
</a-tooltip>
</div>
</div>
</a-form>
</div> </div>
<div class="login-icons">
<a-tooltip title="微信登录"> <!-- 错误提示 -->
<a-button shape="circle" class="login-icon" @click="showDevMessage"> <div v-if="errorMessage" class="error-message">
<template #icon><wechat-outlined /></template> {{ errorMessage }}
</a-button>
</a-tooltip>
<a-tooltip title="企业微信登录">
<a-button shape="circle" class="login-icon" @click="showDevMessage">
<template #icon><qrcode-outlined /></template>
</a-button>
</a-tooltip>
<a-tooltip title="飞书登录">
<a-button shape="circle" class="login-icon" @click="showDevMessage">
<template #icon><thunderbolt-outlined /></template>
</a-button>
</a-tooltip>
</div> </div>
</div> </div>
</a-form>
</div>
<!-- 错误提示 -->
<div v-if="errorMessage" class="error-message">
{{ errorMessage }}
</div>
<!-- 页脚 --> <!-- 页脚 -->
<div class="login-footer"> <div class="login-footer">
@ -224,7 +222,7 @@
</template> </template>
<script setup> <script setup>
import { ref, reactive, onMounted, onUnmounted, computed, watch } from 'vue'; import { ref, reactive, onMounted, onUnmounted, computed } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { useUserStore } from '@/stores/user'; import { useUserStore } from '@/stores/user';
import { useInfoStore } from '@/stores/info'; import { useInfoStore } from '@/stores/info';
@ -237,10 +235,25 @@ const userStore = useUserStore();
const infoStore = useInfoStore(); const infoStore = useInfoStore();
const agentStore = useAgentStore(); const agentStore = useAgentStore();
// infoStore //
const loginBgImage = computed(() => { const loginBgImage = computed(() => {
return infoStore.organization?.login_bg || '/login-bg.jpg'; return infoStore.organization?.login_bg || '/login-bg.jpg';
}); });
const brandName = computed(() => {
const rawName = infoStore.branding?.name ?? '';
const trimmed = rawName.trim();
return trimmed || 'Yuxi-Know';
});
const brandSubtitle = computed(() => {
const rawSubtitle = infoStore.branding?.subtitle ?? '';
const trimmed = rawSubtitle.trim();
return trimmed || '大模型驱动的知识库管理工具';
});
const brandDescription = computed(() => {
const rawDescription = infoStore.branding?.description ?? '';
const trimmed = rawDescription.trim();
return trimmed || '结合知识库与知识图谱,提供更准确、更全面的回答';
});
// //
const isFirstRun = ref(false); const isFirstRun = ref(false);
@ -531,7 +544,7 @@ onUnmounted(() => {
} }
.back-home-btn { .back-home-btn {
color: #666; color: var(--gray-600);
font-size: 14px; font-size: 14px;
padding: 0 8px; padding: 0 8px;
@ -544,14 +557,16 @@ onUnmounted(() => {
.login-layout { .login-layout {
display: flex; display: flex;
height: 100%; min-height: 100%;
width: 100%; width: 100%;
background: var(--gray-10);
} }
.login-image-section { .login-image-section {
flex: 0 0 55%; flex: 0 0 52%;
position: relative; position: relative;
overflow: hidden; overflow: hidden;
max-height: 100vh;
.login-bg-image { .login-bg-image {
width: 100%; width: 100%;
@ -561,48 +576,48 @@ onUnmounted(() => {
} }
.image-overlay { .image-overlay {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
background: rgba(0, 0, 0, 0.4); background: rgba(0, 0, 0, 0.35);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
padding: 80px 60px 40px 60px; padding: 72px 64px 36px;
} }
.brand-info { .brand-info {
text-align: left; text-align: left;
color: white; color: white;
max-width: 600px; max-width: 520px;
.brand-title { .brand-title {
font-size: 64px; font-size: 52px;
font-weight: 800; font-weight: 700;
margin-bottom: 24px; margin-bottom: 20px;
text-shadow: 0 3px 6px rgba(0, 0, 0, 0.4); text-shadow: 0 3px 6px rgba(0, 0, 0, 0.35);
letter-spacing: -1px; letter-spacing: -0.5px;
} }
.brand-subtitle { .brand-subtitle {
font-size: 28px; font-size: 24px;
font-weight: 500; font-weight: 500;
margin-bottom: 32px; margin-bottom: 24px;
opacity: 0.95; opacity: 0.92;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); text-shadow: 0 2px 4px rgba(0, 0, 0, 0.28);
line-height: 1.3; line-height: 1.4;
} }
.brand-description { .brand-description {
font-size: 20px; font-size: 18px;
line-height: 1.6; line-height: 1.6;
margin-bottom: 0; margin: 0;
opacity: 0.85; opacity: 0.82;
text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
} }
} }
.brand-copyright { .brand-copyright {
align-self: flex-start; align-self: flex-start;
@ -619,54 +634,80 @@ onUnmounted(() => {
.login-form-section { .login-form-section {
flex: 1; flex: 1;
min-width: 400px; min-width: 420px;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
background: #ffffff; padding: 64px 72px;
padding: 40px; background: var(--main-20);
} }
.login-container { .login-container {
width: 100%; width: 100%;
max-width: 420px; max-width: 460px;
padding: 0; padding: 40px;
background: transparent; background: var(--gray-0);
border-radius: 0; border-radius: 24px;
box-shadow: none; border: 1px solid var(--gray-150);
backdrop-filter: none; box-shadow: 0 18px 36px rgba(66, 66, 66, 0.05);
border: none; display: flex;
flex-direction: column;
gap: 32px;
} }
.login-logo { .login-header {
text-align: center; display: flex;
margin-bottom: 30px; flex-direction: column;
gap: 8px;
text-align: left;
}
img { .login-title {
height: 70px; margin: 0;
margin-bottom: 16px; font-size: 14px;
} font-weight: 600;
letter-spacing: 0.08em;
color: var(--gray-600);
text-transform: uppercase;
}
h1 { .login-brand {
font-size: 28px; margin: 0;
font-weight: 600; font-size: 30px;
color: var(--main-color); font-weight: 600;
margin: 0; color: var(--main-color);
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); line-height: 1.25;
}
.login-subtitle {
margin: 0;
font-size: 16px;
color: var(--gray-600);
line-height: 1.6;
}
.login-content {
display: flex;
flex-direction: column;
gap: 24px;
&.is-initializing {
gap: 28px;
} }
} }
.login-form { .login-form {
h2 { display: flex;
text-align: center; flex-direction: column;
margin-bottom: 30px; gap: 12px;
font-size: 22px; width: 100%;
font-weight: 500;
color: #333; :deep(.ant-form) {
width: 100%;
} }
:deep(.ant-form-item) { :deep(.ant-form-item) {
margin-bottom: 20px; margin-bottom: 18px;
} }
:deep(.ant-input-affix-wrapper) { :deep(.ant-input-affix-wrapper) {
@ -681,35 +722,52 @@ onUnmounted(() => {
} }
} }
.login-form--init {
padding: 24px;
border-radius: 18px;
background: var(--main-30);
border: 1px solid var(--main-200);
h2 {
margin-bottom: 16px;
font-size: 22px;
font-weight: 600;
color: var(--main-color);
text-align: left;
}
}
.login-options { .login-options {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin-bottom: 8px; margin-bottom: 8px;
gap: 12px;
flex-wrap: wrap;
.forgot-password { .forgot-password {
color: #1890ff; color: var(--main-color);
font-size: 14px; font-size: 14px;
&:hover { &:hover {
color: #40a9ff; color: var(--main-bright);
} }
} }
} }
.init-tips { .init-tips {
background: #f6ffed; background: var(--main-20);
border: 1px solid #b7eb8f; border: 1px solid var(--main-200);
border-radius: 6px; border-radius: 12px;
padding: 12px 16px; padding: 16px 18px;
margin-bottom: 20px; margin-bottom: 20px;
text-align: left; text-align: left;
p { p {
margin: 4px 0; margin: 4px 0;
font-size: 13px; font-size: 13px;
color: #52c41a; color: var(--main-700);
line-height: 1.4; line-height: 1.45;
&:first-child { &:first-child {
margin-top: 0; margin-top: 0;
@ -724,10 +782,10 @@ onUnmounted(() => {
.error-message { .error-message {
margin-top: 16px; margin-top: 16px;
padding: 10px 12px; padding: 10px 12px;
background-color: #fff2f0; background-color: var(--stats-error-bg);
border: 1px solid #ffccc7; border: 1px solid rgba(220, 38, 38, 0.25);
border-radius: 4px; border-radius: 8px;
color: #ff4d4f; color: var(--stats-error-color);
font-size: 14px; font-size: 14px;
} }
@ -745,7 +803,7 @@ onUnmounted(() => {
top: 50%; top: 50%;
width: calc(50% - 60px); width: calc(50% - 60px);
height: 1px; height: 1px;
background-color: #e8e8e8; background-color: var(--gray-200);
} }
&::before { &::before {
@ -759,9 +817,9 @@ onUnmounted(() => {
span { span {
display: inline-block; display: inline-block;
padding: 0 12px; padding: 0 12px;
background-color: #fff; background-color: var(--gray-0);
position: relative; position: relative;
color: #999; color: var(--gray-600);
font-size: 14px; font-size: 14px;
} }
} }
@ -775,26 +833,33 @@ onUnmounted(() => {
margin: 0 12px; margin: 0 12px;
width: 42px; width: 42px;
height: 42px; height: 42px;
color: #666; color: var(--gray-600);
border: 1px solid var(--gray-300); border: 1px solid var(--gray-300);
transition: all 0.3s; transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
&:hover { &:hover {
color: var(--main-color); color: var(--main-color);
border-color: var(--main-color); border-color: var(--main-color);
background-color: var(--main-20);
} }
} }
} }
} }
.login-footer { .login-footer {
margin-top: 24px; margin-top: 16px;
text-align: center; padding-top: 16px;
border-top: 1px solid var(--gray-150);
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
gap: 16px;
font-size: 13px; font-size: 13px;
a { a {
color: #666; color: var(--gray-600);
margin: 0 8px;
cursor: pointer; cursor: pointer;
&:hover { &:hover {
@ -804,7 +869,7 @@ onUnmounted(() => {
} }
.server-status-alert { .server-status-alert {
position: fixed; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
right: 0; right: 0;