From f50cd9cfde1cdfc8e5b2205a63bdb2694da28e1c Mon Sep 17 00:00:00 2001
From: chenhaozhe <cgz@hz-kingdee.com>
Date: 星期二, 14 四月 2026 16:55:19 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-LayUI
---
WebTM/layuiadmin/Scripts/webConfig.js | 212 ++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 178 insertions(+), 34 deletions(-)
diff --git a/WebTM/layuiadmin/Scripts/webConfig.js b/WebTM/layuiadmin/Scripts/webConfig.js
index 67cc4f1..df7866a 100644
--- a/WebTM/layuiadmin/Scripts/webConfig.js
+++ b/WebTM/layuiadmin/Scripts/webConfig.js
@@ -1,39 +1,183 @@
-锘�
-function GetWEBURL() {
- //var WEBURL = "http://192.168.16.80:8011/"; //鍔炲叕瀹ゆ湇鍔″櫒
- //var WEBURL = "http://61.164.86.218:8099/ABAPI/";
- //var WEBURL = "http://localhost/API/"; //棰滄檽鍐涙湰鍦伴厤缃�
- //var WEBURL = "http://localhost:8082/API/"; //鏉滆春鏈湴閰嶇疆
- var WEBURL = "http://localhost:81/API/" //缈佹稕娑涙湰鍦伴厤缃�
- //var WEBURL = "http://localhost:8082/API/"; //寮犵憺骞挎湰鍦伴厤缃�
- //var WEBURL = "http://localhost:81/API/"; //闄堥晲鍝叉湰鍦伴厤缃�
- //var WEBURL = "http://localhost:8082/LuBaoAPI/"; //鏉庢灄淇婃湰鍦伴厤缃�
- //var WEBURL = "http://localhost:8080/API/"; //鐜嬩华鏈湴閰嶇疆
- //var WEBURL = "http://localhost:8082/LuBaoAPI/"; //浣欐�濇澃鏈湴閰嶇疆
- //var WEBURL = "http://localhost:8088/ARAPI/"; //浣欐�濇澃鏈湴閰嶇疆(瀹夌憺)
- //var WEBURL = "http://47.96.97.237/API/"; //鏅轰簯鏈嶅姟鍣�
- //var WEBURL = "http://61.164.86.218:8099/ABAPI/"; //濂ラ偊
- //var WEBURL = "http://10.1.4.155/API/"; //姹熶赴瀹㈡埛NEW
- //var WEBURL = "http://183.129.128.86:9090/API/"; //鍑礉濂堢壒瀹㈡埛鏈嶅姟鍣ㄥ缃�
- //var WEBURL = "http://192.168.1.253:8080/API/"; //鍑礉濂堢壒瀹㈡埛鏈嶅姟鍣ㄥ唴缃�
- //var WEBURL = "http://220.189.218.154:8092/API/"; //涓镐簳鍥涚淮灏旀湇鍔″櫒
- //var WEBURL = "http://192.168.0.214/API/"; //鐟炰笌绁烘湇鍔″櫒
- //var WEBURL = "http://192.168.10.66/API/"; //妫シ鏈嶅姟鍣�
- //var WEBURL = "http://192.168.80.90:9090/API/"; //瀹夌憺鏈嶅姟鍣�
- //var WEBURL = "http://192.168.16.53:8081/API/"; //榫欏北姹介厤
- //var WEBURL = "http://122.227.158.218:8090/API/"; //榫欏北姹介厤澶栫綉
- //var WEBURL = "http://192.168.0.244:8082/API/"; //甯呭▉鍐呯綉
- //var WEBURL = "http://192.168.1.237:9003/API"; //澶忓疂鍐呯綉
- //var WEBURL = "http://60.190.4.42:9003/API"; //澶忓疂澶栫綉
- //var WEBURL = "http://192.168.60.12/API"; //涓帶
- //var WEBURL = "http://192.168.6.5:8082/API/"; //鑸滄垚
- //var WEBURL = "http://121.36.199.126:8181/API/"; //涓夊崌
- //var WEBURL = "http://36.134.2.30:200/WEBS-API/"; //閲戝竻
- //var WEBURL = "http://172.16.1.85/API/"; //杩﹀崡
- return WEBURL
+锘縡unction GetWEBURL() {
+ //var WEBURL = "http://192.168.16.80:8011/"; //鍔炲叕瀹ゆ湇鍔″櫒
+ //var WEBURL = "http://61.164.86.218:8099/ABAPI/";
+ //var WEBURL = "http://localhost/API/"; //棰滄檽鍐涙湰鍦伴厤缃�
+ //var WEBURL = "http://localhost:8082/API/"; //鏉滆春鏈湴閰嶇疆
+ //var WEBURL = "http://localhost:81/API/" //缈佹稕娑涙湰鍦伴厤缃�
+ //var WEBURL = "http://localhost:8082/API/"; //寮犵憺骞挎湰鍦伴厤缃�
+ // var WEBURL = "http://localhost:81/API/"; //闄堥晲鍝叉湰鍦伴厤缃�
+ var WEBURL = "http://localhost:8082/LuBaoAPI/"; //鏉庢灄淇婃湰鍦伴厤缃�
+ //var WEBURL = "http://localhost:8080/API/"; //鐜嬩华鏈湴閰嶇疆
+ //var WEBURL = "http://localhost:8082/LuBaoAPI/"; //浣欐�濇澃鏈湴閰嶇疆
+ //var WEBURL = "http://localhost:8088/ARAPI/"; //浣欐�濇澃鏈湴閰嶇疆(瀹夌憺)
+ //var WEBURL = "http://47.96.97.237/API/"; //鏅轰簯鏈嶅姟鍣�
+ //var WEBURL = "http://61.164.86.218:8099/ABAPI/"; //濂ラ偊
+ //var WEBURL = "http://10.1.4.155/API/"; //姹熶赴瀹㈡埛NEW
+ //var WEBURL = "http://183.129.128.86:9090/API/"; //鍑礉濂堢壒瀹㈡埛鏈嶅姟鍣ㄥ缃�
+ //var WEBURL = "http://192.168.1.253:8080/API/"; //鍑礉濂堢壒瀹㈡埛鏈嶅姟鍣ㄥ唴缃�
+ //var WEBURL = "http://220.189.218.154:8092/API/"; //涓镐簳鍥涚淮灏旀湇鍔″櫒
+ //var WEBURL = "http://192.168.0.214/API/"; //鐟炰笌绁烘湇鍔″櫒
+ //var WEBURL = "http://192.168.10.66/API/"; //妫シ鏈嶅姟鍣�
+ //var WEBURL = "http://192.168.80.90:9090/API/"; //瀹夌憺鏈嶅姟鍣�
+ //var WEBURL = "http://192.168.16.53:8081/API/"; //榫欏北姹介厤
+ //var WEBURL = "http://122.227.158.218:8090/API/"; //榫欏北姹介厤澶栫綉
+ //var WEBURL = "http://192.168.0.244:8082/API/"; //甯呭▉鍐呯綉
+ //var WEBURL = "http://192.168.1.237:9003/API"; //澶忓疂鍐呯綉
+ //var WEBURL = "http://60.190.4.42:9003/API"; //澶忓疂澶栫綉
+ //var WEBURL = "http://192.168.60.12/API"; //涓帶
+ //var WEBURL = "http://192.168.6.5:8082/API/"; //鑸滄垚
+ //var WEBURL = "http://121.36.199.126:8181/API/"; //涓夊崌
+ //var WEBURL = "http://36.134.2.30:200/WEBS-API/"; //閲戝竻
+ //var WEBURL = "http://172.16.1.85/API/"; //杩﹀崡
+ // var WEBURL = "http://61.164.64.222:8082/API_WW/"
+ return WEBURL;
}
function GetWEBURlLanguage() {
- return GetWEBURL()
+ return GetWEBURL();
}
+layui.use(["jquery", "layer"], function () {
+ var $ = layui.jquery,
+ layer = layui.layer;
+ // 鍏ㄥ眬閰嶇疆
+ layer.config({
+ scrollbar: false,
+ });
+
+ var pendingRequests = [];
+
+ // 鍏ㄥ眬閰嶇疆 榛樿涓嶆樉绀虹埗绾ф粴鍔ㄦ
+ var _open = layer.open;
+ layer.open = function (opts) {
+ // 鍚堝苟榛樿閰嶇疆
+ var options = $.extend({}, layer.config, opts);
+
+ var oldSuccess = options.success;
+ var oldEnd = options.end;
+ var needHideScroll = options.scrollbar === false;
+
+ // 鎵撳紑寮圭獥鏃�
+ options.success = function (layero, index) {
+ if (needHideScroll) {
+ $("body").css("overflow", "hidden");
+ }
+ if (oldSuccess) oldSuccess.call(this, layero, index);
+ };
+
+ // 鍏抽棴寮圭獥鏃�
+ options.end = function () {
+ if (needHideScroll) {
+ // 鍙湁鏈�鍚庝竴涓脊绐楀叧闂墠鎭㈠
+ if ($(".layui-layer:visible").length <= 1) {
+ $("body").css("overflow", "");
+ }
+ }
+ if (oldEnd) oldEnd.call(this);
+ };
+
+ return _open.call(this, options);
+ };
+
+ // 鍏ㄥ眬鎷︽埅鎵�鏈� layui ajax 璇锋眰
+ $(document).ajaxSend(function (event, jqxhr, settings) {
+ var token = localStorage.getItem("token");
+ pendingRequests.push(jqxhr);
+
+ if (typeof token != "undefined") {
+ // 鑷姩甯︿笂 token
+ jqxhr.setRequestHeader("Authorization", "Bearer " + token);
+ }
+ });
+
+ // 缁熶竴澶勭悊 鏈璇�/鏈巿鏉冭姹�
+ $(document).ajaxComplete(function (event, jqxhr, settings) {
+ // HTTP 鐘舵�佺爜
+ var status = jqxhr.status;
+ console.log(jqxhr);
+ if (status === 401) {
+ abortAllPendingRequests(pendingRequests);
+ // 鏈櫥褰� / token 杩囨湡
+ layer.confirm(
+ jqxhr.responseJSON.Message,
+ { icon: 7, title: "鎻愮ず" },
+ function () {
+ localStorage.removeItem("token");
+ window.top.location.href = "/WEBTM/views/user/login.html"; // 璺冲埌鐧诲綍椤�
+ }
+ );
+ } else if (status === 403) {
+ abortAllPendingRequests(pendingRequests);
+ // 鏃犳潈闄�
+ layer.confirm(jqxhr.responseJSON.Message, {
+ icon: 4,
+ skin: "layui-layer-lan",
+ title: "娓╅Θ鎻愮ず",
+ closeBtn: 0,
+ btn: ["纭畾"],
+ });
+ }
+ });
+});
+var pendingRequests2 = [];
+if (typeof $ != "undefined") {
+ $(document).ajaxSend(function (event, jqxhr, settings) {
+ var token = localStorage.getItem("token");
+ pendingRequests2.push(jqxhr);
+
+ if (typeof token != "undefined") {
+ // 鑷姩甯︿笂 token
+ jqxhr.setRequestHeader("Authorization", "Bearer " + token);
+ }
+ });
+
+ // 缁熶竴澶勭悊 鏈璇�/鏈巿鏉冭姹�
+ $(document).ajaxComplete(function (event, jqxhr, settings) {
+ // HTTP 鐘舵�佺爜
+ var status = jqxhr.status;
+
+ if (status === 401) {
+ // 鏈櫥褰� / token 杩囨湡
+ abortAllPendingRequests(pendingRequests2);
+ layer.confirm(
+ jqxhr.responseJSON.Message,
+ { icon: 7, title: "鎻愮ず" },
+ function () {
+ localStorage.removeItem("token");
+ window.top.location.href = "/views/user/login.html"; // 璺冲埌鐧诲綍椤�
+ }
+ );
+ } else if (status === 403) {
+ // 鏃犳潈闄�
+ abortAllPendingRequests(pendingRequests2);
+ layer.confirm(jqxhr.responseJSON.Message, {
+ icon: 4,
+ skin: "layui-layer-lan",
+ title: "娓╅Θ鎻愮ず",
+ closeBtn: 0,
+ btn: ["纭畾"],
+ });
+ }
+ });
+}
+
+
+// 鍙栨秷鎵�鏈� pending 璇锋眰鐨勫嚱鏁�
+function abortAllPendingRequests(pendingArray) {
+ if (!pendingArray || pendingArray.length === 0) return;
+
+ // 閬嶅巻鎵�鏈夋湭瀹屾垚鐨勮姹傦紝鎵ц abort
+ for (var i = 0; i < pendingArray.length; i++) {
+ try {
+ // jQuery 鐨� jqxhr 瀵硅薄鏀寔 abort() 鏂规硶
+ if (pendingArray[i] && typeof pendingArray[i].abort === 'function') {
+ pendingArray[i].abort();
+ }
+ } catch (e) {
+ // 闃叉 abort 鏃舵姤閿欏鑷翠唬鐮佸崱浣�
+ console.warn('璇锋眰鍙栨秷澶辫触', e);
+ }
+ }
+ // 娓呯┖鏁扮粍
+ pendingArray.length = 0;
+}
\ No newline at end of file
--
Gitblit v1.9.1