error.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>错误页面 - EasyTemplate后台系统</title>
  7. <style>
  8. * {
  9. margin: 0;
  10. padding: 0;
  11. box-sizing: border-box;
  12. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  13. }
  14. body {
  15. background-color: #f0f2f5;
  16. min-height: 100vh;
  17. display: flex;
  18. justify-content: center;
  19. align-items: center;
  20. color: #000000d9;
  21. line-height: 1.5715;
  22. }
  23. .error-container {
  24. width: 90%;
  25. max-width: 520px;
  26. margin: 0 auto;
  27. }
  28. .error-card {
  29. background: #ffffff;
  30. border-radius: 8px;
  31. box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 9px 28px 8px rgba(0, 0, 0, 0.05);
  32. padding: 48px 32px;
  33. text-align: center;
  34. border: 1px solid #f0f0f0;
  35. }
  36. .error-image {
  37. width: 120px;
  38. height: 120px;
  39. margin: 0 auto 32px;
  40. display: flex;
  41. align-items: center;
  42. justify-content: center;
  43. border-radius: 50%;
  44. background: #f0f7ff;
  45. border: 4px solid #e6f7ff;
  46. }
  47. .error-image svg {
  48. width: 60px;
  49. height: 60px;
  50. fill: #1890ff;
  51. }
  52. .error-code {
  53. font-size: 72px;
  54. font-weight: 600;
  55. color: #1890ff;
  56. margin-bottom: 8px;
  57. line-height: 1;
  58. }
  59. .error-title {
  60. font-size: 20px;
  61. font-weight: 500;
  62. color: #000000d9;
  63. margin-bottom: 16px;
  64. }
  65. .error-message {
  66. font-size: 14px;
  67. color: #00000073;
  68. line-height: 1.6;
  69. margin-bottom: 32px;
  70. max-width: 400px;
  71. margin-left: auto;
  72. margin-right: auto;
  73. }
  74. .action-buttons {
  75. display: flex;
  76. justify-content: center;
  77. gap: 12px;
  78. }
  79. .btn {
  80. height: 40px;
  81. padding: 8px 20px;
  82. border: 1px solid #d9d9d9;
  83. border-radius: 6px;
  84. font-size: 14px;
  85. cursor: pointer;
  86. transition: all 0.3s;
  87. display: inline-flex;
  88. align-items: center;
  89. justify-content: center;
  90. text-decoration: none;
  91. background: #ffffff;
  92. color: #000000d9;
  93. }
  94. .btn-primary {
  95. background: #1890ff;
  96. border-color: #1890ff;
  97. color: #ffffff;
  98. }
  99. .btn-primary:hover {
  100. background: #40a9ff;
  101. border-color: #40a9ff;
  102. }
  103. .btn-default:hover {
  104. border-color: #40a9ff;
  105. color: #40a9ff;
  106. }
  107. .error-details {
  108. margin-top: 24px;
  109. padding: 16px;
  110. background: #fafafa;
  111. border-radius: 6px;
  112. font-size: 14px;
  113. color: #00000073;
  114. text-align: left;
  115. border: 1px solid #f0f0f0;
  116. }
  117. @media (max-width: 768px) {
  118. .error-card {
  119. padding: 32px 20px;
  120. }
  121. .error-code {
  122. font-size: 60px;
  123. }
  124. .error-image {
  125. width: 100px;
  126. height: 100px;
  127. margin-bottom: 24px;
  128. }
  129. .error-image svg {
  130. width: 50px;
  131. height: 50px;
  132. }
  133. .action-buttons {
  134. flex-direction: column;
  135. align-items: center;
  136. }
  137. .btn {
  138. width: 100%;
  139. max-width: 200px;
  140. }
  141. }
  142. </style>
  143. </head>
  144. <body>
  145. <div class="error-container">
  146. <div class="error-card">
  147. <div class="error-image" id="errorImage">
  148. <svg viewBox="0 0 24 24" id="errorSvg">
  149. <path d="M12,2C6.48,2,2,6.48,2,12s4.48,10,10,10s10-4.48,10-10S17.52,2,12,2z M13,17h-2v-2h2V17z M13,13h-2V7h2V13z"/>
  150. </svg>
  151. </div>
  152. <h1 class="error-code" id="errorCode">500</h1>
  153. <h2 class="error-title" id="errorTitle">服务器错误</h2>
  154. <p class="error-message" id="errorMessage">抱歉,服务器遇到意外错误,无法完成您的请求。</p>
  155. <div class="action-buttons">
  156. <button id="loginBtn" class="btn btn-primary">返回登录页面</button>
  157. <button id="backBtn" class="btn btn-default">返回上页</button>
  158. </div>
  159. <div class="error-details" id="errorDetails" style="display: none;">
  160. <strong>详细信息:</strong>
  161. <div id="detailsContent"></div>
  162. </div>
  163. </div>
  164. </div>
  165. <script>
  166. // 从URL参数获取错误信息
  167. function getUrlParams() {
  168. const params = new URLSearchParams(window.location.search);
  169. return {
  170. code: params.get('code') || '500',
  171. title: params.get('title') || '服务器错误',
  172. message: params.get('message') || '抱歉,服务器遇到意外错误,无法完成您的请求。',
  173. image: params.get('image') || 'default'
  174. };
  175. }
  176. // 根据错误代码设置不同的图标和颜色
  177. function setErrorImage(code, imageType) {
  178. const errorImage = document.getElementById('errorImage');
  179. const errorSvg = document.getElementById('errorSvg');
  180. // 根据错误代码设置不同的颜色
  181. switch(code) {
  182. case '500':
  183. errorImage.style.background = "#fff2f0";
  184. errorImage.style.borderColor = "#ffccc7";
  185. errorSvg.innerHTML = '<path d="M12,2C6.48,2,2,6.48,2,12s4.48,10,10,10s10-4.48,10-10S17.52,2,12,2z M16.59,7.58L10,14.17l-2.59-2.58L6,13l4,4l8-8L16.59,7.58z"/>';
  186. errorSvg.style.fill = "#ff4d4f";
  187. break;
  188. case '404':
  189. errorImage.style.background = "#fff7e6";
  190. errorImage.style.borderColor = "#ffd591";
  191. errorSvg.innerHTML = '<path d="M12,2C6.48,2,2,6.48,2,12s4.48,10,10,10s10-4.48,10-10S17.52,2,12,2z M13,17h-2v-2h2V17z M13,13h-2V7h2V13z"/>';
  192. errorSvg.style.fill = "#fa8c16";
  193. break;
  194. case '403':
  195. errorImage.style.background = "#f6ffed";
  196. errorImage.style.borderColor = "#b7eb8f";
  197. errorSvg.innerHTML = '<path d="M18,8h-1V6c0-2.76-2.24-5-5-5S7,3.24,7,6v2H6c-1.1,0-2,0.9-2,2v10c0,1.1,0.9,2,2,2h12c1.1,0,2-0.9,2-2V10C20,8.9,19.1,8,18,8z M12,17c-1.1,0-2-0.9-2-2s0.9-2,2-2s2,0.9,2,2S13.1,17,12,17z M15.1,8H8.9V6c0-1.71,1.39-3.1,3.1-3.1c1.71,0,3.1,1.39,3.1,3.1V8z"/>';
  198. errorSvg.style.fill = "#52c41a";
  199. break;
  200. case '502':
  201. errorImage.style.background = "#f9f0ff";
  202. errorImage.style.borderColor = "#d3adf7";
  203. errorSvg.innerHTML = '<path d="M12,2C6.48,2,2,6.48,2,12s4.48,10,10,10s10-4.48,10-10S17.52,2,12,2z M16,15H8v-2h8V15z M16,11H8V9h8V11z"/>';
  204. errorSvg.style.fill = "#722ed1";
  205. break;
  206. case '503':
  207. errorImage.style.background = "#e6f7ff";
  208. errorImage.style.borderColor = "#91d5ff";
  209. errorSvg.innerHTML = '<path d="M12,2C6.48,2,2,6.48,2,12s4.48,10,10,10s10-4.48,10-10S17.52,2,12,2z M16,15H8v-2h8V15z M16,11H8V9h8V11z M16,7H8V5h8V7z"/>';
  210. errorSvg.style.fill = "#1890ff";
  211. break;
  212. default:
  213. errorImage.style.background = "#f0f7ff";
  214. errorImage.style.borderColor = "#e6f7ff";
  215. errorSvg.innerHTML = '<path d="M12,2C6.48,2,2,6.48,2,12s4.48,10,10,10s10-4.48,10-10S17.52,2,12,2z M13,17h-2v-2h2V17z M13,13h-2V7h2V13z"/>';
  216. errorSvg.style.fill = "#1890ff";
  217. }
  218. // 如果有自定义图片类型,使用自定义设置
  219. if (imageType && imageType !== 'default') {
  220. switch(imageType) {
  221. case 'warning':
  222. errorImage.style.background = "#fff7e6";
  223. errorImage.style.borderColor = "#ffd591";
  224. errorSvg.style.fill = "#fa8c16";
  225. break;
  226. case 'error':
  227. errorImage.style.background = "#fff2f0";
  228. errorImage.style.borderColor = "#ffccc7";
  229. errorSvg.style.fill = "#ff4d4f";
  230. break;
  231. case 'info':
  232. errorImage.style.background = "#e6f7ff";
  233. errorImage.style.borderColor = "#91d5ff";
  234. errorSvg.style.fill = "#1890ff";
  235. break;
  236. }
  237. }
  238. }
  239. // 更新页面内容
  240. function updateErrorPage() {
  241. const params = getUrlParams();
  242. document.getElementById('errorCode').textContent = params.code;
  243. document.getElementById('errorTitle').textContent = params.title;
  244. document.getElementById('errorMessage').textContent = params.message;
  245. setErrorImage(params.code, params.image);
  246. }
  247. // 返回登录页面
  248. document.getElementById('loginBtn').addEventListener('click', function() {
  249. // 保持相同的IP和域名,只改变路径
  250. window.location.href = '/account/login';
  251. });
  252. // 返回上页
  253. document.getElementById('backBtn').addEventListener('click', function() {
  254. history.back();
  255. });
  256. // 页面加载时应用URL参数
  257. document.addEventListener('DOMContentLoaded', () => {
  258. updateErrorPage();
  259. });
  260. </script>
  261. </body>
  262. </html>