error.html 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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>{{ title }}</title>
  7. <style>
  8. body {
  9. font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  10. background: linear-gradient(135deg, #f6f9fc, #e2e8f0);
  11. margin: 0;
  12. padding: 0;
  13. display: flex;
  14. justify-content: center;
  15. align-items: center;
  16. min-height: 100vh;
  17. color: #1a202c;
  18. }
  19. .error-container {
  20. display: flex;
  21. flex-direction: column;
  22. align-items: center;
  23. max-width: 800px;
  24. width: 80%;
  25. padding: 40px;
  26. border-radius: 16px;
  27. box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  28. background-color: #ffffff;
  29. position: relative;
  30. overflow: hidden;
  31. min-height: 300px; /* 确保最小高度 */
  32. max-height: 80vh; /* 避免内容过多时超出视口 */
  33. flex-grow: 1;
  34. }
  35. @media (max-width: 768px) {
  36. .error-container {
  37. width: 90%;
  38. padding: 20px;
  39. min-height: auto; /* 移除最小高度限制 */
  40. }
  41. }
  42. .error-container::before {
  43. content: '';
  44. position: absolute;
  45. top: -50%;
  46. left: -50%;
  47. width: 200%;
  48. height: 200%;
  49. background: linear-gradient(
  50. to bottom right,
  51. rgba(255, 255, 255, 0.3),
  52. rgba(255, 255, 255, 0)
  53. );
  54. transform: rotate(30deg);
  55. z-index: -1;
  56. animation: shine 3s infinite;
  57. }
  58. h1 {
  59. font-size: 6rem;
  60. margin: 0;
  61. color: #2563eb;
  62. text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.05);
  63. font-weight: 900;
  64. }
  65. @media (max-width: 768px) {
  66. h1 {
  67. font-size: 4rem; /* 减小标题字体大小 */
  68. }
  69. }
  70. h2 {
  71. font-size: 2rem;
  72. margin-top: 20px;
  73. color: #4a5568;
  74. }
  75. @media (max-width: 768px) {
  76. h2 {
  77. font-size: 1.5rem; /* 减小副标题字体大小 */
  78. }
  79. }
  80. p {
  81. font-size: 1.2rem;
  82. line-height: 1.8;
  83. margin: 20px 0;
  84. color: #718096;
  85. }
  86. @media (max-width: 768px) {
  87. p {
  88. font-size: 1rem; /* 减小段落字体大小 */
  89. }
  90. }
  91. .error-code {
  92. background-color: #e2e8f0;
  93. padding: 8px 20px;
  94. border-radius: 24px;
  95. display: inline-block;
  96. font-family: 'Courier New', Courier, monospace;
  97. margin: 10px 0;
  98. color: #2d3748;
  99. }
  100. .home-link {
  101. display: inline-block;
  102. margin-top: 30px;
  103. padding: 14px 36px;
  104. background-color: #2563eb;
  105. color: white;
  106. text-decoration: none;
  107. border-radius: 24px;
  108. font-weight: bold;
  109. transition: all 0.3s ease;
  110. box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  111. font-size: 1.1rem;
  112. }
  113. @media (max-width: 768px) {
  114. .home-link {
  115. padding: 10px 24px;
  116. font-size: 1rem; /* 减小按钮字体大小 */
  117. }
  118. }
  119. .home-link:hover {
  120. background-color: #1d4ed8;
  121. transform: translateY(-2px);
  122. box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
  123. }
  124. @keyframes shine {
  125. 0% { transform: rotate(30deg) translate(-10%, -10%); }
  126. 100% { transform: rotate(30deg) translate(10%, 10%); }
  127. }
  128. .error-icon {
  129. font-size: 5rem;
  130. margin-bottom: 20px;
  131. animation: pulse 2s infinite;
  132. color: #ff4d4d;
  133. }
  134. @media (max-width: 768px) {
  135. .error-icon {
  136. font-size: 3rem; /* 减小图标大小 */
  137. }
  138. }
  139. @keyframes pulse {
  140. 0% { transform: scale(1); }
  141. 50% { transform: scale(1.1); }
  142. 100% { transform: scale(1); }
  143. }
  144. </style>
  145. </head>
  146. <body>
  147. <div class="error-container">
  148. <div class="error-icon">⚠️</div>
  149. <h1>{{ status_code }}</h1>
  150. <h2>{{ message }}</h2>
  151. <div class="error-code">错误代码: {{ error_code }}</div>
  152. <p>{{ description }}</p>
  153. <a href="{{ home_url }}" class="home-link">返回主页</a>
  154. </div>
  155. </body>
  156. </html>