knowledge-point-stats.blade.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. <div>
  2. <div class="space-y-6">
  3. {{-- 页面标题和筛选 --}}
  4. <div class="flex items-center justify-between">
  5. <div>
  6. <h2 class="text-xl font-semibold tracking-tight">知识点题目数量统计</h2>
  7. <p class="text-sm text-gray-500 mt-1">通过知识点筛选,汇总当前知识点和各个技能点的题目数量</p>
  8. </div>
  9. </div>
  10. {{-- 知识点筛选器 --}}
  11. <div class="bg-white dark:bg-gray-800 rounded-lg shadow p-6">
  12. <div class="flex items-center gap-4">
  13. <div class="flex-1">
  14. <label for="kp-select" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
  15. 选择知识点
  16. </label>
  17. <select
  18. id="kp-select"
  19. wire:model.live="selectedKpCode"
  20. class="w-full rounded-lg border-gray-300 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500"
  21. >
  22. <option value="">-- 选择知识点 --</option>
  23. @foreach($this->knowledgePointOptions as $code => $name)
  24. <option value="{{ $code }}">{{ $name }} ({{ $code }})</option>
  25. @endforeach
  26. </select>
  27. </div>
  28. <div class="flex items-end">
  29. <button
  30. type="button"
  31. wire:click="toggleDetails"
  32. class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2"
  33. >
  34. {{ $showDetails ? '隐藏详情' : '显示详情' }}
  35. </button>
  36. </div>
  37. </div>
  38. </div>
  39. {{-- 统计概览 --}}
  40. @if(!empty($this->knowledgePointStatistics))
  41. <div class="grid grid-cols-1 md:grid-cols-4 gap-4">
  42. {{-- 总题目数 --}}
  43. <div class="bg-white dark:bg-gray-800 rounded-lg shadow p-6">
  44. <div class="flex items-center justify-between">
  45. <div>
  46. <p class="text-sm font-medium text-gray-600 dark:text-gray-400">总题目数</p>
  47. <p class="text-3xl font-bold text-gray-900 dark:text-gray-100 mt-2">
  48. {{ array_sum(array_map([$this, 'getTotalQuestions'], $this->knowledgePointStatistics)) }}
  49. </p>
  50. </div>
  51. <div class="p-3 bg-blue-100 dark:bg-blue-900 rounded-full">
  52. <svg class="w-8 h-8 text-blue-600 dark:text-blue-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  53. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path>
  54. </svg>
  55. </div>
  56. </div>
  57. </div>
  58. {{-- 直接题目数 --}}
  59. <div class="bg-white dark:bg-gray-800 rounded-lg shadow p-6">
  60. <div class="flex items-center justify-between">
  61. <div>
  62. <p class="text-sm font-medium text-gray-600 dark:text-gray-400">直接题目数</p>
  63. <p class="text-3xl font-bold text-gray-900 dark:text-gray-100 mt-2">
  64. {{ array_sum(array_map([$this, 'getDirectQuestions'], $this->knowledgePointStatistics)) }}
  65. </p>
  66. </div>
  67. <div class="p-3 bg-green-100 dark:bg-green-900 rounded-full">
  68. <svg class="w-8 h-8 text-green-600 dark:text-green-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  69. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
  70. </svg>
  71. </div>
  72. </div>
  73. </div>
  74. {{-- 子知识点题目数 --}}
  75. <div class="bg-white dark:bg-gray-800 rounded-lg shadow p-6">
  76. <div class="flex items-center justify-between">
  77. <div>
  78. <p class="text-sm font-medium text-gray-600 dark:text-gray-400">子知识点题目数</p>
  79. <p class="text-3xl font-bold text-gray-900 dark:text-gray-100 mt-2">
  80. {{ array_sum(array_map([$this, 'getChildrenQuestions'], $this->knowledgePointStatistics)) }}
  81. </p>
  82. </div>
  83. <div class="p-3 bg-yellow-100 dark:bg-yellow-900 rounded-full">
  84. <svg class="w-8 h-8 text-yellow-600 dark:text-yellow-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  85. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"></path>
  86. </svg>
  87. </div>
  88. </div>
  89. </div>
  90. {{-- 技能点题目数 --}}
  91. <div class="bg-white dark:bg-gray-800 rounded-lg shadow p-6">
  92. <div class="flex items-center justify-between">
  93. <div>
  94. <p class="text-sm font-medium text-gray-600 dark:text-gray-400">技能点题目数</p>
  95. <p class="text-3xl font-bold text-gray-900 dark:text-gray-100 mt-2">
  96. {{ array_sum(array_map([$this, 'getSkillQuestions'], $this->knowledgePointStatistics)) }}
  97. </p>
  98. </div>
  99. <div class="p-3 bg-purple-100 dark:bg-purple-900 rounded-full">
  100. <svg class="w-8 h-8 text-purple-600 dark:text-purple-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  101. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"></path>
  102. </svg>
  103. </div>
  104. </div>
  105. </div>
  106. </div>
  107. @endif
  108. {{-- 知识点统计列表 --}}
  109. <div class="bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden">
  110. <div class="px-6 py-4 border-b border-gray-200 dark:border-gray-700">
  111. <h3 class="text-lg font-medium text-gray-900 dark:text-gray-100">
  112. {{ $selectedKpCode ? '知识点详情' : '所有知识点统计' }}
  113. </h3>
  114. </div>
  115. <div class="overflow-x-auto">
  116. <table class="min-w-full divide-y divide-gray-200 dark:divide-gray-700">
  117. <thead class="bg-gray-50 dark:bg-gray-900">
  118. <tr>
  119. <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">
  120. 知识点
  121. </th>
  122. <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">
  123. 总题目数
  124. </th>
  125. <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">
  126. 直接题目
  127. </th>
  128. <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">
  129. 子知识点题目
  130. </th>
  131. <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">
  132. 技能点数
  133. </th>
  134. <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">
  135. 技能点题目
  136. </th>
  137. </tr>
  138. </thead>
  139. <tbody class="bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700">
  140. @forelse($this->knowledgePointStatistics as $stat)
  141. <tr class="hover:bg-gray-50 dark:hover:bg-gray-700">
  142. <td class="px-6 py-4 whitespace-nowrap">
  143. <div>
  144. <div class="text-sm font-medium text-gray-900 dark:text-gray-100">
  145. {{ $stat['cn_name'] ?? $stat['kp_code'] }}
  146. </div>
  147. <div class="text-sm text-gray-500 dark:text-gray-400">
  148. {{ $stat['kp_code'] }}
  149. </div>
  150. </div>
  151. </td>
  152. <td class="px-6 py-4 whitespace-nowrap">
  153. <span class="inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200">
  154. {{ $stat['total_questions'] ?? 0 }}
  155. </span>
  156. </td>
  157. <td class="px-6 py-4 whitespace-nowrap">
  158. <span class="inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200">
  159. {{ $stat['direct_questions'] ?? 0 }}
  160. </span>
  161. </td>
  162. <td class="px-6 py-4 whitespace-nowrap">
  163. <span class="inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200">
  164. {{ $stat['children_questions'] ?? 0 }}
  165. </span>
  166. </td>
  167. <td class="px-6 py-4 whitespace-nowrap">
  168. <span class="inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200">
  169. {{ $stat['skills_count'] ?? 0 }}
  170. </span>
  171. </td>
  172. <td class="px-6 py-4 whitespace-nowrap">
  173. <span class="inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-indigo-100 text-indigo-800 dark:bg-indigo-900 dark:text-indigo-200">
  174. {{ $stat['skills_total_questions'] ?? 0 }}
  175. </span>
  176. </td>
  177. </tr>
  178. @if($showDetails && !empty($stat['children']))
  179. @foreach($stat['children'] as $child)
  180. <tr class="hover:bg-gray-50 dark:hover:bg-gray-700 bg-gray-50 dark:bg-gray-900">
  181. <td class="px-6 py-4 whitespace-nowrap pl-12">
  182. <div class="flex items-center">
  183. <svg class="w-4 h-4 text-gray-400 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  184. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path>
  185. </svg>
  186. <div>
  187. <div class="text-sm font-medium text-gray-900 dark:text-gray-100">
  188. {{ $child['cn_name'] ?? $child['kp_code'] }}
  189. </div>
  190. <div class="text-sm text-gray-500 dark:text-gray-400">
  191. {{ $child['kp_code'] }}
  192. </div>
  193. </div>
  194. </div>
  195. </td>
  196. <td class="px-6 py-4 whitespace-nowrap">
  197. <span class="text-sm font-medium text-blue-600 dark:text-blue-400">
  198. {{ $child['total_questions'] ?? 0 }}
  199. </span>
  200. </td>
  201. <td class="px-6 py-4 whitespace-nowrap">
  202. <span class="text-sm font-medium text-green-600 dark:text-green-400">
  203. {{ $child['direct_questions'] ?? 0 }}
  204. </span>
  205. </td>
  206. <td class="px-6 py-4 whitespace-nowrap">
  207. <span class="text-sm font-medium text-yellow-600 dark:text-yellow-400">
  208. {{ $child['children_questions'] ?? 0 }}
  209. </span>
  210. </td>
  211. <td class="px-6 py-4 whitespace-nowrap">
  212. <span class="text-sm font-medium text-purple-600 dark:text-purple-400">
  213. {{ $child['skills_count'] ?? 0 }}
  214. </span>
  215. </td>
  216. <td class="px-6 py-4 whitespace-nowrap">
  217. <span class="text-sm font-medium text-indigo-600 dark:text-indigo-400">
  218. {{ $child['skills_total_questions'] ?? 0 }}
  219. </span>
  220. </td>
  221. </tr>
  222. @if($showDetails && !empty($child['skills']))
  223. @foreach($child['skills'] as $skill)
  224. <tr class="hover:bg-gray-50 dark:hover:bg-gray-700 bg-gray-100 dark:bg-gray-800">
  225. <td class="px-6 py-4 whitespace-nowrap pl-16">
  226. <div class="flex items-center">
  227. <svg class="w-3 h-3 text-gray-500 mr-2" fill="currentColor" viewBox="0 0 20 20">
  228. <circle cx="10" cy="10" r="3"></circle>
  229. </svg>
  230. <div>
  231. <div class="text-sm text-gray-900 dark:text-gray-100">
  232. {{ $skill['skill_code'] }}
  233. </div>
  234. </div>
  235. </div>
  236. </td>
  237. <td class="px-6 py-4 whitespace-nowrap">
  238. <span class="text-sm text-gray-600 dark:text-gray-400">
  239. {{ $skill['question_count'] ?? 0 }}
  240. </span>
  241. </td>
  242. <td class="px-6 py-4 whitespace-nowrap">
  243. <span class="text-sm text-gray-600 dark:text-gray-400">-</span>
  244. </td>
  245. <td class="px-6 py-4 whitespace-nowrap">
  246. <span class="text-sm text-gray-600 dark:text-gray-400">-</span>
  247. </td>
  248. <td class="px-6 py-4 whitespace-nowrap">
  249. <span class="text-sm text-gray-600 dark:text-gray-400">1</span>
  250. </td>
  251. <td class="px-6 py-4 whitespace-nowrap">
  252. <span class="text-sm text-gray-600 dark:text-gray-400">
  253. {{ $skill['question_count'] ?? 0 }}
  254. </span>
  255. </td>
  256. </tr>
  257. @endforeach
  258. @endif
  259. @endforeach
  260. @endif
  261. @if($showDetails && !empty($stat['skills']))
  262. @foreach($stat['skills'] as $skill)
  263. <tr class="hover:bg-gray-50 dark:hover:bg-gray-700 bg-gray-100 dark:bg-gray-800">
  264. <td class="px-6 py-4 whitespace-nowrap pl-12">
  265. <div class="flex items-center">
  266. <svg class="w-3 h-3 text-gray-500 mr-2" fill="currentColor" viewBox="0 0 20 20">
  267. <circle cx="10" cy="10" r="3"></circle>
  268. </svg>
  269. <div>
  270. <div class="text-sm text-gray-900 dark:text-gray-100">
  271. {{ $skill['skill_code'] }}
  272. </div>
  273. </div>
  274. </div>
  275. </td>
  276. <td class="px-6 py-4 whitespace-nowrap">
  277. <span class="text-sm text-gray-600 dark:text-gray-400">
  278. {{ $skill['question_count'] ?? 0 }}
  279. </span>
  280. </td>
  281. <td class="px-6 py-4 whitespace-nowrap">
  282. <span class="text-sm text-gray-600 dark:text-gray-400">-</span>
  283. </td>
  284. <td class="px-6 py-4 whitespace-nowrap">
  285. <span class="text-sm text-gray-600 dark:text-gray-400">-</span>
  286. </td>
  287. <td class="px-6 py-4 whitespace-nowrap">
  288. <span class="text-sm text-gray-600 dark:text-gray-400">1</span>
  289. </td>
  290. <td class="px-6 py-4 whitespace-nowrap">
  291. <span class="text-sm text-gray-600 dark:text-gray-400">
  292. {{ $skill['question_count'] ?? 0 }}
  293. </span>
  294. </td>
  295. </tr>
  296. @endforeach
  297. @endif
  298. @empty
  299. <tr>
  300. <td colspan="6" class="px-6 py-12 text-center text-gray-500 dark:text-gray-400">
  301. 暂无统计数据
  302. </td>
  303. </tr>
  304. @endforelse
  305. </tbody>
  306. </table>
  307. </div>
  308. </div>
  309. </div>
  310. </div>