瀏覽代碼

修复war包部署情况下404、500等页面样式丢失问题

RuoYi 5 年之前
父節點
當前提交
b32111f1ab

+ 4 - 4
ruoyi-admin/src/main/resources/templates/error/404.html

@@ -4,9 +4,9 @@
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <title>RuoYi - 404</title>
-    <link href="/css/bootstrap.min.css" rel="stylesheet"/>
-    <link href="/css/animate.css" rel="stylesheet"/>
-    <link href="/css/style.css" rel="stylesheet"/>
+    <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
+    <link th:href="@{/css/animate.css}" rel="stylesheet"/>
+    <link th:href="@{/css/style.css}" rel="stylesheet"/>
 </head>
 <body class="gray-bg">
     <div class="middle-box text-center animated fadeInDown">
@@ -14,7 +14,7 @@
         <h3 class="font-bold">找不到网页!</h3>
         <div class="error-desc">
                                 对不起,您正在寻找的页面不存在。尝试检查URL的错误,然后按浏览器上的刷新按钮或尝试在我们的应用程序中找到其他内容。
-            <a href="javascript:top.document.location.href='/'" class="btn btn-primary m-t">主页</a>
+            <a th:href="@{/index}" class="btn btn-primary m-t">主页</a>
         </div>
     </div>
 </body>

+ 4 - 4
ruoyi-admin/src/main/resources/templates/error/500.html

@@ -4,9 +4,9 @@
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <title>RuoYi - 500</title>
-	<link href="/css/bootstrap.min.css" rel="stylesheet"/>
-    <link href="/css/animate.css" rel="stylesheet"/>
-    <link href="/css/style.css" rel="stylesheet"/>
+	<link th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
+    <link th:href="@{/css/animate.css}" rel="stylesheet"/>
+    <link th:href="@{/css/style.css}" rel="stylesheet"/>
 </head>
 <body class="gray-bg">
     <div class="middle-box text-center animated fadeInDown">
@@ -15,7 +15,7 @@
 
         <div class="error-desc">
                                 服务器遇到意外事件,不允许完成请求。我们抱歉。您可以返回主页面。
-            <a href="javascript:top.document.location.href='/'" class="btn btn-primary m-t">主页</a>
+            <a th:href="@{/index}" class="btn btn-primary m-t">主页</a>
         </div>
     </div>
 </body>

+ 3 - 3
ruoyi-admin/src/main/resources/templates/error/business.html

@@ -4,9 +4,9 @@
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <title>RuoYi - 403</title>
-	<link href="/css/bootstrap.min.css" rel="stylesheet"/>
-    <link href="/css/animate.css" rel="stylesheet"/>
-    <link href="/css/style.css" rel="stylesheet"/>
+	<link th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
+    <link th:href="@{/css/animate.css}" rel="stylesheet"/>
+    <link th:href="@{/css/style.css}" rel="stylesheet"/>
 </head>
 <body class="gray-bg">
     <div class="middle-box text-center animated fadeInDown">

+ 4 - 4
ruoyi-admin/src/main/resources/templates/error/unauth.html

@@ -4,9 +4,9 @@
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <title>RuoYi - 403</title>
-	<link href="/css/bootstrap.min.css" rel="stylesheet"/>
-    <link href="/css/animate.css" rel="stylesheet"/>
-    <link href="/css/style.css" rel="stylesheet"/>
+	<link th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
+    <link th:href="@{/css/animate.css}" rel="stylesheet"/>
+    <link th:href="@{/css/style.css}" rel="stylesheet"/>
 </head>
 <body class="gray-bg">
     <div class="middle-box text-center animated fadeInDown">
@@ -15,7 +15,7 @@
 
         <div class="error-desc">
                                 对不起,您没有访问权限,请不要进行非法操作!您可以返回主页面
-            <a href="javascript:top.document.location.href='/'" class="btn btn-outline btn-primary btn-xs">返回主页</a>
+            <a th:href="@{/index}" class="btn btn-outline btn-primary btn-xs">返回主页</a>
         </div>
     </div>
 </body>

+ 9 - 9
ruoyi-generator/src/main/resources/vm/java/controller.java.vm

@@ -46,30 +46,30 @@ public class ${ClassName}Controller extends BaseController
         return prefix + "/${businessName}";
     }
 
-#if($table.tree)
+#if($table.crud)
     /**
-     * 查询${functionName}列表
+     * 查询${functionName}列表
      */
     @RequiresPermissions("${permissionPrefix}:list")
     @PostMapping("/list")
     @ResponseBody
-    public List<${ClassName}> list(${ClassName} ${className})
+    public TableDataInfo list(${ClassName} ${className})
     {
+        startPage();
         List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
-        return list;
+        return getDataTable(list);
     }
-#elseif($table.crud)
+#elseif($table.tree)
     /**
-     * 查询${functionName}列表
+     * 查询${functionName}列表
      */
     @RequiresPermissions("${permissionPrefix}:list")
     @PostMapping("/list")
     @ResponseBody
-    public TableDataInfo list(${ClassName} ${className})
+    public List<${ClassName}> list(${ClassName} ${className})
     {
-        startPage();
         List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
-        return getDataTable(list);
+        return list;
     }
 #end