@@ -3,10 +3,11 @@ import { keysApi } from "@/api/keys";
33import type { Group , GroupConfigOption , GroupStatsResponse } from " @/types/models" ;
44import { appState } from " @/utils/app-state" ;
55import { copy } from " @/utils/clipboard" ;
6- import { getGroupDisplayName } from " @/utils/display" ;
7- import { Pencil , Trash } from " @vicons/ionicons5" ;
6+ import { getGroupDisplayName , maskProxyKeys } from " @/utils/display" ;
7+ import { CopyOutline , EyeOffOutline , EyeOutline , Pencil , Trash } from " @vicons/ionicons5" ;
88import {
99 NButton ,
10+ NButtonGroup ,
1011 NCard ,
1112 NCollapse ,
1213 NCollapseItem ,
@@ -20,7 +21,7 @@ import {
2021 NTooltip ,
2122 useDialog ,
2223} from " naive-ui" ;
23- import { onMounted , ref , watch } from " vue" ;
24+ import { computed , onMounted , ref , watch } from " vue" ;
2425import GroupFormModal from " ./GroupFormModal.vue" ;
2526
2627interface Props {
@@ -43,6 +44,30 @@ const showEditModal = ref(false);
4344const delLoading = ref (false );
4445const expandedName = ref <string []>([]);
4546const configOptions = ref <GroupConfigOption []>([]);
47+ const showProxyKeys = ref (false );
48+
49+ const proxyKeysDisplay = computed (() => {
50+ if (! props .group ?.proxy_keys ) {
51+ return " -" ;
52+ }
53+ if (showProxyKeys .value ) {
54+ return props .group .proxy_keys .replace (/ ,/ g , " \n " );
55+ }
56+ return maskProxyKeys (props .group .proxy_keys );
57+ });
58+
59+ async function copyProxyKeys() {
60+ if (! props .group ?.proxy_keys ) {
61+ return ;
62+ }
63+ const keysToCopy = props .group .proxy_keys .replace (/ ,/ g , " \n " );
64+ const success = await copy (keysToCopy );
65+ if (success ) {
66+ window .$message .success (" 代理密钥已复制到剪贴板" );
67+ } else {
68+ window .$message .error (" 复制失败" );
69+ }
70+ }
4671
4772onMounted (() => {
4873 loadStats ();
@@ -385,10 +410,41 @@ function resetPage() {
385410 {{ group?.validation_endpoint }}
386411 </n-form-item >
387412 </n-grid-item >
388- <n-grid-item >
413+ <n-grid-item :span =" 2" >
414+ <n-form-item label =" 代理密钥:" >
415+ <div class =" proxy-keys-content" >
416+ <span class =" key-text" >{{ proxyKeysDisplay }}</span >
417+ <n-button-group size =" small" class =" key-actions" v-if =" group?.proxy_keys" >
418+ <n-tooltip trigger =" hover" >
419+ <template #trigger >
420+ <n-button quaternary circle @click =" showProxyKeys = !showProxyKeys" >
421+ <template #icon >
422+ <n-icon
423+ :component =" showProxyKeys ? EyeOffOutline : EyeOutline"
424+ />
425+ </template >
426+ </n-button >
427+ </template >
428+ {{ showProxyKeys ? "隐藏密钥" : "显示密钥" }}
429+ </n-tooltip >
430+ <n-tooltip trigger =" hover" >
431+ <template #trigger >
432+ <n-button quaternary circle @click =" copyProxyKeys" >
433+ <template #icon >
434+ <n-icon :component =" CopyOutline" />
435+ </template >
436+ </n-button >
437+ </template >
438+ 复制密钥
439+ </n-tooltip >
440+ </n-button-group >
441+ </div >
442+ </n-form-item >
443+ </n-grid-item >
444+ <n-grid-item :span =" 2" >
389445 <n-form-item label =" 描述:" >
390446 <div class =" description-content" >
391- {{ group?.description }}
447+ {{ group?.description || "-" }}
392448 </div >
393449 </n-form-item >
394450 </n-grid-item >
@@ -613,6 +669,28 @@ function resetPage() {
613669 color : #374151 ;
614670}
615671
672+ .proxy-keys-content {
673+ display : flex ;
674+ align-items : flex-start ;
675+ justify-content : space-between ;
676+ width : 100% ;
677+ gap : 8px ;
678+ }
679+
680+ .key-text {
681+ flex-grow : 1 ;
682+ font-family : monospace ;
683+ white-space : pre-wrap ;
684+ word-break : break-all ;
685+ line-height : 1.5 ;
686+ padding-top : 4px ; /* Align with buttons */
687+ color : #374151 ;
688+ }
689+
690+ .key-actions {
691+ flex-shrink : 0 ;
692+ }
693+
616694/* 配置项tooltip样式 */
617695.config-label {
618696 display : inline-flex ;
0 commit comments