私钥文本框右上角增加复制图标
This commit is contained in:
parent
aa0f6aa602
commit
b90e1e6d9b
@ -179,8 +179,15 @@
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<span class="text-gray-600 mb-2">私钥:</span>
|
||||
<div v-if="$jsiteServer.pg.private_key" class="bg-gray-50 p-3 rounded border">
|
||||
<pre class="font-mono text-xs text-gray-900 whitespace-pre-wrap break-all">{{ $jsiteServer.pg.private_key }}</pre>
|
||||
<div v-if="$jsiteServer.pg.private_key" class="bg-gray-50 p-3 rounded border relative">
|
||||
<button
|
||||
@click="copyPrivateKey"
|
||||
class="absolute top-2 right-2 p-1 text-gray-500 hover:text-gray-700 transition-colors rounded"
|
||||
:title="copySuccess ? '已复制' : '复制私钥'"
|
||||
>
|
||||
<CopyIcon class="h-4 w-4" />
|
||||
</button>
|
||||
<pre class="font-mono text-xs text-gray-900 whitespace-pre-wrap break-all pr-8">{{ $jsiteServer.pg.private_key }}</pre>
|
||||
</div>
|
||||
<span v-else class="font-mono text-gray-900">未设置</span>
|
||||
</div>
|
||||
@ -201,6 +208,7 @@ import EyeIcon from '~icons/lucide/eye';
|
||||
import EyeOffIcon from '~icons/lucide/eye-off';
|
||||
import ClockIcon from '~icons/lucide/clock';
|
||||
import InfoIcon from '~icons/lucide/info';
|
||||
import CopyIcon from '~icons/lucide/copy';
|
||||
|
||||
export default {
|
||||
name: 'JsiteServerOverview',
|
||||
@ -212,6 +220,7 @@ export default {
|
||||
EyeOffIcon,
|
||||
ClockIcon,
|
||||
InfoIcon,
|
||||
CopyIcon,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -221,6 +230,7 @@ export default {
|
||||
resetPasswordLoading: false,
|
||||
resetKeyPairLoading: false,
|
||||
resetSystemLoading: false,
|
||||
copySuccess: false,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
@ -478,6 +488,19 @@ export default {
|
||||
getPasswordRequest.submit();
|
||||
}
|
||||
},
|
||||
copyPrivateKey() {
|
||||
if (this.$jsiteServer.pg.private_key) {
|
||||
navigator.clipboard.writeText(this.$jsiteServer.pg.private_key).then(() => {
|
||||
this.copySuccess = true;
|
||||
toast.success('私钥已复制到剪贴板');
|
||||
setTimeout(() => {
|
||||
this.copySuccess = false;
|
||||
}, 2000);
|
||||
}).catch(() => {
|
||||
toast.error('复制失败,请手动复制');
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
serverInformation() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user