fix(前端): 密钥共用提示不再常驻界面,只走通知与铃铛

This commit is contained in:
2026-10-25 00:17:25 +08:00
parent bb4cf3cdd2
commit f93e7d95fc
2 changed files with 8 additions and 31 deletions
@@ -4,7 +4,7 @@
* 异常时客户端立刻弹窗并暂停该账号的新任务;已跑完的任务与结果行不受影响。
*
* - 暂停:红色不可忽略横幅 + 首次弹确认框,用户排查后点「继续任务」走 resume;
* - 共用密钥:黄色提示条,只报账号数,不阻断任务;
* - 共用密钥:只弹 ElMessage 通知(铃铛有服务端 secret_shared 推送),不再常驻界面;
* - 轮询失败保留上一轮状态(与 ProxyBalanceAlert 同口径),不把网络抖动刷成误报。
*/
import { onBeforeUnmount, onMounted, ref } from 'vue'
@@ -130,9 +130,8 @@ onBeforeUnmount(() => {
</script>
<template>
<div v-if="status?.paused || sharedWarnings.length" class="cost-guard-stack">
<div v-if="status?.paused" class="cost-guard-stack">
<div
v-if="status?.paused"
class="cost-guard-alert cost-guard-alert--paused"
role="alert"
aria-live="assertive"
@@ -150,24 +149,6 @@ onBeforeUnmount(() => {
</button>
</div>
</div>
<div
v-if="sharedWarnings.length"
class="cost-guard-alert cost-guard-alert--shared"
role="status"
>
<div class="cost-guard-alert-icon" aria-hidden="true">i</div>
<div class="cost-guard-alert-content">
<div class="cost-guard-alert-title">密钥共用提示</div>
<div
v-for="warning in sharedWarnings"
:key="sharedWarningKey(warning)"
class="cost-guard-alert-reason"
>
{{ warning.message }}
</div>
</div>
</div>
</div>
</template>
@@ -202,12 +183,6 @@ onBeforeUnmount(() => {
color: #7d1d1d;
}
.cost-guard-alert--shared {
border: 1px solid #e0a13c;
background: #fff8e8;
color: #7a4a06;
}
.cost-guard-alert-icon {
flex-shrink: 0;
width: 22px;
@@ -224,10 +199,6 @@ onBeforeUnmount(() => {
background: #d64545;
}
.cost-guard-alert--shared .cost-guard-alert-icon {
background: #e0a13c;
}
.cost-guard-alert-content {
display: flex;
flex-direction: column;
@@ -74,6 +74,12 @@ test('共享密钥提示按键去重,不按文案去重', async () => {
)
})
test('密钥共用提示只走通知,不再常驻界面', () => {
assert.ok(component.includes('ElMessage.warning'), '共用密钥提示应通过 ElMessage 通知弹出')
assert.ok(!component.includes('cost-guard-alert--shared'), '黄色常驻横幅已下线,样式类不得回流')
assert.ok(!component.includes('密钥共用提示'), '界面模板不应再渲染「密钥共用提示」横幅')
})
test('全局挂载并在暂停时提供「继续任务」', () => {
assert.ok(app.includes("import CostGuardAlert from '@/shared/components/CostGuardAlert.vue'"))
assert.ok(app.includes('<CostGuardAlert />'), '组件没挂到 App.vue,异常时界面不会弹')