fix:剧本列表工具函数去除默认值兜底

This commit is contained in:
2026-06-23 22:19:30 +08:00
parent 70434c1325
commit ae1463e400
@@ -220,25 +220,24 @@ const getLengthLabel = (length) => {
const getTags = (script) => {
if (Array.isArray(script.tags) && script.tags.length) return script.tags.slice(0, 4)
return [script.style || '逆袭成长', '都市', '事业', '热血']
return []
}
const getChapterCount = (script) => script.chapterCount || script.chapters || Math.max(1, Math.round((script.wordCount || 30000) / 4500))
const getChapterCount = (script) => script.chapterCount || script.chapters || 0
const getWordCount = (script) => {
const count = Number(script.wordCount || 0)
if (!count) return '3.1万字'
if (count >= 10000) return `${(count / 10000).toFixed(1)}万字`
return `${count}`
}
const getDateText = (script) => {
if (getStatus(script) === 'done') return `完成于:${script.completedAt || script.date || '2025.05.10'}`
if (getStatus(script) === 'draft') return `创建于:${script.createdAt || script.date || '2025.05.08'}`
return `最近更新:${script.updatedAt || script.date || '今天 21:30'}`
if (getStatus(script) === 'done') return `完成于:${script.completedAt || script.date || ''}`
if (getStatus(script) === 'draft') return `创建于:${script.createdAt || script.date || ''}`
return `最近更新:${script.updatedAt || script.date || ''}`
}
const getProgress = (script) => Math.max(1, Math.min(99, Number(script.progress || 28)))
const getProgress = (script) => Math.max(0, Math.min(99, Number(script.progress || 0)))
const getInitial = (script) => (script.title || '剧').slice(0, 1)