From 2a766efb8394339057e08125c79bacb5b340dda0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=84=E8=87=AA=E8=BE=BE?= <980324341@qq.com>
Date: Sun, 13 Sep 2026 12:14:41 +0800
Subject: [PATCH] =?UTF-8?q?feat(=E5=AE=A2=E6=88=B7=E7=AB=AF=E5=AF=86?=
=?UTF-8?q?=E9=92=A5=E9=9D=A2=E6=9D=BF):=20=E4=BB=A3=E7=90=86=E8=AE=BE?=
=?UTF-8?q?=E7=BD=AE=E6=94=AF=E6=8C=81=E8=BF=9E=E9=80=9A=E6=80=A7=E6=A3=80?=
=?UTF-8?q?=E6=B5=8B=E4=B8=8E=E7=8A=B6=E6=80=81=E5=B1=95=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 代理卡片新增检测按钮:地址有改动时检测输入值(不落库),否则检测/落库已存值
- 状态行展示检测结果(连通正常/失败原因/耗时),颜色区分通过/失败/警示
- 余量无数据时显示"余额查询暂不可用"占位
---
.../components/ApiSecretSettingsPanel.vue | 65 +++++++++++++++++++
1 file changed, 65 insertions(+)
diff --git a/frontend-vue/src/shared/components/ApiSecretSettingsPanel.vue b/frontend-vue/src/shared/components/ApiSecretSettingsPanel.vue
index 5c945e79..518e8048 100644
--- a/frontend-vue/src/shared/components/ApiSecretSettingsPanel.vue
+++ b/frontend-vue/src/shared/components/ApiSecretSettingsPanel.vue
@@ -86,12 +86,27 @@
+
+
+
+ {{ proxyStatusText }}
+
+
+
正在读取代理配置...
代理配置读取失败,请关闭弹窗后重试
代理设置仅在桌面客户端中可用
正在查询代理余量...
{{ balanceText }}
+ 余额查询暂不可用
@@ -151,6 +166,56 @@ const proxyReady = ref(false)
const proxySupported = ref(false)
const proxyDirty = ref(false)
+const proxyChecking = ref(false)
+const proxyCheckResult = ref(null)
+const proxyCheckError = ref('')
+
+const proxyStatusText = computed(() => {
+ if (proxyChecking.value) return '正在检测...'
+ if (proxyCheckResult.value) {
+ const latency = proxyCheckResult.value.checkLatencyMs != null ? `(${proxyCheckResult.value.checkLatencyMs}ms)` : ''
+ if (proxyCheckResult.value.checkStatus === 'passed') return `代理连通正常${latency}`
+ return `${proxyCheckResult.value.checkMessage || '代理检测失败'}`
+ }
+ if (proxyCheckError.value) return proxyCheckError.value
+ return ''
+})
+
+const proxyResultClass = computed(() => {
+ const status = proxyCheckResult.value?.checkStatus
+ return {
+ 'check-result--ok': status === 'passed',
+ 'check-result--fail': status === 'failed',
+ 'check-result--warn': status === 'error',
+ }
+})
+
+/** 检测代理连通性:地址有改动时检测输入值(不落库),否则检测/落库已存值并刷新状态展示。 */
+async function runProxyCheck() {
+ if (proxyChecking.value) return
+ const inputValue = proxyUrl.value.trim()
+ const dirty = proxyDirty.value && inputValue
+ proxyChecking.value = true
+ proxyCheckError.value = ''
+ proxyCheckResult.value = null
+ try {
+ proxyCheckResult.value = await checkApiSecret('proxy', dirty ? inputValue : undefined)
+ const result = proxyCheckResult.value
+ if (result.checkStatus === 'failed') {
+ ElMessage.warning(result.checkMessage || '代理不可用')
+ } else if (result.checkStatus === 'error') {
+ ElMessage.warning(result.checkMessage || '暂时无法判定代理可用性')
+ } else {
+ ElMessage.success(dirty ? '输入地址连通正常(未保存)' : '代理连通正常')
+ }
+ } catch (error) {
+ proxyCheckError.value = error instanceof Error ? error.message : '代理检测失败'
+ ElMessage.error(proxyCheckError.value)
+ } finally {
+ proxyChecking.value = false
+ }
+}
+
const balance = ref<{ surplus: string | null; balance: string | null } | null>(null)
const balanceLoading = ref(false)