From 7d1f0d4524969b244210c967837866c7b01c50a6 Mon Sep 17 00:00:00 2001
From: dap <15891557205@163.com>
Date: Tue, 13 Aug 2024 20:32:37 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=A2=E6=88=B7=E7=AB=AF=E7=AE=A1?=
=?UTF-8?q?=E7=90=86=20=E9=9A=8F=E6=9C=BAsecret?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/utils/uuid.ts | 28 +++++++++++++++++
src/views/system/client/SecretInput.vue | 41 +++++++++++++++++++++++++
src/views/system/client/index.vue | 3 +-
3 files changed, 71 insertions(+), 1 deletion(-)
create mode 100644 src/utils/uuid.ts
create mode 100644 src/views/system/client/SecretInput.vue
diff --git a/src/utils/uuid.ts b/src/utils/uuid.ts
new file mode 100644
index 00000000..548bcf39
--- /dev/null
+++ b/src/utils/uuid.ts
@@ -0,0 +1,28 @@
+const hexList: string[] = [];
+for (let i = 0; i <= 15; i++) {
+ hexList[i] = i.toString(16);
+}
+
+export function buildUUID(): string {
+ let uuid = '';
+ for (let i = 1; i <= 36; i++) {
+ if (i === 9 || i === 14 || i === 19 || i === 24) {
+ uuid += '-';
+ } else if (i === 15) {
+ uuid += 4;
+ } else if (i === 20) {
+ uuid += hexList[(Math.random() * 4) | 8];
+ } else {
+ uuid += hexList[(Math.random() * 16) | 0];
+ }
+ }
+ return uuid.replace(/-/g, '');
+}
+
+let unique = 0;
+export function buildShortUUID(prefix = ''): string {
+ const time = Date.now();
+ const random = Math.floor(Math.random() * 1000000000);
+ unique++;
+ return prefix + '_' + random + unique + String(time);
+}
diff --git a/src/views/system/client/SecretInput.vue b/src/views/system/client/SecretInput.vue
new file mode 100644
index 00000000..8714a01b
--- /dev/null
+++ b/src/views/system/client/SecretInput.vue
@@ -0,0 +1,41 @@
+
+
+
+ 随机生成
+
+
+
+
+
+
+
diff --git a/src/views/system/client/index.vue b/src/views/system/client/index.vue
index c05dcdcf..3a235597 100644
--- a/src/views/system/client/index.vue
+++ b/src/views/system/client/index.vue
@@ -89,7 +89,7 @@
-
+
@@ -144,6 +144,7 @@