Browse Source

更改CSS

1037015548@qq.com 2 years ago
parent
commit
f4b94dc9ab

+ 35 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysIndexController.java

@@ -1,5 +1,6 @@
 package com.ruoyi.web.controller.system;
 
+import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.Date;
 import java.util.List;
@@ -8,6 +9,8 @@ import javax.servlet.ServletRequest;
 import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletResponse;
 
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.*;
 import com.ruoyi.system.domain.Dangan;
 import com.ruoyi.system.domain.SysConfig;
@@ -15,6 +18,7 @@ import com.ruoyi.system.domain.UserRelate;
 import com.ruoyi.system.mapper.SysConfigMapper;
 import com.ruoyi.system.service.IDanganService;
 import com.ruoyi.system.service.IUserRelateService;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Controller;
@@ -217,6 +221,26 @@ public class SysIndexController extends BaseController
         return "mainLhk";
     }
 
+
+    /**
+     * @Author Lx
+     * @Description //TODO 首页权限测试接口,调用即可 会被filter过滤,过期则返回登录
+     * @Date 15:43 2023/5/11
+     * @Param
+     * @return
+     **/
+    @PostMapping("/system/view/indexSession")
+    @ResponseBody
+    public AjaxResult indexSession(Dangan dangan)
+    {
+        SysUser user = getSysUser();
+        if (StringUtils.isNull(user))
+        {
+            return AjaxResult.error("服务器超时,请重新登录");
+        }
+        return AjaxResult.success();
+    }
+
     @GetMapping("/system/view")
     public String view(ModelMap mmap){
         String sessionId = ShiroUtils.getSessionId();
@@ -295,6 +319,17 @@ public class SysIndexController extends BaseController
             }
         }
         mmap.put("danganList",userRelates);
+        //TODO 如果集合数大于八个,那么则在底部显示, 以另外的新集合抽出,只支持显示四个
+        List<UserRelate> userRelateBottomList = new ArrayList<>();
+        if(!userRelates.isEmpty()&&userRelates.size()>8){
+            for (int i = 8; i < userRelates.size(); i++) {
+                if(userRelateBottomList.size()>=4){
+                    break;
+                }
+                userRelateBottomList.add(userRelates.get(i));
+            }
+        }
+        mmap.put("bottomDanganList",userRelateBottomList);
         return "view";
     }
 

+ 16 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/ActionApi.java

@@ -1,5 +1,6 @@
 package com.ruoyi.web.controller.tool;
 
+import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.system.domain.Dangan;
@@ -11,6 +12,8 @@ import com.ruoyi.system.service.IUserRelateService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.shiro.crypto.hash.Md5Hash;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -31,7 +34,7 @@ public class ActionApi {
 
     @Autowired
     private IDanganService danganService;
-
+    protected final Logger logger = LoggerFactory.getLogger(this.getClass());
 
     /**
      * JSESSIONID=abbf57c4-eb7e-4ce8-9556-061a1cb9c016
@@ -63,6 +66,18 @@ public class ActionApi {
 
         }
 
+        //TODO 新逻辑 传递的reqid加上了自定义的字符串newReqid+时间,
+        //TODO 所以要取掉该字符串以便保证原逻辑不变的情况下设定每分钟更新新的reqid的进行验证,即当前系统会话内每一分钟传递新的reqid
+        if(!StringUtils.isEmpty(validateMessage.getReqid())){
+            String reqid = validateMessage.getReqid();
+            if(reqid.indexOf("newReqid")>0){
+                StringBuilder stringBuilder = new StringBuilder(reqid);
+                stringBuilder.replace(reqid.indexOf("newReqid"),reqid.length(),"");
+                validateMessage.setReqid(stringBuilder.toString());
+            }
+        }else{
+            logger.error("子系统未传递reqid");
+        }
         SysUserOnline sysUserOnline = onlineService.selectOnlineById( validateMessage.getReqid());
 
         if (StringUtils.isNull(sysUserOnline)) {

+ 67 - 0
ruoyi-admin/src/main/resources/static/css/customPage.css

@@ -0,0 +1,67 @@
+:root {
+    --left-image-one: url("../images/icon-charge.png");
+    --left-image-two: url("../images/icon-bz.png");
+    --left-image-three: url("../images/icon-yyt.png");
+    --left-image-four: url("../images/icon-meter.png");
+}
+
+
+.middle-all-box {
+    position: absolute;
+    height: 100%;
+    width: 100%;
+    top: -30px;
+}
+
+.bottom-tag {
+    position: absolute;
+    height: 100px;
+    bottom: 62px;
+    display: flex;
+    align-items: center;
+    left: 244px;
+}
+
+.bottom-tag .tag-box {
+    width: 300px;
+    height: 66px;
+    display: flex;
+    align-items: center;
+    background: linear-gradient(88deg, rgb(255 255 255 / 0%), rgb(23 69 127 / 50%));
+    border-radius: 10px;
+}
+
+.bottom-tag .tag-box .image-show {
+    width: 100px;
+    height: 66px;
+    background-repeat: no-repeat;
+    background-size: 60px;
+    background-position: center;
+}
+
+
+.bottom-tag .tag-box .left-image1 {
+    background-image: var(--left-image-one)
+}
+
+.bottom-tag .tag-box .left-image2 {
+    background-image: var(--left-image-two);
+}
+
+.bottom-tag .tag-box .left-image3 {
+    background-image: var(--left-image-three);
+}
+
+.bottom-tag .tag-box .left-image4 {
+    background-image: var(--left-image-four);
+}
+
+.bottom-tag .tag-box .right-word {
+    font-size: 28px;
+    color: #ffffff;
+
+}
+
+.bottom-tag .two-box-margin {
+    margin-left: 224px;
+}

BIN
ruoyi-admin/src/main/resources/static/images/icon-bz.png


BIN
ruoyi-admin/src/main/resources/static/images/icon-charge.png


BIN
ruoyi-admin/src/main/resources/static/images/icon-meter.png


BIN
ruoyi-admin/src/main/resources/static/images/icon-yyt.png


+ 61 - 32
ruoyi-admin/src/main/resources/templates/view.html

@@ -27,6 +27,8 @@
 
     <link href="../css/weatherTime.css" rel="stylesheet">
 
+    <link href="../css/customPage.css" rel="stylesheet">
+
     <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
 </head>
 
@@ -74,7 +76,7 @@
                             </div>
                         </div>
                     </div>
-                    <div class="assembly-wrap right-wrap">
+                    <div class="assembly-wrap right-wrap" style="z-index: 9999!important;">
                         <div onclick="showMenu()">
                             <a title="设置" th:id="showMenuA" style="color: #FFFFFF!important;" href="#" id="showMenu">
                             <i class="fa fa-cog" style="color:#FFFFFF!important;font-size: 30px!important;"></i>
@@ -120,35 +122,42 @@
                             </div>
                         </div>
                     </div>
-                    <div class="assembly-wrap earth-text-wrap">
-                        <span class="component-element">
-                            <p class="earth-text-basic">
-                                <span class="earth-text-style"><!--{{companyName}}-->老河口清源供水</span>
-                            </p>
-                            <p class="earth-text-basic">
-                                <span class="earth-text-style"><!--{{sysName}}-->信息管理平台</span>
-                            </p>
-                        </span>
-                    </div>
-
+                    <div class="middle-all-box">
+                        <div class="assembly-wrap earth-text-wrap">
+                            <span class="component-element">
+                                <p class="earth-text-basic">
+                                    <span class="earth-text-style"><!--{{companyName}}-->老河口清源供水</span>
+                                </p>
+                                <p class="earth-text-basic">
+                                    <span class="earth-text-style"><!--{{sysName}}-->信息管理平台</span>
+                                </p>
+                            </span>
+                        </div>
 
-                    <div th:each="dangan:${danganList}" th:class="assembly-wrap+' '+${dangan.className}">
-                        <div class="component-element component-custom" style="position: relative;" >
-                            <div th:if="${dangan!=null}" th:class = "NavLinkContent+${danganStat.count}" th:onclick="opennewpage([[${dangan.danganUrl}]] ,[[${dangan.danganNums} ]]);">
-                            <!--<div class = "'NavLinkConte1nt'">-->
-                                <div class="ShowContent custom-content">
-                                    <div class="LeftPart custom-img"></div><!--暂时不用-->
-                                    <div class="RightPart">
-                                        <div class="RightPart_TopPart" th:text="${dangan.danganName}"><!--{{dangan.danganName}}--></div>
-                                        <div class="RightPart_BottomPart" th:if="${@dict.getLabel('sys_dangan_status', dangan.danganStatus)!=null&&@dict.getLabel('sys_dangan_status', dangan.danganStatus)!=''}" th:text="${@dict.getLabel('sys_dangan_status', dangan.danganStatus)}">
-                                            <!--{{item.introName}}-->
+                        <div th:each="dangan:${danganList}" th:class="assembly-wrap+' '+${dangan.className}">
+                            <div class="component-element component-custom" style="position: relative;" >
+                                <div th:if="${dangan!=null}" th:class = "NavLinkContent+${danganStat.count}" th:onclick="opennewpage([[${dangan.danganUrl}]] ,[[${dangan.danganNums} ]]);">
+                                <!--<div class = "'NavLinkConte1nt'">-->
+                                    <div class="ShowContent custom-content">
+                                        <div class="LeftPart custom-img"></div><!--暂时不用-->
+                                        <div class="RightPart">
+                                            <div class="RightPart_TopPart" th:text="${dangan.danganName}"><!--{{dangan.danganName}}--></div>
+                                            <div class="RightPart_BottomPart" th:if="${@dict.getLabel('sys_dangan_status', dangan.danganStatus)!=null&&@dict.getLabel('sys_dangan_status', dangan.danganStatus)!=''}" th:text="${@dict.getLabel('sys_dangan_status', dangan.danganStatus)}">
+                                                <!--{{item.introName}}-->
+                                            </div>
                                         </div>
                                     </div>
-                                </div>
-                            </divth>
+                                </divth>
+                            </div>
+                        </div>
+                    </div>
+                    </div>
+                    <div class="bottom-tag">
+                        <div th:each="bottomDangan:${bottomDanganList}" th:class="tag-box+' '+ ${bottomDanganStat.index == 2 ? 'two-box-margin':''}">
+                            <div th:class="image-show+' '+left-image+${bottomDanganStat.index+1}"></div>
+                            <div class="right-word" th:text="${bottomDangan.danganName}"></div>
                         </div>
                     </div>
-                </div>
             </div>
         </div>
 
@@ -176,20 +185,40 @@
     initTimer();
 
     var sessionId = [[${sessionId}]];
-    function opennewpage(url,danganLoginName) {
-
+    //TODO 将sessionId存储在内存中,并且每一分钟更新一次新的
+    sessionStorage.setItem("reqid",sessionId+"newReqid"+new Date().getTime());
+    setInterval(function () {
+        sessionStorage.setItem("reqid",sessionId+"newReqid"+new Date().getTime());
+    },60000);
 
+    var ctx = [[@{/}]];
+    function opennewpage(url,danganLoginName) {
         // window.location.href=url;
-        url = url+"?"+"reqid="+sessionId;
+        url = url+"?"+"reqid="+sessionStorage.getItem("reqid");
         console.log(url)
 
-        window.open(url)
+        //TODO 先跑一个接口进行会话验证,判断当前登录是否过期在进行跳转
+        var config = {
+            url:ctx+"system/view/indexSession",
+            type: "post",
+            dataType: "json",
+            data: {},
+            beforeSend: function() {
+
+            },
+            success: function(result) {
+                if (result.code === 0) {
+                    window.open(url);
+                }else{
+                    //TODO 说明是会话过期
+                    location.reload(true);
+                }
+            }
+        };
+        $.ajax(config);
         // console.log(danganLoginName)
         //
         // console.log(sessionId)
-
-
-
     }
 
     var menuFlag = top.window.tagMenu;