From f667fdf1a1948b2d3c36e1dac803e26992fcab8c Mon Sep 17 00:00:00 2001
From: pang.jiabao <pang_jiabao@163.com>
Date: 星期三, 03 九月 2025 15:27:24 +0800
Subject: [PATCH] 许可证到期提醒,系统30分钟无操作下线账号

---
 src/main/webapp/views/index.html |   85 +++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 82 insertions(+), 3 deletions(-)

diff --git a/src/main/webapp/views/index.html b/src/main/webapp/views/index.html
index b04d533..528fbe8 100644
--- a/src/main/webapp/views/index.html
+++ b/src/main/webapp/views/index.html
@@ -12,6 +12,8 @@
   <script type="text/javascript" src="../static/js/jquery/jquery-3.3.1.min.js"></script>
   <script type="text/javascript" src="../static/js/common.js"></script>
   <script type="text/javascript" src="../static/layuiadmin/layui/layui.js"></script>
+  <link rel="stylesheet" href="../static/css/layx.min.css" type="text/css" />
+  <script type="text/javascript" src="../static/js/tools/layx.min.js"></script>
   <style>
     .layui-layout-admin .layui-footer {
       box-sizing: border-box;
@@ -45,6 +47,27 @@
     .layui-side-menu .layui-nav {
       margin-top: 110px;
     }
+    /* 寮圭獥鏍峰紡 */
+    .popup {
+      position: fixed;
+      top: 0;
+      left: 0;
+      width: 100%;
+      height: 100%;
+      background-color: rgba(0,0,0,0.5);
+      display: none;
+      justify-content: center;
+      align-items: center;
+      z-index: 9999;
+    }
+
+    .popup-content {
+      background-color: #fff;
+      padding: 20px;
+      border-radius: 5px;
+      box-shadow: 0px 0px 20px rgba(0,0,0,0.3);
+      text-align: center;
+    }
   </style>
 </head>
 <body class="layui-layout-body">
@@ -74,7 +97,9 @@
           <!--</li>-->
         </ul>
         <ul id="cool-header-right" class="layui-nav layui-layout-right" lay-filter="layadmin-layout-right">
-          
+          <li class="layui-nav-item" lay-unselect id="licenseShow" style="display: none;user-select: none;">
+            <div style="color: red;">涓存椂璁稿彲璇佹湁鏁堟湡锛�<span id="licenseDays">29</span>澶�</div>
+          </li>
           <li class="layui-nav-item layui-hide-xs" lay-unselect>
             <a href="javascript:;" layadmin-event="theme">
               <i class="layui-icon layui-icon-theme"></i>
@@ -153,9 +178,42 @@
       <div class="layadmin-body-shade" layadmin-event="shade"></div>
     </div>
   </div>
-
+  <!-- 寮圭獥鍐呭 -->
+  <div class="popup" id="popup">
+    <div class="popup-content">
+      <h2 style="font-size: 28px;margin-bottom: 10px;">璁稿彲璇佸嵆灏嗚繃鏈�</h2>
+      <div id="popup-text" style="font-size: 28px;color: red"></div>
+      <button style="background-color: #007bff;color: #fff;border: none;padding: 10px 20px;border-radius: 5px;cursor: pointer;font-size: 16px;" onclick="hidePopup()">鍏抽棴</button>
+    </div>
+  </div>
   <script>
-  layui.config({
+
+    // 鏄剧ず寮圭獥
+    function showPopup(res) {
+      console.log(res)
+      document.getElementById('popup').style.display = 'block';
+      // 鑾峰彇寮瑰嚭绐楀彛鍐呭鐨勫鍣ㄥ厓绱�
+      var popupText = document.getElementById('popup-text');
+      // 鍋囪鍚庡彴杩斿洖鐨勫瓧绗︿覆涓� responseString
+      if (res!==""){
+        // 鑾峰彇褰撳墠鏃ユ湡
+        const currentDate = new Date();
+        // 鍒涘缓鏂版棩鏈熷璞″苟娣诲姞澶╂暟
+        const newDate = new Date();
+        newDate.setDate(currentDate.getDate() + res + 1);
+        // 灏嗗瓧绗︿覆璁剧疆涓哄脊绐楀唴瀹圭殑鏂囨湰
+        popupText.textContent = "璁稿彲璇佸皢浜�" + new Intl.DateTimeFormat('zh-CN').format(newDate) + "杩囨湡锛屽墿浣欐湁鏁堟湡:" + res + "澶╋紒";
+      }else {
+        document.getElementById('popup').style.display = 'none';
+      }
+    }
+
+    // 闅愯棌寮圭獥
+    function hidePopup() {
+      document.getElementById('popup').style.display = 'none';
+    }
+
+    layui.config({
     base: '../static/layuiadmin/' //闈欐�佽祫婧愭墍鍦ㄨ矾寰�
   }).extend({
     index: 'lib/index' //涓诲叆鍙fā鍧�
@@ -233,6 +291,27 @@
           }
         });
       }
+    $.ajax({
+      url: baseUrl + "/license/getLicenseDays",
+      headers: {'token': localStorage.getItem('token')},
+      method: 'POST',
+      success: function (res) {
+        if (res.code == 200) {
+          let days = res.data
+          if (days <= 30) {
+            $("#licenseShow").show()
+            $("#licenseDays").html(days)
+          }
+
+          if (days <= 15) {
+            showPopup(days)
+          }
+        }else {
+          top.location.href = baseUrl + "/login";
+        }
+      }
+    });
+
   });
   </script>
 </body>

--
Gitblit v1.9.1