exam-history-simple.blade.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <x-filament-panels::page>
  2. <div class="space-y-6">
  3. <!-- 页面标题 -->
  4. <div class="flex justify-between items-center">
  5. <div>
  6. <h2 class="text-2xl font-bold text-gray-900">卷子历史记录</h2>
  7. <p class="mt-1 text-sm text-gray-500">
  8. 查看所有历史生成的试卷,支持导出、复制和删除操作
  9. </p>
  10. </div>
  11. </div>
  12. <!-- 筛选器 - 使用 DaisyUI -->
  13. <div class="card bg-base-100 shadow-xl">
  14. <div class="card-body">
  15. <div class="grid grid-cols-1 md:grid-cols-4 gap-4">
  16. <input
  17. type="text"
  18. wire:model.live="search"
  19. placeholder="搜索试卷名称..."
  20. class="input input-bordered input-primary w-full"
  21. />
  22. <select wire:model.live="statusFilter" class="select select-bordered select-primary w-full">
  23. <option value="">-- 全部状态 --</option>
  24. <option value="draft">草稿</option>
  25. <option value="completed">已完成</option>
  26. <option value="graded">已评分</option>
  27. </select>
  28. <select wire:model.live="difficultyFilter" class="select select-bordered select-primary w-full">
  29. <option value="">-- 全部难度 --</option>
  30. <option value="基础">基础</option>
  31. <option value="进阶">进阶</option>
  32. <option value="竞赛">竞赛</option>
  33. </select>
  34. <button
  35. wire:click="$refresh"
  36. type="button"
  37. class="btn btn-outline btn-secondary">
  38. 重置
  39. </button>
  40. </div>
  41. </div>
  42. </div>
  43. <!-- 试卷列表 - 全宽表格视图 -->
  44. <div class="w-full">
  45. <div class="card bg-base-100 shadow-xl overflow-hidden">
  46. <div class="overflow-x-auto">
  47. <table class="table table-zebra w-full">
  48. <thead>
  49. <tr>
  50. <th>试卷名称</th>
  51. <th>状态</th>
  52. <th>难度</th>
  53. <th>题目/总分</th>
  54. <th>创建时间</th>
  55. <th>操作</th>
  56. </tr>
  57. </thead>
  58. <tbody>
  59. @forelse($this->exams()['data'] as $exam)
  60. <tr class="hover">
  61. <td>
  62. <div class="font-bold">{{ $exam['paper_name'] }}</div>
  63. <div class="text-xs opacity-50">{{ $exam['id'] }}</div>
  64. </td>
  65. <td>
  66. <span class="badge badge-{{ $this->getStatusColor($exam['status']) }} badge-sm">
  67. {{ $this->getStatusLabel($exam['status']) }}
  68. </span>
  69. </td>
  70. <td>
  71. <span class="badge badge-{{ $this->getDifficultyColor($exam['difficulty_category']) }} badge-sm">
  72. {{ $exam['difficulty_category'] }}
  73. </span>
  74. </td>
  75. <td>
  76. <div class="text-sm">{{ $exam['question_count'] }} 题</div>
  77. <div class="text-xs opacity-50">{{ $exam['total_score'] }} 分</div>
  78. </td>
  79. <td class="text-sm">
  80. {{ \Carbon\Carbon::parse($exam['created_at'])->format('Y-m-d H:i') }}
  81. </td>
  82. <td>
  83. <div class="flex gap-2">
  84. <a href="{{ url('/admin/exam-detail?paperId=' . $exam['id']) }}"
  85. class="btn btn-ghost btn-xs tooltip"
  86. data-tip="查看详情">
  87. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  88. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path>
  89. <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>
  90. </svg>
  91. </a>
  92. <button
  93. wire:click.stop="exportPdf('{{ $exam['id'] }}')"
  94. class="btn btn-ghost btn-xs tooltip"
  95. data-tip="导出PDF">
  96. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"></path></svg>
  97. </button>
  98. <button
  99. wire:click.stop="duplicateExam({{ json_encode($exam) }})"
  100. class="btn btn-ghost btn-xs tooltip"
  101. data-tip="复制配置">
  102. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"></path></svg>
  103. </button>
  104. <button
  105. wire:click.stop="startEditExam('{{ $exam['id'] }}')"
  106. class="btn btn-ghost btn-xs tooltip"
  107. data-tip="编辑试卷">
  108. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"></path></svg>
  109. </button>
  110. <button
  111. wire:click.stop="deleteExam('{{ $exam['id'] }}')"
  112. wire:confirm="确定要删除这份试卷吗?此操作不可恢复!"
  113. class="btn btn-ghost btn-xs tooltip text-error"
  114. data-tip="删除试卷">
  115. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"></path></svg>
  116. </button>
  117. </div>
  118. </td>
  119. </tr>
  120. @empty
  121. <tr>
  122. <td colspan="6" class="text-center py-8">
  123. <div class="flex flex-col items-center justify-center text-gray-500">
  124. <svg class="w-12 h-12 mb-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  125. <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>
  126. </svg>
  127. <p>暂无试卷记录</p>
  128. <a href="{{ url('/admin/intelligent-exam-generation') }}" class="btn btn-primary btn-sm mt-2">
  129. 去出卷
  130. </a>
  131. </div>
  132. </td>
  133. </tr>
  134. @endforelse
  135. </tbody>
  136. </table>
  137. </div>
  138. <!-- 分页 -->
  139. <div class="p-4 border-t">
  140. <div class="flex justify-between items-center">
  141. <div class="text-sm text-gray-500">
  142. 共 {{ $this->meta()['total'] }} 条记录
  143. </div>
  144. <div class="join">
  145. <button class="join-item btn btn-sm" wire:click="$set('currentPage', {{ max(1, $this->currentPage - 1) }})" {{ $this->currentPage <= 1 ? 'disabled' : '' }}>«</button>
  146. <button class="join-item btn btn-sm">第 {{ $this->currentPage }} 页</button>
  147. <button class="join-item btn btn-sm" wire:click="$set('currentPage', {{ $this->currentPage + 1 }})" {{ $this->currentPage >= $this->meta()['total_pages'] ? 'disabled' : '' }}>»</button>
  148. </div>
  149. </div>
  150. </div>
  151. </div>
  152. </div>
  153. </div>
  154. {{-- 编辑试卷模态框 --}}
  155. @if($editingExamId)
  156. <div class="modal modal-open">
  157. <div class="modal-box">
  158. <h3 class="font-bold text-lg mb-4">编辑试卷</h3>
  159. <div class="space-y-4">
  160. <div class="form-control">
  161. <label class="label">
  162. <span class="label-text">试卷名称</span>
  163. </label>
  164. <input type="text" wire:model="editForm.paper_name"
  165. class="input input-bordered input-primary"
  166. placeholder="请输入试卷名称" />
  167. @error('editForm.paper_name')
  168. <label class="label">
  169. <span class="label-text-alt text-error">{{ $message }}</span>
  170. </label>
  171. @enderror
  172. </div>
  173. <div class="form-control">
  174. <label class="label">
  175. <span class="label-text">难度分类</span>
  176. </label>
  177. <select wire:model="editForm.difficulty_category"
  178. class="select select-bordered select-primary">
  179. <option value="">-- 请选择难度 --</option>
  180. <option value="基础">基础</option>
  181. <option value="进阶">进阶</option>
  182. <option value="竞赛">竞赛</option>
  183. </select>
  184. @error('editForm.difficulty_category')
  185. <label class="label">
  186. <span class="label-text-alt text-error">{{ $message }}</span>
  187. </label>
  188. @enderror
  189. </div>
  190. <div class="form-control">
  191. <label class="label">
  192. <span class="label-text">状态</span>
  193. </label>
  194. <select wire:model="editForm.status"
  195. class="select select-bordered select-primary">
  196. <option value="">-- 请选择状态 --</option>
  197. <option value="draft">草稿</option>
  198. <option value="completed">已完成</option>
  199. <option value="graded">已评分</option>
  200. </select>
  201. @error('editForm.status')
  202. <label class="label">
  203. <span class="label-text-alt text-error">{{ $message }}</span>
  204. </label>
  205. @enderror
  206. </div>
  207. </div>
  208. <div class="modal-action">
  209. <button wire:click="cancelEdit" class="btn btn-ghost">取消</button>
  210. <button wire:click="saveExamEdit" class="btn btn-primary">保存</button>
  211. </div>
  212. </div>
  213. </div>
  214. @endif
  215. </x-filament-panels::page>