Skip to content

Commit 792bb5a

Browse files
authored
feat(ui): 完善弹幕详情全格式导出、来源操作与内容筛选 (huangxd-#433)
- 支持选择后端全部弹幕格式导出,正确处理 JSON、XML 与二进制响应 - 自动和手动匹配结果均透传并展示来源地址,提供复制与打开操作 - 增加弹幕内容关键词搜索,并可与滚动、顶部、底部类型筛选组合使用 - 将首次加载及每次加载更多数量从 100 调整为 500 - 补充桌面端与移动端响应式布局,避免控件挤压和横向溢出
1 parent 89fd166 commit 792bb5a

5 files changed

Lines changed: 262 additions & 28 deletions

File tree

danmu_api/apis/dandan-api.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2057,7 +2057,8 @@ export async function matchAnime(url, req, clientIp) {
20572057
"type": resAnime.type,
20582058
"typeDescription": resAnime.typeDescription,
20592059
"shift": 0,
2060-
"imageUrl": resAnime.imageUrl
2060+
"imageUrl": resAnime.imageUrl,
2061+
"url": resEpisode.url || ""
20612062
})
20622063
]
20632064
}

danmu_api/models/dandan-model.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class Link {
8282
// =====================
8383
export class AnimeMatch {
8484
constructor({ episodeId = 10001, animeId = 111, animeTitle = "", episodeTitle = "",
85-
type = "", typeDescription = "", shift = 1, imageUrl = "" } = {}) {
85+
type = "", typeDescription = "", shift = 1, imageUrl = "", url = "" } = {}) {
8686
// ---- 类型检查 ----
8787
validateType(episodeId, "number");
8888
validateType(animeId, "number");
@@ -92,9 +92,10 @@ export class AnimeMatch {
9292
validateType(typeDescription, "string");
9393
validateType(shift, "number");
9494
validateType(imageUrl, "string");
95+
validateType(url, "string");
9596

9697
// 直接解构并赋值给 this
97-
Object.assign(this, { episodeId, animeId, animeTitle, episodeTitle, type, typeDescription, shift, imageUrl });
98+
Object.assign(this, { episodeId, animeId, animeTitle, episodeTitle, type, typeDescription, shift, imageUrl, url });
9899
}
99100

100101
// ---- 静态方法:从 JSON 创建 User 对象 ----

danmu_api/ui/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ UI 系统需要通过在 URL 中添加 TOKEN 来访问,以确保安全性:
8282
- 手动匹配测试:搜索动漫 → 选择番剧 → 选择剧集 → 获取弹幕
8383
- 弹幕统计:弹幕数、时长、高能时刻、平均密度、匹配时长、类型分布
8484
- 弹幕热力图:按时间段可视化弹幕密度分布
85-
- 弹幕列表:支持全部/滚动/顶部/底部过滤,显示颜色和类型标签,懒加载每次100条
85+
- 弹幕列表:支持全部/滚动/顶部/底部过滤,显示颜色和类型标签,首次加载及每次加载更多500条
8686
- 导出功能:支持导出JSON和XML格式弹幕文件
8787
- 时长处理:优先请求 `/api/v2/comment/:commentId?format=json&duration=true` 返回的 `videoDuration`,没有真实时长时再回退到尾部裁剪算法
8888
- 视图导航优化:搜索结果/剧集详情/弹幕详情逐级切换,带返回按钮和加载动画

danmu_api/ui/css/components.css.js

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1832,6 +1832,25 @@ body.modal-open {
18321832
18331833
.danmu-filter-tabs::-webkit-scrollbar { display: none; }
18341834
1835+
.danmu-list-tools {
1836+
display: flex;
1837+
align-items: center;
1838+
gap: 10px;
1839+
margin-bottom: 10px;
1840+
}
1841+
1842+
.danmu-search {
1843+
flex: 1 1 260px;
1844+
min-width: 0;
1845+
max-width: 420px;
1846+
}
1847+
1848+
.danmu-search-status {
1849+
color: var(--theme-muted);
1850+
font-size: 12px;
1851+
white-space: nowrap;
1852+
}
1853+
18351854
.danmu-filter-tab {
18361855
flex: 0 0 auto;
18371856
display: inline-flex;
@@ -2034,6 +2053,109 @@ body.modal-open {
20342053
display: flex;
20352054
gap: 6px;
20362055
margin-left: auto;
2056+
align-items: center;
2057+
flex-wrap: wrap;
2058+
justify-content: flex-end;
2059+
}
2060+
2061+
.danmu-export-select {
2062+
background-color: var(--theme-panel-strong);
2063+
color: var(--theme-text);
2064+
border: 1px solid var(--theme-border);
2065+
border-radius: var(--app-radius-btn);
2066+
padding: 5px 12px;
2067+
font-size: 12px;
2068+
line-height: 1.4;
2069+
max-width: 220px;
2070+
cursor: pointer;
2071+
}
2072+
2073+
.danmu-export-select:hover {
2074+
border-color: var(--theme-accent);
2075+
}
2076+
2077+
.danmu-export-select:focus-visible {
2078+
outline: 2px solid var(--theme-accent);
2079+
outline-offset: 2px;
2080+
}
2081+
2082+
.danmu-source-url {
2083+
display: grid;
2084+
grid-template-columns: auto minmax(0, 1fr) auto;
2085+
align-items: center;
2086+
gap: 8px;
2087+
margin-bottom: 14px;
2088+
padding: 9px 10px;
2089+
border: 1px solid var(--theme-border);
2090+
border-radius: var(--app-radius-card-sm);
2091+
background: var(--theme-panel-bg);
2092+
}
2093+
2094+
.danmu-source-url-label {
2095+
color: var(--theme-muted);
2096+
font-size: 12px;
2097+
white-space: nowrap;
2098+
}
2099+
2100+
.danmu-source-url-value {
2101+
min-width: 0;
2102+
overflow: hidden;
2103+
color: var(--theme-text);
2104+
font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
2105+
font-size: 12px;
2106+
text-overflow: ellipsis;
2107+
white-space: nowrap;
2108+
user-select: text;
2109+
}
2110+
2111+
.danmu-source-url-actions {
2112+
display: flex;
2113+
gap: 6px;
2114+
}
2115+
2116+
.danmu-source-url-actions .btn {
2117+
flex: 0 0 auto;
2118+
white-space: nowrap;
2119+
}
2120+
2121+
@media (max-width: 768px) {
2122+
.danmu-list-tools {
2123+
flex-wrap: wrap;
2124+
}
2125+
2126+
.preview-search.danmu-search {
2127+
order: 0;
2128+
flex: 1 1 100%;
2129+
width: 100%;
2130+
max-width: none;
2131+
}
2132+
2133+
.danmu-search-status {
2134+
order: 1;
2135+
margin-left: auto;
2136+
}
2137+
2138+
.danmu-export-btns {
2139+
flex: 1 1 0;
2140+
min-width: 0;
2141+
flex-wrap: nowrap;
2142+
}
2143+
2144+
.danmu-export-select {
2145+
flex: 1 1 160px;
2146+
max-width: none;
2147+
min-width: 0;
2148+
}
2149+
2150+
.danmu-export-btns .btn {
2151+
flex: 0 0 auto;
2152+
white-space: nowrap;
2153+
}
2154+
2155+
.danmu-result-toolbar .btn-back {
2156+
flex: 0 0 auto;
2157+
white-space: nowrap;
2158+
}
20372159
}
20382160
20392161
/* ============ 颜色池配置 ============ */

0 commit comments

Comments
 (0)