feat: 添加文档管理系统前后端基础功能

- 新增后端FastAPI应用,包含用户管理、文档管理和操作日志功能
- 实现JWT认证机制,支持用户注册、登录、登出操作
- 添加数据库模型定义,包括用户表、文档表和操作日志表
- 实现文档的增删改查功能及权限控制
- 添加管理员功能,支持用户管理和全局操作日志查看
- 新增前端界面,实现完整的用户交互体验
- 配置环境变量示例和Git忽略规则
- 编写详细的README文档,包含安装和使用说明
This commit is contained in:
starsac
2026-01-11 15:56:55 +08:00
commit bb9e208381
12 changed files with 2411 additions and 0 deletions

542
style.css Normal file
View File

@@ -0,0 +1,542 @@
/* 全局样式 */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
line-height: 1.6;
color: #333;
background-color: #667eea;
min-height: 100vh;
}
/* 导航栏样式 */
.navbar {
background: rgba(255, 255, 255, 0.95);
backdrop-filter: blur(10px);
box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
position: sticky;
top: 0;
z-index: 1000;
}
.nav-container {
max-width: 1200px;
margin: 0 auto;
padding: 1rem 2rem;
display: flex;
justify-content: space-between;
align-items: center;
}
.nav-logo {
font-size: 1.5rem;
font-weight: bold;
color: #4a5568;
}
.nav-menu {
display: flex;
align-items: center;
gap: 1rem;
}
.user-info {
color: #4a5568;
font-weight: 500;
}
.nav-btn {
padding: 0.5rem 1rem;
border: 2px solid #667eea;
background: transparent;
color: #667eea;
border-radius: 6px;
cursor: pointer;
font-weight: 500;
transition: all 0.3s ease;
}
.nav-btn:hover {
background: #667eea;
color: white;
}
/* 主要内容区域 */
.main-content {
max-width: 1200px;
margin: 2rem auto;
padding: 0 2rem;
}
/* 表单区域样式 */
.form-section {
background: white;
border-radius: 12px;
padding: 2rem;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
max-width: 400px;
margin: 2rem auto;
}
.form-section h2 {
text-align: center;
margin-bottom: 1.5rem;
color: #4a5568;
}
.auth-form {
display: flex;
flex-direction: column;
gap: 1rem;
}
.form-group {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.form-group label {
font-weight: 500;
color: #4a5568;
}
.form-group input,
.form-group textarea,
.form-group select {
padding: 0.75rem;
border: 2px solid #e2e8f0;
border-radius: 6px;
font-size: 1rem;
transition: border-color 0.3s ease;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
outline: none;
border-color: #667eea;
}
.checkbox-group {
display: flex;
align-items: center;
gap: 0.5rem;
}
.checkbox-group input[type="checkbox"] {
width: auto;
margin: 0;
}
/* 按钮样式 */
.btn-primary {
background-color: #667eea;
color: white;
border: none;
padding: 0.75rem 1.5rem;
border-radius: 6px;
font-size: 1rem;
font-weight: 500;
cursor: pointer;
transition: transform 0.2s ease;
}
.btn-primary:hover {
transform: translateY(-2px);
}
.btn-secondary {
background: #e2e8f0;
color: #4a5568;
border: none;
padding: 0.5rem 1rem;
border-radius: 6px;
cursor: pointer;
font-weight: 500;
transition: all 0.3s ease;
}
.btn-secondary:hover {
background: #cbd5e0;
}
.btn-danger {
background: #e53e3e;
color: white;
border: none;
padding: 0.5rem 1rem;
border-radius: 6px;
cursor: pointer;
font-weight: 500;
transition: all 0.3s ease;
}
.btn-danger:hover {
background: #c53030;
}
/* 用户面板样式 */
.user-panel {
background: white;
border-radius: 12px;
padding: 2rem;
margin-bottom: 2rem;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}
.user-panel h2 {
color: #4a5568;
margin-bottom: 1rem;
}
.user-actions {
display: flex;
gap: 1rem;
flex-wrap: wrap;
}
/* 用户管理区域 */
.user-management-section {
background: white;
border-radius: 12px;
padding: 2rem;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
margin-bottom: 2rem;
}
/* 文档管理区域 */
.documents-section {
background: white;
border-radius: 12px;
padding: 2rem;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}
.section-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 2rem;
}
.section-header h2 {
color: #4a5568;
}
/* 文档列表样式 */
.documents-list {
display: grid;
gap: 1rem;
}
.document-item {
background: #f7fafc;
border: 2px solid #e2e8f0;
border-radius: 8px;
padding: 1.5rem;
transition: all 0.3s ease;
cursor: pointer;
}
.document-item:hover {
border-color: #667eea;
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}
.document-header {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 0.5rem;
}
.document-title {
font-size: 1.2rem;
font-weight: 600;
color: #2d3748;
margin-bottom: 0.5rem;
}
.document-meta {
display: flex;
gap: 1rem;
color: #718096;
font-size: 0.875rem;
}
.document-description {
color: #4a5568;
margin-bottom: 0.5rem;
}
.document-content-preview {
color: #718096;
font-size: 0.875rem;
line-height: 1.4;
max-height: 3rem;
overflow: hidden;
text-overflow: ellipsis;
}
.document-actions {
display: flex;
gap: 0.5rem;
margin-top: 1rem;
}
/* 模态框样式 */
.modal {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
display: flex;
justify-content: center;
align-items: center;
z-index: 2000;
}
.modal-content {
background: white;
border-radius: 12px;
padding: 2rem;
max-width: 500px;
width: 90%;
max-height: 80vh;
overflow-y: auto;
position: relative;
}
.modal-content h3 {
color: #4a5568;
margin-bottom: 1.5rem;
}
.close {
position: absolute;
top: 1rem;
right: 1.5rem;
font-size: 1.5rem;
cursor: pointer;
color: #718096;
}
.close:hover {
color: #4a5568;
}
/* 用户列表样式 */
.users-list {
display: grid;
gap: 1rem;
}
.user-item {
background: #f7fafc;
border: 2px solid #e2e8f0;
border-radius: 8px;
padding: 1.5rem;
transition: all 0.3s ease;
}
.user-item:hover {
border-color: #667eea;
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}
.user-header {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 0.5rem;
}
.user-info {
flex: 1;
}
.user-username {
font-size: 1.2rem;
font-weight: 600;
color: #2d3748;
margin-bottom: 0.25rem;
}
.user-email {
color: #718096;
font-size: 0.875rem;
margin-bottom: 0.25rem;
}
.user-fullname {
color: #4a5568;
font-size: 0.875rem;
margin-bottom: 0.5rem;
}
.user-meta {
display: flex;
gap: 1rem;
color: #718096;
font-size: 0.75rem;
}
.user-admin-badge {
background: #667eea;
color: white;
padding: 0.25rem 0.5rem;
border-radius: 12px;
font-size: 0.75rem;
font-weight: 600;
}
.user-actions {
display: flex;
gap: 0.5rem;
}
/* 日志列表样式 */
.logs-list {
max-height: 400px;
overflow-y: auto;
}
.log-item {
background: #f7fafc;
border: 1px solid #e2e8f0;
border-radius: 6px;
padding: 1rem;
margin-bottom: 0.5rem;
}
.log-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 0.5rem;
}
.log-action {
font-weight: 600;
color: #2d3748;
}
.log-time {
color: #718096;
font-size: 0.875rem;
}
.log-details {
color: #4a5568;
font-size: 0.875rem;
}
/* 消息提示样式 */
.message {
position: fixed;
top: 20px;
right: 20px;
padding: 1rem 1.5rem;
border-radius: 6px;
color: white;
font-weight: 500;
z-index: 3000;
animation: slideIn 0.3s ease;
}
.message.success {
background: #48bb78;
}
.message.error {
background: #f56565;
}
.message.info {
background: #4299e1;
}
@keyframes slideIn {
from {
transform: translateX(100%);
opacity: 0;
}
to {
transform: translateX(0);
opacity: 1;
}
}
/* 响应式设计 */
@media (max-width: 768px) {
.nav-container {
padding: 1rem;
}
.main-content {
padding: 0 1rem;
margin: 1rem auto;
}
.form-section {
margin: 1rem auto;
padding: 1.5rem;
}
.section-header {
flex-direction: column;
gap: 1rem;
align-items: flex-start;
}
.user-actions {
flex-direction: column;
}
.document-header {
flex-direction: column;
gap: 0.5rem;
}
.modal-content {
width: 95%;
padding: 1.5rem;
}
}
/* 加载动画 */
.loading {
display: inline-block;
width: 20px;
height: 20px;
border: 3px solid #f3f3f3;
border-top: 3px solid #667eea;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* 空状态样式 */
.empty-state {
text-align: center;
padding: 3rem 2rem;
color: #718096;
}
.empty-state h3 {
margin-bottom: 0.5rem;
color: #4a5568;
}