From f5d95a01f5e41210bf5b4757d7f8aeaff32badff Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Fri, 24 Mar 2023 15:13:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=B9=E9=87=8F=E4=B8=8A=E4=BC=A0=E6=97=B6?= =?UTF-8?q?=E5=A6=82=E6=9E=9C=E8=AF=81=E4=B9=A6=E6=96=87=E4=BB=B6=E5=92=8C?= =?UTF-8?q?=E7=A7=81=E9=92=A5=E6=96=87=E4=BB=B6=E4=B8=8D=E4=B8=80=E8=87=B4?= =?UTF-8?q?=EF=BC=8C=E4=B9=9F=E4=BC=9A=E6=8F=90=E7=A4=BA=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default/servers/certs/uploadBatchPopup.go | 6 ++++++ .../@default/servers/certs/uploadBatchPopup.html | 2 +- .../@default/servers/certs/uploadBatchPopup.js | 16 ++++++---------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/internal/web/actions/default/servers/certs/uploadBatchPopup.go b/internal/web/actions/default/servers/certs/uploadBatchPopup.go index b0c4b1a0..9d4eb7ef 100644 --- a/internal/web/actions/default/servers/certs/uploadBatchPopup.go +++ b/internal/web/actions/default/servers/certs/uploadBatchPopup.go @@ -94,6 +94,12 @@ func (this *UploadBatchPopupAction) RunPost(params struct { return } + // 对比证书和私钥数量是否一致 + if len(certDataList) != len(keyDataList) { + this.Fail("证书文件数量(" + types.String(len(certDataList)) + ")和私钥文件数量(" + types.String(len(keyDataList)) + ")不一致") + return + } + // 自动匹配 var pairs = [][2][]byte{} // [] { cert, key } var keyIndexMap = map[int]bool{} // 方便下面跳过已匹配的Key diff --git a/web/views/@default/servers/certs/uploadBatchPopup.html b/web/views/@default/servers/certs/uploadBatchPopup.html index e89caa0f..807fce39 100644 --- a/web/views/@default/servers/certs/uploadBatchPopup.html +++ b/web/views/@default/servers/certs/uploadBatchPopup.html @@ -9,7 +9,7 @@ 选择要上传的证书和私钥文件 * -

点击后在弹出的文件选择框中支持多选。

+

点击后在弹出的文件选择框中支持多选;不用担心文件名和顺序问题,系统会自动匹配。

diff --git a/web/views/@default/servers/certs/uploadBatchPopup.js b/web/views/@default/servers/certs/uploadBatchPopup.js index cbe031f3..8330bce1 100644 --- a/web/views/@default/servers/certs/uploadBatchPopup.js +++ b/web/views/@default/servers/certs/uploadBatchPopup.js @@ -11,17 +11,13 @@ Tea.context(function () { } this.successUpload = function (resp) { - if (resp.data.count > 0) { - let msg = "html:成功上传" + resp.data.count + "个证书" - if (this.userId > 0) { - msg += "
由于你选择了证书用户,所以只有此用户才能在用户系统中查看到这些证书。" - } - teaweb.success(msg, function () { - NotifyPopup(resp) - }) - return + let msg = "html:成功上传" + resp.data.count + "个证书" + if (this.userId > 0) { + msg += "
由于你选择了证书用户,所以只有此用户才能在用户系统中查看到这些证书。" } - NotifyPopup(resp) + teaweb.success(msg, function () { + NotifyPopup(resp) + }) } this.changeUserId = function (userId) {