From 780ff45fdc167cadf4724c6c94530929b7445aab Mon Sep 17 00:00:00 2001
From: zwl <1051256694@qq.com>
Date: 星期一, 16 三月 2026 10:37:51 +0800
Subject: [PATCH] 完善许可证

---
 src/main/webapp/views/index.html |   28 ++++++++++++++++++++++++++--
 1 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/src/main/webapp/views/index.html b/src/main/webapp/views/index.html
index ede1192..642c1aa 100644
--- a/src/main/webapp/views/index.html
+++ b/src/main/webapp/views/index.html
@@ -92,6 +92,26 @@
 <script type="text/javascript" src="../static/js/common.js"></script>
 <script>
   // console.log('%c 涓壃绔嬪簱骞冲彴 %c 1.0.0','background-color:rgb(53,73,94);color: #fff;border-radius:2px 0 0 2px;padding:2px 4px;','background-color:rgb(25,190,107);color: #fff;border-radius:0 2px 2px 0;padding:2px 4px;font: 9pt "Apercu Regular", Georgia, "Times New Roman", Times, serif;');
+  function getResponseValue(res) {
+    if (!res) {
+      return "";
+    }
+    if (typeof res.data !== "undefined" && res.data !== null && res.data !== "") {
+      return res.data;
+    }
+    if (typeof res.msg !== "undefined" && res.msg !== null && res.msg !== "") {
+      return res.msg;
+    }
+    return "";
+  }
+
+  function redirectToLicensePage(message) {
+    sessionStorage.setItem("licensePanelAutoOpen", "1");
+    sessionStorage.setItem("licenseInvalidReason", message || "绯荤粺褰撳墠璁稿彲璇佹棤鏁堬紝璇烽噸鏂板鍏ユ柊璁稿彲璇併��");
+    localStorage.removeItem('token');
+    top.location.href = "login.html?license=invalid";
+  }
+
   $(function () {
     if ("" === localStorage.getItem('token')) {
       top.location.href = baseUrl + "/login";
@@ -146,13 +166,17 @@
       method: 'POST',
       success: function (res) {
         if (res.code == 200) {
-          let days = res.data
+          let days = Number(getResponseValue(res))
+          if (days < 0) {
+            redirectToLicensePage('绯荤粺褰撳墠鏈娴嬪埌鍙敤璁稿彲璇侊紝璇烽噸鏂板鍏ユ柊鐨勮鍙瘉銆�');
+            return;
+          }
           if (days <= 30) {
             $("#licenseShow").show()
             $("#licenseDays").html(days)
           }
         }else {
-          top.location.href = baseUrl + "/login";
+          redirectToLicensePage(res.msg || '璁稿彲璇佹牎楠屽け璐ワ紝璇烽噸鏂板鍏ユ柊鐨勮鍙瘉銆�');
         }
       }
     });

--
Gitblit v1.9.1