From 6829b211ac6c88ac145f41372cd6782b0f2d4702 Mon Sep 17 00:00:00 2001 From: gouki Date: Sat, 8 Aug 2026 23:36:13 +0000 Subject: [PATCH] =?UTF-8?q?feat(ui):=20=E5=B9=B3=E5=8F=B0=E9=A1=B5?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E9=9A=90=E8=97=8F=E6=9C=AA=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0(=E6=97=A0=E8=B5=84=E4=BA=A7/=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7/API=E9=85=8D=E7=BD=AE),=E5=8F=AF=E4=B8=80=E9=94=AE?= =?UTF-8?q?=E5=B1=95=E5=BC=80=E5=85=A8=E9=83=A8,=E5=81=8F=E5=A5=BD?= =?UTF-8?q?=E6=8C=81=E4=B9=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VERSION | 2 +- static/js/views/providers.js | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index d15723f..1c09c74 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.3.2 +0.3.3 diff --git a/static/js/views/providers.js b/static/js/views/providers.js index 2689eb0..5763090 100644 --- a/static/js/views/providers.js +++ b/static/js/views/providers.js @@ -6,13 +6,14 @@ const ProvidersView = {
🏢 平台 = 资产的服务商(Vultr / 新网 / OpenAI…)。在「资产」中添加项目时选择归属平台;支持 API 对接的平台配置好密钥后,可「测试连接」或「同步资产」拉取真实数据。
-
+
+
-
+
{{ 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) }; }, };