版本1.0.4 - 发布前准备
- 修复system.py缩进错误 - 优化前端页面样式(待重构) - 改进API接口结构 - 完善文档和自动化脚本 - 平台基本功能稳定运行
This commit is contained in:
+228
-123
@@ -4,176 +4,273 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>宇之然内容创作平台 - 登录</title>
|
||||
|
||||
<script src="/static/vue.global.prod.js?v=20260421-0830"></script>
|
||||
<link rel="stylesheet" href="/static/element-plus.css?v=20260421-0830" />
|
||||
<script src="/static/element-plus.full.js?v=20260421-0830"></script>
|
||||
<link rel="stylesheet" href="/static/element-plus/index.css">
|
||||
<style>
|
||||
.login-container {
|
||||
/* 重置与基础样式 */
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||
/* 紫蓝渐变背景 */
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* 背景动态装饰圆 */
|
||||
.bg-circle {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
animation: float 20s infinite ease-in-out;
|
||||
}
|
||||
.bg-circle:nth-child(1) { width: 300px; height: 300px; top: -150px; left: -150px; animation-delay: 0s; }
|
||||
.bg-circle:nth-child(2) { width: 200px; height: 200px; bottom: -100px; right: -100px; animation-delay: -5s; }
|
||||
.bg-circle:nth-child(3) { width: 150px; height: 150px; top: 50%; right: 10%; animation-delay: -10s; }
|
||||
.bg-circle:nth-child(4) { width: 100px; height: 100px; bottom: 20%; left: 5%; animation-delay: -15s; }
|
||||
|
||||
@keyframes float {
|
||||
0%, 100% { transform: translate(0, 0) scale(1); }
|
||||
25% { transform: translate(30px, -30px) scale(1.1); }
|
||||
50% { transform: translate(-20px, 20px) scale(0.9); }
|
||||
75% { transform: translate(20px, 30px) scale(1.05); }
|
||||
}
|
||||
|
||||
/* 登录卡片 */
|
||||
.login-card {
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
width: 100%;
|
||||
max-width: 400px;
|
||||
padding: 32px;
|
||||
background: white;
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
|
||||
max-width: 420px;
|
||||
padding: 48px 40px;
|
||||
background: rgba(255, 255, 255, 0.95);
|
||||
backdrop-filter: blur(20px);
|
||||
border-radius: 24px;
|
||||
box-shadow:
|
||||
0 20px 60px rgba(0, 0, 0, 0.3),
|
||||
0 0 0 1px rgba(255, 255, 255, 0.2) inset;
|
||||
animation: slide-up 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
|
||||
}
|
||||
|
||||
@keyframes slide-up {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(40px) scale(0.95);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0) scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
.login-title {
|
||||
text-align: center;
|
||||
font-size: 28px;
|
||||
font-weight: bold;
|
||||
color: #1f2937;
|
||||
font-weight: 700;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
margin-bottom: 40px;
|
||||
letter-spacing: -0.5px;
|
||||
}
|
||||
|
||||
.login-subtitle {
|
||||
text-align: center;
|
||||
color: #9ca3af;
|
||||
font-size: 14px;
|
||||
margin-top: -24px;
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
.login-input {
|
||||
|
||||
/* 表单样式 */
|
||||
.form-group {
|
||||
margin-bottom: 24px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.form-input {
|
||||
width: 100%;
|
||||
padding: 12px 16px;
|
||||
border: 1px solid #d1d5db;
|
||||
border-radius: 8px;
|
||||
padding: 14px 16px;
|
||||
border: 2px solid #e5e7eb;
|
||||
border-radius: 12px;
|
||||
font-size: 16px;
|
||||
margin-bottom: 16px;
|
||||
color: #1f2937;
|
||||
background: #f9fafb;
|
||||
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
outline: none;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
.login-input:focus {
|
||||
border-color: #3b82f6;
|
||||
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
|
||||
|
||||
.form-input:focus {
|
||||
border-color: #667eea;
|
||||
background: #ffffff;
|
||||
box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
.login-button {
|
||||
|
||||
.form-input:not(:placeholder-shown) {
|
||||
border-color: #764ba2;
|
||||
}
|
||||
|
||||
.form-label {
|
||||
position: absolute;
|
||||
left: 14px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
color: #9ca3af;
|
||||
pointer-events: none;
|
||||
transition: all 0.2s ease;
|
||||
font-size: 16px;
|
||||
background: transparent;
|
||||
padding: 0 4px;
|
||||
}
|
||||
|
||||
.form-input:focus ~ .form-label,
|
||||
.form-input:not(:placeholder-shown) ~ .form-label {
|
||||
top: 0;
|
||||
font-size: 12px;
|
||||
color: #667eea;
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
/* 登录按钮 */
|
||||
.login-btn {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
background: #3b82f6;
|
||||
padding: 14px;
|
||||
margin-top: 8px;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
border-radius: 12px;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: background 0.2s;
|
||||
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
.login-button:hover {
|
||||
background: #2563eb;
|
||||
|
||||
.login-btn:hover:not(:disabled) {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
|
||||
}
|
||||
.login-button:disabled {
|
||||
|
||||
.login-btn:active:not(:disabled) {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.login-btn:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
/* 按钮加载动画 */
|
||||
.btn-loader {
|
||||
display: inline-block;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
border: 2px solid rgba(255, 255, 255, 0.3);
|
||||
border-top-color: white;
|
||||
border-radius: 50%;
|
||||
animation: spin 0.8s linear infinite;
|
||||
margin-right: 8px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
/* 底部信息 */
|
||||
.login-footer {
|
||||
text-align: center;
|
||||
margin-top: 24px;
|
||||
color: #6b7280;
|
||||
font-size: 14px;
|
||||
font-size: 13px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- Tailwind CSS -->
|
||||
|
||||
|
||||
<!-- Vue 3 -->
|
||||
|
||||
|
||||
<!-- Element Plus CSS -->
|
||||
|
||||
|
||||
<!-- Element Plus JS -->
|
||||
|
||||
.login-footer a {
|
||||
color: #667eea;
|
||||
text-decoration: none;
|
||||
transition: color 0.2s;
|
||||
}
|
||||
|
||||
.login-footer a:hover {
|
||||
color: #764ba2;
|
||||
}
|
||||
|
||||
<style>
|
||||
/* 基础重置 */
|
||||
body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
|
||||
|
||||
/* 卡片组件 */
|
||||
.card { background: white; border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,0.08); padding: 24px; margin-bottom: 24px; transition: all 0.3s; }
|
||||
.card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
|
||||
|
||||
/* 侧边栏 */
|
||||
.sidebar { width: 160px; position: fixed; height: 100vh; left: 0; top: 0; background: #f5f5f5; border-right: 1px solid #e0e0e0; }
|
||||
|
||||
/* 主内容区 */
|
||||
.main-content { margin-left: 160px; width: calc(100vw - 160px); min-height: 100vh; overflow-x: auto; }
|
||||
|
||||
/* 统计卡片 */
|
||||
.stat-card { text-align: center; padding: 20px; cursor: pointer; transition: transform 0.2s; }
|
||||
.stat-card:hover { transform: translateY(-4px); }
|
||||
.stat-value { font-size: 2.5rem; font-weight: bold; color: #409EFF; line-height: 1.2; }
|
||||
.stat-label { color: #909399; font-size: 0.9rem; margin-top: 8px; }
|
||||
|
||||
/* 操作按钮组 */
|
||||
.action-btn-group { display: flex; gap: 8px; flex-wrap: wrap; }
|
||||
|
||||
/* 快速筛选 */
|
||||
.quick-filter { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
|
||||
|
||||
/* 状态徽章 */
|
||||
.status-badge { display: inline-flex; align-items: center; gap: 4px; }
|
||||
.status-dot { width: 6px; height: 6px; border-radius: 50%; }
|
||||
.status-dot.pending { background: #E6A23C; }
|
||||
.status-dot.review { background: #F56C6C; }
|
||||
.status-dot.ready { background: #67C23A; }
|
||||
.status-dot.published { background: #409EFF; }
|
||||
|
||||
/* 加载覆盖层 */
|
||||
.loading-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,0.8); display: flex; align-items: center; justify-content: center; z-index: 9999; }
|
||||
|
||||
/* 响应式 */
|
||||
@media (max-width: 768px) {
|
||||
.sidebar { display: none; }
|
||||
.main-content { margin-left: 0; width: 100vw; }
|
||||
@media (max-width: 480px) {
|
||||
.login-card {
|
||||
max-width: 90%;
|
||||
padding: 32px 24px;
|
||||
margin: 16px;
|
||||
border-radius: 20px;
|
||||
}
|
||||
.login-title {
|
||||
font-size: 24px;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<!-- 本地静态文件 -->
|
||||
<script src="./static/vue.global.prod.js?v=20260427"></script>
|
||||
<link rel="stylesheet" href="./static/element-plus.css?v=20260427">
|
||||
<script src="./static/element-plus.full.js?v=20260427"></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="login-container">
|
||||
<div class="login-card">
|
||||
<h1 class="login-title">宇之然内容创作平台</h1>
|
||||
|
||||
<form @submit.prevent="handleLogin">
|
||||
<!-- 背景装饰 -->
|
||||
<div class="bg-circle"></div>
|
||||
<div class="bg-circle"></div>
|
||||
<div class="bg-circle"></div>
|
||||
<div class="bg-circle"></div>
|
||||
|
||||
<div class="login-card">
|
||||
<h1 class="login-title">宇之然内容创作平台</h1>
|
||||
<p class="login-subtitle">Yuzhiran Content Creation Platform</p>
|
||||
|
||||
<form @submit.prevent="handleLogin">
|
||||
<div class="form-group">
|
||||
<input
|
||||
v-model="username"
|
||||
class="login-input"
|
||||
class="form-input"
|
||||
type="text"
|
||||
placeholder="请输入用户名"
|
||||
placeholder=" "
|
||||
required
|
||||
autocomplete="username"
|
||||
/>
|
||||
<label class="form-label">用户名</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<input
|
||||
v-model="password"
|
||||
class="login-input"
|
||||
class="form-input"
|
||||
type="password"
|
||||
placeholder="请输入密码"
|
||||
placeholder=" "
|
||||
required
|
||||
autocomplete="current-password"
|
||||
/>
|
||||
<button
|
||||
class="login-button"
|
||||
type="submit"
|
||||
:disabled="loading"
|
||||
:class="{'opacity-60 cursor-not-allowed': loading}"
|
||||
>
|
||||
{{ loading ? '登录中...' : '登录' }}
|
||||
</button>
|
||||
</form>
|
||||
<label class="form-label">密码</label>
|
||||
</div>
|
||||
|
||||
<p class="login-footer">
|
||||
只有管理员用户可登录访问系统
|
||||
</p>
|
||||
</div>
|
||||
<button
|
||||
type="submit"
|
||||
class="login-btn"
|
||||
:disabled="loading"
|
||||
>
|
||||
<span v-if="loading" class="btn-loader"></span>
|
||||
{{ loading ? '登录中...' : '立即登录' }}
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<p class="login-footer">
|
||||
管理员用户可访问完整系统功能
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<script src="/static/vue/vue.global.js"></script>
|
||||
<script src="/static/element-plus/index.full.min.js"></script>
|
||||
<script>
|
||||
const { ref } = Vue;
|
||||
const { ElMessage } = ElementPlus;
|
||||
@@ -208,16 +305,18 @@
|
||||
const data = await response.json();
|
||||
|
||||
if (response.ok && data.token) {
|
||||
// 保存认证信息
|
||||
localStorage.setItem('auth_token', data.token);
|
||||
localStorage.setItem('user_role', data.role || 'admin');
|
||||
localStorage.setItem('authToken', data.token);
|
||||
localStorage.setItem('userRole', data.role || 'admin');
|
||||
localStorage.setItem('currentUser', JSON.stringify(data.user));
|
||||
|
||||
ElMessage.success('登录成功!正在跳转...');
|
||||
|
||||
// 延迟跳转,让用户看到成功消息
|
||||
setTimeout(() => {
|
||||
window.location.href = '/';
|
||||
}, 1000);
|
||||
ElMessage({
|
||||
message: '登录成功!正在跳转...',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
window.location.href = '/';
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ElMessage.error(data.message || data.error || '登录失败,请检查用户名和密码');
|
||||
}
|
||||
@@ -229,6 +328,12 @@
|
||||
}
|
||||
};
|
||||
|
||||
// 检查是否已登录
|
||||
const token = localStorage.getItem('authToken');
|
||||
if (token) {
|
||||
window.location.href = '/';
|
||||
}
|
||||
|
||||
return {
|
||||
username,
|
||||
password,
|
||||
@@ -239,7 +344,7 @@
|
||||
});
|
||||
|
||||
app.use(ElementPlus);
|
||||
app.mount('#app');
|
||||
app.mount('body');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user