exam-history-simple.blade.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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="grid grid-cols-1 lg:grid-cols-3 gap-6">
  45. <!-- 左侧:试卷列表 -->
  46. <div class="lg:col-span-2">
  47. <div class="card bg-base-100 shadow-xl overflow-hidden">
  48. <div class="overflow-x-auto">
  49. <table class="table table-zebra w-full">
  50. <thead>
  51. <tr>
  52. <th>试卷名称</th>
  53. <th>状态</th>
  54. <th>难度</th>
  55. <th>题目/总分</th>
  56. <th>创建时间</th>
  57. <th>操作</th>
  58. </tr>
  59. </thead>
  60. <tbody>
  61. @forelse($this->exams()['data'] as $exam)
  62. <tr class="hover cursor-pointer {{ $selectedExamId == $exam['id'] ? 'active' : '' }}"
  63. wire:click="viewExamDetail('{{ $exam['id'] }}')">
  64. <td>
  65. <div class="font-bold">{{ $exam['paper_name'] }}</div>
  66. <div class="text-xs opacity-50">{{ $exam['id'] }}</div>
  67. </td>
  68. <td>
  69. <span class="badge badge-{{ $this->getStatusColor($exam['status']) }} badge-sm">
  70. {{ $this->getStatusLabel($exam['status']) }}
  71. </span>
  72. </td>
  73. <td>
  74. <span class="badge badge-{{ $this->getDifficultyColor($exam['difficulty_category']) }} badge-sm">
  75. {{ $exam['difficulty_category'] }}
  76. </span>
  77. </td>
  78. <td>
  79. <div class="text-sm">{{ $exam['question_count'] }} 题</div>
  80. <div class="text-xs opacity-50">{{ $exam['total_score'] }} 分</div>
  81. </td>
  82. <td class="text-sm">
  83. {{ \Carbon\Carbon::parse($exam['created_at'])->format('Y-m-d H:i') }}
  84. </td>
  85. <td>
  86. <div class="flex gap-2">
  87. <button
  88. wire:click.stop="exportPdf('{{ $exam['id'] }}')"
  89. class="btn btn-ghost btn-xs tooltip"
  90. data-tip="导出PDF">
  91. <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>
  92. </button>
  93. <button
  94. wire:click.stop="duplicateExam({{ json_encode($exam) }})"
  95. class="btn btn-ghost btn-xs tooltip"
  96. data-tip="复制配置">
  97. <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>
  98. </button>
  99. </div>
  100. </td>
  101. </tr>
  102. @empty
  103. <tr>
  104. <td colspan="6" class="text-center py-8">
  105. <div class="flex flex-col items-center justify-center text-gray-500">
  106. <svg class="w-12 h-12 mb-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  107. <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>
  108. </svg>
  109. <p>暂无试卷记录</p>
  110. <a href="{{ url('/admin/intelligent-exam-generation') }}" class="btn btn-primary btn-sm mt-2">
  111. 去出卷
  112. </a>
  113. </div>
  114. </td>
  115. </tr>
  116. @endforelse
  117. </tbody>
  118. </table>
  119. </div>
  120. <!-- 分页 -->
  121. <div class="p-4 border-t">
  122. <div class="flex justify-between items-center">
  123. <div class="text-sm text-gray-500">
  124. 共 {{ $this->meta()['total'] }} 条记录
  125. </div>
  126. <div class="join">
  127. <button class="join-item btn btn-sm" wire:click="$set('currentPage', {{ max(1, $this->currentPage - 1) }})" {{ $this->currentPage <= 1 ? 'disabled' : '' }}>«</button>
  128. <button class="join-item btn btn-sm">第 {{ $this->currentPage }} 页</button>
  129. <button class="join-item btn btn-sm" wire:click="$set('currentPage', {{ $this->currentPage + 1 }})" {{ $this->currentPage >= $this->meta()['total_pages'] ? 'disabled' : '' }}>»</button>
  130. </div>
  131. </div>
  132. </div>
  133. </div>
  134. </div>
  135. <!-- 右侧:试卷详情与预览 -->
  136. <div class="lg:col-span-1">
  137. @if($selectedExamId)
  138. <div class="card bg-base-100 shadow-xl sticky top-6">
  139. <div class="card-body">
  140. <div class="flex items-center justify-between mb-4">
  141. <h3 class="card-title">试卷详情</h3>
  142. <button
  143. wire:click="$set('selectedExamId', null)"
  144. class="btn btn-ghost btn-sm btn-circle">
  145. <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg>
  146. </button>
  147. </div>
  148. <div class="space-y-4">
  149. <div>
  150. <div class="text-sm text-gray-500">试卷名称</div>
  151. <div class="font-medium text-gray-900">{{ $selectedExamDetail['paper_name'] ?? '未命名试卷' }}</div>
  152. </div>
  153. <div class="stats stats-vertical shadow w-full">
  154. <div class="stat">
  155. <div class="stat-title">题目数量</div>
  156. <div class="stat-value text-primary">{{ $selectedExamDetail['question_count'] ?? 0 }}</div>
  157. <div class="stat-desc">题</div>
  158. </div>
  159. <div class="stat">
  160. <div class="stat-title">总分</div>
  161. <div class="stat-value text-secondary">{{ $selectedExamDetail['total_score'] ?? 0 }}</div>
  162. <div class="stat-desc">分</div>
  163. </div>
  164. </div>
  165. <div>
  166. <div class="text-sm text-gray-500">创建时间</div>
  167. <div class="font-medium text-gray-900">
  168. @if(isset($selectedExamDetail['created_at']))
  169. {{ \Carbon\Carbon::parse($selectedExamDetail['created_at'])->format('Y-m-d H:i') }}
  170. @else
  171. 未知时间
  172. @endif
  173. </div>
  174. </div>
  175. <div class="divider"></div>
  176. <div class="space-y-2">
  177. <a href="{{ route('filament.admin.auth.intelligent-exam.pdf', ['paper_id' => $selectedExamId]) }}"
  178. target="_blank"
  179. class="btn btn-primary w-full">
  180. 查看 PDF 试卷
  181. </a>
  182. <button
  183. wire:click="duplicateExam({{ json_encode($selectedExamDetail) }})"
  184. class="btn btn-outline w-full">
  185. 复制试卷配置
  186. </button>
  187. </div>
  188. </div>
  189. </div>
  190. </div>
  191. @else
  192. <div class="card bg-base-100 shadow-xl h-64">
  193. <div class="card-body items-center justify-center text-center text-gray-400">
  194. <svg class="w-16 h-16 mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  195. <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>
  196. </svg>
  197. <p>点击左侧列表查看试卷详情及预览</p>
  198. </div>
  199. </div>
  200. @endif
  201. </div>
  202. </div>
  203. </div>
  204. </x-filament-panels::page>