From 8ee0e46a3a84119e4f0b7bb7d087f9e1622de6fa Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 7 May 2020 18:58:44 +0800 Subject: [PATCH] =?UTF-8?q?[Update]=20=E4=BF=AE=E6=94=B9=20detailcard=20?= =?UTF-8?q?=E6=94=AF=E6=8C=81jsx?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/DetailCard/index.vue | 7 +++-- src/components/DetailCard/value.vue | 25 ++++++++++++++++ src/i18n/langs/cn.js | 9 ++++-- src/i18n/langs/en.js | 7 ++++- src/styles/element-ui.scss | 10 +++---- src/views/users/users/UserDetail/UserInfo.vue | 29 +++++++++++++++---- 6 files changed, 71 insertions(+), 16 deletions(-) create mode 100644 src/components/DetailCard/value.vue diff --git a/src/components/DetailCard/index.vue b/src/components/DetailCard/index.vue index 3334a0f1b..bd689000e 100644 --- a/src/components/DetailCard/index.vue +++ b/src/components/DetailCard/index.vue @@ -3,7 +3,9 @@
-
{{ item.value }}
+
+ +
@@ -11,10 +13,11 @@ + + diff --git a/src/i18n/langs/cn.js b/src/i18n/langs/cn.js index cad9de959..5cffc9027 100644 --- a/src/i18n/langs/cn.js +++ b/src/i18n/langs/cn.js @@ -225,13 +225,16 @@ const cn = { 'Date password updated': '更新密码日期', 'MFA': '多因子认证', 'Source': '用户来源', - 'Reset MFA': '重置多因子认证', + 'resetMFATitle': '重置多因子认证', 'Send reset password mail': '发送重置密码邮件', - 'Send reset ssh key mail': '发送重置密钥邮件', + 'resetPublicKeyTitle': '发送重置密钥邮件', + 'resetPasswordTitle': '发送重置密码邮件', 'Unblock user': '解除登录限制', 'Force enabled MFA': '强制启用多因子认证', 'resetPasswordWarningMsg': '将失效用户当前密码,并发送重设密码邮件到用户邮箱', - 'resetPublicKeyWarningMsg': '将会失效用户当前密钥,并发送重置邮件到用户邮箱' + 'resetPasswordSuccessMsg': '已发送邮件到用户邮箱', + 'resetPublicKeyWarningMsg': '将会失效用户当前密钥,并发送重置邮件到用户邮箱', + 'resetPublicKeySuccessMsg': '已发送邮件到用户邮箱' }, // 用户组 assets: { diff --git a/src/i18n/langs/en.js b/src/i18n/langs/en.js index 5856919cb..bdd3d9faf 100644 --- a/src/i18n/langs/en.js +++ b/src/i18n/langs/en.js @@ -84,8 +84,13 @@ const en = { 'remote_app_permission': 'RemoteApp permission', 'database_app_granted': 'DatabaseApp granted', 'database_app_permission': 'DatabaseApp permission', + 'resetPublicKeyTitle': 'Send reset ssh key mail', + 'resetPasswordTitle': 'Send reset password mail', 'resetPasswordWarningMsg': 'This will reset the user password and send a reset mail', - 'resetPublicKeyWarningMsg': 'This will reset the user public key and send a reset mail' + 'resetPasswordSuccessMsg': 'An e-mail has been sent to the user`s mailbox', + 'resetPublicKeyWarningMsg': 'This will reset the user public key and send a reset mail', + 'resetPublicKeySuccessMsg': 'An e-mail has been sent to the user`s mailbox', + 'resetMFATitle': 'Reset MFA' }, usergroup: { 'user_group_list': 'User group list', diff --git a/src/styles/element-ui.scss b/src/styles/element-ui.scss index 0daba763a..221d91e5a 100644 --- a/src/styles/element-ui.scss +++ b/src/styles/element-ui.scss @@ -92,11 +92,11 @@ td .el-button.el-button--mini { font-weight: 600; } -.el-button.el-button--default:focus:not(.is-disabled), .el-button.el-button--default:hover:not(.is-disabled) { - color: #606266; - border-color: #d2d2d2; - background-color: #e6e6e6; -} +//.el-button.el-button--default:focus:not(.is-disabled), .el-button.el-button--default:hover:not(.is-disabled) { +// color: #606266; +// border-color: #d2d2d2; +// background-color: #e6e6e6; +//} .el-button-group>.el-dropdown>.el-button { border-top-left-radius: 0; diff --git a/src/views/users/users/UserDetail/UserInfo.vue b/src/views/users/users/UserDetail/UserInfo.vue index 7c11a9e28..dbc0d1142 100644 --- a/src/views/users/users/UserDetail/UserInfo.vue +++ b/src/views/users/users/UserDetail/UserInfo.vue @@ -47,7 +47,7 @@ export default { } }, { - title: this.$t('users.Reset MFA'), + title: this.$t('users.resetMFATitle'), attrs: { type: 'primary', label: this.$tc('Reset') @@ -59,7 +59,7 @@ export default { } }, { - title: this.$t('users.Send reset password mail'), + title: this.$t('users.resetPasswordTitle'), attrs: { type: 'primary', label: this.$tc('Send') @@ -80,7 +80,7 @@ export default { try { await vm.$axios.patch(url, {}) done() - this.$message.success(successMsg) + vm.$message.success(successMsg) } finally { instance.confirmButtonLoading = false } @@ -90,14 +90,33 @@ export default { } }, { - title: this.$t('users.Send reset ssh key mail'), + title: this.$t('users.resetPublicKeyTitle'), attrs: { type: 'primary', label: this.$tc('Send') }, callbacks: { click: function() { - console.log('click') + const warnMsg = vm.$t('users.resetPublicKeyWarningMsg') + const warnTitle = vm.$tc('Info') + const url = `/api/v1/users/users/${vm.object.id}/pubkey/reset/` + const successMsg = vm.$t('users.resetPasswordSuccessMsg') + vm.$confirm(warnMsg, warnTitle, { + type: 'warning', + confirmButtonClass: 'el-button--warning', + showCancelButton: true, + beforeClose: async(action, instance, done) => { + if (action !== 'confirm') return done() + instance.confirmButtonLoading = true + try { + await vm.$axios.patch(url, {}) + done() + vm.$message.success(successMsg) + } finally { + instance.confirmButtonLoading = false + } + } + }) } } },