mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 05:49:20 +08:00
57 lines
1.4 KiB
Vue
57 lines
1.4 KiB
Vue
<script setup lang="ts">
|
||
import { ref } from 'vue';
|
||
|
||
import { createIconifyIcon } from '@vben/icons';
|
||
|
||
import { Button, Input, message, Space, Typography } from 'ant-design-vue';
|
||
|
||
defineOptions({ name: 'FingerprintDisplay' });
|
||
|
||
const props = defineProps<{
|
||
fingerprint: string;
|
||
hostname?: string;
|
||
machineId?: string;
|
||
}>();
|
||
|
||
const CopyIcon = createIconifyIcon('lucide:copy');
|
||
|
||
const copying = ref(false);
|
||
|
||
async function copyFingerprint() {
|
||
if (!props.fingerprint) return;
|
||
copying.value = true;
|
||
try {
|
||
await navigator.clipboard.writeText(props.fingerprint);
|
||
message.success('机器指纹已复制');
|
||
} catch {
|
||
message.error('复制失败,请手动选择复制');
|
||
} finally {
|
||
copying.value = false;
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<template>
|
||
<div class="rounded-lg border border-dashed border-primary/30 bg-primary/5 p-4">
|
||
<Typography.Text type="secondary" class="mb-2 block text-sm">
|
||
请将以下机器指纹发送给运营方签发 License
|
||
</Typography.Text>
|
||
<Input :value="fingerprint" readonly class="font-mono text-xs" />
|
||
<Space class="mt-3" wrap>
|
||
<Button
|
||
type="primary"
|
||
ghost
|
||
size="small"
|
||
:loading="copying"
|
||
@click="copyFingerprint"
|
||
>
|
||
<CopyIcon class="mr-1 size-4" />
|
||
复制指纹
|
||
</Button>
|
||
<Typography.Text v-if="hostname" type="secondary" class="text-xs">
|
||
主机名:{{ hostname }}
|
||
</Typography.Text>
|
||
</Space>
|
||
</div>
|
||
</template>
|