Files
crawler-plugin/admin-frontend-vue/src/pages/account/UserSecretsPage.vue
T
huangzd1997 cc22600a07 feat(后管): 密钥管理拆两列显示余额(LLM 人民币余额/代理余量),实时查不落库
按拍板:数据源=实时查上游不落库(⇒ 本窗零 Flyway、零 Schema);列形态=拆两列,不是一列两行——
两张货源字典本就互不相通(LLM 行为渠道 longtaitou/t8star,代理行为供应商 qingguo/jikip),合成一格
就是 11-02 那次"代理行贴出龙抬头"的串档形状重来一遍(铁律 25)。不加 v-if="isSuperAdmin":主管必须
能解释组员任务为什么挂欠费,鉴权维持 requireAdmin + DataReadScope。

- src/api/user-secrets.ts:fetchAdminSecretBalances(userIds, companyId?),POST /api/admin/user-secrets/balances,
  超时放宽到 30s(服务端整请求预算 10s,客户端必须比它长,否则拿到的是本地掐断而不是"上游未应答")。
- user-secret-model.ts:llmBalanceLines/proxyBalanceLine 纯函数——**两张字典各查各的**、跨域一律 —、
  未知渠道只出 — 不出钱;available=false 时把 message 挂进 title 而不是画成 0;同一账号两个模块归到
  同一个渠道名下只列一次钱。保持零 @/ 别名以便 node --test 直测。
- UserSecretsPage.vue:两个 <th>(LLM 余额 170px/代理余量 160px,放「更新时间」前),两个 <td> 首屏画 —/查询中,
  列表返回后异步填(不阻塞首屏);colspan 由 isSuperAdmin ? 10 : 9 改成 12 : 11(两处同改,892d88ed 的提交信息
  专门写过这句);表格 min-width 相应 +240px;「刷新余额」按钮按 BALANCE_BATCH=20 分批请求。
- 已核对 ops-cell-must-wrap.test.ts:它的 opsColDecl() 正则锚在表头文字「操作」上,新增 <th> 排在它之前不影响
  UserSecretsPage: 314 下限 ⇒ 那张表不改(实测绿)。
- mock-admin-server.mjs 补两列夹具(一条有数、一条全查不到)供 dev/e2e。

测试:tests/密钥余额列读数.test.ts 12 例(跨域不认、坏值不画 0)+
tests/mount/user-secret-balance-columns.mount.test.ts 9 例——按表头文字定位不靠列序数,并钉 <th> 数=<td> 数=
空行 colspan(超管与非超管两种形状各一遍),把"加列忘改 colspan"直接钉死。既有 status-band 挂载格的夹具 mock
补一个 fetchAdminSecretBalances 函数名(页面挂载即取余额,缺它整个模块 mock 会炸),不是判据改动。
刻意不新增 readSource 钉 ⇒ 不动 tests/baselines/source-pin-ledger.json。vue-tsc rc=0、node --test 1890 例、vitest 77 例。
2026-11-05 12:03:43 +08:00

786 lines
28 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup lang="ts">
import { computed, onMounted, ref, watch } from 'vue'
import { ElMessage } from 'element-plus'
import { formatDateTime } from '@/utils/datetime'
import OldPagination from '@/components/OldPagination.vue'
import ProxyEntryDialog from './ProxyEntryDialog.vue'
import {
checkUserSecret,
clearUserSecretModule,
deleteUserSecret,
fetchAdminSecretBalances,
fetchUserSecretList,
type AdminUserSecretBalanceItem,
type AdminUserSecretModule,
type AdminUserSecretRow,
type GroupOption,
} from '@/api/user-secrets'
import {
PROXY_MODULE_KEY,
llmBalanceLines,
llmSourceLabel,
moduleStatusBand,
proxyBalanceLine,
proxyDisplayText,
proxySourceLabel,
rowDetailLines,
rowStatusBand,
} from './user-secret-model.ts'
import { useAdminSessionStore } from '@/stores/admin-session'
import { useCompanyTabStore } from '@/stores/company-tab'
import { showAdminFeedback } from '@/components/admin-feedback-ui'
import { openAdminConfirm } from '@/components/admin-confirm'
import LoadFailureBar from '@/components/LoadFailureBar.vue'
const session = useAdminSessionStore()
const companyTab = useCompanyTabStore()
/** 仅超管需要分组维度:非超管数据由后端裁剪到本人分组,分组筛选/列一律不展示。 */
const isSuperAdmin = computed(() => session.isSuperAdmin)
const loading = ref(false)
const loadFailure = ref('')
const rows = ref<AdminUserSecretRow[]>([])
const total = ref(0)
const page = ref(1)
const pageSize = ref(15)
const keyword = ref('')
const statusFilter = ref('')
const groupFilter = ref<number | null>(null)
/** 分组下拉(超管=全部;主管=自己带的分组,由列表接口带回)。 */
const groupOptions = ref<GroupOption[]>([])
/** 正在检测的行 userId,用于按钮 loading 态。 */
const checkingId = ref<number | null>(null)
/** 正在解锁代理的行 userId,避免重复点击(代填在弹窗里自己管 busy)。 */
const proxyBusyId = ref<number | null>(null)
/** 代填/改代理弹窗的目标行(脱敏后没有原文可预填,只能重填账密)。 */
const proxyDialog = ref<{ userId: number; username: string; provider: string | null; locked: boolean } | null>(null)
/** 余额侧写(实时查上游、不落库):按 userId 存,列表接口本身不带这些数。 */
const balances = ref<Record<number, AdminUserSecretBalanceItem>>({})
const balanceLoading = ref(false)
/** 本轮「没取到」的原因(越权剔除/上游未应答/请求失败):进工具行悬停,不弹全局打扰。 */
const balanceNotice = ref('')
/** 服务端单次上限 20 个用户;超出会被当场拒,所以这里按批顺取(并发留给服务端那个线程池)。 */
const BALANCE_BATCH = 20
const totalPages = computed(() => Math.max(1, Math.ceil(total.value / pageSize.value)))
const STATUS_OPTIONS = [
{ value: '', label: '全部状态' },
{ value: 'passed', label: '检测通过' },
{ value: 'failed', label: '检测失败' },
{ value: 'incomplete', label: '未配齐' },
// 后端的行级值仍是 error:这一档现在既可能是「问不出结论」,也可能是「通道还没释放、等一会再点」,
// 界面按码把后者补成「可重试」(见 user-secret-model.ts 的档位表),筛选项就得把两档都点名。
{ value: 'error', label: '无法判定/可重试' },
{ value: 'unknown', label: '未检测' },
]
/* 状态药丸的档位表在 `user-secret-model.ts`(唯一出处,页面不带第二张表):
行级传整行而不是 `row.status`——后端把 failed/incomplete 都判掉之后就只剩一个「error」,
这一行到底是「查不出」还是「等青果释放」只有逐格的 `check_code` 说得清。 */
/**
* 单格悬停详情:后端下发的**脱敏值** + 锁定说明 + **检测结果原文 `check_message`** + 检测时间 + 耗时。
* 运维要判「是欠费还是被自己的采集占着」,靠的就是这句后端原文——档名只是扫一眼用的短词,
* 前端一律不按码自己拼句子。
* ⚠ 只读 `masked`:`full` 在后台侧恒空(2026-11-02 `SecretMasking.maskProxy` 收口),
* 这里不做任何「masked 空就回落原文」的兜底,也不给复制整条链接的旁路。
*/
function moduleTooltip(module: AdminUserSecretModule | undefined) {
if (!module || !module.exists) return '未配置'
const parts: string[] = []
const display = String(module.masked || '').trim()
if (display) {
parts.push(isProxyModule(module) ? `代理地址(已脱敏,不含 key/pwd):${display}` : `密钥:${display}`)
}
if (module.locked) parts.push('已由后台代填并锁定:客户端不可修改或清空,改代理需重新填写账密')
// 后端的这句话就是给人看的结论,原样透出(不动一个字、不按码另拼一句)
const message = String(module.checkMessage || '').trim()
if (message) parts.push(message)
if (module.checkedAt) parts.push(`检测时间:${formatDateTime(module.checkedAt)}`)
if (module.checkLatencyMs != null) parts.push(`耗时:${module.checkLatencyMs}ms`)
return parts.join(';') || '暂无检测记录'
}
/** 该格是不是代理模块:按后端下发的 moduleKey 判,货源标签与文案都走这一条口径。 */
function isProxyModule(module: AdminUserSecretModule) {
return String(module.moduleKey || '').trim().toLowerCase() === PROXY_MODULE_KEY
}
/** 分组列文案:优先分组名;未建分组的用户回退展示所属主管,便于判断归属。 */
function groupTextOf(row: AdminUserSecretRow) {
if (row.groups?.length) return row.groups.join('、')
if (row.leaderUsername) return `${row.leaderUsername}(未建分组)`
return '—'
}
/**
* 行级悬停详情:后端的行级摘要 + 逐格的 `check_message` 原文 + 更新时间。
* 行级状态一旦补成「可重试」,管理员得能立刻看出是哪一格在等、后端原话怎么说;
* 逐格那句一律取后端下发文本(`rowDetailLines` 只搬运、不改写、不另拼一句)。
*/
function rowStatusTooltip(row: AdminUserSecretRow) {
const parts: string[] = []
if (row.statusMessage) parts.push(row.statusMessage)
parts.push(...rowDetailLines(row))
if (row.updatedAt) parts.push(`最近更新:${formatDateTime(row.updatedAt)}`)
return parts.join(';') || '暂无检测记录'
}
async function load() {
loading.value = true
loadFailure.value = ''
try {
const result = await fetchUserSecretList({
keyword: keyword.value.trim() || undefined,
checkStatus: statusFilter.value || undefined,
groupId: groupFilter.value || undefined,
companyId: companyTab.requestCompanyId,
page: page.value,
pageSize: pageSize.value,
})
rows.value = result?.items || []
total.value = Number(result?.total || 0)
groupOptions.value = result?.groupOptions || []
void loadBalances()
} catch (error) {
loadFailure.value = error instanceof Error ? error.message : '加载失败'
showAdminFeedback(loadFailure.value, 'error')
} finally {
loading.value = false
}
}
/**
* 取本页用户的余额:列表已经画完,这两列随后填(余额要实时打上游,不能让它在列表主数据前占位)。
*
* 失败只影响这两列并留一句说明——不 `showAdminFeedback`、不把整页判成加载失败:
* 一次上游抖动就红整页,管理员会以为密钥数据本身出了问题。
*/
async function loadBalances() {
const ids = rows.value.map((row) => row.userId)
balances.value = {}
balanceNotice.value = ''
if (!ids.length) return
balanceLoading.value = true
try {
const merged: Record<number, AdminUserSecretBalanceItem> = {}
let denied = 0
let timedOut = 0
for (let start = 0; start < ids.length; start += BALANCE_BATCH) {
const batch = ids.slice(start, start + BALANCE_BATCH)
const result = await fetchAdminSecretBalances(batch, companyTab.requestCompanyId)
for (const item of result?.items || []) {
if (item && item.userId != null) merged[Number(item.userId)] = item
}
denied += result?.deniedUserIds?.length || 0
timedOut += result?.timedOutUserIds?.length || 0
}
balances.value = merged
const notices: string[] = []
if (denied) notices.push(`${denied} 个用户不在当前数据权限内,本轮未查`)
if (timedOut) notices.push(`${timedOut} 个用户本轮上游未应答(不是余额为 0)`)
balanceNotice.value = notices.join(';')
} catch (error) {
balanceNotice.value = error instanceof Error ? error.message : '余额本轮没取到(不是余额为 0)'
} finally {
balanceLoading.value = false
}
}
/** 某行的 LLM 余额行(按渠道折叠);没取到时给一格占位而不是空白。 */
function llmLinesOf(userId: number) {
const lines = llmBalanceLines(balances.value[userId]?.llm, balanceLoading.value)
return lines.length ? lines : [{ text: '—', title: balanceNotice.value || '本轮没取到数(不是余额为 0)' }]
}
function proxyLineOf(userId: number) {
const item = balances.value[userId]
if (item?.proxy) return proxyBalanceLine(item.proxy, false)
return balanceLoading.value
? { text: '查询中…', title: '余额按实时查询,不落库' }
: { text: '—', title: balanceNotice.value || '本轮没取到数(不是余量为 0)' }
}
// 切公司 = 重新取数。不重取的页 = tab 在那页上是假的(G1 的 pageFiles 断言盯着这条)。
watch(() => companyTab.activeId, () => void load())
function search() {
page.value = 1
load()
}
function reset() {
keyword.value = ''
statusFilter.value = ''
groupFilter.value = null
page.value = 1
load()
}
/** 立即检测:真实请求该用户全部已配置项并把结果落库。 */
async function check(row: AdminUserSecretRow) {
checkingId.value = row.userId
try {
const results = await checkUserSecret(row.userId)
if (!results || !results.length) {
ElMessage.warning('该用户尚未配置任何密钥或代理')
} else {
const failed = results.filter((item) => item.checkStatus === 'failed')
const errors = results.filter((item) => item.checkStatus === 'error')
if (failed.length) {
ElMessage.warning(failed[0].checkMessage || '存在检测失败项')
} else if (errors.length) {
// 后端这句话会区分「通道被你自己占着,等约 3 分钟」与「真的问不出结论」;
// 硬写「无法判定」等于把可重试那一族又抹回一坨(现网 uid=1 就是这个形状)。
ElMessage.warning(errors[0].checkMessage || '部分配置本次无法判定')
} else {
ElMessage.success('检测通过')
}
}
load()
} catch (error) {
showAdminFeedback(error instanceof Error ? error.message : '检测失败', 'error')
} finally {
checkingId.value = null
}
}
async function remove(row: AdminUserSecretRow) {
const who = row.username || `UID ${row.userId}`
if (!(await openAdminConfirm({ message: `确定清空「${who}」的全部密钥与代理配置吗?后台锁定的代理会一并清除并解锁,该用户需要重新配置。`, danger: true }))) return
try {
await deleteUserSecret(row.userId)
ElMessage.success('已清空')
load()
} catch (error) {
showAdminFeedback(error instanceof Error ? error.message : '清空失败', 'error')
}
}
/**
* 打开代填/改代理弹窗。
* ⚠ 不预填任何已有值:后台侧 `full` 恒空(代理链接里带着 key/pwd,2026-11-02 收口后不再下发),
* 所以这一单的语义就是「重新填账密」,界面上也没有把原文取回来的旁路。
*/
function openProxyDialog(row: AdminUserSecretRow) {
proxyDialog.value = {
userId: row.userId,
username: row.username || `UID ${row.userId}`,
provider: row.proxy?.channel ?? null,
locked: Boolean(row.proxy?.locked),
}
}
/** 弹窗保存成功:关掉并重新取数(列表只拿脱敏值,不参与拼装)。 */
function onProxySaved() {
proxyDialog.value = null
load()
}
/** 解锁代理:清空后台代填值,该用户恢复自行配置。 */
async function unlockProxy(row: AdminUserSecretRow) {
const who = row.username || `UID ${row.userId}`
if (!(await openAdminConfirm({ message: `确定解除「${who}」的代理锁定吗?解锁后当前后台代理值会被清空,客户端恢复自行配置。`, danger: true }))) return
proxyBusyId.value = row.userId
try {
await clearUserSecretModule(row.userId, PROXY_MODULE_KEY)
ElMessage.success('已解锁')
load()
} catch (error) {
showAdminFeedback(error instanceof Error ? error.message : '解锁失败', 'error')
} finally {
proxyBusyId.value = null
}
}
function changePage(next: number) {
if (next < 1 || next > totalPages.value) return
page.value = next
load()
}
function changeSize(size: number) {
pageSize.value = size
page.value = 1
load()
}
onMounted(load)
</script>
<template>
<div class="user-secrets-view">
<section class="panel-box">
<div class="secrets-head">
<h3>用户密钥列表</h3>
</div>
<div class="form-row secrets-filter-row">
<div class="form-group" style="min-width: 220px">
<label>用户名</label>
<input v-model="keyword" type="text" placeholder="模糊搜索用户名" @keyup.enter="search" />
</div>
<div class="form-group" style="min-width: 170px">
<label>状态(三项都通过才算通过)</label>
<select v-model="statusFilter">
<option v-for="option in STATUS_OPTIONS" :key="option.value" :value="option.value">{{ option.label }}</option>
</select>
</div>
<div class="form-group" v-if="isSuperAdmin && groupOptions.length" style="min-width: 170px">
<label>分组</label>
<select v-model="groupFilter">
<option :value="null">全部分组</option>
<option v-for="group in groupOptions" :key="group.id" :value="group.id">{{ group.groupName }}</option>
</select>
</div>
<div class="form-group">
<label>&nbsp;</label>
<div class="filter-actions">
<button class="btn" type="button" @click="search">查询</button>
<button class="btn btn-ghost" type="button" @click="reset">重置</button>
<button
class="btn btn-ghost"
type="button"
:disabled="balanceLoading || !rows.length"
:title="balanceNotice || '余额是实时查上游、不落库;这两列没取到时显示 —,不是 0'"
@click="loadBalances"
>
{{ balanceLoading ? '余额查询中…' : '刷新余额' }}
</button>
</div>
</div>
</div>
<LoadFailureBar v-if="loadFailure" :message="loadFailure" @retry="load" />
<div class="secrets-table-scroll">
<table>
<thead>
<tr>
<th style="width: 58px">序号</th>
<th style="width: 260px">用户</th>
<th v-if="isSuperAdmin" style="width: 130px">分组</th>
<th style="width: 230px">货源查询密钥</th>
<th style="width: 230px">外观专利密钥</th>
<th style="width: 170px">LLM 余额</th>
<th style="width: 380px">代理设置</th>
<th style="width: 160px">代理余量</th>
<th style="width: 130px">状态</th>
<th style="width: 170px">创建时间</th>
<th style="width: 170px">更新时间</th>
<th style="width: 315px">操作</th>
</tr>
</thead>
<tbody>
<template v-if="rows.length">
<tr v-for="(row, index) in rows" :key="row.userId">
<td>{{ (page - 1) * pageSize + index + 1 }}</td>
<td>
<span class="user-name">{{ row.username || '—' }}</span>
</td>
<td v-if="isSuperAdmin">
<span class="creator-name">{{ groupTextOf(row) }}</span>
</td>
<td>
<div class="module-cell">
<span v-if="row.similarAsin?.exists" class="mono-mask" :title="moduleTooltip(row.similarAsin)">{{ row.similarAsin.masked }}</span>
<span v-else class="empty-value">未配置</span>
<span v-if="row.similarAsin?.exists" class="wh-pill is-source" title="该用户这把密钥所属渠道">
{{ llmSourceLabel(row.similarAsin.channel) }}
</span>
<span class="wh-pill" :class="moduleStatusBand(row.similarAsin).tone" :title="moduleTooltip(row.similarAsin)">
{{ moduleStatusBand(row.similarAsin).label }}
</span>
</div>
</td>
<td>
<div class="module-cell">
<span v-if="row.appearancePatent?.exists" class="mono-mask" :title="moduleTooltip(row.appearancePatent)">{{ row.appearancePatent.masked }}</span>
<span v-else class="empty-value">未配置</span>
<span v-if="row.appearancePatent?.exists" class="wh-pill is-source" title="该用户这把密钥所属渠道">
{{ llmSourceLabel(row.appearancePatent.channel) }}
</span>
<span class="wh-pill" :class="moduleStatusBand(row.appearancePatent).tone" :title="moduleTooltip(row.appearancePatent)">
{{ moduleStatusBand(row.appearancePatent).label }}
</span>
</div>
</td>
<td>
<div class="module-cell module-cell--stack">
<span
v-for="(line, lineIndex) in llmLinesOf(row.userId)"
:key="`llm-${lineIndex}`"
class="balance-line"
:title="line.title"
>{{ line.text }}</span>
</div>
</td>
<td>
<div class="module-cell module-cell--stack">
<span v-if="row.proxy?.exists" class="mono-mask" :title="moduleTooltip(row.proxy)">{{ proxyDisplayText(row.proxy) }}</span>
<span v-else class="empty-value">未配置</span>
<span class="module-cell-pills">
<span v-if="row.proxy?.exists" class="wh-pill is-source" title="该用户代理所属供应商">
{{ proxySourceLabel(row.proxy.channel) }}
</span>
<span class="wh-pill" :class="moduleStatusBand(row.proxy).tone" :title="moduleTooltip(row.proxy)">
{{ moduleStatusBand(row.proxy).label }}
</span>
<span
v-if="row.proxy?.locked"
class="wh-pill is-locked"
title="已由管理员代填并锁定:客户端不可修改或清空"
>
已锁定
</span>
</span>
</div>
</td>
<td>
<div class="module-cell module-cell--stack">
<span class="balance-line" :title="proxyLineOf(row.userId).title">
{{ proxyLineOf(row.userId).text }}
</span>
</div>
</td>
<td>
<span class="wh-pill" :class="rowStatusBand(row).tone" :title="rowStatusTooltip(row)">
{{ rowStatusBand(row).label }}
</span>
</td>
<td>{{ formatDateTime(row.createdAt) }}</td>
<td>{{ formatDateTime(row.updatedAt) }}</td>
<td class="ops-cell">
<button
class="btn btn-sm"
type="button"
:disabled="checkingId === row.userId"
@click="check(row)"
>
{{ checkingId === row.userId ? '检测中…' : '立即检测' }}
</button>
<button
class="btn btn-sm btn-ghost"
type="button"
@click="openProxyDialog(row)"
>
{{ row.proxy?.locked ? '改代理' : '代填代理' }}
</button>
<button
v-if="row.proxy?.locked"
class="btn btn-sm btn-ghost"
type="button"
:disabled="proxyBusyId === row.userId"
@click="unlockProxy(row)"
>
解锁
</button>
<button class="btn btn-sm btn-danger" type="button" @click="remove(row)">清空</button>
</td>
</tr>
</template>
<tr v-else-if="loading">
<td :colspan="isSuperAdmin ? 12 : 11" class="empty-tip">加载中...</td>
</tr>
<tr v-else>
<td :colspan="isSuperAdmin ? 12 : 11" class="empty-tip">{{ keyword || statusFilter || groupFilter ? '暂无匹配记录' : '暂无用户密钥记录' }}</td>
</tr>
</tbody>
</table>
</div>
<OldPagination :total="total" :page="page" :page-size="pageSize" @change="changePage" @size-change="changeSize" />
</section>
<ProxyEntryDialog
:model-value="proxyDialog != null"
:user-id="proxyDialog?.userId ?? null"
:username="proxyDialog?.username ?? ''"
:provider="proxyDialog?.provider ?? null"
:locked="Boolean(proxyDialog?.locked)"
@update:model-value="(open: boolean) => { if (!open) proxyDialog = null }"
@saved="onProxySaved"
/>
</div>
</template>
<style scoped>
/* 像素复刻旧版 admin.html 面板风格(与店铺密钥页同一视觉语言)。 */
.user-secrets-view {
font-family: inherit;
color: #24384d;
}
.panel-box {
width: 100%;
min-width: 0;
padding: 20px 22px 24px;
border: 1px solid #d8e3ee;
border-radius: 14px;
background: linear-gradient(145deg, #ffffff, #f9fbfd);
box-shadow: 0 1px 2px rgba(39, 67, 94, 0.04), 0 14px 30px -24px rgba(39, 67, 94, 0.28);
}
h3 {
margin: 0;
font-size: 15px;
font-weight: 650;
color: #24384d;
letter-spacing: 0.2px;
}
.secrets-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-bottom: 16px;
}
.secrets-filter-row {
margin: 0 0 16px;
}
.form-row {
display: flex;
flex-wrap: wrap;
align-items: flex-end;
gap: 14px 18px;
}
.form-group {
display: flex;
flex-direction: column;
gap: 7px;
margin-bottom: 0;
}
.form-group label {
color: #5b6f83;
font-size: 12.5px;
font-weight: 600;
}
.form-group input,
.form-group select {
min-width: 0;
min-height: 42px;
padding: 8px 12px;
border: 1px solid #cbd9e6;
border-radius: 9px;
background: #f8fbfd;
color: #24384d;
font-size: 13.5px;
font-family: inherit;
color-scheme: light;
outline: none;
transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.form-group input:hover,
.form-group select:hover {
border-color: #9fb7cd;
}
.form-group input:focus,
.form-group select:focus {
background: #ffffff;
border-color: #5f85ad;
box-shadow: 0 0 0 3px rgba(95, 133, 173, 0.16);
}
.filter-actions {
display: flex;
gap: 10px;
}
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 8px;
min-height: 42px;
padding: 9px 18px;
border: 1px solid #4f78a5;
border-radius: 9px;
background: linear-gradient(135deg, #5f85ad, #4f78a5);
color: #ffffff;
font-family: inherit;
font-size: 13.5px;
cursor: pointer;
box-shadow: 0 8px 18px -14px rgba(79, 120, 165, 0.72);
transition: background 160ms ease, box-shadow 160ms ease, transform 120ms ease;
}
.btn:hover:not(:disabled) {
background: linear-gradient(135deg, #7094ba, #5d83ac);
box-shadow: 0 11px 22px -14px rgba(79, 120, 165, 0.8);
}
.btn:disabled {
cursor: not-allowed;
opacity: 0.55;
}
.btn-danger {
background: linear-gradient(135deg, #c06d77, #b35f6a);
border-color: #b35f6a;
}
.btn-danger:hover:not(:disabled) {
background: linear-gradient(135deg, #cb7c84, #b96570);
}
.btn-ghost {
background: #ffffff;
border-color: #c7d7e5;
color: #4f78a5;
box-shadow: none;
}
.btn-ghost:hover:not(:disabled) {
background: #edf5fb;
border-color: #95b1cb;
color: #2f5d8b;
}
.btn-sm {
min-height: 36px;
padding: 7px 12px;
}
.secrets-table-scroll {
width: 100%;
min-width: 0;
overflow-x: auto;
border: 1px solid #dbe5ee;
border-radius: 10px;
background: #ffffff;
}
.secrets-table-scroll table {
width: 100%;
border-collapse: collapse;
table-layout: fixed;
min-width: 1440px;
}
.secrets-table-scroll th,
.secrets-table-scroll td {
padding: 10px 12px;
text-align: left;
font-size: 13.5px;
line-height: 1.5;
border-bottom: 1px solid #e0e8ef;
vertical-align: middle;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.secrets-table-scroll th {
background: #edf4fa;
color: #4e6479;
border-bottom-color: #d5e1eb;
font-size: 12.5px;
font-weight: 600;
letter-spacing: 0.4px;
}
.secrets-table-scroll tbody tr:hover td {
background: #f1f7fb;
}
.secrets-table-scroll tbody tr:last-child td {
border-bottom: 0;
}
.user-name {
color: #24384d;
font-weight: 600;
/* 用户名(含中文)可完整换行展示,不截断 */
white-space: normal;
overflow-wrap: anywhere;
}
.creator-name {
color: #5b6f83;
font-size: 12.5px;
}
.module-cell {
display: flex;
align-items: center;
gap: 8px;
min-width: 0;
}
/* 代理列:脱敏地址独占一行,状态药丸另起一行(列宽按最长药丸文案留的,不按整条链接) */
.module-cell--stack {
flex-direction: column;
align-items: flex-start;
gap: 6px;
}
.module-cell .mono-mask {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
}
/* 代理列只显示后端脱敏后的 scheme://host(短串,单行足够)。
这里**不许**再出现"允许折行展示完整明文 + user-select:all"那套样式:
它等于给整条带 key/pwd 的链接做了一键全选复制的旁路(2026-11-02 脱敏收口时一并拆掉)。 */
.mono-mask {
font-family: Consolas, "Cascadia Mono", monospace;
font-size: 12.5px;
letter-spacing: 0.5px;
}
.empty-value {
color: #a7b4c1;
}
/* 余额列:数字按等宽数位对齐(两行叠着看差值才不用竖着对),超长进 title。 */
.balance-line {
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-variant-numeric: tabular-nums;
font-size: 12.5px;
color: #2f4256;
}
.ops-cell {
display: flex;
gap: 8px;
flex-wrap: wrap;
}
.empty-tip {
color: #8293a5;
text-align: center;
}
.wh-pill {
display: inline-flex;
align-items: center;
padding: 2px 10px;
border-radius: 999px;
border: 1px solid;
font-size: 12px;
line-height: 1.7;
cursor: help;
flex-shrink: 0;
}
.wh-pill.is-source {
background: #eef2fb;
border-color: #ccd8f2;
color: #3d5a99;
font-weight: 600;
}
.wh-pill.is-allowed {
background: #e8f6ee;
border-color: #b9e0c9;
color: #2f7d52;
}
.wh-pill.is-blocked {
background: #fdecef;
border-color: #f2c4cd;
color: #b04a5a;
}
.wh-pill.is-warn {
background: #fdf6e3;
border-color: #f0dfae;
color: #8f6d1e;
}
/* 「等一会再点」这一族(无可用通道/限流/超时/网络/上游):既不红(密钥没坏)
也不黄(不是欠费)更不是灰(不是查不出),独立一档青色——三种处置一眼分开。 */
.wh-pill.is-retry {
background: #e6f2f7;
border-color: #b6d8e6;
color: #2b6b86;
}
.wh-pill.is-unknown {
background: #f0f3f6;
border-color: #d6dee6;
color: #6b7d8f;
}
.wh-pill.is-locked {
background: #f0ecfb;
border-color: #d5caf0;
color: #5b4a96;
}
.module-cell-pills {
display: inline-flex;
align-items: center;
gap: 6px;
flex-wrap: wrap;
}
</style>