ah_jjzhgd_webscreen/api/commonRequest.js

58 lines
1.9 KiB
JavaScript
Raw Normal View History

2024-04-03 18:15:18 +08:00
let aqEnnable = true;// 参数加密开关
const commonUrl = "http://127.0.0.1:18080/zhgd/";
2024-03-25 20:21:14 +08:00
/* 登录相关 */
const login_url = commonUrl + "auth/login"; // 登录url
const login_out = commonUrl + "auth/logout"; // 登出url
2024-03-26 19:52:42 +08:00
const page_jump = commonUrl + "auth/pageJump"; // 登出url
2024-04-03 18:15:18 +08:00
const login_sg_page = "http://127.0.0.1:63342/ah_jjzhgd_webscreen/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" // 省侧大屏首页
2024-03-25 20:21:14 +08:00
2024-03-29 15:25:34 +08:00
/* POST 请求 */
2024-04-03 18:15:18 +08:00
function ajaxRequest(url, type, data, async, beforeFn, successFn, errorFn, contentType,isAes) {
2024-03-25 20:20:02 +08:00
$.ajax({
url: url,
type: type,
headers: {
2024-04-01 09:12:20 +08:00
"authorization": sessionStorage.getItem("zhgd_token"),
"decrypt": isAes ? '' : 'decrypt'
2024-03-25 20:20:02 +08:00
},
data: data,
async: async,
beforeSend: beforeFn,
contentType: contentType || "application/x-www-form-urlencoded; charset=utf-8",
success: successFn,
error: errorFn
});
2024-03-26 19:52:42 +08:00
}
/* 施工大屏跳转 ajax请求封装 */
function ajaxRequest2(url, type, token, successFn, errorFn) {
$.ajax({
url: url,
type: type,
headers: {
2024-04-03 18:15:18 +08:00
"authorization": token
2024-03-26 19:52:42 +08:00
},
success: successFn,
error: errorFn
});
2024-03-29 15:25:34 +08:00
}
/* GET请求 */
2024-04-01 09:12:20 +08:00
function ajaxRequestGet(url, type, async, beforeFn, successFn, errorFn, isAes) {
2024-03-29 15:25:34 +08:00
$.ajax({
url: url,
type: type,
headers: {
2024-04-01 09:12:20 +08:00
"authorization": sessionStorage.getItem("zhgd_token"),
"decrypt": isAes ? '' : 'decrypt'
2024-03-29 15:25:34 +08:00
},
2024-04-03 18:15:18 +08:00
data: data,
2024-04-01 19:49:28 +08:00
async: async,
beforeSend: beforeFn,
success: successFn,
error: errorFn
});
2024-03-25 20:20:02 +08:00
}