Junjie
昨天 bdb924aaaef6a8d282ed2d34850cfd229d5865c7
src/main/webapp/views/admin/index.html
@@ -18,6 +18,28 @@
      font-weight: 400;
      /*margin-left: 5px;*/
    }
    /* 弹窗样式 */
    .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">
@@ -100,6 +122,30 @@
    }
  });
  // 显示弹窗
  function showPopup(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: baseUrl + "/static/layui/lay/modules/"
  }).extend({
@@ -153,6 +199,10 @@
            $("#licenseShow").show()
            $("#licenseDays").html(days)
          }
          if (days <= 15) {
            showPopup(days)
          }
        }else {
          top.location.href = baseUrl + "/login";
        }