update
This commit is contained in:
@@ -15,10 +15,12 @@
|
||||
<i class="fas fa-arrow-left"></i> 返回首页
|
||||
</a>
|
||||
<h1 class="album-title" id="album-title">加载中...</h1>
|
||||
<div class="album-info" id="album-info">
|
||||
<i class="fas fa-images"></i> 正在加载...
|
||||
<div class="album-header-row">
|
||||
<div class="album-info" id="album-info">
|
||||
正在加载...
|
||||
</div>
|
||||
<div class="album-meta-tags" id="album-meta-tags"></div>
|
||||
</div>
|
||||
<div class="album-meta-tags" id="album-meta-tags"></div>
|
||||
</div>
|
||||
|
||||
<div class="images-grid" id="images-container">
|
||||
@@ -38,13 +40,6 @@
|
||||
<span class="preview-info" id="lightbox-album">来自: 相册名称</span>
|
||||
</div>
|
||||
<div class="preview-actions">
|
||||
<button class="preview-nav preview-prev" onclick="prevImage()" id="lightbox-prev">
|
||||
<i class="fas fa-chevron-left"></i>
|
||||
</button>
|
||||
<span class="preview-counter" id="lightbox-counter">1 / 1</span>
|
||||
<button class="preview-nav preview-next" onclick="nextImage()" id="lightbox-next">
|
||||
<i class="fas fa-chevron-right"></i>
|
||||
</button>
|
||||
<button class="preview-close" onclick="closeLightbox()">
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
@@ -70,7 +65,19 @@
|
||||
0 KB
|
||||
</span>
|
||||
</div>
|
||||
<div class="preview-center-controls">
|
||||
<button class="preview-nav preview-prev" onclick="prevImage()" id="lightbox-prev">
|
||||
<i class="fas fa-chevron-left"></i>
|
||||
</button>
|
||||
<span class="preview-counter" id="lightbox-counter">1 / 1</span>
|
||||
<button class="preview-nav preview-next" onclick="nextImage()" id="lightbox-next">
|
||||
<i class="fas fa-chevron-right"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="preview-controls">
|
||||
<button class="preview-action preview-action-close" onclick="closeLightbox()">
|
||||
<i class="fas fa-times"></i> 关闭
|
||||
</button>
|
||||
<button class="preview-action" onclick="addToFavoritesFromLightbox()" id="lightbox-favorite-btn">
|
||||
<i class="fas fa-heart"></i> 加入收藏
|
||||
</button>
|
||||
|
||||
@@ -88,25 +88,103 @@ body {
|
||||
.album-info {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
color: var(--text-light);
|
||||
font-size: 0.95rem;
|
||||
padding: 10px 20px;
|
||||
background: var(--bg-surface);
|
||||
border-radius: var(--radius-full);
|
||||
border: 1px solid var(--border-gray);
|
||||
gap: 6px;
|
||||
color: #475569;
|
||||
font-size: 0.85rem;
|
||||
font-weight: 500;
|
||||
line-height: 1.2;
|
||||
padding: 6px 14px;
|
||||
background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
|
||||
border-radius: 20px;
|
||||
border: 1px solid #cbd5e1;
|
||||
cursor: default;
|
||||
user-select: none;
|
||||
height: auto;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.album-info i { color: var(--secondary-blue); }
|
||||
.album-info i { color: #64748b; }
|
||||
|
||||
/* ============ 相册标签区(新:分类着色) ============ */
|
||||
.album-meta-tags {
|
||||
/* 照片数量 + 标签 合并到一行 */
|
||||
.album-header-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 12px 16px;
|
||||
margin: 12px auto 24px;
|
||||
max-width: 1100px;
|
||||
}
|
||||
|
||||
.album-header-row .album-info {
|
||||
margin: 0;
|
||||
flex: 0 0 auto;
|
||||
width: auto;
|
||||
max-width: none;
|
||||
}
|
||||
|
||||
/* ============ 相册标签区(简洁版:与照片数量同行) ============ */
|
||||
.album-header-row .album-meta-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-start;
|
||||
gap: 8px;
|
||||
margin: 0;
|
||||
max-width: none;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
/* 标签分组 */
|
||||
.tag-group {
|
||||
margin-bottom: 14px;
|
||||
background: var(--bg-surface);
|
||||
border-radius: var(--radius-card);
|
||||
border: 1px solid var(--border-gray);
|
||||
padding: 12px 16px;
|
||||
transition: all 0.2s ease;
|
||||
box-shadow: var(--shadow-sm);
|
||||
}
|
||||
|
||||
.tag-group:hover {
|
||||
box-shadow: var(--shadow-md);
|
||||
border-color: #cbd5e1;
|
||||
}
|
||||
|
||||
.tag-group-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: 10px;
|
||||
padding-bottom: 8px;
|
||||
border-bottom: 1px dashed var(--border-gray);
|
||||
font-size: 0.85rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-light);
|
||||
}
|
||||
|
||||
.tag-group-header i {
|
||||
font-size: 0.9rem;
|
||||
color: var(--secondary-blue);
|
||||
}
|
||||
|
||||
.tag-group-header span {
|
||||
color: var(--text-light);
|
||||
}
|
||||
|
||||
.tag-group-count {
|
||||
margin-left: auto;
|
||||
background: var(--bg-hover);
|
||||
padding: 2px 8px;
|
||||
border-radius: 10px;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.tag-group-chips {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin: 20px auto 32px;
|
||||
max-width: 900px;
|
||||
}
|
||||
|
||||
.meta-chip {
|
||||
@@ -114,13 +192,31 @@ body {
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 6px 14px;
|
||||
border-radius: var(--radius-full);
|
||||
border-radius: 20px;
|
||||
font-size: 0.85rem;
|
||||
font-weight: 500;
|
||||
line-height: 1.2;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
user-select: none;
|
||||
border: 1px solid transparent;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.meta-chip::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: -100%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
|
||||
transition: left 0.5s ease;
|
||||
}
|
||||
|
||||
.meta-chip:hover::before {
|
||||
left: 100%;
|
||||
}
|
||||
|
||||
.meta-chip:hover {
|
||||
@@ -130,13 +226,14 @@ body {
|
||||
|
||||
.meta-chip:active { transform: translateY(0); }
|
||||
|
||||
.meta-chip i { font-size: 0.75rem; }
|
||||
.meta-chip i { font-size: 0.75rem; opacity: 0.9; }
|
||||
|
||||
/* 人物标签 */
|
||||
.meta-chip-person {
|
||||
background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(236, 72, 153, 0.1) 100%);
|
||||
background: linear-gradient(135deg, rgba(139, 92, 246, 0.12) 0%, rgba(236, 72, 153, 0.12) 100%);
|
||||
color: var(--accent-purple);
|
||||
border-color: rgba(139, 92, 246, 0.2);
|
||||
border-color: rgba(139, 92, 246, 0.25);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.meta-chip-person:hover {
|
||||
@@ -147,54 +244,120 @@ body {
|
||||
|
||||
/* 分类标签(按类别着色) */
|
||||
.meta-chip-tag-style {
|
||||
background: #f0f9ff;
|
||||
background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
|
||||
color: #0284c7;
|
||||
border-color: #bae6fd;
|
||||
}
|
||||
.meta-chip-tag-style:hover { background: #0284c7; color: #fff; border-color: #0284c7; }
|
||||
.meta-chip-tag-style:hover { background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%); color: #fff; border-color: transparent; }
|
||||
|
||||
.meta-chip-tag-outfit {
|
||||
background: #fdf2f8;
|
||||
background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%);
|
||||
color: #db2777;
|
||||
border-color: #fbcfe8;
|
||||
}
|
||||
.meta-chip-tag-outfit:hover { background: #db2777; color: #fff; border-color: #db2777; }
|
||||
.meta-chip-tag-outfit:hover { background: linear-gradient(135deg, #db2777 0%, #be185d 100%); color: #fff; border-color: transparent; }
|
||||
|
||||
.meta-chip-tag-scene {
|
||||
background: #f0fdf4;
|
||||
background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
|
||||
color: #15803d;
|
||||
border-color: #bbf7d0;
|
||||
}
|
||||
.meta-chip-tag-scene:hover { background: #15803d; color: #fff; border-color: #15803d; }
|
||||
.meta-chip-tag-scene:hover { background: linear-gradient(135deg, #15803d 0%, #166534 100%); color: #fff; border-color: transparent; }
|
||||
|
||||
.meta-chip-tag-body {
|
||||
background: #fef3c7;
|
||||
background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
|
||||
color: #b45309;
|
||||
border-color: #fde68a;
|
||||
}
|
||||
.meta-chip-tag-body:hover { background: #b45309; color: #fff; border-color: #b45309; }
|
||||
.meta-chip-tag-body:hover { background: linear-gradient(135deg, #b45309 0%, #92400e 100%); color: #fff; border-color: transparent; }
|
||||
|
||||
.meta-chip-tag-mood {
|
||||
background: #faf5ff;
|
||||
background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
|
||||
color: #7c3aed;
|
||||
border-color: #e9d5ff;
|
||||
}
|
||||
.meta-chip-tag-mood:hover { background: #7c3aed; color: #fff; border-color: #7c3aed; }
|
||||
.meta-chip-tag-mood:hover { background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%); color: #fff; border-color: transparent; }
|
||||
|
||||
.meta-chip-tag-topic {
|
||||
background: #eff6ff;
|
||||
background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
|
||||
color: #0369a1;
|
||||
border-color: #bfdbfe;
|
||||
}
|
||||
.meta-chip-tag-topic:hover { background: #0369a1; color: #fff; border-color: #0369a1; }
|
||||
.meta-chip-tag-topic:hover { background: linear-gradient(135deg, #0369a1 0%, #075985 100%); color: #fff; border-color: transparent; }
|
||||
|
||||
/* jieba 提取的新分类 */
|
||||
.meta-chip-tag-noun {
|
||||
background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
|
||||
color: #1d4ed8;
|
||||
border-color: #bfdbfe;
|
||||
}
|
||||
.meta-chip-tag-noun:hover { background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%); color: #fff; border-color: transparent; }
|
||||
|
||||
.meta-chip-tag-proper {
|
||||
background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
|
||||
color: #4338ca;
|
||||
border-color: #c7d2fe;
|
||||
}
|
||||
.meta-chip-tag-proper:hover { background: linear-gradient(135deg, #4338ca 0%, #3730a3 100%); color: #fff; border-color: transparent; }
|
||||
|
||||
.meta-chip-tag-location {
|
||||
background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
|
||||
color: #047857;
|
||||
border-color: #a7f3d0;
|
||||
}
|
||||
.meta-chip-tag-location:hover { background: linear-gradient(135deg, #047857 0%, #065f46 100%); color: #fff; border-color: transparent; }
|
||||
|
||||
.meta-chip-tag-organization {
|
||||
background: linear-gradient(135deg, #fef9c3 0%, #fef08a 100%);
|
||||
color: #a16207;
|
||||
border-color: #fde68a;
|
||||
}
|
||||
.meta-chip-tag-organization:hover { background: linear-gradient(135deg, #a16207 0%, #854d0e 100%); color: #fff; border-color: transparent; }
|
||||
|
||||
.meta-chip-tag-noun_verb {
|
||||
background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%);
|
||||
color: #be185d;
|
||||
border-color: #f9a8d4;
|
||||
}
|
||||
.meta-chip-tag-noun_verb:hover { background: linear-gradient(135deg, #be185d 0%, #9d174d 100%); color: #fff; border-color: transparent; }
|
||||
|
||||
.meta-chip-tag-adj {
|
||||
background: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 100%);
|
||||
color: #6d28d9;
|
||||
border-color: #ddd6fe;
|
||||
}
|
||||
.meta-chip-tag-adj:hover { background: linear-gradient(135deg, #6d28d9 0%, #5b21b6 100%); color: #fff; border-color: transparent; }
|
||||
|
||||
.meta-chip-tag-verb {
|
||||
background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
|
||||
color: #c2410c;
|
||||
border-color: #fed7aa;
|
||||
}
|
||||
.meta-chip-tag-verb:hover { background: linear-gradient(135deg, #c2410c 0%, #9a3412 100%); color: #fff; border-color: transparent; }
|
||||
|
||||
.meta-chip-tag-chinese {
|
||||
background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
|
||||
color: #475569;
|
||||
border-color: #cbd5e1;
|
||||
}
|
||||
.meta-chip-tag-chinese:hover { background: linear-gradient(135deg, #475569 0%, #334155 100%); color: #fff; border-color: transparent; }
|
||||
|
||||
.meta-chip-tag-english {
|
||||
background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
|
||||
color: #64748b;
|
||||
border-color: #cbd5e1;
|
||||
}
|
||||
.meta-chip-tag-english:hover { background: linear-gradient(135deg, #64748b 0%, #475569 100%); color: #fff; border-color: transparent; }
|
||||
|
||||
/* 默认标签 */
|
||||
.meta-chip-tag-default,
|
||||
.meta-chip-tag {
|
||||
background: var(--bg-hover);
|
||||
color: var(--text-light);
|
||||
border-color: var(--border-gray);
|
||||
}
|
||||
.meta-chip-tag:hover { background: var(--text-light); color: #fff; border-color: var(--text-light); }
|
||||
.meta-chip-tag-default:hover,
|
||||
.meta-chip-tag:hover { background: linear-gradient(135deg, #64748b 0%, #475569 100%); color: #fff; border-color: transparent; }
|
||||
|
||||
/* ============ 瀑布流布局(核心) ============ */
|
||||
.images-grid {
|
||||
@@ -214,7 +377,6 @@ body {
|
||||
box-shadow: var(--shadow-sm);
|
||||
background: var(--bg-surface);
|
||||
transition: all 0.3s ease;
|
||||
cursor: pointer;
|
||||
border: 1px solid var(--border-gray);
|
||||
break-inside: avoid;
|
||||
page-break-inside: avoid;
|
||||
@@ -233,6 +395,7 @@ body {
|
||||
display: block;
|
||||
object-fit: contain;
|
||||
transition: transform 0.4s ease;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.image-item:hover img {
|
||||
@@ -249,6 +412,7 @@ body {
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
border-top: 1px solid var(--border-gray);
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.image-caption small {
|
||||
@@ -368,7 +532,7 @@ body {
|
||||
justify-content: center;
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
transition: all 0.3s ease;
|
||||
transition: all 0.25s ease;
|
||||
}
|
||||
|
||||
.preview-modal.active { opacity: 1; visibility: visible; }
|
||||
@@ -377,44 +541,48 @@ body {
|
||||
position: absolute;
|
||||
top: 0; left: 0;
|
||||
width: 100%; height: 100%;
|
||||
background: rgba(15, 23, 42, 0.9);
|
||||
backdrop-filter: blur(8px);
|
||||
background: rgba(0, 0, 0, 0.92);
|
||||
backdrop-filter: blur(4px);
|
||||
}
|
||||
|
||||
.preview-container {
|
||||
position: relative;
|
||||
background: var(--bg-surface);
|
||||
border-radius: var(--radius-lg);
|
||||
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
|
||||
max-width: 92vw;
|
||||
max-height: 90vh;
|
||||
width: 1200px;
|
||||
height: 800px;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
max-width: 100vw;
|
||||
max-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
transform: scale(0.92);
|
||||
transition: transform 0.3s ease;
|
||||
background: transparent;
|
||||
border-radius: 0;
|
||||
box-shadow: none;
|
||||
transform: scale(1);
|
||||
}
|
||||
|
||||
.preview-modal.active .preview-container { transform: scale(1); }
|
||||
|
||||
/* 顶部栏 - 浮在图片上方 */
|
||||
.preview-header {
|
||||
position: absolute;
|
||||
top: 0; left: 0; right: 0;
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 16px 20px;
|
||||
border-bottom: 1px solid var(--border-gray);
|
||||
padding: 16px 24px;
|
||||
background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, transparent 100%);
|
||||
flex-shrink: 0;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.preview-title h3 {
|
||||
font-size: 1.1rem;
|
||||
font-size: 1rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-dark);
|
||||
color: #f1f5f9;
|
||||
margin: 0 0 4px 0;
|
||||
}
|
||||
|
||||
.preview-info { font-size: 0.85rem; color: var(--text-light); }
|
||||
.preview-info { font-size: 0.8rem; color: #94a3b8; }
|
||||
|
||||
.preview-actions {
|
||||
display: flex;
|
||||
@@ -423,51 +591,60 @@ body {
|
||||
}
|
||||
|
||||
.preview-nav {
|
||||
width: 36px; height: 36px;
|
||||
border: 1px solid var(--border-gray);
|
||||
border-radius: var(--radius);
|
||||
background: var(--bg-surface);
|
||||
color: var(--text-dark);
|
||||
width: 40px; height: 40px;
|
||||
border: 1px solid rgba(255,255,255,0.15);
|
||||
border-radius: 50%;
|
||||
background: rgba(255,255,255,0.08);
|
||||
color: #f1f5f9;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: all 0.2s ease;
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
.preview-nav:hover:not(:disabled) {
|
||||
background: var(--bg-hover);
|
||||
border-color: var(--secondary-blue);
|
||||
color: var(--secondary-blue);
|
||||
background: rgba(255,255,255,0.2);
|
||||
border-color: rgba(255,255,255,0.3);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.preview-nav:disabled { opacity: 0.4; cursor: not-allowed; }
|
||||
.preview-nav:disabled { opacity: 0.3; cursor: not-allowed; }
|
||||
|
||||
.preview-counter { font-size: 0.85rem; color: var(--text-light); font-weight: 500; }
|
||||
.preview-counter {
|
||||
font-size: 0.9rem;
|
||||
color: #cbd5e1;
|
||||
font-weight: 500;
|
||||
padding: 0 4px;
|
||||
}
|
||||
|
||||
.preview-close {
|
||||
width: 36px; height: 36px;
|
||||
border: none;
|
||||
border-radius: var(--radius);
|
||||
background: var(--bg-hover);
|
||||
color: var(--text-dark);
|
||||
width: 40px; height: 40px;
|
||||
border: 1px solid rgba(255,255,255,0.15);
|
||||
border-radius: 50%;
|
||||
background: rgba(255,255,255,0.08);
|
||||
color: #f1f5f9;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: all 0.2s ease;
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
.preview-close:hover { background: #ef4444; color: #fff; }
|
||||
.preview-close:hover { background: rgba(239, 68, 68, 0.8); color: #fff; border-color: rgba(239, 68, 68, 0.6); }
|
||||
|
||||
/* 图片内容区 - 占满全屏 */
|
||||
.preview-content {
|
||||
flex: 1;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
top: 0; left: 0; right: 0; bottom: 0;
|
||||
padding: 60px 80px;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #0f172a;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.preview-image-container {
|
||||
@@ -482,8 +659,12 @@ body {
|
||||
.preview-image {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
width: auto;
|
||||
height: auto;
|
||||
object-fit: contain;
|
||||
transition: opacity 0.3s ease;
|
||||
transition: opacity 0.3s ease, transform 0.3s ease;
|
||||
box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.preview-loading {
|
||||
@@ -494,54 +675,107 @@ body {
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
color: var(--text-light);
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
.preview-loading i { font-size: 1.8rem; color: var(--secondary-blue); }
|
||||
.preview-loading i { font-size: 2rem; color: #3b82f6; }
|
||||
|
||||
/* 底部栏 - 浮在图片上方 */
|
||||
.preview-footer {
|
||||
position: absolute;
|
||||
bottom: 0; left: 0; right: 0;
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 12px 20px;
|
||||
border-top: 1px solid var(--border-gray);
|
||||
gap: 20px;
|
||||
padding: 16px 24px;
|
||||
background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, transparent 100%);
|
||||
flex-shrink: 0;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.preview-meta { display: flex; gap: 16px; }
|
||||
.preview-meta { display: flex; gap: 16px; flex: 1; }
|
||||
|
||||
.preview-meta .meta-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 0.85rem;
|
||||
color: var(--text-light);
|
||||
font-size: 0.8rem;
|
||||
color: #cbd5e1;
|
||||
}
|
||||
|
||||
.preview-controls { display: flex; gap: 10px; }
|
||||
/* 底部居中的切换控制栏 */
|
||||
.preview-center-controls {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
flex: 1;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.preview-center-controls .preview-nav {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border: 1px solid rgba(255,255,255,0.2);
|
||||
border-radius: 50%;
|
||||
background: rgba(255,255,255,0.1);
|
||||
color: #f1f5f9;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: all 0.2s ease;
|
||||
backdrop-filter: blur(10px);
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.preview-center-controls .preview-nav:hover:not(:disabled) {
|
||||
background: rgba(255,255,255,0.25);
|
||||
border-color: rgba(255,255,255,0.4);
|
||||
transform: scale(1.08);
|
||||
}
|
||||
|
||||
.preview-center-controls .preview-nav:disabled {
|
||||
opacity: 0.3;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.preview-center-controls .preview-counter {
|
||||
font-size: 0.9rem;
|
||||
color: #e2e8f0;
|
||||
font-weight: 500;
|
||||
min-width: 60px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.preview-controls { display: flex; gap: 10px; flex: 1; justify-content: flex-end; }
|
||||
|
||||
.preview-action {
|
||||
padding: 7px 14px;
|
||||
border: 1px solid var(--border-gray);
|
||||
border-radius: var(--radius);
|
||||
background: var(--bg-surface);
|
||||
color: var(--text-dark);
|
||||
padding: 8px 16px;
|
||||
border: 1px solid rgba(255,255,255,0.15);
|
||||
border-radius: 20px;
|
||||
background: rgba(255,255,255,0.08);
|
||||
color: #f1f5f9;
|
||||
cursor: pointer;
|
||||
font-size: 0.85rem;
|
||||
font-size: 0.8rem;
|
||||
font-weight: 500;
|
||||
transition: all 0.2s ease;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
.preview-action:hover { background: var(--bg-hover); }
|
||||
.preview-action:hover { background: rgba(255,255,255,0.2); }
|
||||
|
||||
.preview-remove { border-color: #fecaca; color: #dc2626; }
|
||||
.preview-remove:hover { background: #fef2f2; border-color: #fca5a5; }
|
||||
.preview-action-close:hover {
|
||||
background: rgba(239, 68, 68, 0.7);
|
||||
border-color: rgba(239, 68, 68, 0.5);
|
||||
}
|
||||
|
||||
.preview-action.favorited { border-color: #fbcfe8; color: #ec4899; background: #fdf2f8; }
|
||||
.preview-action.favorited:hover { background: #fce7f3; border-color: #f9a8d4; }
|
||||
.preview-action.favorited { border-color: rgba(236, 72, 153, 0.5); color: #f9a8d4; background: rgba(236, 72, 153, 0.15); }
|
||||
.preview-action.favorited:hover { background: rgba(236, 72, 153, 0.25); }
|
||||
|
||||
/* 暗色模式 */
|
||||
@media (prefers-color-scheme: dark) {
|
||||
@@ -554,6 +788,15 @@ body {
|
||||
--text-light: #cbd5e1;
|
||||
--text-muted: #94a3b8;
|
||||
}
|
||||
.preview-container { background: var(--bg-surface); }
|
||||
.preview-nav, .preview-close, .preview-action { background: var(--bg-hover); color: var(--text-dark); border-color: var(--border-gray); }
|
||||
}
|
||||
|
||||
/* 移动端适配 */
|
||||
@media (max-width: 768px) {
|
||||
.preview-content { padding: 40px 10px 70px; }
|
||||
.preview-header, .preview-footer { padding: 12px 16px; }
|
||||
.preview-footer { flex-wrap: wrap; gap: 12px; }
|
||||
.preview-meta { order: 2; justify-content: center; }
|
||||
.preview-center-controls { order: 1; width: 100%; }
|
||||
.preview-controls { order: 3; justify-content: center; }
|
||||
.preview-center-controls .preview-nav { width: 36px; height: 36px; }
|
||||
}
|
||||
|
||||
@@ -107,30 +107,56 @@ input { font-family: inherit; }
|
||||
.sidebar.collapsed .brand-text,
|
||||
.sidebar.collapsed .nav-item span,
|
||||
.sidebar.collapsed .sidebar-section-title span,
|
||||
.sidebar.collapsed .sidebar-section-title .section-arrow,
|
||||
.sidebar.collapsed .sidebar-tags,
|
||||
.sidebar.collapsed .collapse-btn span {
|
||||
.sidebar.collapsed .sidebar-people,
|
||||
.sidebar.collapsed .sidebar-section-content,
|
||||
.sidebar.collapsed .sidebar-divider {
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.sidebar.collapsed .sidebar-section {
|
||||
padding: var(--spacer-md) 0;
|
||||
gap: var(--spacer-xs);
|
||||
}
|
||||
|
||||
.sidebar.collapsed .sidebar-section-title {
|
||||
justify-content: center;
|
||||
padding: var(--spacer-sm) 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.sidebar.collapsed .sidebar-section-group {
|
||||
margin-bottom: var(--spacer-sm);
|
||||
}
|
||||
|
||||
.sidebar.collapsed .nav-item {
|
||||
justify-content: center;
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
margin: 0 var(--spacer-xs);
|
||||
}
|
||||
|
||||
.sidebar.collapsed .sidebar-brand {
|
||||
padding: var(--spacer-lg) 0;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.sidebar.collapsed .collapse-btn {
|
||||
justify-content: center;
|
||||
padding: var(--spacer-md) 0;
|
||||
}
|
||||
|
||||
.sidebar.collapsed .collapse-btn i {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
.sidebar.collapsed .sidebar-nav {
|
||||
padding: var(--spacer-md) var(--spacer-xs);
|
||||
}
|
||||
|
||||
/* 品牌 Logo */
|
||||
.sidebar-brand {
|
||||
display: flex;
|
||||
@@ -228,6 +254,7 @@ input { font-family: inherit; }
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
gap: var(--spacer-sm);
|
||||
}
|
||||
|
||||
.sidebar-section::-webkit-scrollbar {
|
||||
@@ -238,6 +265,12 @@ input { font-family: inherit; }
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
/* 可折叠区块组 */
|
||||
.sidebar-section-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.sidebar-section-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -251,7 +284,49 @@ input { font-family: inherit; }
|
||||
margin-bottom: var(--spacer-sm);
|
||||
}
|
||||
|
||||
.sidebar-section-title i {
|
||||
.sidebar-section-title.collapsible {
|
||||
cursor: pointer;
|
||||
border-radius: var(--radius);
|
||||
transition: background var(--transition-fast);
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.sidebar-section-title.collapsible:hover {
|
||||
background: var(--bg-hover);
|
||||
color: var(--text-light);
|
||||
}
|
||||
|
||||
.section-arrow {
|
||||
margin-left: auto;
|
||||
font-size: 0.7rem;
|
||||
transition: transform var(--transition-base);
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.sidebar-section-group.collapsed .section-arrow {
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
|
||||
.sidebar-section-content {
|
||||
overflow: hidden;
|
||||
max-height: 600px;
|
||||
transition: max-height 0.28s cubic-bezier(0.4, 0, 0.2, 1),
|
||||
opacity 0.2s ease,
|
||||
margin 0.2s ease;
|
||||
opacity: 1;
|
||||
margin-bottom: var(--spacer-sm);
|
||||
}
|
||||
|
||||
.sidebar-section-group.collapsed .sidebar-section-content {
|
||||
max-height: 0;
|
||||
opacity: 0;
|
||||
margin-bottom: 0;
|
||||
transition: max-height 0.2s cubic-bezier(0.4, 0, 0.2, 1),
|
||||
opacity 0.15s ease,
|
||||
margin 0.15s ease;
|
||||
}
|
||||
|
||||
.sidebar-section-title i:first-child {
|
||||
width: 20px;
|
||||
text-align: center;
|
||||
font-size: 0.85rem;
|
||||
@@ -309,24 +384,95 @@ input { font-family: inherit; }
|
||||
color: var(--white);
|
||||
}
|
||||
|
||||
/* 侧边栏人物列表 */
|
||||
.sidebar-people {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacer-xs);
|
||||
transition: opacity var(--transition-base);
|
||||
}
|
||||
|
||||
.sidebar-person {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacer-sm);
|
||||
padding: var(--spacer-sm) var(--spacer-lg);
|
||||
border-radius: var(--radius);
|
||||
cursor: pointer;
|
||||
transition: all var(--transition-fast);
|
||||
font-size: 0.9rem;
|
||||
color: var(--text-light);
|
||||
}
|
||||
|
||||
.sidebar-person:hover {
|
||||
background: var(--bg-hover);
|
||||
color: var(--text-dark);
|
||||
}
|
||||
|
||||
.sidebar-person.active {
|
||||
background: rgba(139, 92, 246, 0.1);
|
||||
color: var(--accent-purple);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.sidebar-person-avatar {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 50%;
|
||||
background: #6366f1;
|
||||
color: var(--white);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 0.8rem;
|
||||
font-weight: 600;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.sidebar-person-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.sidebar-person-name {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.sidebar-person-count {
|
||||
font-size: 0.75rem;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.sidebar-person.active .sidebar-person-count {
|
||||
color: var(--accent-purple);
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
/* 侧边栏底部 */
|
||||
.sidebar-footer {
|
||||
padding: var(--spacer-md);
|
||||
border-top: 1px solid var(--border-gray);
|
||||
flex-shrink: 0;
|
||||
margin-top: auto;
|
||||
}
|
||||
|
||||
.collapse-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacer-md);
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
padding: var(--spacer-md) var(--spacer-lg);
|
||||
padding: var(--spacer-md);
|
||||
border-radius: var(--radius);
|
||||
color: var(--text-light);
|
||||
font-size: 0.9rem;
|
||||
font-size: 1rem;
|
||||
font-weight: 500;
|
||||
transition: all var(--transition-fast);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.collapse-btn:hover {
|
||||
@@ -338,12 +484,6 @@ input { font-family: inherit; }
|
||||
width: 20px;
|
||||
text-align: center;
|
||||
transition: transform var(--transition-base);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.collapse-btn span {
|
||||
transition: opacity var(--transition-base);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* ============ 主内容区 ============ */
|
||||
|
||||
@@ -37,22 +37,38 @@
|
||||
<!-- 分隔线 -->
|
||||
<div class="sidebar-divider"></div>
|
||||
|
||||
<!-- 热门人物 -->
|
||||
<div class="sidebar-section-group">
|
||||
<div class="sidebar-section-title collapsible" data-section="people" onclick="toggleSidebarSection('people')">
|
||||
<i class="fas fa-users"></i>
|
||||
<span>热门人物</span>
|
||||
<i class="fas fa-chevron-down section-arrow"></i>
|
||||
</div>
|
||||
<div class="sidebar-section-content" id="sidebar-people-content">
|
||||
<div class="sidebar-people" id="sidebar-people">
|
||||
<!-- 动态填充 -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 热门标签 -->
|
||||
<div class="sidebar-section">
|
||||
<div class="sidebar-section-title">
|
||||
<div class="sidebar-section-group">
|
||||
<div class="sidebar-section-title collapsible" data-section="tags" onclick="toggleSidebarSection('tags')">
|
||||
<i class="fas fa-tags"></i>
|
||||
<span>热门标签</span>
|
||||
<i class="fas fa-chevron-down section-arrow"></i>
|
||||
</div>
|
||||
<div class="sidebar-tags" id="sidebar-tags">
|
||||
<!-- 动态填充 -->
|
||||
<div class="sidebar-section-content" id="sidebar-tags-content">
|
||||
<div class="sidebar-tags" id="sidebar-tags">
|
||||
<!-- 动态填充 -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 底部折叠按钮 -->
|
||||
<div class="sidebar-footer">
|
||||
<button class="collapse-btn" onclick="toggleSidebar()" id="collapse-btn">
|
||||
<button class="collapse-btn" onclick="toggleSidebar()" id="collapse-btn" title="收起侧边栏">
|
||||
<i class="fas fa-chevron-left"></i>
|
||||
<span>收起侧边栏</span>
|
||||
</button>
|
||||
</div>
|
||||
</aside>
|
||||
@@ -124,20 +140,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 热门人物横向滚动条 -->
|
||||
<div class="people-strip" id="people-strip" style="display:none;">
|
||||
<div class="people-strip-header">
|
||||
<i class="fas fa-users"></i>
|
||||
<span>热门人物</span>
|
||||
</div>
|
||||
<div class="people-scroll" id="people-scroll">
|
||||
<!-- 动态填充 -->
|
||||
</div>
|
||||
<div class="people-scroll-hint">
|
||||
<i class="fas fa-chevron-right"></i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 相册网格 -->
|
||||
<div class="albums-grid" id="albums-container">
|
||||
<div class="loading">
|
||||
|
||||
@@ -262,7 +262,7 @@ async function loadAlbum(albumId) {
|
||||
function updateAlbumInfo() {
|
||||
document.getElementById('album-title').textContent = currentAlbum.title;
|
||||
|
||||
let infoHtml = `<i class="fas fa-images"></i> 共 ${images.length} 张图片`;
|
||||
let infoHtml = `${images.length} 张图片`;
|
||||
document.getElementById('album-info').innerHTML = infoHtml;
|
||||
|
||||
// 显示相册元数据(人名 + 标签)
|
||||
@@ -316,7 +316,7 @@ function getTagCategory(tag) {
|
||||
return 'default';
|
||||
}
|
||||
|
||||
// 更新相册元数据(人名 + 标签)点击可搜索
|
||||
// 更新相册元数据(人名 + 标签)简洁版:只用颜色区分,不写分类名
|
||||
function updateAlbumMeta() {
|
||||
const metaContainer = document.getElementById('album-meta-tags');
|
||||
if (!metaContainer) return;
|
||||
@@ -337,7 +337,6 @@ function updateAlbumMeta() {
|
||||
if (currentAlbum.tags) {
|
||||
let tagList = [];
|
||||
try {
|
||||
// 格式1: JSON数组 [["标签名", "分类"], ...]
|
||||
const parsed = JSON.parse(currentAlbum.tags);
|
||||
if (Array.isArray(parsed)) {
|
||||
parsed.forEach(item => {
|
||||
@@ -353,7 +352,6 @@ function updateAlbumMeta() {
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
// 格式2: 逗号分隔字符串
|
||||
currentAlbum.tags.split(',').forEach(tag => {
|
||||
const t = tag.trim();
|
||||
if (t) tagList.push({ text: t, category: getTagCategory(t) });
|
||||
@@ -378,9 +376,8 @@ function updateAlbumMeta() {
|
||||
metaContainer.style.display = 'flex';
|
||||
metaContainer.innerHTML = chips.map(chip => {
|
||||
const icon = chip.type === 'person' ? 'fa-user' : 'fa-tag';
|
||||
// 生成 CSS 类名:人物用 person,标签用 tag-{category}
|
||||
const cssClass = chip.type === 'person' ? 'meta-chip-person' : `meta-chip-tag-${chip.category || 'default'}`;
|
||||
return `<span class="meta-chip ${cssClass}" data-meta-type="${chip.type}" data-meta-query="${encodeURIComponent(chip.query)}">
|
||||
return `<span class="meta-chip ${cssClass}" data-meta-type="${chip.type}" data-meta-query="${encodeURIComponent(chip.query)}" title="点击搜索: ${chip.text}">
|
||||
<i class="fas ${icon}"></i> ${chip.text}
|
||||
</span>`;
|
||||
}).join('');
|
||||
@@ -446,7 +443,7 @@ function displayImages() {
|
||||
// 检查图片是否已被收藏
|
||||
isImageFavorited(image.id || image.original_url);
|
||||
return `
|
||||
<div class="image-item ${orientation}" onclick="openLightbox(${index})">
|
||||
<div class="image-item ${orientation}">
|
||||
<img
|
||||
src="${imageUrl}"
|
||||
${image.id ? `data-image-id="${image.id}"` : ''}
|
||||
@@ -454,6 +451,7 @@ function displayImages() {
|
||||
class="lazy"
|
||||
loading="lazy"
|
||||
onerror="this.src='/assets/placeholder.svg'"
|
||||
onclick="openLightbox(${index})"
|
||||
>
|
||||
<div class="image-caption">
|
||||
${image.width ? `<small>${image.width}×${image.height}</small>` : ''}
|
||||
|
||||
136
assets/js/app.js
136
assets/js/app.js
@@ -109,6 +109,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
initSearch();
|
||||
initInfiniteScroll();
|
||||
initLazyLoading(); // 初始化图片懒加载
|
||||
initSidebarSections(); // 初始化侧边栏区块折叠状态
|
||||
|
||||
// 检查URL中是否有search参数
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
@@ -539,7 +540,10 @@ async function performServerSearch(searchTerm) {
|
||||
|
||||
// 显示服务器搜索结果
|
||||
displayAlbums(serverResults);
|
||||
document.getElementById('stats').innerHTML = `在全站找到 ${serverResults.length} 个包含 "${searchTerm}" 的相册`;
|
||||
const oldStats = document.getElementById('stats');
|
||||
if (oldStats) {
|
||||
oldStats.innerHTML = `在全站找到 ${serverResults.length} 个包含 "${searchTerm}" 的相册`;
|
||||
}
|
||||
|
||||
// 初始化图片懒加载
|
||||
initLazyLoading();
|
||||
@@ -636,11 +640,11 @@ function updateStats(albums) {
|
||||
const oldStats = document.getElementById('stats');
|
||||
if (oldStats) oldStats.innerHTML = `共发现 ${albums.length} 个相册,包含 ${totalImages} 张图片`;
|
||||
|
||||
// 获取人物数量
|
||||
fetch(`${API_BASE}/recommend/popular-persons?limit=1`).then(r => r.ok && r.json()).then(data => {
|
||||
if (data && data.length > 0 && data[0].total) {
|
||||
// 获取人物数量(用 metadata stats API)
|
||||
fetch(`${API_BASE}/metadata/stats`).then(r => r.ok && r.json()).then(data => {
|
||||
if (data && data.total_persons !== undefined) {
|
||||
const statPeople = document.getElementById('stat-people');
|
||||
if (statPeople) statPeople.textContent = data[0].total.toLocaleString();
|
||||
if (statPeople) statPeople.textContent = data.total_persons.toLocaleString();
|
||||
}
|
||||
}).catch(() => {});
|
||||
}
|
||||
@@ -799,14 +803,20 @@ function openAlbum(albumId) {
|
||||
|
||||
// 随机打开相册
|
||||
function openRandomAlbum() {
|
||||
// 添加随机动画效果
|
||||
const randomButton = document.querySelector('.random-button');
|
||||
randomButton.style.transform = 'scale(0.95)';
|
||||
randomButton.disabled = true;
|
||||
|
||||
// 显示加载状态
|
||||
const originalText = randomButton.textContent;
|
||||
randomButton.textContent = '随机加载中...';
|
||||
// 添加随机动画效果 - 兼容侧边栏导航项
|
||||
const navItems = document.querySelectorAll('.nav-item');
|
||||
let randomButton = null;
|
||||
navItems.forEach(item => {
|
||||
if (item.textContent.includes('随机')) randomButton = item;
|
||||
});
|
||||
// 也试试顶部操作按钮
|
||||
if (!randomButton) {
|
||||
randomButton = document.querySelector('.action-btn[onclick*="openRandomAlbum"]');
|
||||
}
|
||||
|
||||
if (randomButton) {
|
||||
randomButton.style.transform = 'scale(0.95)';
|
||||
}
|
||||
|
||||
// 调用新的随机相册API
|
||||
fetch(`${API_BASE}/album/random`)
|
||||
@@ -821,22 +831,22 @@ function openRandomAlbum() {
|
||||
})
|
||||
.then(randomAlbum => {
|
||||
// 恢复按钮状态
|
||||
setTimeout(() => {
|
||||
randomButton.style.transform = '';
|
||||
randomButton.disabled = false;
|
||||
randomButton.textContent = originalText;
|
||||
}, 200);
|
||||
if (randomButton) {
|
||||
setTimeout(() => {
|
||||
randomButton.style.transform = '';
|
||||
}, 200);
|
||||
}
|
||||
|
||||
// 跳转到随机相册
|
||||
window.location.href = `/album?id=${randomAlbum.id}`;
|
||||
})
|
||||
.catch(error => {
|
||||
// 恢复按钮状态
|
||||
setTimeout(() => {
|
||||
randomButton.style.transform = '';
|
||||
randomButton.disabled = false;
|
||||
randomButton.textContent = originalText;
|
||||
}, 200);
|
||||
if (randomButton) {
|
||||
setTimeout(() => {
|
||||
randomButton.style.transform = '';
|
||||
}, 200);
|
||||
}
|
||||
|
||||
alert(error.message);
|
||||
});
|
||||
@@ -847,6 +857,11 @@ function showFavorites() {
|
||||
// 设置当前在收藏页
|
||||
isInFavoritesPage = true;
|
||||
|
||||
// 切换侧边栏选中状态
|
||||
document.querySelectorAll('.nav-item').forEach(item => item.classList.remove('active'));
|
||||
const favNav = document.querySelector('.nav-item[data-view="favorites"]');
|
||||
if (favNav) favNav.classList.add('active');
|
||||
|
||||
// 从后端API获取收藏列表
|
||||
fetch(`${API_BASE}/favorites`)
|
||||
.then(response => {
|
||||
@@ -919,8 +934,10 @@ function displayFavorites(favoriteImages) {
|
||||
`}
|
||||
`;
|
||||
|
||||
// 更新统计信息 - 显示收藏数量
|
||||
document.getElementById('stats').innerHTML = `<div class="favorites-header">
|
||||
// 更新统计信息 - 显示收藏数量(兼容新旧版布局)
|
||||
const statsEl = document.getElementById('stats');
|
||||
if (statsEl) {
|
||||
statsEl.innerHTML = `<div class="favorites-header">
|
||||
<div class="header-content">
|
||||
<div class="header-left">
|
||||
<div class="favorites-icon">
|
||||
@@ -940,6 +957,7 @@ function displayFavorites(favoriteImages) {
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
// 初始化图片懒加载,确保收藏的图片被加载
|
||||
initLazyLoading();
|
||||
@@ -959,8 +977,12 @@ function formatDate(dateString) {
|
||||
function backToHome() {
|
||||
// 重置收藏页标记
|
||||
isInFavoritesPage = false;
|
||||
// 重新加载首页相册
|
||||
loadAlbums(true);
|
||||
// 切换导航高亮到首页
|
||||
document.querySelectorAll('.nav-item').forEach(item => {
|
||||
item.classList.toggle('active', item.dataset.view === 'home');
|
||||
});
|
||||
// 清除筛选
|
||||
clearFilter();
|
||||
}
|
||||
|
||||
// 全局变量存储收藏列表和当前预览索引
|
||||
@@ -1241,7 +1263,9 @@ async function loadDiscoverData() {
|
||||
]);
|
||||
|
||||
if (tagsResp.ok) {
|
||||
const tags = await tagsResp.json();
|
||||
const tagsData = await tagsResp.json();
|
||||
// 兼容两种格式:直接数组 或 { total, tags }
|
||||
const tags = Array.isArray(tagsData) ? tagsData : (tagsData.tags || tagsData.items || []);
|
||||
if (tags && tags.length > 0) {
|
||||
renderTagCloud(tags);
|
||||
}
|
||||
@@ -1300,7 +1324,24 @@ function renderTagCloud(tags) {
|
||||
|
||||
// 渲染热门人物(横向滚动条)
|
||||
function renderPeopleCloud(people) {
|
||||
// 新版:横向滚动条
|
||||
// 侧边栏人物列表
|
||||
const sidebarPeople = document.getElementById('sidebar-people');
|
||||
if (sidebarPeople && people && people.length) {
|
||||
sidebarPeople.innerHTML = people.slice(0, 25).map(p => {
|
||||
const name = p.name || p.display_name || '';
|
||||
const albumCount = p.total_albums || 0;
|
||||
const isActive = currentFilter && currentFilter.type === 'person' && currentFilter.value === name;
|
||||
return `<div class="sidebar-person ${isActive ? 'active' : ''}" onclick="filterByPerson('${name}')" title="${albumCount} 个相册">
|
||||
<div class="sidebar-person-avatar">${name.charAt(0)}</div>
|
||||
<div class="sidebar-person-info">
|
||||
<div class="sidebar-person-name">${name}</div>
|
||||
<div class="sidebar-person-count">${albumCount} 相册</div>
|
||||
</div>
|
||||
</div>`;
|
||||
}).join('');
|
||||
}
|
||||
|
||||
// 横向滚动条
|
||||
const strip = document.getElementById('people-strip');
|
||||
const scroll = document.getElementById('people-scroll');
|
||||
if (strip && scroll && people && people.length) {
|
||||
@@ -1339,6 +1380,32 @@ function renderPeopleCloud(people) {
|
||||
}
|
||||
}
|
||||
|
||||
// 侧边栏区块折叠/展开
|
||||
function toggleSidebarSection(section) {
|
||||
const group = document.querySelector(`.sidebar-section-group [data-section="${section}"]`)?.closest('.sidebar-section-group');
|
||||
if (!group) return;
|
||||
group.classList.toggle('collapsed');
|
||||
// 保存状态到 localStorage
|
||||
try {
|
||||
const state = JSON.parse(localStorage.getItem('sidebarSections') || '{}');
|
||||
state[section] = group.classList.contains('collapsed');
|
||||
localStorage.setItem('sidebarSections', JSON.stringify(state));
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
// 初始化侧边栏区块折叠状态
|
||||
function initSidebarSections() {
|
||||
try {
|
||||
const state = JSON.parse(localStorage.getItem('sidebarSections') || '{}');
|
||||
Object.keys(state).forEach(section => {
|
||||
if (state[section]) {
|
||||
const group = document.querySelector(`.sidebar-section-group [data-section="${section}"]`)?.closest('.sidebar-section-group');
|
||||
if (group) group.classList.add('collapsed');
|
||||
}
|
||||
});
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
// 按标签筛选
|
||||
async function filterByTag(tag) {
|
||||
currentFilter = { type: 'tag', value: tag };
|
||||
@@ -1372,6 +1439,15 @@ async function filterByPerson(personName) {
|
||||
currentFilter = { type: 'person', value: personName };
|
||||
showFilterStatus(`人物: ${personName}`);
|
||||
|
||||
// 刷新侧边栏人物高亮
|
||||
try {
|
||||
const peopleResp = await fetch(`${API_BASE}/recommend/popular-persons?limit=30`);
|
||||
if (peopleResp.ok) {
|
||||
const peopleData = await peopleResp.json();
|
||||
renderPeopleCloud(peopleData);
|
||||
}
|
||||
} catch(e) {}
|
||||
|
||||
try {
|
||||
showSkeleton(6);
|
||||
const response = await fetch(`${API_BASE}/people/search?q=${encodeURIComponent(personName)}`);
|
||||
@@ -1489,6 +1565,8 @@ function switchView(view) {
|
||||
|
||||
if (view === 'home') {
|
||||
backToHome();
|
||||
} else if (view === 'favorites') {
|
||||
showFavorites();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user