init
This commit is contained in:
86
frontend/index.html
Normal file
86
frontend/index.html
Normal file
@ -0,0 +1,86 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>我的导航网站</title>
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<header>
|
||||
<div class="header-left">
|
||||
<h1>我的导航网站</h1>
|
||||
<div class="search-box">
|
||||
<input type="text" id="searchInput" placeholder="搜索网站...">
|
||||
<i class="fas fa-search"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="header-right">
|
||||
<div class="theme-switcher">
|
||||
<button id="themeBtn"><i class="fas fa-moon"></i></button>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<button id="addSiteBtn"><i class="fas fa-plus"></i> 添加网站</button>
|
||||
<button id="manageCategoriesBtn"><i class="fas fa-tags"></i> 管理分类</button>
|
||||
<button id="exportBtn"><i class="fas fa-file-export"></i> 导出</button>
|
||||
<button id="importBtn"><i class="fas fa-file-import"></i> 导入</button>
|
||||
<input type="file" id="importFile" style="display: none;" accept=".json">
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="categories" id="categories">
|
||||
<!-- 分类将通过JavaScript动态生成 -->
|
||||
</div>
|
||||
|
||||
<!-- 添加网站的模态框 -->
|
||||
<div class="modal" id="addSiteModal">
|
||||
<div class="modal-content">
|
||||
<span class="close">×</span>
|
||||
<h2><i class="fas fa-plus-circle"></i> 添加新网站</h2>
|
||||
<form id="addSiteForm">
|
||||
<div class="form-group">
|
||||
<label for="siteName"><i class="fas fa-heading"></i> 网站名称</label>
|
||||
<input type="text" id="siteName" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="siteUrl"><i class="fas fa-link"></i> 网站URL</label>
|
||||
<input type="url" id="siteUrl" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="siteCategory"><i class="fas fa-tag"></i> 分类</label>
|
||||
<select id="siteCategory" required>
|
||||
<!-- 分类选项将通过JavaScript动态生成 -->
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="siteIcon"><i class="fas fa-image"></i> 图标URL (可选)</label>
|
||||
<input type="url" id="siteIcon" placeholder="https://example.com/favicon.ico">
|
||||
</div>
|
||||
<button type="submit"><i class="fas fa-save"></i> 保存</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 管理分类的模态框 -->
|
||||
<div class="modal" id="manageCategoriesModal">
|
||||
<div class="modal-content">
|
||||
<span class="close">×</span>
|
||||
<h2><i class="fas fa-tags"></i> 管理分类</h2>
|
||||
<div class="category-list" id="categoryList">
|
||||
<!-- 分类列表将通过JavaScript动态生成 -->
|
||||
</div>
|
||||
<div class="add-category">
|
||||
<input type="text" id="newCategoryName" placeholder="新分类名称">
|
||||
<button id="addCategoryBtn"><i class="fas fa-plus"></i> 添加分类</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/sortablejs@1.14.0/Sortable.min.js"></script>
|
||||
<script src="script.js"></script>
|
||||
</body>
|
||||
</html>
|
0
frontend/script.js
Normal file
0
frontend/script.js
Normal file
401
frontend/styles.css
Normal file
401
frontend/styles.css
Normal file
@ -0,0 +1,401 @@
|
||||
:root {
|
||||
--primary-color: #3498db;
|
||||
--secondary-color: #2ecc71;
|
||||
--danger-color: #e74c3c;
|
||||
--text-color: #333;
|
||||
--bg-color: #f5f5f5;
|
||||
--card-color: #fff;
|
||||
--border-color: #ddd;
|
||||
--shadow-color: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
[data-theme="dark"] {
|
||||
--primary-color: #2980b9;
|
||||
--secondary-color: #27ae60;
|
||||
--danger-color: #c0392b;
|
||||
--text-color: #f5f5f5;
|
||||
--bg-color: #121212;
|
||||
--card-color: #1e1e1e;
|
||||
--border-color: #333;
|
||||
--shadow-color: rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
font-family: 'Arial', sans-serif;
|
||||
transition: background-color 0.3s, color 0.3s;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: var(--bg-color);
|
||||
color: var(--text-color);
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 1400px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 30px;
|
||||
padding-bottom: 20px;
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.header-left, .header-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 2rem;
|
||||
color: var(--primary-color);
|
||||
}
|
||||
|
||||
.search-box {
|
||||
position: relative;
|
||||
min-width: 250px;
|
||||
}
|
||||
|
||||
.search-box input {
|
||||
width: 100%;
|
||||
padding: 8px 15px 8px 35px;
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 20px;
|
||||
background-color: var(--card-color);
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
.search-box i {
|
||||
position: absolute;
|
||||
left: 12px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
color: var(--text-color);
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.actions {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.actions button {
|
||||
padding: 8px 16px;
|
||||
background-color: var(--primary-color);
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
.actions button:hover {
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.actions button i {
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.theme-switcher button {
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--text-color);
|
||||
font-size: 1.2rem;
|
||||
cursor: pointer;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.categories {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 30px;
|
||||
}
|
||||
|
||||
.category {
|
||||
background-color: var(--card-color);
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
box-shadow: 0 2px 5px var(--shadow-color);
|
||||
}
|
||||
|
||||
.category h2 {
|
||||
margin-bottom: 15px;
|
||||
color: var(--primary-color);
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.sites {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.site {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
text-decoration: none;
|
||||
color: var(--text-color);
|
||||
transition: transform 0.2s;
|
||||
position: relative;
|
||||
padding: 10px;
|
||||
border-radius: 8px;
|
||||
background-color: var(--bg-color);
|
||||
}
|
||||
|
||||
.site:hover {
|
||||
transform: translateY(-5px);
|
||||
box-shadow: 0 5px 15px var(--shadow-color);
|
||||
}
|
||||
|
||||
.site-icon {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
margin-bottom: 8px;
|
||||
border-radius: 50%;
|
||||
object-fit: cover;
|
||||
background-color: var(--border-color);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 18px;
|
||||
color: var(--primary-color);
|
||||
}
|
||||
|
||||
.site-name {
|
||||
text-align: center;
|
||||
font-size: 0.9rem;
|
||||
word-break: break-word;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.delete-btn {
|
||||
position: absolute;
|
||||
top: -8px;
|
||||
right: -8px;
|
||||
background-color: var(--danger-color);
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 50%;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.site:hover .delete-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
/* 模态框样式 */
|
||||
.modal {
|
||||
display: none;
|
||||
position: fixed;
|
||||
z-index: 100;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
background-color: var(--card-color);
|
||||
margin: 10% auto;
|
||||
padding: 25px;
|
||||
border-radius: 8px;
|
||||
width: 90%;
|
||||
max-width: 500px;
|
||||
box-shadow: 0 4px 8px var(--shadow-color);
|
||||
position: relative;
|
||||
max-height: 80vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.modal h2 {
|
||||
margin-bottom: 20px;
|
||||
color: var(--primary-color);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.close {
|
||||
position: absolute;
|
||||
top: 15px;
|
||||
right: 20px;
|
||||
font-size: 28px;
|
||||
font-weight: bold;
|
||||
color: var(--text-color);
|
||||
cursor: pointer;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.close:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.form-group label {
|
||||
display: block;
|
||||
margin-bottom: 5px;
|
||||
font-weight: bold;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.form-group input,
|
||||
.form-group select {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 4px;
|
||||
background-color: var(--bg-color);
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
form button {
|
||||
background-color: var(--secondary-color);
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 10px 20px;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
form button:hover {
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
/* 分类管理样式 */
|
||||
.category-list {
|
||||
margin-bottom: 20px;
|
||||
max-height: 300px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.category-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
background-color: var(--bg-color);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.category-item span {
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.category-item button {
|
||||
background-color: var(--danger-color);
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
padding: 5px 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.add-category {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.add-category input {
|
||||
flex-grow: 1;
|
||||
padding: 10px;
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 4px;
|
||||
background-color: var(--bg-color);
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
.add-category button {
|
||||
background-color: var(--secondary-color);
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 10px 15px;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
/* 拖拽样式 */
|
||||
.sortable-ghost {
|
||||
opacity: 0.5;
|
||||
background: var(--primary-color);
|
||||
}
|
||||
|
||||
.sortable-chosen {
|
||||
box-shadow: 0 0 10px var(--shadow-color);
|
||||
}
|
||||
|
||||
/* 响应式设计 */
|
||||
@media (max-width: 768px) {
|
||||
header {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.header-left, .header-right {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.search-box {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.actions {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.actions button {
|
||||
flex-grow: 1;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.sites {
|
||||
grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
|
||||
}
|
||||
|
||||
.add-category {
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user