From 8af4cdbdb52932dca5d16fbce42a2f6fad4e3b8b Mon Sep 17 00:00:00 2001
From: Administrator <1051256694@qq.com>
Date: 星期六, 28 三月 2026 14:59:29 +0800
Subject: [PATCH] #
---
src/main/webapp/views/login.html | 889 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 811 insertions(+), 78 deletions(-)
diff --git a/src/main/webapp/views/login.html b/src/main/webapp/views/login.html
index a4d77c0..e516ab0 100644
--- a/src/main/webapp/views/login.html
+++ b/src/main/webapp/views/login.html
@@ -1,111 +1,844 @@
<!DOCTYPE html>
-<html lang="ja">
- <head>
+<html lang="en">
+<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
- <title>instancing 鈹� sketch of three.js</title>
+ <title>WMS</title>
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1">
<meta name="description" content="study of Instancing with three.js">
<meta name="keywords" content="undefined, Yoichi Kobayashi, WebGL, three.js">
<meta name="theme-color" content="#111111">
<meta name="msapplication-TileImage" content="/sketch-threejs/img/common/ms_tileimage.png">
<meta name="msapplication-TileColor" content="#111111">
- <link rel="icon" type="image/x-icon" href="../static/image/favicon.ico" />
+ <link rel="icon" type="image/x-icon" href="../static/image/favicon.ico"/>
<link rel="stylesheet" href="../static/css/font/font-awesome-4.7.0/css/font-awesome.css">
<link rel="stylesheet" href="../static/css/main.min.css">
<link rel="stylesheet" href="../static/css/login.css">
<style>
- #sidebar{
- /*瀹氫綅*/
- position: absolute;
- top: 50%;
- right: 1%;
- transform: translateY(-50%);
- width: 20%;
- height: 95%;
- /*鐗规晥*/
- background: rgba(255,255,255,0.6);
- border-radius: 5px;
- color: #ffffff;
- z-index: 99;
- box-shadow: 3px 3px 6px 3px rgba(0, 0, 0, .3);
- }
+ #sidebar {
+ /*瀹氫綅*/
+ position: absolute;
+ top: 50%;
+ right: 1%;
+ transform: translateY(-50%);
+ width: 20%;
+ height: 95%;
+ /*鐗规晥*/
+ background: rgba(255, 255, 255, 0.6);
+ border-radius: 5px;
+ color: #ffffff;
+ z-index: 99;
+ box-shadow: 3px 3px 6px 3px rgba(0, 0, 0, .3);
+ }
- .login-contain {
- position: relative;
- width: 100%;
- height: 100%;
- }
- .login-box {
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- width: 100%;
- text-align: center;
- }
+ .login-contain {
+ position: relative;
+ width: 100%;
+ height: 100%;
+ }
+
+ .login-box {
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ width: 100%;
+ text-align: center;
+ }
+
+ .login-system-name {
+ width: 80%;
+ margin: 18px auto 6px;
+ color: #6b6b6b;
+ font-size: 24px;
+ font-weight: 700;
+ letter-spacing: 8px;
+ line-height: 1.2;
+ cursor: pointer;
+ user-select: none;
+ }
+
+ .license-entry-wrap {
+ width: 80%;
+ margin: 22px auto 0;
+ }
+
+ .license-entry-text {
+ width: 100%;
+ margin: 0 auto 12px;
+ color: #5e5e5e;
+ font-size: 12px;
+ line-height: 1.7;
+ text-align: center;
+ }
+
+ .system-tool-shell {
+ background: #ffffff;
+ border-radius: 22px;
+ overflow: hidden;
+ }
+
+ .system-tool-header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 14px 20px;
+ border-bottom: 1px solid #dbe4ef;
+ }
+
+ .system-tool-title {
+ color: #243447;
+ font-size: 18px;
+ font-weight: 700;
+ }
+
+ .system-tool-close {
+ color: #97a5b4;
+ font-size: 24px;
+ line-height: 1;
+ cursor: pointer;
+ user-select: none;
+ }
+
+ .system-tool-body {
+ padding: 18px 20px 22px;
+ background: #ffffff;
+ }
+
+ .system-tool-group + .system-tool-group {
+ margin-top: 18px;
+ padding-top: 18px;
+ border-top: 1px solid #e8eef5;
+ }
+
+ .system-tool-group-title {
+ color: #34495e;
+ font-size: 14px;
+ font-weight: 700;
+ margin-bottom: 14px;
+ }
+
+ .system-tool-actions {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 12px 18px;
+ }
+
+ .system-tool-btn {
+ min-width: 104px;
+ height: 34px;
+ padding: 0 18px;
+ border: 1px solid #d7dfea;
+ border-radius: 4px;
+ background: #ffffff;
+ color: #4d5d6d;
+ font-size: 14px;
+ cursor: pointer;
+ box-sizing: border-box;
+ }
+
+ .system-tool-btn.primary {
+ color: #ffffff;
+ background: #5da8ff;
+ border-color: #5da8ff;
+ }
+
+ .system-tool-btn.secondary {
+ color: #7eb4ef;
+ background: #d9ecff;
+ border-color: #aed4ff;
+ }
+
+ .system-tool-desc {
+ margin-top: 12px;
+ color: #9aa8b6;
+ font-size: 12px;
+ line-height: 1.7;
+ }
+
+ .system-dialog-shell {
+ background: #ffffff;
+ border-radius: 18px;
+ overflow: hidden;
+ }
+
+ .system-dialog-header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 14px 18px;
+ border-bottom: 1px solid #e1e8f0;
+ background: #f8fbff;
+ }
+
+ .system-dialog-title {
+ color: #243447;
+ font-size: 16px;
+ font-weight: 700;
+ }
+
+ .system-dialog-close {
+ color: #97a5b4;
+ font-size: 22px;
+ line-height: 1;
+ cursor: pointer;
+ user-select: none;
+ }
+
+ .system-dialog-body {
+ padding: 18px;
+ background: #ffffff;
+ }
+
+ .system-dialog-label {
+ color: #43576b;
+ font-size: 13px;
+ font-weight: 700;
+ margin-bottom: 8px;
+ }
+
+ .system-dialog-tip {
+ margin-bottom: 10px;
+ color: #8c9aac;
+ font-size: 12px;
+ line-height: 1.7;
+ }
+
+ .system-dialog-textarea {
+ width: 100%;
+ min-height: 220px;
+ resize: none;
+ border: 1px solid #d7dfea;
+ border-radius: 8px;
+ padding: 10px 12px;
+ box-sizing: border-box;
+ color: #4d5d6d;
+ background: #fbfdff;
+ font-size: 13px;
+ line-height: 1.7;
+ }
+
+ .system-dialog-footer {
+ display: flex;
+ justify-content: flex-end;
+ gap: 10px;
+ margin-top: 14px;
+ }
+
+ body .system-tool-popup {
+ border-radius: 22px !important;
+ overflow: hidden !important;
+ }
+
+ body .system-tool-popup .layui-layer-content {
+ overflow: hidden !important;
+ background: transparent;
+ }
</style>
- </head>
- <body>
- <div class="l-page l-page--white" data-id="instancing">
- <div style="position: fixed;
+</head>
+<body>
+<div class="l-page l-page--white" data-id="instancing">
+ <div style="position: fixed;
z-index: 100;
top: 22px;
left: 20px;">
- <img src="../static/image/logo.png" alt="" style="width: 20%">
- </div>
- <div class="p-sketch-outline">
+ <img src="../static/image/logo_light_colour.png" alt="" style="width: 20%">
+ </div>
+ <div class="p-sketch-outline">
<h2 class="p-sketch-outline__title">Automatic Storage and Retrieval System</h2>
- <p class="p-sketch-outline__date">posted: 2018.01.01 / update: 2022.03.18
+ <p class="p-sketch-outline__date">posted: 2018.01.01 / update: 2022.09.21
</p>
<p class="p-sketch-outline__description">wms made with various simple objects.</p>
- </div>
- <canvas class="p-canvas-webgl" id="canvas-webgl"></canvas>
</div>
- <!-- 渚ц竟鏍� -->
- <div id="sidebar">
- <div class="login-contain">
+ <canvas class="p-canvas-webgl" id="canvas-webgl"></canvas>
+</div>
+<!-- 渚ц竟鏍� -->
+<div id="sidebar">
+ <div class="login-contain">
<div class="login-box">
- <img src="../static/image/logo.png" alt="" style="width: 80%">
- <span class="login100-form-title p-t-20 p-b-45">涓壃绔嬪簱</span>
- <span class="login100-form-title p-t-20 p-b-45" style="margin: 15px 0;color: #868686;font-size: 24px">WMS</span>
- <div class="wrap-input100 validate-input m-b-10" data-validate="璇疯緭鍏ョ敤鎴峰悕">
- <input class="input100" type="text" name="username" placeholder="username" autocomplete="off">
- <span class="focus-input100"></span>
- <span class="symbol-input100">
+ <img src="../static/image/zy_logo_dark_color.png" alt="" style="width: 80%">
+ <!-- <span class="login100-form-title p-t-20 p-b-45">涓壃绔嬪簱</span>-->
+ <!-- <span class="login100-form-title p-t-20 p-b-45" style="margin: 15px 0;color: #868686;font-size: 24px">WMS</span>-->
+ <div class="login-system-name" id="wmsTrigger">WMS</div>
+ <div class="wrap-input100 validate-input m-b-10" data-validate="璇疯緭鍏ョ敤鎴峰悕">
+ <input id="username" class="input100" type="text" name="username" placeholder="username"
+ autocomplete="off">
+ <span class="focus-input100"></span>
+ <span class="symbol-input100">
<i class="fa fa-user"></i>
</span>
- </div>
- <div class="wrap-input100 validate-input m-b-10" data-validate="璇疯緭鍏ュ瘑鐮�">
- <input class="input100" type="password" name="pass" placeholder="password">
- <span class="focus-input100"></span>
- <span class="symbol-input100">
+ </div>
+ <div class="wrap-input100 validate-input m-b-10" data-validate="璇疯緭鍏ュ瘑鐮�">
+ <input id="password" class="input100" type="password" name="pass" placeholder="password">
+ <span class="focus-input100"></span>
+ <span class="symbol-input100">
<i class="fa fa-lock"></i>
</span>
- </div>
- <div class="container-login100-form-btn p-t-10">
- <button class="login100-form-btn">Login</button>
- </div>
+ </div>
+ <div class="container-login100-form-btn p-t-10">
+ <button class="login100-form-btn login-btn">Login</button>
+ </div>
+ <div class="license-entry-wrap" style="display: none;" id="updateLicense">
+ <div class="license-entry-text" id="licenseEntryMessage">绯荤粺褰撳墠鏈娴嬪埌鍙敤璁稿彲璇侊紝璇锋墦寮�璇佷功宸ュ叿澶勭悊璁稿彲璇併��</div>
+ <button class="login100-form-btn" id="openLicenseTool" type="button">璇佷功</button>
+ </div>
</div>
- </div>
</div>
+</div>
- <script type="text/javascript" src="../static/js/tools/main.min.js"></script>
- <script type="text/javascript" src="../static/js/jquery/jquery-3.3.1.min.js"></script>
- <script type="text/javascript" src="../static/js/tools/md5.js"></script>
- <script>
- window.onload = function(){document.getElementById("username").focus();}
-
- $(document).on('click','.login-btn', function () {
- window.location.href = "../index.html"
- });
-
- $('body').keydown(function () {
- if (event.keyCode === 13) {
- $(".login-btn").click();
+<script type="text/javascript" src="../static/js/tools/main.min.js"></script>
+<script type="text/javascript" src="../static/js/jquery/jquery-3.3.1.min.js"></script>
+<script type="text/javascript" src="../static/js/tools/md5.js"></script>
+<script type="text/javascript" src="../static/layer/layer.js"></script>
+<script type="text/javascript" src="../static/js/common.js"></script>
+<script>
+ // remember pwd
+ $(function () {
+ var oldUserName = localStorage.getItem('oldUserName');
+ var oldPass = localStorage.getItem('oldPass');
+ if (oldUserName) {
+ $('#username').val(oldUserName);
}
- });
- </script>
- </body>
+ if (oldPass) {
+ $('#password').val(oldPass);
+ }
+ autoShowLicenseTool();
+ })
+
+ window.onload = function () {
+ document.getElementById("username").focus();
+ }
+
+ var licenseToolState = {
+ toolLayerIndex: null,
+ textLayerIndex: null,
+ uploadLayerIndex: null
+ };
+ var wmsTriggerState = {
+ count: 0,
+ lastClickTime: 0
+ };
+
+ function getQueryValue(name) {
+ var query = window.location.search.substring(1).split("&");
+ for (var i = 0; i < query.length; i++) {
+ var item = query[i].split("=");
+ if (item[0] === name) {
+ return decodeURIComponent(item[1] || "");
+ }
+ }
+ return "";
+ }
+
+ function autoShowLicenseTool() {
+ var needOpen = getQueryValue("license") === "invalid" || sessionStorage.getItem("licensePanelAutoOpen") === "1";
+ if (!needOpen) {
+ return;
+ }
+ verifyLicenseAvailability(function (isValid) {
+ if (isValid) {
+ clearLicensePromptState();
+ hideLicenseEntry();
+ clearLicenseQueryFlag();
+ return;
+ }
+ var message = sessionStorage.getItem("licenseInvalidReason") || "绯荤粺褰撳墠鏈娴嬪埌鍙敤璁稿彲璇侊紝璇峰厛瀵煎叆鏂扮殑璁稿彲璇併��";
+ showLicenseEntry(message);
+ openLicenseTool(message);
+ });
+ }
+
+ function showLicenseEntry(message, showMessage) {
+ $("#updateLicense").show();
+ if (showMessage === false) {
+ $("#licenseEntryMessage").text("濡傞渶鏇存柊璁稿彲锛岃鐐瑰嚮璇佷功宸ュ叿銆�");
+ $("#licenseEntryMessage").hide();
+ return;
+ }
+ $("#licenseEntryMessage").show();
+ if (message) {
+ $("#licenseEntryMessage").text(message);
+ }
+ }
+
+ function hideLicenseEntry() {
+ $("#updateLicense").hide();
+ }
+
+ function clearLicensePromptState() {
+ sessionStorage.removeItem("licensePanelAutoOpen");
+ sessionStorage.removeItem("licenseInvalidReason");
+ }
+
+ function clearLicenseQueryFlag() {
+ if (window.history && window.history.replaceState && getQueryValue("license") === "invalid") {
+ window.history.replaceState(null, document.title, window.location.pathname);
+ }
+ }
+
+ function verifyLicenseAvailability(callback) {
+ $.ajax({
+ url: baseUrl + "/license/getLicenseDays",
+ method: 'GET',
+ success: function (res) {
+ if (res.code == 200) {
+ var days = Number(getResponseValue(res));
+ callback(!isNaN(days) && days >= 0);
+ return;
+ }
+ callback(false);
+ },
+ error: function () {
+ callback(false);
+ }
+ });
+ }
+
+ function handleWmsTriggerClick() {
+ var now = new Date().getTime();
+ if (now - wmsTriggerState.lastClickTime <= 1500) {
+ wmsTriggerState.count += 1;
+ } else {
+ wmsTriggerState.count = 1;
+ }
+ wmsTriggerState.lastClickTime = now;
+ if (wmsTriggerState.count < 3) {
+ return;
+ }
+ wmsTriggerState.count = 0;
+ wmsTriggerState.lastClickTime = 0;
+ showLicenseEntry("", false);
+ layer.msg('璇佷功鍏ュ彛宸叉樉绀�', {time: 1200});
+ }
+
+ function escapeHtml(text) {
+ return String(text || "")
+ .replace(/&/g, "&")
+ .replace(/</g, "<")
+ .replace(/>/g, ">")
+ .replace(/\"/g, """)
+ .replace(/'/g, "'");
+ }
+
+ function buildLicenseToolContent() {
+ return ''
+ + '<div class="system-tool-shell">'
+ + ' <div class="system-tool-header">'
+ + ' <div class="system-tool-title">绯荤粺宸ュ叿</div>'
+ + ' <span class="system-tool-close" id="toolClose">脳</span>'
+ + ' </div>'
+ + ' <div class="system-tool-body">'
+ + ' <div class="system-tool-group">'
+ + ' <div class="system-tool-group-title">鎺ㄨ崘鎿嶄綔</div>'
+ + ' <div class="system-tool-actions">'
+ + ' <button type="button" class="system-tool-btn primary" id="toolRequestCode">鑾峰彇璇锋眰鐮�</button>'
+ + ' <button type="button" class="system-tool-btn secondary" id="toolActivate">涓�閿縺娲�</button>'
+ + ' </div>'
+ + ' <div class="system-tool-desc">浼樺厛浣跨敤鈥滆幏鍙栬姹傜爜鈥濆拰鈥滀竴閿縺娲烩�濆畬鎴愯鍙瘉鐢宠涓庢縺娲汇��</div>'
+ + ' </div>'
+ + ' <div class="system-tool-group">'
+ + ' <div class="system-tool-group-title">鍏朵粬宸ュ叿</div>'
+ + ' <div class="system-tool-actions">'
+ + ' <button type="button" class="system-tool-btn" id="toolProjectName">鑾峰彇椤圭洰鍚嶇О</button>'
+ + ' <button type="button" class="system-tool-btn" id="toolServerInfo">鑾峰彇绯荤粺閰嶇疆</button>'
+ + ' <button type="button" class="system-tool-btn" id="toolInputLicense">褰曞叆璁稿彲璇�</button>'
+ + ' </div>'
+ + ' </div>'
+ + ' </div>'
+ + '</div>';
+ }
+
+ function openLicenseTool(message) {
+ var toolMessage = message || $("#licenseEntryMessage").text() || "绯荤粺褰撳墠鏈娴嬪埌鍙敤璁稿彲璇侊紝璇峰厛瀵煎叆鏂扮殑璁稿彲璇併��";
+ var toolWidth = Math.min($(window).width() - 32, 760);
+ showLicenseEntry(toolMessage);
+ if (licenseToolState.toolLayerIndex !== null) {
+ layer.close(licenseToolState.toolLayerIndex);
+ }
+ licenseToolState.toolLayerIndex = layer.open({
+ type: 1,
+ title: false,
+ closeBtn: 0,
+ area: [Math.min(toolWidth, 560) + 'px', 'auto'],
+ shadeClose: false,
+ skin: 'system-tool-popup',
+ content: buildLicenseToolContent(),
+ success: function (layero, index) {
+ licenseToolState.toolLayerIndex = index;
+ bindLicenseToolEvents(layero);
+ },
+ end: function () {
+ licenseToolState.toolLayerIndex = null;
+ }
+ });
+ }
+
+ function bindLicenseToolEvents(layero) {
+ layero.find("#toolClose").on("click", function () {
+ layer.close(licenseToolState.toolLayerIndex);
+ });
+ layero.find("#toolRequestCode").on("click", function () {
+ requestCode();
+ });
+ layero.find("#toolActivate").on("click", function () {
+ activateLicense();
+ });
+ layero.find("#toolProjectName").on("click", function () {
+ getProjectName();
+ });
+ layero.find("#toolServerInfo").on("click", function () {
+ getServerInfo();
+ });
+ layero.find("#toolInputLicense").on("click", function () {
+ openLicenseInputDialog();
+ });
+ }
+
+ 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 openTextDialog(title, label, text, tip) {
+ var prettyText = "";
+ try {
+ prettyText = typeof text === "string" ? text : JSON.stringify(text, null, 2);
+ } catch (e) {
+ prettyText = String(text || "");
+ }
+ if (licenseToolState.textLayerIndex !== null) {
+ layer.close(licenseToolState.textLayerIndex);
+ }
+ licenseToolState.textLayerIndex = layer.open({
+ type: 1,
+ title: false,
+ closeBtn: 0,
+ area: [Math.min($(window).width() - 32, 720) + 'px', 'auto'],
+ shadeClose: false,
+ skin: 'system-tool-popup',
+ content: ''
+ + '<div class="system-dialog-shell">'
+ + ' <div class="system-dialog-header">'
+ + ' <div class="system-dialog-title">' + escapeHtml(title) + '</div>'
+ + ' <span class="system-dialog-close" id="systemTextClose">脳</span>'
+ + ' </div>'
+ + ' <div class="system-dialog-body">'
+ + ' <div class="system-dialog-label">' + escapeHtml(label) + '</div>'
+ + (tip ? '<div class="system-dialog-tip">' + escapeHtml(tip) + '</div>' : '')
+ + ' <textarea class="system-dialog-textarea" id="systemDialogText" readonly></textarea>'
+ + ' <div class="system-dialog-footer">'
+ + ' <button type="button" class="system-tool-btn" id="systemTextCloseBtn">鍏抽棴</button>'
+ + ' <button type="button" class="system-tool-btn primary" id="systemTextCopy">澶嶅埗</button>'
+ + ' </div>'
+ + ' </div>'
+ + '</div>',
+ success: function (layero, index) {
+ licenseToolState.textLayerIndex = index;
+ layero.find("#systemDialogText").val(prettyText);
+ layero.find("#systemTextClose, #systemTextCloseBtn").on("click", function () {
+ layer.close(index);
+ });
+ layero.find("#systemTextCopy").on("click", function () {
+ copyRequestCodeText(prettyText);
+ });
+ },
+ end: function () {
+ licenseToolState.textLayerIndex = null;
+ }
+ });
+ }
+
+ function openLicenseInputDialog() {
+ if (licenseToolState.uploadLayerIndex !== null) {
+ layer.close(licenseToolState.uploadLayerIndex);
+ }
+ licenseToolState.uploadLayerIndex = layer.open({
+ type: 1,
+ title: false,
+ closeBtn: 0,
+ area: [Math.min($(window).width() - 32, 760) + 'px', 'auto'],
+ shadeClose: false,
+ skin: 'system-tool-popup',
+ content: ''
+ + '<div class="system-dialog-shell">'
+ + ' <div class="system-dialog-header">'
+ + ' <div class="system-dialog-title">褰曞叆璁稿彲璇�</div>'
+ + ' <span class="system-dialog-close" id="licenseInputClose">脳</span>'
+ + ' </div>'
+ + ' <div class="system-dialog-body">'
+ + ' <div class="system-dialog-label">璁稿彲璇� Base64</div>'
+ + ' <div class="system-dialog-tip">灏嗚鍙瘉鏈嶅姟绔繑鍥炵殑 license 瀛楁瀹屾暣绮樿创鍒拌繖閲屻��</div>'
+ + ' <textarea class="system-dialog-textarea" id="licenseInputValue"></textarea>'
+ + ' <div class="system-dialog-footer">'
+ + ' <button type="button" class="system-tool-btn" id="licenseInputCancel">鍙栨秷</button>'
+ + ' <button type="button" class="system-tool-btn primary" id="licenseInputSubmit">鎻愪氦</button>'
+ + ' </div>'
+ + ' </div>'
+ + '</div>',
+ success: function (layero, index) {
+ licenseToolState.uploadLayerIndex = index;
+ layero.find("#licenseInputClose, #licenseInputCancel").on("click", function () {
+ layer.close(index);
+ });
+ layero.find("#licenseInputSubmit").on("click", function () {
+ submitLicense(layero.find("#licenseInputValue").val());
+ });
+ },
+ end: function () {
+ licenseToolState.uploadLayerIndex = null;
+ }
+ });
+ }
+
+ function requestCode() {
+ fetchRequestCode(function (value, errorMsg) {
+ if (value) {
+ openTextDialog("鑾峰彇璇锋眰鐮�", "璇锋眰鐮�", value, "璇锋眰鐮佷腑宸插寘鍚」鐩悕绉帮紝鐩存帴鍙戠粰璁稿彲璇佹湇鍔$鍗冲彲銆�");
+ return;
+ }
+ layer.msg(errorMsg || '鑾峰彇璇锋眰鐮佸け璐�', {time: 2000});
+ });
+ }
+
+ function fetchRequestCode(callback) {
+ $.ajax({
+ url: baseUrl + "/license/getRequestCode",
+ method: 'GET',
+ success: function (res) {
+ var value = getResponseValue(res);
+ if (res.code == 200) {
+ callback(value ? String(value) : "", "");
+ return;
+ }
+ callback("", res.msg || '鑾峰彇璇锋眰鐮佸け璐�');
+ },
+ error: function (xhr) {
+ callback("", xhr && xhr.status === 404 ? "鑾峰彇璇锋眰鐮佹帴鍙d笉瀛樺湪" : "鑾峰彇璇锋眰鐮佸け璐�");
+ }
+ })
+ }
+
+ function getProjectName() {
+ $.ajax({
+ url: baseUrl + "/license/getProjectName",
+ method: 'GET',
+ success: function (res) {
+ var value = getResponseValue(res);
+ if (res.code == 200 && value) {
+ layer.alert(escapeHtml(String(value)), {
+ title: '椤圭洰鍚嶇О'
+ });
+ return;
+ }
+ layer.msg(res.msg || '鑾峰彇椤圭洰鍚嶇О澶辫触', {time: 2000});
+ },
+ error: function () {
+ layer.msg('鑾峰彇椤圭洰鍚嶇О澶辫触', {time: 2000});
+ }
+ })
+ }
+
+ function getServerInfo() {
+ $.ajax({
+ url: baseUrl + "/license/getServerInfos",
+ method: 'GET',
+ success: function (res) {
+ openTextDialog("鑾峰彇绯荤粺閰嶇疆", "绯荤粺閰嶇疆淇℃伅", res, "鏂拌鍙瘉妯″紡涓嬪彲鐢ㄤ簬鎺掓煡褰撳墠鑺傜偣纭欢缁戝畾淇℃伅銆�");
+ },
+ error: function () {
+ fallbackServerInfoFromRequestCode();
+ }
+ })
+ }
+
+ function fallbackServerInfoFromRequestCode() {
+ fetchRequestCode(function (requestCode, errorMsg) {
+ if (!requestCode) {
+ layer.msg(errorMsg || '鑾峰彇绯荤粺閰嶇疆淇℃伅澶辫触', {time: 2000});
+ return;
+ }
+ try {
+ var decoded = decodeRequestCodePayload(requestCode);
+ var node = (((decoded || {}).licenseBind || {}).nodes || [])[0] || {};
+ var serverInfo = {
+ subject: decoded.subject || "",
+ nodeId: node.nodeId || "",
+ ipAddress: node.ipAddress || [],
+ macAddress: node.macAddress || [],
+ cpuSerial: node.cpuSerial || "",
+ mainBoardSerial: node.mainBoardSerial || ""
+ };
+ openTextDialog("鑾峰彇绯荤粺閰嶇疆", "绯荤粺閰嶇疆淇℃伅", serverInfo, "褰撳墠鎺ュ彛涓嶅彲鐢紝宸叉寜璇锋眰鐮佽В鏋愬嚭鏈満鑺傜偣閰嶇疆銆�");
+ } catch (e) {
+ layer.msg('鑾峰彇绯荤粺閰嶇疆淇℃伅澶辫触', {time: 2000});
+ }
+ });
+ }
+
+ function decodeRequestCodePayload(requestCode) {
+ var normalized = String(requestCode || "").replace(/\s+/g, "");
+ if (!normalized) {
+ return {};
+ }
+ var binary = window.atob(normalized);
+ var bytes = [];
+ for (var i = 0; i < binary.length; i++) {
+ bytes.push("%" + ("00" + binary.charCodeAt(i).toString(16)).slice(-2));
+ }
+ return JSON.parse(decodeURIComponent(bytes.join("")));
+ }
+
+ function activateLicense() {
+ layer.confirm('纭畾鎵ц涓�閿縺娲诲悧锛�', {
+ title: '鎻愮ず'
+ }, function (index) {
+ layer.close(index);
+ $.ajax({
+ url: baseUrl + "/license/activate",
+ method: 'POST',
+ success: function (res) {
+ if (res.code == 200) {
+ layer.msg('婵�娲绘垚鍔�', {time: 1500});
+ return;
+ }
+ layer.msg(res.msg || '婵�娲诲け璐�', {time: 2000});
+ },
+ error: function () {
+ layer.msg('婵�娲诲け璐�', {time: 2000});
+ }
+ })
+ });
+ }
+
+ function submitLicense(licenseBase64) {
+ if (!licenseBase64 || !licenseBase64.trim()) {
+ layer.msg('璁稿彲璇佸唴瀹逛笉鑳戒负绌�', {time: 1500});
+ return;
+ }
+ $.ajax({
+ url: baseUrl + "/license/updateLicense",
+ headers: {'Content-Type': 'application/json'},
+ data: JSON.stringify({license: licenseBase64.trim()}),
+ method: 'POST',
+ success: function (res) {
+ if (res.code == 200) {
+ clearLicensePromptState();
+ clearLicenseQueryFlag();
+ if (licenseToolState.uploadLayerIndex !== null) {
+ layer.close(licenseToolState.uploadLayerIndex);
+ }
+ layer.msg('璁稿彲璇佹洿鏂版垚鍔�', {time: 1000}, function () {
+ parent.location.reload();
+ });
+ return;
+ }
+ layer.msg(res.msg || '璁稿彲璇佹洿鏂板け璐�', {time: 2000});
+ },
+ error: function (xhr) {
+ if (xhr && xhr.status === 403) {
+ layer.msg('璁稿彲璇佸綍鍏ユ帴鍙h鎷︽埅锛岃閲嶅惎鏈嶅姟鍚庨噸璇�', {time: 2500});
+ return;
+ }
+ layer.msg('璁稿彲璇佸綍鍏ュけ璐�', {time: 2000});
+ }
+ });
+ }
+
+ function copyRequestCodeText(text) {
+ if (!text) {
+ layer.msg('璇锋眰鐮佷负绌�', {time: 1500});
+ return;
+ }
+ if (navigator.clipboard && window.isSecureContext) {
+ navigator.clipboard.writeText(text).then(function () {
+ layer.msg('璇锋眰鐮佸凡澶嶅埗', {time: 1200});
+ }, function () {
+ fallbackCopy(text);
+ });
+ return;
+ }
+ fallbackCopy(text);
+ }
+
+ function fallbackCopy(text) {
+ var copyInput = $("<textarea>").val(text).css({
+ position: "fixed",
+ top: "-1000px"
+ }).appendTo("body");
+ copyInput[0].select();
+ try {
+ document.execCommand("copy");
+ layer.msg('璇锋眰鐮佸凡澶嶅埗', {time: 1200});
+ } catch (e) {
+ layer.msg('澶嶅埗澶辫触锛岃鎵嬪姩澶嶅埗', {time: 1500});
+ }
+ copyInput.remove();
+ }
+
+ $(document).on('click', '.login-btn', function () {
+ let username = $("#username").val();
+ if (username === "") {
+ layer.tips('璇疯緭鍏ョ櫥褰曡处鍙�', '#username', {tips: [4, '#ff0000']});
+ return;
+ }
+ let password = $("#password").val();
+ if (password === "") {
+ layer.tips('璇疯緭鍏ュ瘑鐮�', '#password', {tips: [4, '#ff0000']});
+ return;
+ }
+ let params = {username: username, password: hex_md5(password)}
+ $.ajax({
+ url: baseUrl + "/login.action",
+ headers: {'Content-Type': 'application/json'},
+ data: JSON.stringify(params),
+ method: 'POST',
+ success: function (res) {
+ if (res.code === 200) {
+ clearLicensePromptState();
+ clearLicenseQueryFlag();
+ localStorage.setItem("token", res.data.token);
+ localStorage.setItem("username", res.data.username);
+ window.location.href = "index.html";
+ } else if (res.code === 10001) {
+ layer.tips(res.msg, '#username', {tips: [4, '#ff0000']});
+ } else if (res.code === 10002) {
+ layer.tips(res.msg, '#username', {tips: [4, '#ff0000']});
+ } else if (res.code === 10003) {
+ layer.tips(res.msg, '#password', {tips: [4, '#ff0000']});
+ } else if (res.code == 20001) {
+ layer.tips(res.msg, '.login-btn', {tips: [3, '#ff0000']});
+ showLicenseEntry(res.msg, true)
+ openLicenseTool(res.msg)
+ } else {
+ layer.tips(res.msg, '.login-btn', {tips: [3, '#ff0000']});
+ }
+ }
+ });
+ });
+
+ $('body').keydown(function () {
+ if (event.keyCode === 13) {
+ $(".login-btn").click();
+ }
+ });
+
+ $("#openLicenseTool").on("click", () => {
+ var message = $("#licenseEntryMessage").is(":visible") ? $("#licenseEntryMessage").text() : "濡傞渶鏇存柊璁稿彲锛岃鐐瑰嚮璇佷功宸ュ叿銆�";
+ openLicenseTool(message);
+ });
+
+ $("#wmsTrigger").on("click", function () {
+ handleWmsTriggerClick();
+ });
+</script>
+</body>
</html>
--
Gitblit v1.9.1