diff --git a/api/commonRequest.js b/api/commonRequest.js index fd1e49a..7b040b1 100644 --- a/api/commonRequest.js +++ b/api/commonRequest.js @@ -1,15 +1,15 @@ -let aqEnnable = false;// 参数加密开关 -const commonUrl = "http://10.40.92.106:18080/zhgd/"; +let aqEnnable = true // 参数加密开关 +const commonUrl = "http://10.40.92.33:18080/zhgd/"; /* 登录相关 */ const login_url = commonUrl + "auth/login"; // 登录url const login_out = commonUrl + "auth/logout"; // 登出url const page_jump = commonUrl + "auth/pageJump"; // 登出url -const login_sg_page = "http://10.40.92.106:8101/sg_login.html" // 施工大屏登录页面 -const login_sc_page = "http://10.40.92.106:8100/sc_login.html" // 省侧大屏登录页面 -const login_sg_index = "http://10.40.92.106:8101/pages/home/navigation.html" // 施工大屏首页 -const login_sc_index = "http://10.40.92.106:8100/pages/web/index.html" // 省侧大屏首页 +const login_sg_page = "http://10.40.92.33:8101/sg_login.html" // 施工大屏登录页面 +const login_sc_page = "http://10.40.92.33:8100/sc_login.html" // 省侧大屏登录页面 +const login_sg_index = "http://10.40.92.33:8101/pages/home/navigation.html" // 施工大屏首页 +const login_sc_index = "http://10.40.92.33:8100/pages/web/index.html" // 省侧大屏首页 -// ajax 请求封装 +/* POST 请求 */ function ajaxRequest(url, type, data, async, beforeFn, successFn, errorFn, contentType) { $.ajax({ url: url, @@ -37,4 +37,20 @@ function ajaxRequest2(url, type, token, successFn, errorFn) { success: successFn, error: errorFn }); +} + +/* GET请求 */ +function ajaxRequestGet(url, type, data, async, beforeFn, successFn, errorFn) { + $.ajax({ + url: url, + type: type, + headers: { + "authorization": sessionStorage.getItem("zhgd_token") + }, + data: data, + async: async, + beforeSend: beforeFn, + success: successFn, + error: errorFn + }); } \ No newline at end of file diff --git a/js/login/login.js b/js/login/login.js index ef719ec..292f11d 100644 --- a/js/login/login.js +++ b/js/login/login.js @@ -35,8 +35,8 @@ layui.use(function () { } else if (result.code === 500) { layer.msg(result.msg, { icon: 2 }); } - }, function (xhr) { - error(xhr) + }, function (xhr, status, error) { + error(xhr, status, error) }, "application/json"); }); }); \ No newline at end of file diff --git a/js/publics/public.js b/js/publics/public.js index 0005457..e7d466d 100644 --- a/js/publics/public.js +++ b/js/publics/public.js @@ -4,6 +4,7 @@ const zhgd_type = sessionStorage.getItem("zhgd_type"); const roleCode = JSON.parse(us).roleCode; const orgId = JSON.parse(us).orgId; const userId = JSON.parse(us).userId; + /* 退出登录 */ function loginout(type) { if (type) { @@ -53,6 +54,16 @@ function loginout(type) { }); } } +/* 请求错误 */ +function error(xhr, status, error) { + if (xhr.status === 0) { + // 网络连接失败 + console.error("网络连接失败,请检查网络是否正常"); + } else { + // 请求出现其他错误 + console.error("ajax请求错误:" + error); + } +} /* 返回登录页 */ function backLoginPage() {