simulated-grading.blade.php.backup 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  1. <x-filament-panels::page>
  2. <div class="min-h-screen bg-gray-50 p-8">
  3. {{-- 页面标题区域 --}}
  4. <div class="mb-8">
  5. <div class="bg-white rounded-xl shadow-sm p-6 border border-gray-200">
  6. <div class="flex items-center justify-between mb-6">
  7. <div>
  8. <h1 class="text-3xl font-bold text-gray-900 flex items-center">
  9. <svg class="w-8 h-8 mr-3 text-indigo-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  10. <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>
  11. </svg>
  12. 模拟判卷
  13. </h1>
  14. <p class="mt-2 text-sm text-gray-600 ml-11">
  15. 选择知识点和技能,生成题目进行练习,自动记录答题结果并更新学生掌握度
  16. </p>
  17. </div>
  18. </div>
  19. {{-- 选择器区域 --}}
  20. <div class="bg-gray-50 rounded-lg p-4 border border-gray-200">
  21. <div class="flex items-end space-x-6">
  22. <div class="flex-1">
  23. <label for="teacher-select" class="block text-sm font-medium text-gray-700 mb-2">
  24. <svg class="w-4 h-4 inline mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  25. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"></path>
  26. </svg>
  27. 选择老师
  28. </label>
  29. <select
  30. id="teacher-select"
  31. wire:model.live="teacherId"
  32. class="block w-full rounded-lg border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 text-sm py-2.5 bg-gray-50"
  33. >
  34. <option value="">请选择老师</option>
  35. @foreach ($teachers as $teacher)
  36. <option value="{{ $teacher->teacher_id }}">
  37. {{ $teacher->name }} ({{ $teacher->subject }})
  38. </option>
  39. @endforeach
  40. </select>
  41. </div>
  42. <div class="flex-1">
  43. <label for="student-select" class="block text-sm font-medium text-gray-700 mb-2">
  44. <svg class="w-4 h-4 inline mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  45. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z"></path>
  46. </svg>
  47. 选择学生
  48. </label>
  49. <select
  50. id="student-select"
  51. wire:model.live="studentId"
  52. class="block w-full rounded-lg border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 text-sm py-2.5 bg-gray-50"
  53. @disabled(empty($teacherId))
  54. >
  55. <option value="">请选择学生</option>
  56. @foreach ($students as $student)
  57. <option value="{{ $student->student_id }}">
  58. {{ $student->name }} - {{ $student->grade }}{{ $student->class_name }}
  59. </option>
  60. @endforeach
  61. </select>
  62. </div>
  63. </div>
  64. </div>
  65. </div>
  66. </div>
  67. {{-- 加载状态 --}}
  68. @if ($isLoading)
  69. <div class="mb-8">
  70. <div class="bg-white rounded-xl shadow-sm p-12 border border-gray-200">
  71. <div class="flex flex-col items-center justify-center">
  72. <svg class="animate-spin h-12 w-12 text-indigo-600" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
  73. <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
  74. <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>
  75. </svg>
  76. <p class="mt-4 text-sm text-gray-600">正在生成题目,请稍候...</p>
  77. </div>
  78. </div>
  79. </div>
  80. @else
  81. {{-- 练习题目模块 --}}
  82. <div class="mb-8">
  83. <div class="bg-white shadow-sm rounded-xl border border-gray-200">
  84. <div class="px-6 py-5 border-b border-gray-100">
  85. <div class="flex items-center justify-between mb-4">
  86. <h3 class="text-lg font-semibold text-gray-900 flex items-center">
  87. <svg class="w-5 h-5 mr-2 text-indigo-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  88. <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>
  89. </svg>
  90. 模拟判卷练习
  91. </h3>
  92. </div>
  93. <div class="p-6">
  94. <div class="space-y-6">
  95. {{-- 知识点和技能选择区域 --}}
  96. <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
  97. {{-- 知识点选择 --}}
  98. <div class="border border-gray-200 rounded-lg p-4">
  99. <h4 class="text-sm font-medium text-gray-900 mb-3 flex items-center">
  100. <svg class="w-4 h-4 mr-2 text-indigo-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  101. <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>
  102. </svg>
  103. 选择知识点
  104. </h4>
  105. <select
  106. wire:model.live="selectedKnowledgePoint"
  107. class="block w-full rounded-lg border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 text-sm bg-gray-50"
  108. >
  109. <option value="">随机知识点</option>
  110. @foreach ($availableKnowledgePoints as $kp)
  111. <option value="{{ $kp['id'] ?? $kp['code'] ?? $kp }}">{{ $kp['name'] ?? $kp['code'] ?? $kp }}</option>
  112. @endforeach
  113. </select>
  114. </div>
  115. {{-- 技能选择 --}}
  116. <div class="border border-gray-200 rounded-lg p-4">
  117. <h4 class="text-sm font-medium text-gray-900 mb-3 flex items-center">
  118. <svg class="w-4 h-4 mr-2 text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  119. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"></path>
  120. </svg>
  121. 选择技能(可多选)
  122. </h4>
  123. <div class="space-y-2 max-h-32 overflow-y-auto">
  124. @foreach ($availableSkills as $skill)
  125. <label class="flex items-center">
  126. <input
  127. type="checkbox"
  128. wire:model.live="selectedSkills"
  129. value="{{ $skill['id'] ?? $skill['code'] ?? $skill }}"
  130. class="rounded border-gray-300 text-indigo-600 focus:ring-indigo-500"
  131. />
  132. <span class="ml-2 text-sm text-gray-700">{{ $skill['name'] ?? $skill['code'] ?? $skill }}</span>
  133. </label>
  134. @endforeach
  135. </div>
  136. </div>
  137. </div>
  138. {{-- 题目数量和生成按钮 --}}
  139. <div class="flex items-center space-x-4 p-4 bg-gray-50 rounded-lg">
  140. <div class="flex items-center space-x-2">
  141. <label class="text-sm font-medium text-gray-700">题目数量:</label>
  142. <input
  143. type="number"
  144. wire:model.live="questionsPerSet"
  145. min="1"
  146. max="10"
  147. class="w-16 rounded-lg border-gray-300 text-sm text-center bg-gray-50"
  148. />
  149. </div>
  150. <button
  151. wire:click="generateBatchQuestions"
  152. wire:loading.attr="disabled"
  153. class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-lg shadow-sm text-white bg-green-600 hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500"
  154. >
  155. <svg wire:loading class="animate-spin -ml-1 mr-2 h-4 w-4 text-white" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
  156. <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
  157. <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>
  158. </svg>
  159. 生成题目组
  160. </button>
  161. <div class="text-sm text-gray-500">
  162. 当前批次ID: {{ $currentBatchId ?: '未生成' }}
  163. </div>
  164. </div>
  165. {{-- 题目列表 --}}
  166. @if (!empty($exerciseQuestions))
  167. <div class="border border-gray-200 rounded-lg p-4">
  168. <h4 class="text-sm font-medium text-gray-900 mb-4">题目列表 (请标记对错)</h4>
  169. <div class="space-y-4 max-h-96 overflow-y-auto">
  170. @foreach ($exerciseQuestions as $index => $question)
  171. <div class="border border-gray-200 rounded-lg p-4">
  172. <div class="flex items-start justify-between mb-3">
  173. <div class="flex-1">
  174. <div class="flex items-center mb-2">
  175. <span class="inline-flex items-center justify-center w-6 h-6 rounded-full bg-indigo-100 text-indigo-800 text-xs font-medium mr-2">
  176. {{ $index + 1 }}
  177. </span>
  178. <span class="text-sm text-gray-500">{{ $question['type'] ?? '数学题' }}</span>
  179. <span class="mx-2 text-gray-300">|</span>
  180. <span class="text-sm text-gray-500">难度: {{ $question['difficulty'] ?? 3 }}/5</span>
  181. </div>
  182. <h5 class="text-base font-medium text-gray-900">
  183. {{ $question['content'] ?? '' }}
  184. </h5>
  185. </div>
  186. </div>
  187. <div class="grid grid-cols-1 lg:grid-cols-2 gap-4">
  188. <div>
  189. <label class="block text-sm font-medium text-gray-700 mb-1">学生答案(可选)</label>
  190. <input
  191. type="text"
  192. wire:model.live="exerciseAnswers.{{ $index }}.user_answer"
  193. placeholder="输入答案..."
  194. class="block w-full rounded-lg border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 text-sm bg-gray-50"
  195. />
  196. </div>
  197. <div>
  198. <label class="block text-sm font-medium text-gray-700 mb-1">答题结果</label>
  199. <div class="flex space-x-4">
  200. <label class="flex items-center">
  201. <input
  202. type="radio"
  203. wire:model.live="exerciseAnswers.{{ $index }}.is_correct"
  204. value="1"
  205. class="h-4 w-4 text-green-600 focus:ring-green-500 border-gray-300"
  206. />
  207. <span class="ml-2 text-sm text-green-700">正确</span>
  208. </label>
  209. <label class="flex items-center">
  210. <input
  211. type="radio"
  212. wire:model.live="exerciseAnswers.{{ $index }}.is_correct"
  213. value="0"
  214. class="h-4 w-4 text-red-600 focus:ring-red-500 border-gray-300"
  215. />
  216. <span class="ml-2 text-sm text-red-700">错误</span>
  217. </label>
  218. </div>
  219. </div>
  220. </div>
  221. <div class="mt-3 p-2 bg-green-50 border border-green-200 rounded">
  222. <span class="text-xs text-green-800">正确答案: </span>
  223. <span class="text-xs">
  224. {{ $question['answer'] ?? 'N/A' }}
  225. </span>
  226. </div>
  227. </div>
  228. @endforeach
  229. </div>
  230. {{-- 批量提交按钮 --}}
  231. <div class="mt-6 pt-4 border-t border-gray-200">
  232. <button
  233. wire:click="submitBatchAnswers"
  234. wire:loading.attr="disabled"
  235. class="w-full inline-flex items-center justify-center px-6 py-3 border border-transparent text-sm font-medium rounded-lg shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
  236. >
  237. <svg wire:loading class="animate-spin -ml-1 mr-2 h-4 w-4 text-white" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
  238. <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
  239. <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>
  240. </svg>
  241. <svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  242. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
  243. </svg>
  244. 批量提交答案 ({{ count($exerciseQuestions) }} 题)
  245. </button>
  246. </div>
  247. </div>
  248. @else
  249. {{-- 批量模式空状态 --}}
  250. <div class="text-center py-12">
  251. <svg class="mx-auto h-16 w-16 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  252. <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>
  253. </svg>
  254. <h3 class="mt-4 text-lg font-medium text-gray-900">批量练习模式</h3>
  255. <p class="mt-2 text-sm text-gray-500 max-w-md mx-auto">
  256. 选择知识点和技能,设置题目数量,点击"生成题目组"开始批量答题练习
  257. </p>
  258. </div>
  259. @endif
  260. </div>
  261. </div>
  262. </div>
  263. </div>
  264. </div>
  265. {{-- 答题历史模块 --}}
  266. @if (!empty($studentId))
  267. <div class="mb-8">
  268. <div class="bg-white shadow-sm rounded-xl border border-gray-200">
  269. <div class="px-6 py-5 border-b border-gray-100">
  270. <h3 class="text-lg font-semibold text-gray-900 flex items-center">
  271. <svg class="w-5 h-5 mr-2 text-purple-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  272. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path>
  273. </svg>
  274. 答题历史
  275. </h3>
  276. </div>
  277. <div class="p-6">
  278. {{-- 每页显示数量选择 --}}
  279. <div class="flex items-center justify-between mb-6">
  280. <div class="flex items-center space-x-2">
  281. <label class="text-sm font-medium text-gray-700">每页显示:</label>
  282. <select
  283. wire:model.live="historyPerPage"
  284. class="rounded-lg border-gray-300 text-sm bg-gray-50"
  285. >
  286. <option value="5">5 条</option>
  287. <option value="10">10 条</option>
  288. <option value="20">20 条</option>
  289. <option value="50">50 条</option>
  290. </select>
  291. </div>
  292. <div class="text-sm text-gray-500">
  293. 共 {{ $historyTotal }} 条记录
  294. </div>
  295. </div>
  296. {{-- 历史记录列表 --}}
  297. @if (!empty($exerciseHistory))
  298. <div class="space-y-4">
  299. @foreach ($exerciseHistory as $history)
  300. <div class="border border-gray-200 rounded-lg p-4 hover:bg-gray-50 transition-colors">
  301. <div class="flex items-start justify-between mb-3">
  302. <div class="flex-1">
  303. <div class="flex items-center mb-2">
  304. <span class="inline-flex items-center justify-center w-6 h-6 rounded-full bg-purple-100 text-purple-800 text-xs font-medium mr-2">
  305. {{ $loop->iteration + ($historyCurrentPage - 1) * $historyPerPage }}
  306. </span>
  307. <span class="text-sm text-gray-500">批次: {{ $history['batch_id'] ?? 'N/A' }}</span>
  308. <span class="mx-2 text-gray-300">|</span>
  309. <span class="text-sm text-gray-500">
  310. {{ $history['kp_code'] ?? 'N/A' }}
  311. </span>
  312. </div>
  313. <h5 class="text-base font-medium text-gray-900 mb-2">
  314. {{ Str::limit($history['question_content'] ?? 'N/A', 100) }}
  315. </h5>
  316. <div class="grid grid-cols-1 lg:grid-cols-2 gap-4 mt-3">
  317. <div>
  318. <span class="text-xs text-gray-500">学生答案:</span>
  319. <div class="text-sm text-gray-900">
  320. {{ $history['student_answer'] ?? '未填写' }}
  321. </div>
  322. </div>
  323. <div>
  324. <span class="text-xs text-gray-500">正确答案:</span>
  325. <div class="text-sm text-gray-900">
  326. {{ $history['correct_answer'] ?? 'N/A' }}
  327. </div>
  328. </div>
  329. </div>
  330. </div>
  331. <div class="ml-4 text-right">
  332. @if ($history['is_correct'])
  333. <span class="inline-flex items-center px-3 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800">
  334. <svg class="w-3 h-3 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  335. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
  336. </svg>
  337. 正确
  338. </span>
  339. @else
  340. <span class="inline-flex items-center px-3 py-1 rounded-full text-xs font-medium bg-red-100 text-red-800">
  341. <svg class="w-3 h-3 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  342. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
  343. </svg>
  344. 错误
  345. </span>
  346. @endif
  347. <div class="mt-2 text-xs text-gray-500">
  348. {{ date('Y-m-d H:i', strtotime($history['created_at'])) }}
  349. </div>
  350. </div>
  351. </div>
  352. </div>
  353. @endforeach
  354. </div>
  355. {{-- 分页导航 --}}
  356. @if ($historyTotalPages > 1)
  357. <div class="mt-6 pt-4 border-t border-gray-200 flex items-center justify-between">
  358. <div class="text-sm text-gray-700">
  359. 显示第 {{ ($historyCurrentPage - 1) * $historyPerPage + 1 }} -
  360. {{ min($historyCurrentPage * $historyPerPage, $historyTotal) }} 条,
  361. 共 {{ $historyTotal }} 条记录
  362. </div>
  363. <div class="flex items-center gap-2">
  364. <button
  365. wire:click="previousHistoryPage"
  366. @disabled($historyCurrentPage <= 1)
  367. class="px-3 py-1 border rounded-lg text-sm hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"
  368. >
  369. 上一页
  370. </button>
  371. @foreach ($this->getHistoryPages() as $page)
  372. <button
  373. wire:click="gotoHistoryPage({{ $page }})"
  374. class="px-3 py-1 border rounded-lg text-sm {{ $page === $historyCurrentPage ? 'bg-indigo-600 text-white' : 'hover:bg-gray-50' }}"
  375. >
  376. {{ $page }}
  377. </button>
  378. @endforeach
  379. <button
  380. wire:click="nextHistoryPage"
  381. @disabled($historyCurrentPage >= $historyTotalPages)
  382. class="px-3 py-1 border rounded-lg text-sm hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"
  383. >
  384. 下一页
  385. </button>
  386. </div>
  387. </div>
  388. @endif
  389. @else
  390. <div class="text-center py-12">
  391. <svg class="mx-auto h-16 w-16 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  392. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path>
  393. </svg>
  394. <h3 class="mt-4 text-lg font-medium text-gray-900">暂无答题历史</h3>
  395. <p class="mt-2 text-sm text-gray-500 max-w-md mx-auto">
  396. 选择学生后,答题历史将显示在这里
  397. </p>
  398. </div>
  399. @endif
  400. </div>
  401. </div>
  402. </div>
  403. @endif
  404. @endif
  405. </div>
  406. {{-- 通知脚本 --}}
  407. <script>
  408. document.addEventListener('notify', (event) => {
  409. const message = event.detail.message;
  410. const type = event.detail.type || 'info';
  411. alert(message);
  412. });
  413. </script>
  414. </x-filament-panels::page>