index.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. {% extends "layout.html" %}
  2. {% block page_title %}首页{% endblock %}
  3. {% block content %}
  4. <div class="space-y-6">
  5. <!-- 总体统计卡片 -->
  6. <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
  7. <!-- 总题目数 -->
  8. <div class="apple-card p-6 hover:shadow-lg transition-all duration-300 group">
  9. <div class="flex items-center justify-between mb-4">
  10. <div class="w-12 h-12 rounded-xl bg-gradient-to-br from-blue-500 to-blue-600 flex items-center justify-center text-white text-xl shadow-lg group-hover:scale-110 transition-transform">
  11. <i class="ri-file-list-3-line"></i>
  12. </div>
  13. <div class="text-right">
  14. <div class="text-3xl font-bold text-gray-800">{{ total }}</div>
  15. <div class="text-sm text-gray-500 mt-1">总题目数</div>
  16. </div>
  17. </div>
  18. <div class="h-1 bg-gray-200 rounded-full overflow-hidden">
  19. <div class="h-full bg-gradient-to-r from-blue-500 to-blue-600 rounded-full" style="width: 100%"></div>
  20. </div>
  21. </div>
  22. <!-- 已审核题目 -->
  23. <div class="apple-card p-6 hover:shadow-lg transition-all duration-300 group">
  24. <div class="flex items-center justify-between mb-4">
  25. <div class="w-12 h-12 rounded-xl bg-gradient-to-br from-green-500 to-green-600 flex items-center justify-center text-white text-xl shadow-lg group-hover:scale-110 transition-transform">
  26. <i class="ri-checkbox-circle-line"></i>
  27. </div>
  28. <div class="text-right">
  29. <div class="text-3xl font-bold text-gray-800">{{ audited_count }}</div>
  30. <div class="text-sm text-gray-500 mt-1">已审核</div>
  31. </div>
  32. </div>
  33. <div class="h-1 bg-gray-200 rounded-full overflow-hidden">
  34. <div class="h-full bg-gradient-to-r from-green-500 to-green-600 rounded-full" style="width: {{ audit_rate }}%"></div>
  35. </div>
  36. <div class="text-xs text-gray-400 mt-2">审核率: {{ audit_rate }}%</div>
  37. </div>
  38. <!-- 合格题目 -->
  39. <div class="apple-card p-6 hover:shadow-lg transition-all duration-300 group">
  40. <div class="flex items-center justify-between mb-4">
  41. <div class="w-12 h-12 rounded-xl bg-gradient-to-br from-emerald-500 to-emerald-600 flex items-center justify-center text-white text-xl shadow-lg group-hover:scale-110 transition-transform">
  42. <i class="ri-check-double-line"></i>
  43. </div>
  44. <div class="text-right">
  45. <div class="text-3xl font-bold text-gray-800">{{ pass_count }}</div>
  46. <div class="text-sm text-gray-500 mt-1">合格题目</div>
  47. </div>
  48. </div>
  49. <div class="h-1 bg-gray-200 rounded-full overflow-hidden">
  50. <div class="h-full bg-gradient-to-r from-emerald-500 to-emerald-600 rounded-full" style="width: {{ pass_rate }}%"></div>
  51. </div>
  52. <div class="text-xs text-gray-400 mt-2">通过率: {{ pass_rate }}%</div>
  53. </div>
  54. <!-- 待审核题目 -->
  55. <div class="apple-card p-6 hover:shadow-lg transition-all duration-300 group">
  56. <div class="flex items-center justify-between mb-4">
  57. <div class="w-12 h-12 rounded-xl bg-gradient-to-br from-orange-500 to-orange-600 flex items-center justify-center text-white text-xl shadow-lg group-hover:scale-110 transition-transform">
  58. <i class="ri-time-line"></i>
  59. </div>
  60. <div class="text-right">
  61. <div class="text-3xl font-bold text-gray-800">{{ pending_count }}</div>
  62. <div class="text-sm text-gray-500 mt-1">待审核</div>
  63. </div>
  64. </div>
  65. {% if pending_count > 0 %}
  66. <a href="/audit_questions" class="block mt-4 text-sm text-orange-600 hover:text-orange-700 font-medium">
  67. 立即审核 →
  68. </a>
  69. {% else %}
  70. <div class="text-xs text-gray-400 mt-2">全部已审核</div>
  71. {% endif %}
  72. </div>
  73. </div>
  74. <!-- 教材和知识点统计 -->
  75. <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
  76. <!-- 教材统计 -->
  77. <div class="apple-card p-6">
  78. <h2 class="text-xl font-bold text-gray-800 mb-6 flex items-center gap-2">
  79. <i class="ri-book-open-line text-indigo-600"></i>
  80. <span>教材统计</span>
  81. </h2>
  82. <div class="space-y-4">
  83. <!-- 教材系列 -->
  84. <div class="flex items-center justify-between p-4 rounded-lg bg-gradient-to-r from-indigo-50 to-purple-50">
  85. <div class="flex items-center gap-3">
  86. <div class="w-10 h-10 rounded-lg bg-gradient-to-r from-indigo-500 to-indigo-600 flex items-center justify-center text-white">
  87. <i class="ri-stack-line"></i>
  88. </div>
  89. <div>
  90. <div class="text-sm text-gray-600">教材系列</div>
  91. <div class="text-lg font-bold text-gray-800">{{ total_series }} 个系列</div>
  92. </div>
  93. </div>
  94. <div class="text-right">
  95. <div class="text-xs text-gray-500">激活</div>
  96. <div class="text-lg font-bold text-indigo-600">{{ active_series }}</div>
  97. </div>
  98. </div>
  99. <!-- 教材总数 -->
  100. <div class="flex items-center justify-between p-4 rounded-lg bg-gradient-to-r from-blue-50 to-cyan-50">
  101. <div class="flex items-center gap-3">
  102. <div class="w-10 h-10 rounded-lg bg-gradient-to-r from-blue-500 to-blue-600 flex items-center justify-center text-white">
  103. <i class="ri-book-2-line"></i>
  104. </div>
  105. <div>
  106. <div class="text-sm text-gray-600">教材总数</div>
  107. <div class="text-lg font-bold text-gray-800">{{ total_textbooks }} 本</div>
  108. </div>
  109. </div>
  110. <a href="/textbook_management" class="text-blue-600 hover:text-blue-700">
  111. <i class="ri-arrow-right-s-line text-xl"></i>
  112. </a>
  113. </div>
  114. </div>
  115. </div>
  116. <!-- 知识点统计 -->
  117. <div class="apple-card p-6">
  118. <h2 class="text-xl font-bold text-gray-800 mb-6 flex items-center gap-2">
  119. <i class="ri-node-tree text-green-600"></i>
  120. <span>知识点统计</span>
  121. </h2>
  122. <div class="space-y-4">
  123. <!-- 知识点总数 -->
  124. <div class="flex items-center justify-between p-4 rounded-lg bg-gradient-to-r from-green-50 to-emerald-50">
  125. <div class="flex items-center gap-3">
  126. <div class="w-10 h-10 rounded-lg bg-gradient-to-r from-green-500 to-green-600 flex items-center justify-center text-white">
  127. <i class="ri-file-list-3-line"></i>
  128. </div>
  129. <div>
  130. <div class="text-sm text-gray-600">知识点总数</div>
  131. <div class="text-lg font-bold text-gray-800">{{ total_kp }} 个</div>
  132. </div>
  133. </div>
  134. <a href="/kp_management" class="text-green-600 hover:text-green-700">
  135. <i class="ri-arrow-right-s-line text-xl"></i>
  136. </a>
  137. </div>
  138. <!-- 知识点层级分布 -->
  139. <div class="space-y-2">
  140. <div class="flex items-center justify-between text-sm">
  141. <span class="text-gray-600">一级知识点</span>
  142. <span class="font-bold text-gray-800">{{ kp_level_0 }} 个</span>
  143. </div>
  144. <div class="flex items-center justify-between text-sm">
  145. <span class="text-gray-600">二级知识点</span>
  146. <span class="font-bold text-gray-800">{{ kp_level_1 }} 个</span>
  147. </div>
  148. <div class="flex items-center justify-between text-sm">
  149. <span class="text-gray-600">三级及以上</span>
  150. <span class="font-bold text-gray-800">{{ kp_level_2_plus }} 个</span>
  151. </div>
  152. </div>
  153. </div>
  154. </div>
  155. </div>
  156. <!-- 审核状态分布 -->
  157. <div class="apple-card p-6">
  158. <h2 class="text-xl font-bold text-gray-800 mb-6 flex items-center gap-2">
  159. <i class="ri-pie-chart-line text-blue-600"></i>
  160. <span>审核状态分布</span>
  161. </h2>
  162. <div class="space-y-4">
  163. <!-- 合格 -->
  164. <div class="flex items-center justify-between">
  165. <div class="flex items-center gap-3">
  166. <div class="w-4 h-4 rounded-full bg-gradient-to-r from-emerald-500 to-emerald-600"></div>
  167. <span class="text-gray-700 font-medium">合格题目</span>
  168. </div>
  169. <div class="flex items-center gap-4">
  170. <div class="w-32 h-2 bg-gray-200 rounded-full overflow-hidden">
  171. <div class="h-full bg-gradient-to-r from-emerald-500 to-emerald-600 rounded-full" style="width: {% if total > 0 %}{{ (pass_count / total * 100)|round(1) }}{% else %}0{% endif %}%"></div>
  172. </div>
  173. <span class="text-gray-800 font-bold w-16 text-right">{{ pass_count }}</span>
  174. </div>
  175. </div>
  176. <!-- 不合格 -->
  177. <div class="flex items-center justify-between">
  178. <div class="flex items-center gap-3">
  179. <div class="w-4 h-4 rounded-full bg-gradient-to-r from-red-500 to-red-600"></div>
  180. <span class="text-gray-700 font-medium">不合格题目</span>
  181. </div>
  182. <div class="flex items-center gap-4">
  183. <div class="w-32 h-2 bg-gray-200 rounded-full overflow-hidden">
  184. <div class="h-full bg-gradient-to-r from-red-500 to-red-600 rounded-full" style="width: {% if total > 0 %}{{ (fail_count / total * 100)|round(1) }}{% else %}0{% endif %}%"></div>
  185. </div>
  186. <span class="text-gray-800 font-bold w-16 text-right">{{ fail_count }}</span>
  187. </div>
  188. </div>
  189. <!-- 待审核 -->
  190. <div class="flex items-center justify-between">
  191. <div class="flex items-center gap-3">
  192. <div class="w-4 h-4 rounded-full bg-gradient-to-r from-orange-500 to-orange-600"></div>
  193. <span class="text-gray-700 font-medium">待审核题目</span>
  194. </div>
  195. <div class="flex items-center gap-4">
  196. <div class="w-32 h-2 bg-gray-200 rounded-full overflow-hidden">
  197. <div class="h-full bg-gradient-to-r from-orange-500 to-orange-600 rounded-full" style="width: {% if total > 0 %}{{ (pending_count / total * 100)|round(1) }}{% else %}0{% endif %}%"></div>
  198. </div>
  199. <span class="text-gray-800 font-bold w-16 text-right">{{ pending_count }}</span>
  200. </div>
  201. </div>
  202. </div>
  203. </div>
  204. <!-- 最近添加的题目 -->
  205. {% if recent_questions %}
  206. <div class="apple-card p-6">
  207. <h2 class="text-xl font-bold text-gray-800 mb-6 flex items-center gap-2">
  208. <i class="ri-history-line text-indigo-600"></i>
  209. <span>最近添加的题目</span>
  210. </h2>
  211. <div class="space-y-3">
  212. {% for question in recent_questions %}
  213. <a href="/detail/{{ question.question_code }}" class="block p-4 rounded-lg hover:bg-gray-50 transition-colors border-l-4 border-transparent hover:border-blue-500">
  214. <div class="flex items-start justify-between gap-4">
  215. <div class="flex-1 min-w-0">
  216. <div class="flex items-center gap-2 mb-2">
  217. <span class="text-xs font-mono text-gray-500 bg-gray-100 px-2 py-1 rounded">ID: {{ question.question_code }}</span>
  218. {% if question.audit_reason %}
  219. {% if question.audit_reason == '合格' %}
  220. <span class="text-xs px-2 py-1 bg-emerald-100 text-emerald-700 rounded font-semibold">合格</span>
  221. {% else %}
  222. <span class="text-xs px-2 py-1 bg-red-100 text-red-700 rounded font-semibold">不合格</span>
  223. {% endif %}
  224. {% else %}
  225. <span class="text-xs px-2 py-1 bg-orange-100 text-orange-700 rounded font-semibold">待审核</span>
  226. {% endif %}
  227. </div>
  228. <div class="text-sm text-gray-700 line-clamp-2">
  229. {{ question.stem[:100]|safe }}{% if question.stem|length > 100 %}...{% endif %}
  230. </div>
  231. </div>
  232. <i class="ri-arrow-right-s-line text-gray-400 text-xl"></i>
  233. </div>
  234. </a>
  235. {% endfor %}
  236. </div>
  237. </div>
  238. {% endif %}
  239. </div>
  240. <style>
  241. .line-clamp-2 {
  242. display: -webkit-box;
  243. -webkit-line-clamp: 2;
  244. -webkit-box-orient: vertical;
  245. overflow: hidden;
  246. }
  247. </style>
  248. {% endblock %}