| | |
| | | <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 clearLicensePromptState() { |
| | | sessionStorage.removeItem("licensePanelAutoOpen"); |
| | | sessionStorage.removeItem("licenseInvalidReason"); |
| | | } |
| | | |
| | | $(function () { |
| | | if ("" === localStorage.getItem('token')) { |
| | | top.location.href = baseUrl + "/login"; |
| | |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code == 200) { |
| | | let days = res.data |
| | | let days = Number(getResponseValue(res)) |
| | | if (days < 0) { |
| | | redirectToLicensePage('系统当前未检测到可用许可证,请重新导入新的许可证。'); |
| | | return; |
| | | } |
| | | clearLicensePromptState(); |
| | | if (days <= 30) { |
| | | $("#licenseShow").show() |
| | | $("#licenseDays").html(days) |
| | | } else { |
| | | $("#licenseShow").hide() |
| | | } |
| | | }else { |
| | | top.location.href = baseUrl + "/login"; |
| | | redirectToLicensePage(res.msg || '许可证校验失败,请重新导入新的许可证。'); |
| | | } |
| | | } |
| | | }); |