Skip to content

Commit 81ab3f9

Browse files
fix(subscribe): show best version mode tag (#471)
1 parent d520645 commit 81ab3f9

4 files changed

Lines changed: 35 additions & 1 deletion

File tree

src/components/cards/SubscribeCard.vue

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,25 @@ const subscribeState = ref<string>(props.media?.state ?? 'P')
6767
// 上一次更新时间
6868
const lastUpdateText = computed(() => (props.media?.last_update ? formatDateDifference(props.media.last_update) : ''))
6969
70+
// 判断后端数字/布尔开关是否启用
71+
function isEnabledFlag(value: any) {
72+
return value === true || value === 1 || value === '1'
73+
}
74+
75+
// 订阅列表接口通常返回中文媒体类型,插件或缓存数据可能只保留剧集字段
76+
function isTvSubscribe(media?: Subscribe) {
77+
return media?.type === '电视剧' || media?.type === 'tv' || !!media?.season || !!media?.total_episode
78+
}
79+
80+
// TV 洗版订阅在卡片上展示分集或全集短标签
81+
const bestVersionModeLabel = computed(() => {
82+
if (!isEnabledFlag(props.media?.best_version) || !isTvSubscribe(props.media)) return ''
83+
84+
return isEnabledFlag(props.media?.best_version_full)
85+
? t('subscribe.bestVersionWholeShort')
86+
: t('subscribe.bestVersionEpisodeShort')
87+
})
88+
7089
// 图片加载完成响应
7190
function imageLoadHandler() {
7291
imageLoaded.value = true
@@ -428,6 +447,15 @@ function handleCardClick() {
428447
{{ (props.media?.total_episode || 0) - (props.media?.lack_episode || 0) }} /
429448
{{ props.media?.total_episode }}
430449
</div>
450+
<VChip
451+
v-if="bestVersionModeLabel"
452+
size="x-small"
453+
color="primary"
454+
variant="flat"
455+
class="me-2 flex-shrink-0"
456+
>
457+
{{ bestVersionModeLabel }}
458+
</VChip>
431459
<VIcon v-if="props.media?.username && props.sortable" icon="mdi-account" size="small" color="white" class="flex-shrink-0 me-1" />
432460
<IconBtn v-else-if="props.media?.username" icon="mdi-account" size="small" color="white" class="flex-shrink-0" />
433461
<!-- 用户名过长时限制在卡片宽度内,并用省略号展示剩余内容 -->

src/locales/en-US.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -984,6 +984,8 @@ export default {
984984
ranking: 'Ranking',
985985
noStatisticsData: 'No share statistics data available',
986986
bestVersion: 'Version Upgrading',
987+
bestVersionEpisodeShort: 'Episode',
988+
bestVersionWholeShort: 'Full',
987989
completed: 'Completed',
988990
subscribing: 'Subscribing',
989991
notStarted: 'Not Started',

src/locales/zh-CN.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -978,6 +978,8 @@ export default {
978978
ranking: '排名',
979979
noStatisticsData: '暂无分享统计数据',
980980
bestVersion: '洗版中',
981+
bestVersionEpisodeShort: '分集',
982+
bestVersionWholeShort: '全集',
981983
completed: '订阅完成',
982984
subscribing: '订阅中',
983985
notStarted: '未开始',
@@ -2546,7 +2548,7 @@ export default {
25462548
bestVersionFull: '全集洗版',
25472549
bestVersionFullHint: '只下载覆盖全集的整包资源,不按单集拆包下载',
25482550
searchImdbid: '使用 ImdbID 搜索',
2549-
searchImdbidHint: '开使用 ImdbID 精确搜索资源',
2551+
searchImdbidHint: '开启后使用 ImdbID 精确搜索资源',
25502552
showEditDialog: '订阅时编辑更多规则',
25512553
showEditDialogHint: '添加订阅时显示此编辑订阅对话框',
25522554
include: '包含(关键字、正则式)',

src/locales/zh-TW.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,8 @@ export default {
979979
ranking: '排名',
980980
noStatisticsData: '暫無分享統計數據',
981981
bestVersion: '洗版中',
982+
bestVersionEpisodeShort: '分集',
983+
bestVersionWholeShort: '全集',
982984
completed: '訂閱完成',
983985
subscribing: '訂閱中',
984986
notStarted: '未開始',

0 commit comments

Comments
 (0)