let aqEnnable = false // 参数加密开关 //后端路径 // 前端地址-生产 // const URL_IP="http://sgwpdm.ah.sgcc.com.cn/gdwebs/zhgd-web" // const commonUrl = "http://sgwpdm.ah.sgcc.com.cn/zhgd/"; // const imgUrl = "http://sgwpdm.ah.sgcc.com.cn/zhgd/file/files/"; // // const URL_IP="http://192.168.0.234:28080/gdwebs/zhgd-web" // const commonUrl = "http://192.168.0.234:28080/zhgd/"; // const imgUrl = "http://192.168.0.234:28080/zhgd/file/files/"; const URL_IP="http://192.168.0.14:1999/gdwebs/zhgd-web" const commonUrl = "http://192.168.0.14:1999/zhgd/"; const imgUrl = "http://192.168.0.14:1999/zhgd/file/files/"; // const URL_IP="http://sgwpdm.ah.sgcc.com.cn/ahsfs/zhgd-web" //前端 //请求路径 // const commonUrl = "http://10.145.34.32:80/zhgd/"; // const imgUrl = "http://10.145.34.32:80/zhgd/file/files/"; // const commonUrl = "http://192.168.0.38:13030/zhgd/"; // // const imgUrl = "http://192.168.0.38:13030/zhgd/file/files/"; const login_url = commonUrl + "auth/login"; // 登录url const sgcc_url = commonUrl + "auth/sgccLogin"; // 登录url const login_out = commonUrl + "auth/logout"; // 登出url 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.14:1999/gdwebs/zhgd-ht/#/login?token="; //大屏地址 const screen_url="http://192.168.0.14:1999/gdwebs/zhgd-web/pages/web/index.html"; //重定向地址 let SGCC_LOGIN_URL="http://192.168.0.14:1999/gdwebs/zhgd-web/sg_login.html"; // //后台登录地址 // const back_url="http://sgwpdm.ah.sgcc.com.cn/gdwebs/zhgd-ht/#/ywgllogin?token="; // //大屏地址 // const screen_url="http://sgwpdm.ah.sgcc.com.cn/gdwebs/zhgd-web/pages/web/index.html"; // //重定向地址 // let SGCC_LOGIN_URL="http://sgwpdm.ah.sgcc.com.cn/"; 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; // 施工大屏首页 /** * 公钥 * @type {string} */ const public_key="04211520e8dc6d2051e67e6e770bd5550268c98105cd3b5b58e9c65958e78e627442343c9f237e01b3f316b1b63d7ddd70a8e6c0690a84c620b2903cb44cdfbe64"; // 修改响应数据的函数 function modifyResponseData(responseData) { // 在这里对响应数据进行修改 if(responseData.decrypt){ responseData=sm4.decryptDefault_CBC(responseData.data); }else{ // responseData=responseData; } if(typeof(responseData)=='object'){ return responseData; } if(typeof(responseData)=='string'){ responseData=removePadding(responseData) var responseData = JSON.parse(responseData); var modifiedData = responseData; return modifiedData; } return responseData; } function removePadding(decrypted) { const lastByte = decrypted.charCodeAt(decrypted.length - 1); if (lastByte <= 16) { for (let i = decrypted.length - lastByte; i < decrypted.length; i++) { if (decrypted.charCodeAt(i) !== lastByte) { return decrypted; // 如果填充不正确,返回原始字符串 } } return decrypted.slice(0, -lastByte); } return decrypted; } /* POST 请求 */ 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' }, 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); successFn(event, xhr, settings, data); }, error:function (event, xhr, settings, error) { errorFn(event, xhr, settings, error) } }); } /* 施工大屏跳转 ajax请求封装 */ function ajaxRequest2(url, type, token, successFn, errorFn) { $.ajax({ url: url, type: type, headers: { "authorization": token, "decrypt": 'decrypt' }, 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) } }); } /* GET请求 */ function ajaxRequestGet(url, type, async, beforeFn, successFn, errorFn, isAes) { $.ajax({ url: url, type: type, headers: { "authorization": sessionStorage.getItem("zhgd_token"), "decrypt": isAes ? '' : 'decrypt' }, async: async, beforeSend: beforeFn, 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) } }); } /* GET请求 */ 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' }, xhrFields: { responseType: 'blob' // 告诉 xhr 我们期望返回的数据类型是 blob }, async: async, beforeSend: beforeFn, success: successFn, error:errorFn }); }