ocr-record-view-new.blade.php 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. <x-filament-panels::page>
  2. <div class="space-y-6">
  3. @php
  4. $record = $this->record();
  5. @endphp
  6. {{-- 面包屑导航 --}}
  7. <div class="breadcrumbs text-sm">
  8. <ul>
  9. <li>
  10. <a href="{{ route('filament.admin.pages.ocr-records') }}" class="link link-primary link-hover no-underline">
  11. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  12. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"></path>
  13. </svg>
  14. OCR识别记录
  15. </a>
  16. </li>
  17. <li>
  18. <span class="text-base-content/60">/</span>
  19. </li>
  20. <li>记录详情 #{{ $record->id }}</li>
  21. </ul>
  22. </div>
  23. @if($record)
  24. {{-- 头部信息卡片 --}}
  25. <div class="card bg-base-100 border border-base-300 shadow-xl">
  26. <div class="card-body">
  27. <div class="flex flex-col lg:flex-row justify-between gap-4">
  28. <div class="flex items-center gap-3">
  29. <div class="avatar placeholder">
  30. <div class="bg-primary text-primary-content rounded-full w-12 h-12 flex items-center justify-center">
  31. <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  32. <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>
  33. </svg>
  34. </div>
  35. </div>
  36. <div>
  37. <h1 class="text-2xl font-bold">OCR记录详情</h1>
  38. <p class="text-sm text-base-content/60">记录ID: {{ $record->id }}</p>
  39. </div>
  40. </div>
  41. <div class="flex items-center gap-2">
  42. @php
  43. $statusConfig = $this->getStatusBadgeConfig($record->status);
  44. @endphp
  45. <div class="badge {{ $statusConfig['class'] }} gap-2">
  46. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  47. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
  48. </svg>
  49. {{ $statusConfig['text'] }}
  50. </div>
  51. @if($record->status === 'pending' || $record->status === 'failed')
  52. <button
  53. wire:click="startRecognition"
  54. class="btn btn-primary btn-sm"
  55. >
  56. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  57. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z"></path>
  58. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
  59. </svg>
  60. 开始识别
  61. </button>
  62. @endif
  63. <a href="{{ route('filament.admin.pages.ocr-records') }}" class="btn btn-ghost btn-sm">
  64. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  65. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"></path>
  66. </svg>
  67. 返回列表
  68. </a>
  69. </div>
  70. </div>
  71. <div class="stats stats-vertical lg:stats-horizontal shadow bg-base-200 border border-base-300">
  72. <div class="stat">
  73. <div class="stat-figure text-primary">
  74. <svg class="w-8 h-8" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  75. <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>
  76. </svg>
  77. </div>
  78. <div class="stat-title">学生</div>
  79. <div class="stat-value text-lg">{{ $record->student->name ?? '未知' }}</div>
  80. <div class="stat-desc">{{ $record->student->grade ?? '-' }} - {{ $record->student->class_name ?? '-' }}</div>
  81. </div>
  82. <div class="stat">
  83. <div class="stat-figure text-secondary">
  84. <svg class="w-8 h-8" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  85. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"></path>
  86. </svg>
  87. </div>
  88. <div class="stat-title">图片</div>
  89. <div class="stat-value text-lg">{{ $record->image_filename }}</div>
  90. <div class="stat-desc">{{ number_format($record->image_size / 1024, 2) }} KB</div>
  91. </div>
  92. <div class="stat">
  93. <div class="stat-figure text-info">
  94. <svg class="w-8 h-8" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  95. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path>
  96. </svg>
  97. </div>
  98. <div class="stat-title">进度</div>
  99. <div class="stat-value text-lg">{{ $record->processed_questions ?? 0 }}/{{ $record->total_questions ?? 0 }}</div>
  100. <div class="stat-desc">
  101. @if($record->total_questions > 0)
  102. @php
  103. $percent = round(($record->processed_questions / $record->total_questions) * 100, 1);
  104. @endphp
  105. <progress class="progress progress-primary w-16" value="{{ $percent }}" max="100"></progress>
  106. {{ $percent }}%
  107. @else
  108. 未开始
  109. @endif
  110. </div>
  111. </div>
  112. <div class="stat">
  113. <div class="stat-figure text-success">
  114. <svg class="w-8 h-8" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  115. <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>
  116. </svg>
  117. </div>
  118. <div class="stat-title">置信度</div>
  119. <div class="stat-value text-lg">
  120. @if($record->confidence_avg)
  121. {{ number_format($record->confidence_avg * 100, 1) }}%
  122. @else
  123. -
  124. @endif
  125. </div>
  126. <div class="stat-desc">
  127. @if($record->confidence_avg)
  128. @if($record->confidence_avg >= 0.7)
  129. <span class="text-success">优秀</span>
  130. @elseif($record->confidence_avg >= 0.5)
  131. <span class="text-warning">良好</span>
  132. @else
  133. <span class="text-error">需改进</span>
  134. @endif
  135. @else
  136. 暂无数据
  137. @endif
  138. </div>
  139. </div>
  140. </div>
  141. @if($record->error_message)
  142. <div class="alert alert-error mt-4">
  143. <svg class="w-6 h-6 shrink-0 stroke-current" fill="none" viewBox="0 0 24 24">
  144. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
  145. </svg>
  146. <div>
  147. <h3 class="font-bold">错误信息</h3>
  148. <div class="text-xs">{{ $record->error_message }}</div>
  149. </div>
  150. </div>
  151. @endif
  152. </div>
  153. </div>
  154. {{-- 图片预览卡片 --}}
  155. @if($record->image_path)
  156. <div class="card bg-base-100 border border-base-300 shadow-xl">
  157. <div class="card-body">
  158. <h2 class="card-title flex items-center gap-2">
  159. <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  160. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"></path>
  161. </svg>
  162. 原图预览
  163. </h2>
  164. <div class="mockup-window border border-base-300">
  165. <div class="mockup-browser-toolbar">
  166. <div class="mockup-browser-dot"></div>
  167. <div class="mockup-browser-dot"></div>
  168. <div class="mockup-browser-dot"></div>
  169. </div>
  170. <div class="mockup-browser-content bg-base-200">
  171. <img
  172. src="{{ asset('storage/' . $record->image_path) }}"
  173. alt="卷子图片"
  174. class="w-full h-auto rounded-b-lg"
  175. >
  176. </div>
  177. </div>
  178. <div class="mt-4 grid grid-cols-2 md:grid-cols-4 gap-4 text-sm">
  179. <div class="stat bg-base-200 rounded-lg border border-base-300">
  180. <div class="stat-title text-xs">文件大小</div>
  181. <div class="stat-value text-sm">{{ number_format($record->image_size / 1024, 2) }} KB</div>
  182. </div>
  183. @if($record->image_width)
  184. <div class="stat bg-base-200 rounded-lg border border-base-300">
  185. <div class="stat-title text-xs">宽度</div>
  186. <div class="stat-value text-sm">{{ $record->image_width }} px</div>
  187. </div>
  188. @endif
  189. @if($record->image_height)
  190. <div class="stat bg-base-200 rounded-lg border border-base-300">
  191. <div class="stat-title text-xs">高度</div>
  192. <div class="stat-value text-sm">{{ $record->image_height }} px</div>
  193. </div>
  194. @endif
  195. <div class="stat bg-base-200 rounded-lg border border-base-300">
  196. <div class="stat-title text-xs">创建时间</div>
  197. <div class="stat-value text-sm">{{ $record->created_at->format('m-d H:i') }}</div>
  198. </div>
  199. </div>
  200. </div>
  201. </div>
  202. @endif
  203. {{-- 题目识别结果列表 --}}
  204. <div class="card bg-base-100 border border-base-300 shadow-xl">
  205. <div class="card-body">
  206. <div class="flex justify-between items-center mb-6">
  207. <h2 class="card-title text-xl flex items-center gap-2">
  208. <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  209. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path>
  210. </svg>
  211. 题目识别结果 ({{ count($record->questions ?? []) }} 道题)
  212. </h2>
  213. @if(!$this->hasAnalysisResults)
  214. <div class="badge badge-primary badge-lg gap-2">
  215. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  216. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
  217. </svg>
  218. 待分析
  219. </div>
  220. @else
  221. <div class="badge badge-success badge-lg gap-2">
  222. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  223. <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>
  224. </svg>
  225. 已分析
  226. </div>
  227. @endif
  228. </div>
  229. @if($record->questions && count($record->questions) > 0)
  230. <div class="overflow-x-auto">
  231. <table class="table table-zebra table-compact">
  232. <thead>
  233. <tr>
  234. <th class="w-12">#</th>
  235. <th>题目内容</th>
  236. <th>学生答案</th>
  237. <th class="w-32">手动校准</th>
  238. <th class="w-24">AI分析</th>
  239. <th class="w-32">状态</th>
  240. </tr>
  241. </thead>
  242. <tbody>
  243. @foreach($record->questions as $index => $question)
  244. <tr class="hover">
  245. <td>
  246. <div class="badge badge-primary badge-sm">
  247. {{ $question->question_number }}
  248. </div>
  249. </td>
  250. <td>
  251. <div class="max-w-xs">
  252. @if($question->question_text)
  253. <p class="text-sm leading-tight">{{ Str::limit($question->question_text, 80) }}</p>
  254. @else
  255. <span class="text-gray-400 italic text-sm">未识别到题目内容</span>
  256. @endif
  257. </div>
  258. </td>
  259. <td>
  260. <div class="flex items-center gap-2">
  261. <div class="text-sm font-medium">
  262. @if($question->student_answer)
  263. <span class="text-primary">{{ $question->student_answer }}</span>
  264. @else
  265. <span class="text-gray-400 italic">未识别</span>
  266. @endif
  267. </div>
  268. @if($question->answer_confidence)
  269. <div class="w-2 h-2 rounded-full" style="background-color: {{ $question->answer_confidence >= 0.7 ? '#10b981' : ($question->answer_confidence >= 0.5 ? '#f59e0b' : '#ef4444') }}"></div>
  270. @endif
  271. </div>
  272. </td>
  273. <td>
  274. <input
  275. type="text"
  276. wire:model.defer="manualAnswers.{{ $question->id }}"
  277. placeholder="手动输入答案"
  278. class="input input-bordered input-xs w-full"
  279. maxlength="10"
  280. value="{{ $question->manual_answer }}"
  281. >
  282. @if($question->manual_answer)
  283. <div class="mt-1">
  284. <div class="badge badge-success badge-xs">
  285. <svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  286. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
  287. </svg>
  288. 已校验
  289. </div>
  290. </div>
  291. @endif
  292. </td>
  293. <td>
  294. @if($question->ai_score !== null || $question->ai_feedback !== null)
  295. <div class="space-y-1">
  296. @if($question->ai_score !== null)
  297. <div class="text-center">
  298. <div class="stat-value text-lg text-success">{{ $question->ai_score }}</div>
  299. <div class="stat-title text-xs">AI评分</div>
  300. </div>
  301. @endif
  302. @if($question->ai_confidence)
  303. <div class="w-full">
  304. <progress class="progress progress-success w-full h-1" value="{{ $question->ai_confidence * 100 }}" max="100"></progress>
  305. <div class="text-xs text-center mt-1">{{ number_format($question->ai_confidence * 100, 1) }}%</div>
  306. </div>
  307. @endif
  308. </div>
  309. @else
  310. <div class="text-center">
  311. <div class="badge badge-ghost badge-sm">
  312. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  313. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
  314. </svg>
  315. 待分析
  316. </div>
  317. </div>
  318. @endif
  319. </td>
  320. <td>
  321. <div class="flex flex-wrap gap-1">
  322. @if($question->answer_verified)
  323. <div class="badge badge-success badge-xs">
  324. <svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  325. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
  326. </svg>
  327. 已校验
  328. </div>
  329. @endif
  330. @if($question->score_value !== null)
  331. <div class="badge badge-info badge-xs">
  332. <svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  333. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11.049 2.927c.3-.921 1.603-.921 2.902 0l1.519 1.519a.922.922 0 011.603.921l1.518-1.519a.922.922 0 012.902 0l2.12 2.12a.922.922 0 010-1.303l-2.12-2.12z"></path>
  334. </svg>
  335. {{ $question->score_value }}分
  336. </div>
  337. @endif
  338. @if($question->kp_code)
  339. <div class="badge badge-warning badge-xs">
  340. <svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  341. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19.428 15.428a2 2 0 00-1.022-.547l-2.387-.477a6 6 0 00-3.86.517l-.318.158a6 6 0 00-3.86.517L6.05 15.21a2 2 0 00-1.022.547c-.505 0-.903.197-1.255.537L3.82 16.673a6 6 0 003.86 2.518l.318.158a6 6 0 003.86-.517l2.387-.477a2 2 0 001.022-.547zM10 15.272a8 8 0 00-5.457-2.91l3.569-3.569a8 8 0 015.458 2.91l-3.57 3.568a8 8 0 00-5.457 2.91z"></path>
  342. </svg>
  343. {{ $question->kp_code }}
  344. </div>
  345. @endif
  346. @if($question->mark_detected)
  347. <div class="text-lg">
  348. {!! $question->mark_badge ?? $question->mark_detected !!}
  349. </div>
  350. @endif
  351. </div>
  352. </td>
  353. </tr>
  354. @endforeach
  355. </tbody>
  356. </table>
  357. </div>
  358. {{-- 提交分析按钮 --}}
  359. @if(!$this->hasAnalysisResults)
  360. <div class="card bg-primary/10 border border-primary mt-6">
  361. <div class="card-body">
  362. <div class="flex justify-between items-center">
  363. <div>
  364. <h3 class="font-bold text-lg flex items-center gap-2">
  365. <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  366. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path>
  367. </svg>
  368. 提交 AI 分析
  369. </h3>
  370. <p class="text-sm text-base-content/70 mt-1">
  371. 将使用手动校准的答案(如有),否则使用 OCR 识别结果进行智能分析
  372. </p>
  373. </div>
  374. <button
  375. wire:click="submitForAnalysis"
  376. class="btn btn-primary btn-lg"
  377. >
  378. <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  379. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path>
  380. </svg>
  381. 提交分析
  382. </button>
  383. </div>
  384. </div>
  385. </div>
  386. @else
  387. <div class="card bg-success/10 border border-success mt-6">
  388. <div class="card-body">
  389. <div class="flex justify-between items-center">
  390. <div>
  391. <h3 class="font-bold text-lg text-success flex items-center gap-2">
  392. <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  393. <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>
  394. </svg>
  395. AI 分析已完成
  396. </h3>
  397. <p class="text-sm text-base-content/70 mt-1">
  398. 所有题目已完成 AI 智能分析,查看上方表格中的详细分析结果
  399. </p>
  400. @if($record->ai_analyzed_at)
  401. <div class="flex gap-4 mt-2 text-sm text-base-content/60">
  402. <span>分析完成时间:{{ $record->ai_analyzed_at }}</span>
  403. @if($record->ai_analysis_count)
  404. <span>分析题目数:{{ $record->ai_analysis_count }}</span>
  405. @endif
  406. </div>
  407. @endif
  408. </div>
  409. <div class="badge badge-success badge-lg gap-2">
  410. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  411. <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>
  412. </svg>
  413. 已分析
  414. </div>
  415. </div>
  416. </div>
  417. </div>
  418. @endif
  419. @else
  420. <div class="text-center py-12 text-base-content/60">
  421. <svg class="w-12 h-12 mx-auto mb-4 opacity-50" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  422. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 13h6m-3-3v6m5 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>
  423. </svg>
  424. <p class="text-lg font-medium">暂无识别结果</p>
  425. @if($record->status === 'pending')
  426. <p class="text-sm mt-2">点击上方"开始识别"按钮开始处理</p>
  427. @endif
  428. </div>
  429. @endif
  430. </div>
  431. </div>
  432. {{-- DaisyUI 时间轴 --}}
  433. <div class="card bg-base-100 border border-base-300 shadow-xl">
  434. <div class="card-body">
  435. <h2 class="card-title text-xl flex items-center gap-2 mb-6">
  436. <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  437. <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>
  438. </svg>
  439. 处理时间线
  440. </h2>
  441. <ul class="timeline timeline-snap-icon timeline-vertical">
  442. <li>
  443. <div class="timeline-middle">
  444. <div class="timeline-box timeline-box-success">
  445. <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  446. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
  447. </svg>
  448. </div>
  449. </div>
  450. <div class="timeline-end">
  451. <time class="text-xs opacity-70">{{ $record->created_at->format('m-d H:i:s') }}</time>
  452. <div class="timeline-title font-bold text-base">上传成功</div>
  453. <div class="timeline-body text-sm opacity-80">卷子图片已上传,等待OCR识别</div>
  454. </div>
  455. <hr class="border-success" />
  456. </li>
  457. @if($record->status === 'processing')
  458. <li>
  459. <div class="timeline-middle">
  460. <div class="timeline-box timeline-box-info animate-pulse">
  461. <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  462. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"></path>
  463. </svg>
  464. </div>
  465. </div>
  466. <div class="timeline-end">
  467. <time class="text-xs opacity-70">{{ now()->format('m-d H:i:s') }}</time>
  468. <div class="timeline-title font-bold text-base text-info">处理中</div>
  469. <div class="timeline-body text-sm opacity-80">OCR识别正在进行中...</div>
  470. <div class="loading loading-spinner loading-sm mt-2"></div>
  471. </div>
  472. <hr class="border-info" />
  473. </li>
  474. @elseif($record->status === 'completed')
  475. <li>
  476. <div class="timeline-middle">
  477. <div class="timeline-box timeline-box-success">
  478. <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  479. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
  480. </svg>
  481. </div>
  482. </div>
  483. <div class="timeline-end">
  484. <time class="text-xs opacity-70">{{ $record->processed_at?->format('m-d H:i:s') }}</time>
  485. <div class="timeline-title font-bold text-base text-success">OCR识别完成</div>
  486. <div class="timeline-body text-sm opacity-80">
  487. OCR识别已完成,识别出 {{ $record->total_questions ?? 0 }} 道题目
  488. <div class="badge badge-success badge-sm mt-2">
  489. 准确率: {{ number_format(($record->confidence_avg ?? 0) * 100, 1) }}%
  490. </div>
  491. </div>
  492. </div>
  493. <hr class="border-success" />
  494. </li>
  495. @elseif($record->status === 'failed')
  496. <li>
  497. <div class="timeline-middle">
  498. <div class="timeline-box timeline-box-error">
  499. <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  500. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
  501. </svg>
  502. </div>
  503. </div>
  504. <div class="timeline-end">
  505. <time class="text-xs opacity-70">{{ now()->format('m-d H:i:s') }}</time>
  506. <div class="timeline-title font-bold text-base text-error">OCR识别失败</div>
  507. @if($record->error_message)
  508. <div class="timeline-body text-sm text-error bg-error/10 p-2 rounded mt-2">
  509. {{ $record->error_message }}
  510. </div>
  511. @endif
  512. </div>
  513. <hr class="border-error" />
  514. </li>
  515. @endif
  516. {{-- AI Analysis Timeline --}}
  517. @if($record->status === 'completed' && $record->ai_analyzed_at)
  518. <li>
  519. <div class="timeline-middle">
  520. <div class="timeline-box timeline-box-info">
  521. <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  522. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"></path>
  523. </svg>
  524. </div>
  525. </div>
  526. <div class="timeline-end">
  527. <time class="text-xs opacity-70">{{ $record->ai_analyzed_at }}</time>
  528. <div class="timeline-title font-bold text-base text-info">AI 分析完成</div>
  529. <div class="timeline-body text-sm opacity-80">
  530. 已完成 {{ $record->ai_analysis_count ?? count($record->questions) }} 道题目的智能分析
  531. <div class="flex gap-2 mt-2">
  532. <div class="badge badge-success badge-sm">
  533. <svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  534. <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>
  535. </svg>
  536. 智能分析
  537. </div>
  538. <div class="badge badge-info badge-sm">学习分析</div>
  539. <div class="badge badge-warning badge-sm">掌握度评估</div>
  540. </div>
  541. </div>
  542. </div>
  543. <hr class="border-info" />
  544. </li>
  545. @endif
  546. {{-- 学生仪表板跳转 --}}
  547. @if($record->status === 'completed' && $record->ai_analyzed_at)
  548. <li>
  549. <div class="timeline-middle">
  550. <div class="timeline-box timeline-box-warning">
  551. <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  552. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"></path>
  553. </svg>
  554. </div>
  555. </div>
  556. <div class="timeline-end">
  557. <div class="timeline-title font-bold text-base text-warning">查看详细分析</div>
  558. <div class="timeline-body text-sm opacity-80">
  559. 在学生仪表板中查看更详细的学习分析报告
  560. <div class="mt-3">
  561. @if($record->student)
  562. <a href="{{ route('filament.admin.pages.student-dashboard') }}?student_id={{ $record->student->student_id }}"
  563. class="btn btn-primary btn-sm gap-2 hover:btn-primary-focus transition-all">
  564. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  565. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7l5 5m0 0l-5 5m5-5H6"></path>
  566. </svg>
  567. 学生仪表板
  568. </a>
  569. @else
  570. <div class="btn btn-disabled btn-sm gap-2">
  571. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  572. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
  573. </svg>
  574. 学生信息缺失
  575. </div>
  576. @endif
  577. </div>
  578. </div>
  579. </div>
  580. </li>
  581. @endif
  582. </ul>
  583. </div>
  584. </div>
  585. @else
  586. <div class="card bg-base-100 border border-base-300 shadow-xl">
  587. <div class="card-body">
  588. <div class="alert alert-error">
  589. <svg class="w-6 h-6 shrink-0 stroke-current" fill="none" viewBox="0 0 24 24">
  590. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
  591. </svg>
  592. <div>
  593. <h3 class="font-bold">记录不存在</h3>
  594. <div class="text-xs">找不到ID为 {{ $recordId }} 的OCR记录</div>
  595. </div>
  596. </div>
  597. <div class="mt-4">
  598. <a href="{{ route('filament.admin.pages.ocr-records') }}" class="btn btn-primary">
  599. <svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  600. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"></path>
  601. </svg>
  602. 返回列表
  603. </a>
  604. </div>
  605. </div>
  606. </div>
  607. @endif
  608. </div>
  609. </x-filament-panels::page>