From d0ed00b27764d916a0ef8ee9731a4be9daa64e74 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@63.com> Date: 星期三, 08 二月 2023 10:34:36 +0800 Subject: [PATCH] # --- src/main/webapp/static/layui/lay/modules/admin.js | 16 ++++++++ src/main/java/com/zy/common/web/AuthController.java | 10 ++-- src/main/webapp/views/index.html | 55 +++++++++++++++++++++++++-- 3 files changed, 71 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/zy/common/web/AuthController.java b/src/main/java/com/zy/common/web/AuthController.java index b4a55a8..9c2bffa 100644 --- a/src/main/java/com/zy/common/web/AuthController.java +++ b/src/main/java/com/zy/common/web/AuthController.java @@ -355,14 +355,14 @@ } } - @PostMapping(value = "/system/secret/auth") + @PostMapping(value = "/system/license/auth") @ManagerAuth - public R systemSecret(@RequestParam(value = "secret") String secret) { - if (Cools.isEmpty(secret)) { + public R systemSecret(@RequestParam(value = "license") String license) { + if (Cools.isEmpty(license)) { return R.error("璇疯緭鍏ユ縺娲荤爜"); } // 楠岃瘉婵�娲荤爜 - String timeStr = AesUtils.decrypt(secret, SystemProperties.SALT); + String timeStr = AesUtils.decrypt(license, SystemProperties.SALT); if (null == timeStr) { return R.error("婵�娲荤爜閿欒"); } @@ -370,7 +370,7 @@ if (new Date().getTime() >= exprTime.getTime()) { return R.error("婵�娲荤爜宸插け鏁�"); } - boolean result = SystemProperties.saveActivationCode(OSinfo.getOSname().getActivationCodePath(), secret); + boolean result = SystemProperties.saveActivationCode(OSinfo.getOSname().getActivationCodePath(), license); if (!result) { return R.error("婵�娲诲け璐�"); } diff --git a/src/main/webapp/static/layui/lay/modules/admin.js b/src/main/webapp/static/layui/lay/modules/admin.js index fc8a4c4..9fd7c09 100644 --- a/src/main/webapp/static/layui/lay/modules/admin.js +++ b/src/main/webapp/static/layui/lay/modules/admin.js @@ -720,6 +720,22 @@ var option = admin.util.deepClone($(this).data()); admin.strToWin(option.window).layui.admin.open(admin.parseLayerOption(option)); }, + /* 婵�娲荤爜 */ + license: function () { + var option = admin.util.deepClone($(this).data()); + admin.strToWin(option.window).layui.admin.open({ + type: 1, + title: '鑾峰彇鎺堟潈', + offset: '150px', + area: ['360px'], + shade: 0.1, + shadeClose: true, + content: $("#license-box").html(), + success: function(layero, index){ + layer.iframeAuto(index); + } + }); + }, /* 鎵撳紑鍙充晶寮圭獥 */ popupRight: function () { var option = admin.util.deepClone($(this).data()); diff --git a/src/main/webapp/views/index.html b/src/main/webapp/views/index.html index cbe75fb..85e62d6 100644 --- a/src/main/webapp/views/index.html +++ b/src/main/webapp/views/index.html @@ -41,6 +41,9 @@ </li> </ul> <ul class="layui-nav layui-layout-right"> + <li class="layui-nav-item" lay-unselect id="activation-icon"> + <a ew-event="license" title="token"><i class="layui-icon layui-icon-auz"></i></a> + </li> <li class="layui-nav-item" lay-unselect> <a ew-event="note" title="渚跨"><i class="layui-icon layui-icon-note"></i></a> </li> @@ -102,13 +105,14 @@ base: baseUrl + "/static/layui/lay/modules/" }).extend({ notice: 'notice/notice', - }).use(['index', 'element', 'layer', 'admin', 'notice'], function () { + }).use(['index', 'element', 'layer', 'admin', 'notice', 'form'], function () { var $ = layui.jquery; var index = layui.index; var element = layui.element; var layer = layui.layer; var admin = layui.admin; var notice = layui.notice; + var form = layui.form; var easywebIframeMsg = localStorage.getItem("easyweb-iframe"); if (!isEmpty(easywebIframeMsg)) { @@ -119,12 +123,23 @@ } $.ajax({ + url: baseUrl + "/system/activation/auth", + method: 'GET', + async: false, + success: function (res) { + if (res.code === 200) { + $("#activation-icon").hide(); + } else { + $("#activation-icon").click(); + } + } + }); + + $.ajax({ url: baseUrl + "/menu/auth", headers: {'token': localStorage.getItem('token')}, method: 'POST', - // async: false, success: function (res) { - // 鍏抽棴鍔犺浇鍔ㄧ敾 $('.layuimini-loader').fadeOut(); if (res.code === 200) { var tpl = $('#menuTpl').html(); @@ -140,7 +155,26 @@ } }); - // 榛樿鍔犺浇涓婚〉 + form.on('submit(saveLicense)', function (data) { + $.ajax({ + url: baseUrl+"/system/license/auth", + headers: {'token': localStorage.getItem('token')}, + data: data.field, + method: 'POST', + success: function (res) { + if (res.code === 200) { + alert("鎺堟潈鎴愬姛"); + window.location.reload(); + } else if (res.code === 403) { + top.location.href = baseUrl+"/login"; + } else { + layer.msg(res.msg, {icon: 2}) + } + } + }); + return false; + }) + index.loadHome({ menuPath: baseUrl+'/views/home/navigation.html', menuName: '<i class="layui-icon layui-icon-home"></i>' @@ -155,7 +189,6 @@ admin.closeAllTabs(); }); - // 鏇挎崲閫�鍑烘寜閽彉閲� var logout = document.getElementById('logout'); var url = logout.getAttribute('href'); logout.setAttribute('href', baseUrl + "/login"); @@ -174,6 +207,18 @@ </li> {{/each}} </script> +<script type="text/html" id="license-box"> + <form class="layui-form" style="padding-right: 10px"> + <div class="layui-form-item" style="padding: 20px 25px"> + <textarea name="license" placeholder="璇疯緭鍏ユ縺娲荤爜" class="layui-textarea" autocomplete="off" + lay-verType="tips" lay-verify="required" required></textarea> + </div> + <div class="layui-form-item text-right"> + <button class="layui-btn layui-btn-normal" lay-filter="saveLicense" lay-submit="">纭畾</button> + <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">鍙栨秷</button> + </div> + </form> +</script> </body> </html> -- Gitblit v1.9.1