This commit is contained in:
parent
ab2f58010e
commit
89875a2e91
|
|
@ -1,4 +1,4 @@
|
|||
let aqEnnable = false // 参数加密开关
|
||||
let aqEnnable = false; // 参数加密开关
|
||||
//后端路径
|
||||
// const commonUrl = "http://11.158.16.194:21624/zhgd/";
|
||||
// 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://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://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 imgUrl = "http://192.168.0.38:13030/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://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://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";
|
||||
|
||||
let SGCC_LOGIN_URL="http://sgwpdm.ah.sgcc.com.cn/";
|
||||
let SGCC_LOGIN_URL = "http://sgwpdm.ah.sgcc.com.cn/";
|
||||
|
||||
let sm4=new SM4Util();
|
||||
const login_sg_page = URL_IP+"/sg_login.html" // 施工大屏登录页面
|
||||
let sm4 = new SM4Util();
|
||||
const login_sg_page = URL_IP + "/sg_login.html"; // 施工大屏登录页面
|
||||
const login_sc_page = SGCC_LOGIN_URL; // 省侧大屏登录页面
|
||||
const login_sg_index = SGCC_LOGIN_URL; // 施工大屏首页
|
||||
const login_sg_index = SGCC_LOGIN_URL; // 施工大屏首页
|
||||
|
||||
/**
|
||||
* 公钥
|
||||
* @type {string}
|
||||
*/
|
||||
const public_key="04211520e8dc6d2051e67e6e770bd5550268c98105cd3b5b58e9c65958e78e627442343c9f237e01b3f316b1b63d7ddd70a8e6c0690a84c620b2903cb44cdfbe64";
|
||||
|
||||
|
||||
|
||||
|
||||
const public_key =
|
||||
"04211520e8dc6d2051e67e6e770bd5550268c98105cd3b5b58e9c65958e78e627442343c9f237e01b3f316b1b63d7ddd70a8e6c0690a84c620b2903cb44cdfbe64";
|
||||
|
||||
// 修改响应数据的函数
|
||||
function modifyResponseData(responseData) {
|
||||
// 在这里对响应数据进行修改
|
||||
if(responseData.decrypt){
|
||||
responseData=sm4.decryptDefault_CBC(responseData.data);
|
||||
}else{
|
||||
// responseData=responseData;
|
||||
if (responseData.decrypt) {
|
||||
responseData = sm4.decryptDefault_CBC(responseData.data);
|
||||
} else {
|
||||
// responseData=responseData;
|
||||
}
|
||||
if(typeof(responseData)=='object'){
|
||||
if (typeof responseData == "object") {
|
||||
return responseData;
|
||||
}
|
||||
if(typeof(responseData)=='string'){
|
||||
responseData=removePadding(responseData)
|
||||
if (typeof responseData == "string") {
|
||||
responseData = removePadding(responseData);
|
||||
var responseData = JSON.parse(responseData);
|
||||
var modifiedData = responseData;
|
||||
return modifiedData;
|
||||
|
|
@ -71,7 +70,6 @@ function modifyResponseData(responseData) {
|
|||
return responseData;
|
||||
}
|
||||
|
||||
|
||||
function removePadding(decrypted) {
|
||||
const lastByte = decrypted.charCodeAt(decrypted.length - 1);
|
||||
if (lastByte <= 16) {
|
||||
|
|
@ -85,30 +83,38 @@ function removePadding(decrypted) {
|
|||
return decrypted;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* POST 请求 */
|
||||
function ajaxRequest(url, type, data, async, beforeFn, successFn, errorFn, contentType, isAes) {
|
||||
function ajaxRequest(
|
||||
url,
|
||||
type,
|
||||
data,
|
||||
async,
|
||||
beforeFn,
|
||||
successFn,
|
||||
errorFn,
|
||||
contentType,
|
||||
isAes
|
||||
) {
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: type,
|
||||
headers: {
|
||||
"authorization": sessionStorage.getItem("zhgd_token"),
|
||||
"decrypt": isAes ? '' : 'decrypt'
|
||||
authorization: sessionStorage.getItem("zhgd_token"),
|
||||
decrypt: isAes ? "" : "decrypt",
|
||||
},
|
||||
data: data,
|
||||
async: async,
|
||||
beforeSend: beforeFn,
|
||||
contentType: contentType || "application/x-www-form-urlencoded; charset=utf-8",
|
||||
success: function (event, xhr, settings, data){
|
||||
event=modifyResponseData(event);
|
||||
contentType:
|
||||
contentType || "application/x-www-form-urlencoded; charset=utf-8",
|
||||
success: function (event, xhr, settings, data) {
|
||||
event = modifyResponseData(event);
|
||||
successFn(event, xhr, settings, data);
|
||||
},
|
||||
error:function (event, xhr, settings, error) {
|
||||
errorFn(event, xhr, settings, error)
|
||||
}
|
||||
error: function (event, xhr, settings, error) {
|
||||
errorFn(event, xhr, settings, error);
|
||||
},
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/* 施工大屏跳转 ajax请求封装 */
|
||||
|
|
@ -117,16 +123,16 @@ function ajaxRequest2(url, type, token, successFn, errorFn) {
|
|||
url: url,
|
||||
type: type,
|
||||
headers: {
|
||||
"authorization": token,
|
||||
"decrypt": 'decrypt'
|
||||
authorization: token,
|
||||
decrypt: "decrypt",
|
||||
},
|
||||
success: function (event, xhr, settings, data){
|
||||
event=modifyResponseData(event);
|
||||
success: function (event, xhr, settings, data) {
|
||||
event = modifyResponseData(event);
|
||||
successFn(event, xhr, settings, data);
|
||||
},
|
||||
error:function (event, xhr, settings, error) {
|
||||
errorFn(event, xhr, settings, error)
|
||||
}
|
||||
error: function (event, xhr, settings, error) {
|
||||
errorFn(event, xhr, settings, error);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -136,38 +142,45 @@ function ajaxRequestGet(url, type, async, beforeFn, successFn, errorFn, isAes) {
|
|||
url: url,
|
||||
type: type,
|
||||
headers: {
|
||||
"authorization": sessionStorage.getItem("zhgd_token"),
|
||||
"decrypt": isAes ? '' : 'decrypt'
|
||||
authorization: sessionStorage.getItem("zhgd_token"),
|
||||
decrypt: isAes ? "" : "decrypt",
|
||||
},
|
||||
async: async,
|
||||
beforeSend: beforeFn,
|
||||
success: function (event, xhr, settings, data){
|
||||
event=modifyResponseData(event);
|
||||
success: function (event, xhr, settings, data) {
|
||||
event = modifyResponseData(event);
|
||||
successFn(event, xhr, settings, data);
|
||||
},
|
||||
error:function (event, xhr, settings, error) {
|
||||
errorFn(event, xhr, settings, error)
|
||||
}
|
||||
error: function (event, xhr, settings, error) {
|
||||
errorFn(event, xhr, settings, error);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/* GET请求 */
|
||||
function ajaxRequestGetExport(url, type, async, beforeFn, successFn, errorFn, isAes) {
|
||||
function ajaxRequestGetExport(
|
||||
url,
|
||||
type,
|
||||
async,
|
||||
beforeFn,
|
||||
successFn,
|
||||
errorFn,
|
||||
isAes
|
||||
) {
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: type,
|
||||
headers: {
|
||||
"encryption":"encryption",
|
||||
"authorization": sessionStorage.getItem("zhgd_token"),
|
||||
"decrypt": isAes ? '' : 'decrypt'
|
||||
encryption: "encryption",
|
||||
authorization: sessionStorage.getItem("zhgd_token"),
|
||||
decrypt: isAes ? "" : "decrypt",
|
||||
},
|
||||
xhrFields: {
|
||||
responseType: 'blob' // 告诉 xhr 我们期望返回的数据类型是 blob
|
||||
responseType: "blob", // 告诉 xhr 我们期望返回的数据类型是 blob
|
||||
},
|
||||
async: async,
|
||||
beforeSend: beforeFn,
|
||||
success: successFn,
|
||||
error:errorFn
|
||||
error: errorFn,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue