From 49bb2841cc45fea723667672e56c8c7510165ba8 Mon Sep 17 00:00:00 2001
From: admin <qiutairan163@163.com>
Date: 星期四, 04 十二月 2025 16:36:15 +0800
Subject: [PATCH] 格式化代码

---
 Pda/js/public.js |  248 +++++++++++++++++++++++++------------------------
 1 files changed, 125 insertions(+), 123 deletions(-)

diff --git a/Pda/js/public.js b/Pda/js/public.js
index 8791bc0..cd00463 100644
--- a/Pda/js/public.js
+++ b/Pda/js/public.js
@@ -8,148 +8,150 @@
 //var IP = "http://192.168.62.200:8888/api";
 //杩愯
 var IP = "https://localhost:44363/api";
+//鏈湴鍙戝竷
+//var IP = "http://localhost:8034/api";
 
 
 
 jQuery.support.cors = true;
 function sendData(url, data, type, callbackFun) {
-  // callbackFun("{}");
-  // return;
-  var deferred = $.Deferred();
-  if (type != "get") {
-    data = JSON.stringify(data);
-  }
-  if (url != IP + "/WeatherForecast/Login") {
-    if (!$.cookie("token")) {
-      callbackFun("鐧诲綍浜轰俊鎭凡澶辨晥");
-      try {
-        parent.window.location.href = "/View/login.html";
-      } catch (error) {
-        window.location.href = "/View/login.html";
-      }
-      return;
-    }
-    if (isTokenExpired($.cookie("token"))) {
-      try {
-        parent.window.location.href = "/View/login.html";
-      } catch (error) {
-        window.location.href = "/View/login.html";
-      }
-      return;
-    }
-  }
-  $.ajax({
-    url: url,
-    data: data,
-    type: type,
-    headers: {
-      "Content-Type": "application/json",
-      ToKen: $.cookie("token"),
-    },
-    timeout: 45000,
-    async: true,
-    cache: false,
-    beforeSend: function (xhr, settings) {},
-    success: function (res, status, xhr) {
-      callbackFun(res);
-    },
-    error: function (xhr, status, error) {
-      callbackFun(xhr, status, error);
-      // layer.msg(xhr.statusText, {
-      //   icon: 2,
-      //   time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
-      // }, function() {});
-    },
-  });
+	// callbackFun("{}");
+	// return;
+	var deferred = $.Deferred();
+	if (type != "get") {
+		data = JSON.stringify(data);
+	}
+	if (url != IP + "/WeatherForecast/Login") {
+		if (!$.cookie("token")) {
+			callbackFun("鐧诲綍浜轰俊鎭凡澶辨晥");
+			try {
+				parent.window.location.href = "/View/login.html";
+			} catch (error) {
+				window.location.href = "/View/login.html";
+			}
+			return;
+		}
+		if (isTokenExpired($.cookie("token"))) {
+			try {
+				parent.window.location.href = "/View/login.html";
+			} catch (error) {
+				window.location.href = "/View/login.html";
+			}
+			return;
+		}
+	}
+	$.ajax({
+		url: url,
+		data: data,
+		type: type,
+		headers: {
+			"Content-Type": "application/json",
+			ToKen: $.cookie("token"),
+		},
+		timeout: 45000,
+		async: true,
+		cache: false,
+		beforeSend: function (xhr, settings) { },
+		success: function (res, status, xhr) {
+			callbackFun(res);
+		},
+		error: function (xhr, status, error) {
+			callbackFun(xhr, status, error);
+			// layer.msg(xhr.statusText, {
+			//   icon: 2,
+			//   time: 2000 //2绉掑叧闂紙濡傛灉涓嶉厤缃紝榛樿鏄�3绉掞級
+			// }, function() {});
+		},
+	});
 }
 function synData(url, data, type, callbackFun) {
-  var deferred = $.Deferred();
-  if (type != "get") {
-    data = JSON.stringify(data);
-  }
-  if (url != IP + "/WeatherForecast/Login") {
-    if (!$.cookie("token")) {
-      callbackFun("鐧诲綍浜轰俊鎭凡澶辨晥");
-      try {
-        parent.window.location.href = "/View/login.html";
-      } catch (error) {
-        window.location.href = "/View/login.html";
-      }
-      return;
-    }
-    if (isTokenExpired($.cookie("token"))) {
-      try {
-        parent.window.location.href = "/View/login.html";
-      } catch (error) {
-        window.location.href = "/View/login.html";
-      }
-      return;
-    }
-  }
-  $.ajax({
-    url: url,
-    data: data,
-    type: type,
-    headers: {
-      "Content-Type": "application/json",
-      ToKen: $.cookie("token"),
-    },
-    timeout: 45000,
-    async: false,
-    cache: false,
-    beforeSend: function (xhr, settings) {},
-    success: function (res, status, xhr) {
-      callbackFun(res);
-    },
-    error: function (xhr, status, error) {
-      console.log("澶辫触浜�");
-      console.log(xhr);
-      callbackFun(xhr, status, error);
-    },
-  });
+	var deferred = $.Deferred();
+	if (type != "get") {
+		data = JSON.stringify(data);
+	}
+	if (url != IP + "/WeatherForecast/Login") {
+		if (!$.cookie("token")) {
+			callbackFun("鐧诲綍浜轰俊鎭凡澶辨晥");
+			try {
+				parent.window.location.href = "/View/login.html";
+			} catch (error) {
+				window.location.href = "/View/login.html";
+			}
+			return;
+		}
+		if (isTokenExpired($.cookie("token"))) {
+			try {
+				parent.window.location.href = "/View/login.html";
+			} catch (error) {
+				window.location.href = "/View/login.html";
+			}
+			return;
+		}
+	}
+	$.ajax({
+		url: url,
+		data: data,
+		type: type,
+		headers: {
+			"Content-Type": "application/json",
+			ToKen: $.cookie("token"),
+		},
+		timeout: 45000,
+		async: false,
+		cache: false,
+		beforeSend: function (xhr, settings) { },
+		success: function (res, status, xhr) {
+			callbackFun(res);
+		},
+		error: function (xhr, status, error) {
+			console.log("澶辫触浜�");
+			console.log(xhr);
+			callbackFun(xhr, status, error);
+		},
+	});
 }
 
 $("#navIcon").click(function () {
-  if ($(".nav_list").css("display") == "none") {
-    $(".nav_list").show();
-  } else {
-    $(".nav_list").hide();
-  }
+	if ($(".nav_list").css("display") == "none") {
+		$(".nav_list").show();
+	} else {
+		$(".nav_list").hide();
+	}
 });
 
 //娣辨嫹璐�
 function deepCopy(obj) {
-  let newobj = null; // 鎺ュ彈鎷疯礉鐨勬柊瀵硅薄
-  if (typeof obj == "object" && typeof obj !== null) {
-    // 鍒ゆ柇鏄惁鏄紩鐢ㄧ被鍨�
-    newobj = obj instanceof Array ? [] : {}; // 鍒ゆ柇鏄暟缁勮繕鏄璞�
-    for (var i in obj) {
-      newobj[i] = deepCopy(obj[i]); // 鍒ゆ柇涓嬩竴绾ф槸鍚﹁繕鏄紩鐢ㄧ被鍨�
-    }
-  } else {
-    newobj = obj;
-  }
+	let newobj = null; // 鎺ュ彈鎷疯礉鐨勬柊瀵硅薄
+	if (typeof obj == "object" && typeof obj !== null) {
+		// 鍒ゆ柇鏄惁鏄紩鐢ㄧ被鍨�
+		newobj = obj instanceof Array ? [] : {}; // 鍒ゆ柇鏄暟缁勮繕鏄璞�
+		for (var i in obj) {
+			newobj[i] = deepCopy(obj[i]); // 鍒ゆ柇涓嬩竴绾ф槸鍚﹁繕鏄紩鐢ㄧ被鍨�
+		}
+	} else {
+		newobj = obj;
+	}
 
-  return newobj;
+	return newobj;
 }
 
 function isTokenExpired(token) {
-  if (token == undefined || token == "") {
-    return true;
-  }
-  const tokenParts = token.split(".");
-  if (tokenParts.length !== 3) {
-    return true; // JWT 鏍煎紡涓嶆纭�
-  }
-  const payloadBase64 = tokenParts[1];
-  const payload = JSON.parse(atob(payloadBase64));
+	if (token == undefined || token == "") {
+		return true;
+	}
+	const tokenParts = token.split(".");
+	if (tokenParts.length !== 3) {
+		return true; // JWT 鏍煎紡涓嶆纭�
+	}
+	const payloadBase64 = tokenParts[1];
+	const payload = JSON.parse(atob(payloadBase64));
 
-  if (!payload || !payload.exp) {
-    return true; // 娌℃湁鏈夋晥杞借嵎鎴栬�呮病鏈夎繃鏈熸椂闂�
-  }
+	if (!payload || !payload.exp) {
+		return true; // 娌℃湁鏈夋晥杞借嵎鎴栬�呮病鏈夎繃鏈熸椂闂�
+	}
 
-  const now = Date.now() / 1000; // 褰撳墠鏃堕棿鎴筹紙绉掞級
-  const expiration = payload.exp;
+	const now = Date.now() / 1000; // 褰撳墠鏃堕棿鎴筹紙绉掞級
+	const expiration = payload.exp;
 
-  return now >= expiration;
+	return now >= expiration;
 }

--
Gitblit v1.8.0