From aa8ac24911f2533765913a90e9c3a146073fae84 Mon Sep 17 00:00:00 2001 From: cwchen <1048842385@qq.com> Date: Mon, 22 Apr 2024 13:02:16 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/login/login.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/js/login/login.js b/js/login/login.js index dd62736..bdca9b0 100644 --- a/js/login/login.js +++ b/js/login/login.js @@ -39,8 +39,19 @@ layui.use(function () { layer.msg(result.msg, { icon: 2 }); } }, function (xhr, status, error) { - error(xhr, status, error) + errorFn(xhr, status, error) $('.layui-btn-fluid').empty().append('登 录'); }, "application/json", aqEnnable); }); -}); \ No newline at end of file +}); + +/* 请求错误 */ +function errorFn(xhr, status, error) { + if (xhr.status === 0) { + // 网络连接失败 + console.error("网络连接失败,请检查网络是否正常"); + } else { + // 请求出现其他错误 + console.error("ajax请求错误:" + error); + } +} \ No newline at end of file