From 81132ecab014a100843a5d7fe07d7891b804b8bd Mon Sep 17 00:00:00 2001 From: kuaifan Date: Fri, 25 Feb 2022 00:05:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AE=A2=E6=88=B7=E7=AB=AF=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E4=B8=8B=E8=BD=BD=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/assets/js/functions/web.js | 43 +++++++++++++++++----------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/resources/assets/js/functions/web.js b/resources/assets/js/functions/web.js index d30b5539..c4dbc5b6 100755 --- a/resources/assets/js/functions/web.js +++ b/resources/assets/js/functions/web.js @@ -366,7 +366,11 @@ return } if ($A.Electron) { - $A.Electron.sendMessage('openExternal', url); + $A.Electron.request({action: 'openExternal', url}, () => { + // 成功 + }, () => { + // 失败 + }); } else { window.open(url) } @@ -422,6 +426,22 @@ } if (typeof config === "string") config = {title:config}; let inputId = "modalInput_" + $A.randomString(6); + const onOk = () => { + if (typeof config.onOk === "function") { + if (config.onOk(config.value, () => { + $A.Modal.remove(); + }) === true) { + $A.Modal.remove(); + } + } else { + $A.Modal.remove(); + } + }; + const onCancel = () => { + if (typeof config.onCancel === "function") { + config.onCancel(); + } + }; $A.Modal.confirm({ render: (h) => { return h('div', [ @@ -441,27 +461,16 @@ on: { input: (val) => { config.value = val; + }, + 'on-enter': (e) => { + $A(e.target).parents(".ivu-modal-body").find(".ivu-btn-primary").click(); } } }) ]) }, - onOk: () => { - if (typeof config.onOk === "function") { - if (config.onOk(config.value, () => { - $A.Modal.remove(); - }) === true) { - $A.Modal.remove(); - } - } else { - $A.Modal.remove(); - } - }, - onCancel: () => { - if (typeof config.onCancel === "function") { - config.onCancel(); - } - }, + onOk, + onCancel, loading: true, okText: $A.L(config.okText || '确定'), cancelText: $A.L(config.cancelText || '取消'),