From 7ff1da71d4561be5b4357062304a7c860869aee7 Mon Sep 17 00:00:00 2001 From: ibuler Date: Fri, 11 Oct 2024 19:22:39 +0800 Subject: [PATCH] perf: updat asset list and account list action --- .../Apps/AccountListTable/AccountList.vue | 18 ++++++++- .../Form/FormFields/PasswordInput.vue | 4 +- .../Form/FormFields/UpdateToken.vue | 26 ++++++++++++- src/utils/string.js | 37 +++++++++++++++---- .../Asset/AssetList/components/BaseList.vue | 4 ++ 5 files changed, 78 insertions(+), 11 deletions(-) diff --git a/src/components/Apps/AccountListTable/AccountList.vue b/src/components/Apps/AccountListTable/AccountList.vue index cbba1f9fc..cd237a392 100644 --- a/src/components/Apps/AccountListTable/AccountList.vue +++ b/src/components/Apps/AccountListTable/AccountList.vue @@ -185,6 +185,7 @@ export default { }, connect: { label: this.$t('Connect'), + width: '80px', formatter: () => { return ( @@ -286,7 +287,7 @@ export default { }, { name: 'Test', - title: this.$t('Test'), + title: this.$t('验证密码'), can: ({ row }) => !this.$store.getters.currentOrgIsRoot && this.$hasPerm('accounts.verify_account') && @@ -314,6 +315,21 @@ export default { this.$message.success(this.$tc('ClearSuccessMsg')) }) } + }, + { + name: 'SecretHistory', + title: '密文历史' + }, + { + name: 'CopyToOther', + title: '复制到其他资产', + type: 'primary', + divided: true + }, + { + name: 'MoveToOther', + title: '移动到其他资产', + type: 'primary' } ] } diff --git a/src/components/Form/FormFields/PasswordInput.vue b/src/components/Form/FormFields/PasswordInput.vue index 72da4d163..422ba9aa8 100644 --- a/src/components/Form/FormFields/PasswordInput.vue +++ b/src/components/Form/FormFields/PasswordInput.vue @@ -5,7 +5,9 @@ v-bind="iAttrs" @input="handleInput" v-on="$listeners" - /> + > + hello + + diff --git a/src/utils/string.js b/src/utils/string.js index f46f8344f..38adf66f1 100644 --- a/src/utils/string.js +++ b/src/utils/string.js @@ -1,9 +1,32 @@ -export function randomString(length) { - const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' - let result = '' - const charactersLength = characters.length - for (let i = 0; i < length; i++) { - result += characters.charAt(Math.floor(Math.random() * charactersLength)) +export function randomString(length, includeSymbols = false) { + const upperCase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + const lowerCase = 'abcdefghijklmnopqrstuvwxyz' + const numbers = '0123456789' + const symbols = '!@#$%^&*()-_=+[]{}|;:,.<>?' + + // 根据是否包含特殊字符来决定字符集 + let allCharacters = upperCase + lowerCase + numbers + if (includeSymbols) { + allCharacters += symbols } - return result + + let result = '' + + // 如果包含特殊字符,确保至少包含一个大写字母、一个小写字母、一个数字、一个符号 + if (includeSymbols) { + result += upperCase.charAt(Math.floor(Math.random() * upperCase.length)) + result += lowerCase.charAt(Math.floor(Math.random() * lowerCase.length)) + result += numbers.charAt(Math.floor(Math.random() * numbers.length)) + result += symbols.charAt(Math.floor(Math.random() * symbols.length)) + } + + const allCharactersLength = allCharacters.length + + // 填充剩余的字符 + for (let i = result.length; i < length; i++) { + result += allCharacters.charAt(Math.floor(Math.random() * allCharactersLength)) + } + + // 随机打乱结果 + return result.split('').sort(() => 0.5 - Math.random()).join('') } diff --git a/src/views/assets/Asset/AssetList/components/BaseList.vue b/src/views/assets/Asset/AssetList/components/BaseList.vue index f252838a3..e1f11b73b 100644 --- a/src/views/assets/Asset/AssetList/components/BaseList.vue +++ b/src/views/assets/Asset/AssetList/components/BaseList.vue @@ -211,6 +211,10 @@ export default { } } }, + { + name: 'AddAccount', + title: '添加账号' + }, ...this.addExtraMoreColActions ] }