knowledge-points-list-component.blade.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <div>
  2. <div class="space-y-4">
  3. {{-- 搜索和筛选 --}}
  4. <div class="bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 p-4 space-y-4">
  5. <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
  6. {{-- 搜索框 --}}
  7. <div class="relative">
  8. <span class="absolute inset-y-0 left-0 pl-3 flex items-center text-gray-400">
  9. <svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  10. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path>
  11. </svg>
  12. </span>
  13. <input
  14. wire:model.live.debounce="search"
  15. type="text"
  16. placeholder="搜索知识点..."
  17. class="w-full pl-10 pr-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-indigo-500 focus:border-indigo-500 dark:bg-gray-700 dark:text-gray-100"
  18. />
  19. </div>
  20. {{-- 学段筛选 --}}
  21. <div class="relative">
  22. <span class="absolute inset-y-0 left-0 pl-3 flex items-center text-gray-400">
  23. <svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  24. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"></path>
  25. </svg>
  26. </span>
  27. <select
  28. wire:model.live="phaseFilter"
  29. class="w-full pl-10 pr-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-indigo-500 focus:border-indigo-500 dark:bg-gray-700 dark:text-gray-100 appearance-none"
  30. >
  31. <option value="">所有学段</option>
  32. @foreach($this->filterOptions['phases'] as $phase)
  33. <option value="{{ $phase }}">{{ $phase }}</option>
  34. @endforeach
  35. </select>
  36. </div>
  37. {{-- 类别筛选 --}}
  38. <div class="relative">
  39. <span class="absolute inset-y-0 left-0 pl-3 flex items-center text-gray-400">
  40. <svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  41. <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>
  42. </svg>
  43. </span>
  44. <select
  45. wire:model.live="categoryFilter"
  46. class="w-full pl-10 pr-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg focus:ring-indigo-500 focus:border-indigo-500 dark:bg-gray-700 dark:text-gray-100 appearance-none"
  47. >
  48. <option value="">所有类别</option>
  49. @foreach($this->filterOptions['categories'] as $category)
  50. <option value="{{ $category }}">{{ $category }}</option>
  51. @endforeach
  52. </select>
  53. </div>
  54. </div>
  55. <div class="flex items-center justify-between pt-2 border-t border-gray-200 dark:border-gray-700">
  56. <div class="text-sm text-gray-600 dark:text-gray-400">
  57. 共 {{ count($filteredPoints) }} 个知识点
  58. </div>
  59. <button
  60. wire:click="clearSelection"
  61. class="inline-flex items-center gap-2 px-3 py-1 text-sm text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200"
  62. >
  63. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  64. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
  65. </svg>
  66. 清空筛选
  67. </button>
  68. </div>
  69. </div>
  70. {{-- 知识点列表 --}}
  71. <div class="bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 overflow-hidden">
  72. @if($isLoading)
  73. <div class="flex items-center justify-center p-8">
  74. <svg class="animate-spin h-6 w-6 text-indigo-600" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
  75. <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
  76. <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
  77. </svg>
  78. <span class="ml-2 text-gray-600 dark:text-gray-300">加载中...</span>
  79. </div>
  80. @elseif(empty($filteredPoints))
  81. <div class="text-center p-8 text-gray-500 dark:text-gray-400">
  82. <svg class="mx-auto h-12 w-12 text-gray-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
  83. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.172 16.172a4 4 0 015.656 0M9 10h.01M15 10h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
  84. </svg>
  85. <p class="mt-2">没有找到匹配的知识点</p>
  86. </div>
  87. @else
  88. <div class="overflow-x-auto">
  89. <table class="min-w-full divide-y divide-gray-200 dark:divide-gray-700">
  90. <thead class="bg-gray-50 dark:bg-gray-900">
  91. <tr>
  92. <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">
  93. 知识点
  94. </th>
  95. <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">
  96. 代码
  97. </th>
  98. <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">
  99. 学段
  100. </th>
  101. <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">
  102. 类别
  103. </th>
  104. <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">
  105. 重要度
  106. </th>
  107. <th scope="col" class="px-6 py-3 text-right text-xs font-medium text-gray-500 dark:text-gray-400 uppercase tracking-wider">
  108. 操作
  109. </th>
  110. </tr>
  111. </thead>
  112. <tbody class="bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700">
  113. @foreach($filteredPoints as $point)
  114. <tr class="hover:bg-gray-50 dark:hover:bg-gray-700 {{ $selectedKpCode === $point['kp_code'] ? 'bg-indigo-50 dark:bg-indigo-900/20' : '' }}">
  115. <td class="px-6 py-4 whitespace-nowrap">
  116. <div class="flex items-center">
  117. <div>
  118. <div class="text-sm font-medium text-gray-900 dark:text-gray-100">
  119. {{ $point['cn_name'] ?? $point['kp_code'] }}
  120. </div>
  121. @if(!empty($point['description']))
  122. <div class="text-sm text-gray-500 dark:text-gray-400">
  123. {{ Str::limit($point['description'], 60) }}
  124. </div>
  125. @endif
  126. </div>
  127. </div>
  128. </td>
  129. <td class="px-6 py-4 whitespace-nowrap">
  130. <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300">
  131. {{ $point['kp_code'] }}
  132. </span>
  133. </td>
  134. <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">
  135. {{ $point['phase'] ?? '-' }}
  136. </td>
  137. <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">
  138. {{ $point['category'] ?? '-' }}
  139. </td>
  140. <td class="px-6 py-4 whitespace-nowrap">
  141. <div class="flex items-center">
  142. <div class="flex-1 bg-gray-200 dark:bg-gray-700 rounded-full h-2">
  143. <div
  144. class="bg-indigo-600 h-2 rounded-full"
  145. style="width: {{ ($point['importance'] ?? 0) * 20 }}%"
  146. ></div>
  147. </div>
  148. <span class="ml-2 text-sm text-gray-500 dark:text-gray-400">
  149. {{ $point['importance'] ?? 0 }}
  150. </span>
  151. </div>
  152. </td>
  153. <td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
  154. <button
  155. wire:click="selectKp('{{ $point['kp_code'] }}')"
  156. class="inline-flex items-center gap-1 px-3 py-1 text-sm font-medium text-indigo-600 hover:text-indigo-800 dark:text-indigo-400 dark:hover:text-indigo-200"
  157. >
  158. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  159. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path>
  160. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"></path>
  161. </svg>
  162. 查看
  163. </button>
  164. </td>
  165. </tr>
  166. @endforeach
  167. </tbody>
  168. </table>
  169. </div>
  170. @endif
  171. </div>
  172. </div>
  173. </div>