fix(admin-spa): 替换原生确认弹窗为自定义弹窗并修复按钮样式

- 替换API Key删除确认弹窗为自定义ConfirmDialog组件
- 替换API Key创建成功后关闭确认弹窗为自定义弹窗
- 修复'我已保存'按钮样式,增加背景色对比度和边框
- 添加降级方案以确保兼容性
This commit is contained in:
shaw
2025-07-29 18:45:55 +08:00
parent 96520bca57
commit d761e89925
5 changed files with 35 additions and 41 deletions

View File

@@ -1 +0,0 @@
/* empty css */import{_ as r}from"./index-CXaPsBVx.js";import{x as t,y as s,z as l,Q as d,L as o,A as c,C as g,P as i}from"./vue-vendor-CKToUHZx.js";const u={class:"flex items-center gap-4"},f={class:"w-12 h-12 bg-gradient-to-br from-blue-500/20 to-purple-500/20 border border-gray-300/30 rounded-xl flex items-center justify-center backdrop-blur-sm flex-shrink-0 overflow-hidden"},y=["src"],m={key:1,class:"fas fa-cloud text-xl text-gray-700"},h={key:1,class:"w-8 h-8 bg-gray-300/50 rounded animate-pulse"},x={class:"flex flex-col justify-center min-h-[48px]"},b={class:"flex items-center gap-3"},k={key:1,class:"h-8 w-64 bg-gray-300/50 rounded animate-pulse"},_={key:0,class:"text-gray-600 text-sm leading-tight mt-0.5"},S={__name:"LogoTitle",props:{loading:{type:Boolean,default:!1},title:{type:String,default:""},subtitle:{type:String,default:""},logoSrc:{type:String,default:""},titleClass:{type:String,default:"text-gray-900"}},setup(e){const n=a=>{a.target.style.display="none"};return(a,p)=>(s(),t("div",u,[l("div",f,[e.loading?(s(),t("div",h)):(s(),t(d,{key:0},[e.logoSrc?(s(),t("img",{key:0,src:e.logoSrc,alt:"Logo",class:"w-8 h-8 object-contain",onError:n},null,40,y)):(s(),t("i",m))],64))]),l("div",x,[l("div",b,[!e.loading&&e.title?(s(),t("h1",{key:0,class:g(["text-2xl font-bold header-title leading-tight",e.titleClass])},i(e.title),3)):e.loading?(s(),t("div",k)):o("",!0),c(a.$slots,"after-title",{},void 0,!0)]),e.subtitle?(s(),t("p",_,i(e.subtitle),1)):o("",!0)])]))}},C=r(S,[["__scopeId","data-v-a75bf797"]]);export{C as L};

File diff suppressed because one or more lines are too long

View File

@@ -1,31 +0,0 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Claude Relay Service - 管理后台</title>
<!-- Google Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<!-- Font Awesome -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<!-- 预连接到CDN域名加速资源加载 -->
<link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin>
<link rel="preconnect" href="https://cdnjs.cloudflare.com" crossorigin>
<link rel="dns-prefetch" href="https://cdn.jsdelivr.net">
<link rel="dns-prefetch" href="https://cdnjs.cloudflare.com">
<script type="module" crossorigin src="/admin-next/assets/index-CXaPsBVx.js"></script>
<link rel="modulepreload" crossorigin href="/admin-next/assets/vue-vendor-CKToUHZx.js">
<link rel="modulepreload" crossorigin href="/admin-next/assets/vendor-BDiMbLwQ.js">
<link rel="modulepreload" crossorigin href="/admin-next/assets/element-plus-B8Fs_0jW.js">
<link rel="stylesheet" crossorigin href="/admin-next/assets/element-plus-CPnoEkWW.css">
<link rel="stylesheet" crossorigin href="/admin-next/assets/index-AuZXVQyt.css">
</head>
<body>
<div id="app"></div>
</body>
</html>

View File

@@ -85,7 +85,7 @@
</button> </button>
<button <button
@click="handleClose" @click="handleClose"
class="px-6 py-3 bg-gray-100 text-gray-700 rounded-xl font-semibold hover:bg-gray-200 transition-colors" class="px-6 py-3 bg-gray-200 text-gray-800 rounded-xl font-semibold hover:bg-gray-300 transition-colors border border-gray-300"
> >
我已保存 我已保存
</button> </button>
@@ -159,12 +159,25 @@ const copyApiKey = async () => {
} }
// 关闭弹窗 // 关闭弹窗
const handleClose = () => { const handleClose = async () => {
const confirmed = confirm( if (window.showConfirm) {
'关闭后将无法再次查看完整的API Key请确保已经妥善保存。\n\n确定要关闭吗' const confirmed = await window.showConfirm(
) '关闭提醒',
if (confirmed) { '关闭后将无法再次查看完整的API Key请确保已经妥善保存。\n\n确定要关闭吗',
emit('close') '确定关闭',
'取消'
)
if (confirmed) {
emit('close')
}
} else {
// 降级方案
const confirmed = confirm(
'关闭后将无法再次查看完整的API Key请确保已经妥善保存。\n\n确定要关闭吗'
)
if (confirmed) {
emit('close')
}
} }
} }
</script> </script>

View File

@@ -863,7 +863,21 @@ const handleRenewSuccess = () => {
// 删除API Key // 删除API Key
const deleteApiKey = async (keyId) => { const deleteApiKey = async (keyId) => {
if (!confirm('确定要删除这个 API Key 吗?此操作不可恢复。')) return let confirmed = false
if (window.showConfirm) {
confirmed = await window.showConfirm(
'删除 API Key',
'确定要删除这个 API Key 吗?此操作不可恢复。',
'确定删除',
'取消'
)
} else {
// 降级方案
confirmed = confirm('确定要删除这个 API Key 吗?此操作不可恢复。')
}
if (!confirmed) return
try { try {
const data = await apiClient.delete(`/admin/api-keys/${keyId}`) const data = await apiClient.delete(`/admin/api-keys/${keyId}`)