diff --git a/web/admin-spa/src/components/apikeys/NewApiKeyModal.vue b/web/admin-spa/src/components/apikeys/NewApiKeyModal.vue
index 13947829..00fd94c9 100644
--- a/web/admin-spa/src/components/apikeys/NewApiKeyModal.vue
+++ b/web/admin-spa/src/components/apikeys/NewApiKeyModal.vue
@@ -13,8 +13,9 @@
@@ -158,7 +159,7 @@ const copyApiKey = async () => {
}
}
-// 关闭弹窗
+// 关闭弹窗(带确认)
const handleClose = async () => {
if (window.showConfirm) {
const confirmed = await window.showConfirm(
@@ -180,6 +181,29 @@ const handleClose = async () => {
}
}
}
+
+// 直接关闭(不带确认)
+const handleDirectClose = async () => {
+ if (window.showConfirm) {
+ const confirmed = await window.showConfirm(
+ '确定要关闭吗?',
+ '您还没有保存API Key,关闭后将无法再次查看。\n\n建议您先复制API Key再关闭。',
+ '仍然关闭',
+ '返回复制'
+ )
+ if (confirmed) {
+ emit('close')
+ }
+ } else {
+ // 降级方案
+ const confirmed = confirm(
+ '您还没有保存API Key,关闭后将无法再次查看。\n\n确定要关闭吗?'
+ )
+ if (confirmed) {
+ emit('close')
+ }
+ }
+}