+
{{ p.name }}
@@ -44,6 +45,9 @@ const ProvidersView = {
{{ results[p.id].text }}
+
`,
setup() {
const testing = Vue.reactive({});
@@ -67,6 +71,18 @@ const ProvidersView = {
function accountsCountOf(p) {
return store.accounts.filter(a => a.platform === p.slug).length;
}
+ // 在用判定:有资产/有账号/已配置 API 任一即算在用
+ function isUsed(p) {
+ return countOf(p) > 0 || accountsCountOf(p) > 0 || p.has_api_config;
+ }
+ // 默认隐藏未使用平台,避免预设平台撑满屏幕;偏好持久化到 localStorage
+ const showAll = Vue.ref(localStorage.getItem('vps_show_all_providers') === '1');
+ function toggleShowAll() {
+ showAll.value = !showAll.value;
+ localStorage.setItem('vps_show_all_providers', showAll.value ? '1' : '0');
+ }
+ const visibleProviders = Vue.computed(() => showAll.value ? store.providers : store.providers.filter(isUsed));
+ const hiddenCount = Vue.computed(() => store.providers.length - visibleProviders.value.length);
function serviceList(p) {
return (p.services || '').split(',').map(s => s.trim()).filter(Boolean);
}
@@ -102,6 +118,6 @@ const ProvidersView = {
} catch (e) { results[p.id] = { ok: false, text: '✗ ' + e.message }; }
finally { syncing[p.id] = false; }
}
- return { store, Fmt, testing, syncing, results, countOf, accountsCountOf, serviceList, isSupported, canSync, fmtTime, test, sync, seed: seedProviders, create: openProviderCreate, edit: openProviderEdit, del: deleteProvider, openAccounts: (p) => openAccountsView(p.slug), manageAccounts: () => openAccountsView(null) };
+ return { store, Fmt, testing, syncing, results, countOf, accountsCountOf, serviceList, showAll, toggleShowAll, visibleProviders, hiddenCount, isSupported, canSync, fmtTime, test, sync, seed: seedProviders, create: openProviderCreate, edit: openProviderEdit, del: deleteProvider, openAccounts: (p) => openAccountsView(p.slug), manageAccounts: () => openAccountsView(null) };
},
};