Bladeren bron

修改错误页面返回主页出现嵌套问题

RuoYi 5 jaren geleden
bovenliggende
commit
d80c1d2a73

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

@@ -14,8 +14,14 @@
         <h3 class="font-bold">找不到网页!</h3>
         <div class="error-desc">
                                 对不起,您正在寻找的页面不存在。尝试检查URL的错误,然后按浏览器上的刷新按钮或尝试在我们的应用程序中找到其他内容。
-            <a th:href="@{/index}" class="btn btn-primary m-t">主页</a>
+            <a href="javascript:index()" class="btn btn-primary m-t">主页</a>
         </div>
     </div>
+    <script th:inline="javascript">
+      var ctx = [[@{/}]];
+      function index() {
+          window.parent.frames.location.href = ctx + "index";
+      }
+    </script>
 </body>
 </html>

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

@@ -15,8 +15,14 @@
 
         <div class="error-desc">
                                 服务器遇到意外事件,不允许完成请求。我们抱歉。您可以返回主页面。
-            <a th:href="@{/index}" class="btn btn-primary m-t">主页</a>
+            <a href="javascript:index()" class="btn btn-primary m-t">主页</a>
         </div>
     </div>
+    <script th:inline="javascript">
+      var ctx = [[@{/}]];
+      function index() {
+          window.parent.frames.location.href = ctx + "index";
+      }
+    </script>
 </body>
 </html>

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

@@ -15,8 +15,14 @@
 
         <div class="error-desc">
                                 对不起,您没有访问权限,请不要进行非法操作!您可以返回主页面
-            <a th:href="@{/index}" class="btn btn-outline btn-primary btn-xs">返回主页</a>
+            <a th:href="javascript:index()" class="btn btn-outline btn-primary btn-xs">返回主页</a>
         </div>
     </div>
+    <script th:inline="javascript">
+      var ctx = [[@{/}]];
+      function index() {
+          window.parent.frames.location.href = ctx + "index";
+      }
+    </script>
 </body>
 </html>