ah_jjzhgd_webscreen/api/commonRequest.js

77 lines
2.3 KiB
JavaScript
Raw Normal View History

2024-04-01 09:12:20 +08:00
let aqEnnable = true // 参数加密开关
2024-04-01 19:49:28 +08:00
const commonUrl = "http://10.40.92.105: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-01 09:12:20 +08:00
const login_sg_page = "http://10.40.92.33:8100/sg_login.html" // 施工大屏登录页面
const login_sc_page = "http://10.40.92.33:8101/sc_login.html" // 省侧大屏登录页面
const login_sg_index = "http://10.40.92.33:8100/pages/home/navigation.html" // 施工大屏首页
const login_sc_index = "http://10.40.92.33:8101/pages/web/index.html" // 省侧大屏首页
2024-03-25 20:21:14 +08:00
2024-03-29 15:25:34 +08:00
/* POST 请求 */
2024-04-01 09:12:20 +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: {
"authorization": token
},
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
},
async: async,
beforeSend: beforeFn,
success: successFn,
error: errorFn
});
2024-04-01 19:49:28 +08:00
}
/* GET请求 */
function ajaxRequestGetExport(url, type, async, beforeFn, successFn, errorFn, isAes) {
$.ajax({
url: url,
type: type,
headers: {
"authorization": sessionStorage.getItem("zhgd_token"),
"decrypt": isAes ? '' : 'decrypt'
},
xhrFields: {
responseType: 'blob' // 告诉 xhr 我们期望返回的数据类型是 blob
},
async: async,
beforeSend: beforeFn,
success: successFn,
error: errorFn
});
2024-03-25 20:20:02 +08:00
}