This commit is contained in:
fl 2025-07-24 20:40:55 +08:00
commit 7c9e376db1
1 changed files with 68 additions and 55 deletions

View File

@ -1,4 +1,4 @@
let aqEnnable = false // 参数加密开关 let aqEnnable = false; // 参数加密开关
//后端路径 //后端路径
// const commonUrl = "http://11.158.16.194:21624/zhgd/"; // const commonUrl = "http://11.158.16.194:21624/zhgd/";
// const URL_IP="http://11.158.16.194:21624/zhgd-web" // const URL_IP="http://11.158.16.194:21624/zhgd-web"
@ -10,10 +10,10 @@ let aqEnnable = false // 参数加密开关
//const URL_IP="http://sgwpdm.ah.sgcc.com.cn/ahsfs/zhgd-web" //const URL_IP="http://sgwpdm.ah.sgcc.com.cn/ahsfs/zhgd-web"
//前端 //前端
const URL_IP="http://127.0.0.1:13030/ah_jjzhgd_webscreen" const URL_IP = "http://127.0.0.1:13030/ah_jjzhgd_webscreen";
// const commonUrl = "http://192.168.0.38:13030/zhgd/"; // const commonUrl = "http://192.168.0.38:13030/zhgd/";
const commonUrl = "http://127.0.0.1:13030/zhgd/"; const commonUrl = "http://192.168.2.72:13030/zhgd/";
// const commonUrl = "http://192.168.1.105:18080/zhgd/"; // const commonUrl = "http://192.168.1.105:18080/zhgd/";
// const imgUrl = "http://192.168.0.38:13030/zhgd/file/files/"; // const imgUrl = "http://192.168.0.38:13030/zhgd/file/files/";
const imgUrl = "http://sgwpdm.ah.sgcc.com.cn/zhgd/file/files/"; const imgUrl = "http://sgwpdm.ah.sgcc.com.cn/zhgd/file/files/";
@ -28,42 +28,41 @@ const page_jump = commonUrl + "auth/pageJump"; // 登出url
// const back_url="http://192.168.0.38:9527/zhgd-ht/#/ywgllogin?token="; // const back_url="http://192.168.0.38:9527/zhgd-ht/#/ywgllogin?token=";
//后台登录地址 //后台登录地址
// const back_url="http://sgwpdm.ah.sgcc.com.cn/jjgdweb/zhgd-ht/#/ywgllogin?token="; // const back_url="http://sgwpdm.ah.sgcc.com.cn/jjgdweb/zhgd-ht/#/ywgllogin?token=";
const back_url="http://192.168.0.7:21624/zhgd-ht/#/login?redirect=%2Fdashboard"; const back_url =
"http://192.168.0.7:21624/zhgd-ht/#/login?redirect=%2Fdashboard";
// const screen_url="http://localhost:63343/ah_jjzhgd_webscreen/pages/web/index.html"; // const screen_url="http://localhost:63343/ah_jjzhgd_webscreen/pages/web/index.html";
const screen_url="http://sgwpdm.ah.sgcc.com.cn/ahsfs/zhgd-web/pages/web/index.html"; const screen_url =
"http://sgwpdm.ah.sgcc.com.cn/ahsfs/zhgd-web/pages/web/index.html";
//const screen_url="http://sgwpdm.ah.sgcc.com.cn/jjgdweb/zhgd-web/pages/web/index.html"; //const screen_url="http://sgwpdm.ah.sgcc.com.cn/jjgdweb/zhgd-web/pages/web/index.html";
let SGCC_LOGIN_URL="http://sgwpdm.ah.sgcc.com.cn/"; let SGCC_LOGIN_URL = "http://sgwpdm.ah.sgcc.com.cn/";
let sm4=new SM4Util(); let sm4 = new SM4Util();
const login_sg_page = URL_IP+"/sg_login.html" // 施工大屏登录页面 const login_sg_page = URL_IP + "/sg_login.html"; // 施工大屏登录页面
const login_sc_page = SGCC_LOGIN_URL; // 省侧大屏登录页面 const login_sc_page = SGCC_LOGIN_URL; // 省侧大屏登录页面
const login_sg_index = SGCC_LOGIN_URL; // 施工大屏首页 const login_sg_index = SGCC_LOGIN_URL; // 施工大屏首页
/** /**
* 公钥 * 公钥
* @type {string} * @type {string}
*/ */
const public_key="04211520e8dc6d2051e67e6e770bd5550268c98105cd3b5b58e9c65958e78e627442343c9f237e01b3f316b1b63d7ddd70a8e6c0690a84c620b2903cb44cdfbe64"; const public_key =
"04211520e8dc6d2051e67e6e770bd5550268c98105cd3b5b58e9c65958e78e627442343c9f237e01b3f316b1b63d7ddd70a8e6c0690a84c620b2903cb44cdfbe64";
// 修改响应数据的函数 // 修改响应数据的函数
function modifyResponseData(responseData) { function modifyResponseData(responseData) {
// 在这里对响应数据进行修改 // 在这里对响应数据进行修改
if(responseData.decrypt){ if (responseData.decrypt) {
responseData=sm4.decryptDefault_CBC(responseData.data); responseData = sm4.decryptDefault_CBC(responseData.data);
}else{ } else {
// responseData=responseData; // responseData=responseData;
} }
if(typeof(responseData)=='object'){ if (typeof responseData == "object") {
return responseData; return responseData;
} }
if(typeof(responseData)=='string'){ if (typeof responseData == "string") {
responseData=removePadding(responseData) responseData = removePadding(responseData);
var responseData = JSON.parse(responseData); var responseData = JSON.parse(responseData);
var modifiedData = responseData; var modifiedData = responseData;
return modifiedData; return modifiedData;
@ -71,7 +70,6 @@ function modifyResponseData(responseData) {
return responseData; return responseData;
} }
function removePadding(decrypted) { function removePadding(decrypted) {
const lastByte = decrypted.charCodeAt(decrypted.length - 1); const lastByte = decrypted.charCodeAt(decrypted.length - 1);
if (lastByte <= 16) { if (lastByte <= 16) {
@ -85,30 +83,38 @@ function removePadding(decrypted) {
return decrypted; return decrypted;
} }
/* POST 请求 */ /* POST 请求 */
function ajaxRequest(url, type, data, async, beforeFn, successFn, errorFn, contentType, isAes) { function ajaxRequest(
url,
type,
data,
async,
beforeFn,
successFn,
errorFn,
contentType,
isAes
) {
$.ajax({ $.ajax({
url: url, url: url,
type: type, type: type,
headers: { headers: {
"authorization": sessionStorage.getItem("zhgd_token"), authorization: sessionStorage.getItem("zhgd_token"),
"decrypt": isAes ? '' : 'decrypt' decrypt: isAes ? "" : "decrypt",
}, },
data: data, data: data,
async: async, async: async,
beforeSend: beforeFn, beforeSend: beforeFn,
contentType: contentType || "application/x-www-form-urlencoded; charset=utf-8", contentType:
success: function (event, xhr, settings, data){ contentType || "application/x-www-form-urlencoded; charset=utf-8",
event=modifyResponseData(event); success: function (event, xhr, settings, data) {
event = modifyResponseData(event);
successFn(event, xhr, settings, data); successFn(event, xhr, settings, data);
}, },
error:function (event, xhr, settings, error) { error: function (event, xhr, settings, error) {
errorFn(event, xhr, settings, error) errorFn(event, xhr, settings, error);
} },
}); });
} }
/* 施工大屏跳转 ajax请求封装 */ /* 施工大屏跳转 ajax请求封装 */
@ -117,16 +123,16 @@ function ajaxRequest2(url, type, token, successFn, errorFn) {
url: url, url: url,
type: type, type: type,
headers: { headers: {
"authorization": token, authorization: token,
"decrypt": 'decrypt' decrypt: "decrypt",
}, },
success: function (event, xhr, settings, data){ success: function (event, xhr, settings, data) {
event=modifyResponseData(event); event = modifyResponseData(event);
successFn(event, xhr, settings, data); successFn(event, xhr, settings, data);
}, },
error:function (event, xhr, settings, error) { error: function (event, xhr, settings, error) {
errorFn(event, xhr, settings, error) errorFn(event, xhr, settings, error);
} },
}); });
} }
@ -136,38 +142,45 @@ function ajaxRequestGet(url, type, async, beforeFn, successFn, errorFn, isAes) {
url: url, url: url,
type: type, type: type,
headers: { headers: {
"authorization": sessionStorage.getItem("zhgd_token"), authorization: sessionStorage.getItem("zhgd_token"),
"decrypt": isAes ? '' : 'decrypt' decrypt: isAes ? "" : "decrypt",
}, },
async: async, async: async,
beforeSend: beforeFn, beforeSend: beforeFn,
success: function (event, xhr, settings, data){ success: function (event, xhr, settings, data) {
event=modifyResponseData(event); event = modifyResponseData(event);
successFn(event, xhr, settings, data); successFn(event, xhr, settings, data);
}, },
error:function (event, xhr, settings, error) { error: function (event, xhr, settings, error) {
errorFn(event, xhr, settings, error) errorFn(event, xhr, settings, error);
} },
}); });
} }
/* GET请求 */ /* GET请求 */
function ajaxRequestGetExport(url, type, async, beforeFn, successFn, errorFn, isAes) { function ajaxRequestGetExport(
url,
type,
async,
beforeFn,
successFn,
errorFn,
isAes
) {
$.ajax({ $.ajax({
url: url, url: url,
type: type, type: type,
headers: { headers: {
"encryption":"encryption", encryption: "encryption",
"authorization": sessionStorage.getItem("zhgd_token"), authorization: sessionStorage.getItem("zhgd_token"),
"decrypt": isAes ? '' : 'decrypt' decrypt: isAes ? "" : "decrypt",
}, },
xhrFields: { xhrFields: {
responseType: 'blob' // 告诉 xhr 我们期望返回的数据类型是 blob responseType: "blob", // 告诉 xhr 我们期望返回的数据类型是 blob
}, },
async: async, async: async,
beforeSend: beforeFn, beforeSend: beforeFn,
success: successFn, success: successFn,
error:errorFn error: errorFn,
}); });
} }