From 4e8befca47ec59d263a5e17b637b5b445c85fbf1 Mon Sep 17 00:00:00 2001 From: ShakeFlower Date: Sat, 19 Apr 2025 14:03:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=BE=AE=E8=B0=83=E5=BC=B9=E5=B9=95?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project/plugins.js | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/project/plugins.js b/project/plugins.js index 8deb2b75..7a3ce00a 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -2194,7 +2194,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = try { res = JSON.parse(res); console.log(res); - core.drawTip('接收成功!') + core.drawTip('接收成功!', 'postman'); core.playSound('item.mp3'); let commentCollection = {}; const commentList = res?.list; @@ -2212,13 +2212,15 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = } core.setFlag('commentCollection', commentCollection); } catch (err) { - core.drawFailTip('接收失败!' + err.message); + core.drawFailTip('在线留言接收失败!' + err.message, 'postman'); } }, function (err) { - err = JSON.parse(err); - console.error(err); - core.drawFailTip('接收失败' + err?.message); + console.log(err); + if (['Abort', 'Timeout', 'Error on Connection'].includes(err)) err = { message: '连接异常' }; + else if (err.startsWith('HTTP ')) err = { message: '连接异常, 状态码:' + err.replace('HTTP ', '') }; + else err = JSON.parse(err); + core.drawFailTip('在线留言接收失败' + err?.message, 'postman'); }, null, null, null, 1000 ); @@ -2228,7 +2230,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = if (core.isReplaying()) return; const isEmpty = /^\s*$/; if (isEmpty.test(comment)) { - core.drawFailTip('您输入的消息为空,请重发!'); + core.drawFailTip('您输入的消息为空,请重发!', 'postman'); return; } let form = new FormData(); @@ -2247,18 +2249,20 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = res = JSON.parse(res); console.log(res); if (res?.code === 0) { - core.drawTip('提交成功!') + core.drawTip('提交成功!', 'postman') } else { - core.drawTip('提交失败!' + res?.message); + core.drawTip('提交失败!' + res?.message, 'postman'); } } catch (err) { - core.drawFailTip('提交失败!' + err.message); + core.drawFailTip('提交失败!' + err.message, 'postman'); } }, function (err) { - err = JSON.parse(err); - console.error(err); - core.drawFailTip('提交失败!' + err?.message); + console.log(err); + if (['Abort', 'Timeout', 'Error on Connection'].includes(err)) err = { message: '连接异常' }; + else if (err.startsWith('HTTP ')) err = { message: '连接异常, 状态码:' + err.replace('HTTP ', '') }; + else err = JSON.parse(err); + core.drawFailTip('提交失败!' + err?.message, 'postman'); }, null, null, null, 1000 );