From 576ace34db9089b836c714d0c931c57f9009a84b Mon Sep 17 00:00:00 2001 From: wangxy <1481820854@qq.com> Date: Wed, 7 May 2025 08:51:41 +0800 Subject: [PATCH] =?UTF-8?q?feat:ueky=E6=8B=94=E5=87=BA=E9=80=80=E5=87=BA?= =?UTF-8?q?=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/system/SysIndexController.java | 16 ++++- .../src/main/resources/static/ruoyi/ukey.js | 50 +++++++++++++++ .../src/main/resources/templates/index.html | 64 +++++++++++++++++++ .../templates/system/user/resetUeky.html | 2 +- .../common/core/domain/entity/SysUser.java | 3 + .../shiro/service/SysLoginService.java | 19 ++++-- .../resources/mapper/system/SysUserMapper.xml | 1 + 7 files changed, 145 insertions(+), 10 deletions(-) create mode 100644 ruoyi-admin/src/main/resources/static/ruoyi/ukey.js diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/system/SysIndexController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/system/SysIndexController.java index 20fce80f..3ea8dc2d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/system/SysIndexController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/system/SysIndexController.java @@ -2,8 +2,11 @@ package com.ruoyi.web.controller.system.system; import java.util.Date; import java.util.List; +import java.util.Objects; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.system.service.ISysUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -28,7 +31,7 @@ import com.ruoyi.system.service.ISysMenuService; /** * 首页 业务处理 - * + * * @author ruoyi */ @Controller @@ -43,6 +46,10 @@ public class SysIndexController extends BaseController @Autowired private SysPasswordService passwordService; + @Autowired + private ISysUserService userService; + + // 系统首页 @GetMapping("/index") public String index(ModelMap mmap) @@ -65,7 +72,12 @@ public class SysIndexController extends BaseController mmap.put("isDefaultModifyPwd", initPasswordIsModify(user.getPwdUpdateDate())); mmap.put("isPasswordExpired", passwordIsExpiration(user.getPwdUpdateDate())); mmap.put("isMobile", ServletUtils.checkAgentIsMobile(ServletUtils.getRequest().getHeader("User-Agent"))); - + //获取系统登录的方式 + SysUser sysUser = userService.lambdaQuery().select(SysUser::getIsWay) + .eq(SysUser::getUserId, user.getUserId()).one(); + if(Objects.nonNull(sysUser)){ + mmap.put("isWay", sysUser.getIsWay()); + } // 菜单导航显示风格 String menuStyle = configService.selectConfigByKey("sys.index.menuStyle"); // 移动端,默认使左侧导航菜单,否则取默认配置 diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/ukey.js b/ruoyi-admin/src/main/resources/static/ruoyi/ukey.js new file mode 100644 index 00000000..e3ab01f9 --- /dev/null +++ b/ruoyi-admin/src/main/resources/static/ruoyi/ukey.js @@ -0,0 +1,50 @@ +function customFireEvent(objId, eventName) { + var obj = document.getElementById(objId); + if (obj == undefined) { + return; + } + if (obj.fireEvent) { + obj.fireEvent("on" + eventName); + } else if (obj.dispatchEvent) { + var e = document.createEvent('HTMLEvents'); + e.initEvent(eventName, false, false); + obj.dispatchEvent(e); + } +} +function FillDeviceList() { + GetAllDeviceSN(function (retObj) { + var obj = document.getElementById("id_device_list"); + if (obj == undefined) { + return; + } + var i, n = obj.length; + for (i = 0; i < n; i++) { + obj.remove(0); + } + var strDeviceList = retObj.retVal; + while (true) { + var pos = strDeviceList.indexOf(";"); + if (pos <= 0) { + break; + } + var strOneDevice = strDeviceList.substring(0, pos); + var objItem = new Option(strOneDevice, strOneDevice); + obj.options.add(objItem); + var len = strDeviceList.length; + strDeviceList = strDeviceList.substring(pos + 1, len); + } + customFireEvent('id_cert_list', 'change'); + customFireEvent('id_device_list', 'change'); + }); +} +function select_cert(value) { + $("#id_selected_cert_id").val(value); +} +function select_device(value) { + $("#id_selected_device_sn").val(value); +} +SetUserCertList("id_cert_list"); +FillDeviceList(); +SetOnUsbKeyChangeCallBack(FillDeviceList); + + diff --git a/ruoyi-admin/src/main/resources/templates/index.html b/ruoyi-admin/src/main/resources/templates/index.html index 21bb1467..b3dd6652 100644 --- a/ruoyi-admin/src/main/resources/templates/index.html +++ b/ruoyi-admin/src/main/resources/templates/index.html @@ -257,6 +257,38 @@
+ + + + + @@ -272,6 +304,9 @@ + + +