新增支持站点折叠功能,并更新相关国际化文本

This commit is contained in:
jxxghp
2025-07-21 11:53:29 +08:00
parent 23a48e07a2
commit 536793ab25
4 changed files with 60 additions and 12 deletions

View File

@@ -1106,6 +1106,8 @@ export default {
viewChangelog: 'View Changelog',
changelog: 'Changelog',
dataDirectory: '/moviepilot',
expand: 'Expand',
collapse: 'Collapse',
},
system: {
custom: 'Custom',

View File

@@ -1102,6 +1102,8 @@ export default {
viewChangelog: '查看变更日志',
changelog: '变更日志',
dataDirectory: '/moviepilot',
expand: '展开',
collapse: '收起',
},
system: {
custom: '自定义',

View File

@@ -1101,6 +1101,8 @@ export default {
viewChangelog: '查看變更日誌',
changelog: '變更日誌',
dataDirectory: '/moviepilot',
expand: '展開',
collapse: '收起',
},
system: {
custom: '自定義',

View File

@@ -15,6 +15,35 @@ const allRelease = ref<any>([])
// 支持站点
const supportingSites = ref<any>({})
// 支持站点折叠状态
const sitesExpanded = ref(false)
// 去重后的支持站点
const uniqueSupportingSites = computed(() => {
const sitesMap = new Map()
Object.entries(supportingSites.value).forEach(([domain, site]: [string, any]) => {
if (!sitesMap.has(site.name)) {
sitesMap.set(site.name, {
name: site.name,
urls: [{ domain, url: site.url }],
})
} else {
sitesMap.get(site.name).urls.push({ domain, url: site.url })
}
})
return Array.from(sitesMap.values())
})
// 显示的支持站点折叠时只显示前5个
const displayedSites = computed(() => {
if (sitesExpanded.value) {
return uniqueSupportingSites.value
}
return uniqueSupportingSites.value.slice(0, 5)
})
// 变更日志对话框
const releaseDialog = ref(false)
@@ -68,6 +97,11 @@ async function querySupportingSites() {
}
}
// 切换站点列表展开状态
function toggleSitesExpanded() {
sitesExpanded.value = !sitesExpanded.value
}
// 计算发布时间
function releaseTime(releaseDate: string) {
// 上一次更新时间
@@ -173,18 +207,26 @@ onMounted(() => {
<div class="max-w-6xl py-4 sm:grid sm:grid-cols-3 sm:gap-4">
<dt class="block text-sm font-bold">{{ t('setting.about.supportingSites') }}</dt>
<dd class="flex text-sm sm:col-span-2 sm:mt-0">
<div class="flex flex-wrap gap-2">
<VChip
v-for="(site, domain) in supportingSites"
:key="domain"
variant="outlined"
size="small"
:title="`${site.name} - ${site.url}`"
target="_blank"
rel="noreferrer"
>
<span class="truncate max-w-32">{{ site.name }}</span>
</VChip>
<div class="flex flex-col gap-2">
<div class="flex flex-wrap gap-2">
<VChip v-for="site in displayedSites" :key="site.name" variant="outlined" size="small">
<span class="truncate max-w-32">{{ site.name }}</span>
</VChip>
</div>
<div v-if="uniqueSupportingSites.length > 5" class="flex justify-start">
<VBtn
variant="text"
size="small"
@click="toggleSitesExpanded"
class="text-indigo-500 hover:text-indigo-400"
>
<template #prepend>
<VIcon :icon="sitesExpanded ? 'mdi-chevron-up' : 'mdi-chevron-down'" />
</template>
{{ sitesExpanded ? t('setting.about.collapse') : t('setting.about.expand') }}
({{ uniqueSupportingSites.length }})
</VBtn>
</div>
</div>
</dd>
</div>