mirror of
https://github.com/Cp0204/quark-auto-save.git
synced 2026-01-12 15:20:44 +08:00
为追剧日历的海报视图和日历视图增加拼音排序功能
- 在 getEpisodesByDate 中对当日节目结果进行拼音升序排序 - 合并集开启时先合并同节目多集,再按节目名拼音排序 - 与内容管理视图排序规则一致,提升一致性与可预期性 - 增加 try-catch 保护,异常时回退原顺序,保证稳定性
This commit is contained in:
parent
4b40560a80
commit
06b6ab04d4
@ -4777,11 +4777,23 @@
|
||||
});
|
||||
|
||||
// 如果启用了合并集功能,则进行合并处理
|
||||
if (this.calendar.mergeEpisodes) {
|
||||
return this.mergeEpisodesByShow(filteredEpisodes);
|
||||
}
|
||||
|
||||
return filteredEpisodes;
|
||||
let result = this.calendar.mergeEpisodes
|
||||
? this.mergeEpisodesByShow(filteredEpisodes)
|
||||
: filteredEpisodes;
|
||||
|
||||
// 统一对同一天节目按节目名称拼音排序(与内容管理一致)
|
||||
try {
|
||||
result = result.slice().sort((a, b) => {
|
||||
const an = (a && a.show_name) ? String(a.show_name) : '';
|
||||
const bn = (b && b.show_name) ? String(b.show_name) : '';
|
||||
const ak = pinyinPro.pinyin(an, { toneType: 'none', type: 'string' }).toLowerCase();
|
||||
const bk = pinyinPro.pinyin(bn, { toneType: 'none', type: 'string' }).toLowerCase();
|
||||
if (ak === bk) return 0;
|
||||
return ak > bk ? 1 : -1;
|
||||
});
|
||||
} catch (e) {}
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
// 根据剧集名称查找对应的任务
|
||||
|
||||
Loading…
Reference in New Issue
Block a user