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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  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-32">判卷</th>
  239. <th class="w-24">AI分析</th>
  240. <th class="w-32">状态</th>
  241. </tr>
  242. </thead>
  243. <tbody>
  244. @foreach($record->questions as $index => $question)
  245. <tr class="hover">
  246. <td>
  247. <div class="badge badge-primary badge-sm">
  248. {{ $question->question_number }}
  249. </div>
  250. </td>
  251. <td>
  252. <div class="max-w-xs">
  253. @if($question->question_text)
  254. <p class="text-sm leading-tight">@math($question->question_text)</p>
  255. @else
  256. <span class="text-gray-400 italic text-sm">未识别到题目内容</span>
  257. @endif
  258. </div>
  259. </td>
  260. <td>
  261. <div class="flex items-center gap-2">
  262. <div class="text-sm font-medium">
  263. @if($question->student_answer)
  264. <span class="text-primary">@math($question->student_answer)</span>
  265. @else
  266. <span class="text-gray-400 italic">未识别</span>
  267. @endif
  268. </div>
  269. @if($question->answer_confidence)
  270. <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>
  271. @endif
  272. </div>
  273. </td>
  274. <td>
  275. <input
  276. type="text"
  277. wire:model.defer="manualAnswers.{{ $question->id }}"
  278. placeholder="手动输入答案"
  279. class="input input-bordered input-xs w-full"
  280. maxlength="10"
  281. value="{{ $question->manual_answer }}"
  282. >
  283. @if($question->manual_answer)
  284. <div class="mt-1">
  285. <div class="badge badge-success badge-xs">
  286. <svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  287. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
  288. </svg>
  289. 已校验
  290. </div>
  291. </div>
  292. @endif
  293. </td>
  294. <td>
  295. {{-- 判卷区域 --}}
  296. <div class="space-y-2">
  297. {{-- 对错判断 --}}
  298. <div class="flex gap-1">
  299. <label class="label cursor-pointer gap-1 p-1">
  300. <input
  301. type="radio"
  302. wire:model="questionGrades.{{ $question->id }}.is_correct"
  303. value="1"
  304. class="radio radio-success radio-xs"
  305. >
  306. <span class="text-xs">✓</span>
  307. </label>
  308. <label class="label cursor-pointer gap-1 p-1">
  309. <input
  310. type="radio"
  311. wire:model="questionGrades.{{ $question->id }}.is_correct"
  312. value="0"
  313. class="radio radio-error radio-xs"
  314. >
  315. <span class="text-xs">✗</span>
  316. </label>
  317. </div>
  318. {{-- 分数输入 --}}
  319. <input
  320. type="number"
  321. wire:model="questionGrades.{{ $question->id }}.score"
  322. placeholder="分数"
  323. class="input input-bordered input-xs w-full"
  324. min="0"
  325. max="100"
  326. step="0.5"
  327. >
  328. </div>
  329. </td>
  330. <td>
  331. @if($question->ai_score !== null || $question->ai_feedback !== null)
  332. <div class="space-y-1">
  333. @if($question->ai_score !== null)
  334. <div class="text-center">
  335. <div class="stat-value text-lg text-success">{{ $question->ai_score }}</div>
  336. <div class="stat-title text-xs">AI评分</div>
  337. </div>
  338. @endif
  339. @if($question->ai_confidence)
  340. <div class="w-full">
  341. <progress class="progress progress-success w-full h-1" value="{{ $question->ai_confidence * 100 }}" max="100"></progress>
  342. <div class="text-xs text-center mt-1">{{ number_format($question->ai_confidence * 100, 1) }}%</div>
  343. </div>
  344. @endif
  345. </div>
  346. @else
  347. <div class="text-center">
  348. <div class="badge badge-ghost badge-sm">
  349. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  350. <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>
  351. </svg>
  352. 待分析
  353. </div>
  354. </div>
  355. @endif
  356. </td>
  357. <td>
  358. <div class="flex flex-wrap gap-1">
  359. @if($question->answer_verified)
  360. <div class="badge badge-success badge-xs">
  361. <svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  362. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
  363. </svg>
  364. 已校验
  365. </div>
  366. @endif
  367. @if($question->score_value !== null)
  368. <div class="badge badge-info badge-xs">
  369. <svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  370. <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>
  371. </svg>
  372. {{ $question->score_value }}分
  373. </div>
  374. @endif
  375. @if($question->kp_code)
  376. <div class="badge badge-warning badge-xs">
  377. <svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  378. <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>
  379. </svg>
  380. {{ $question->kp_code }}
  381. </div>
  382. @endif
  383. @if($question->mark_detected)
  384. <div class="text-lg">
  385. {!! $question->mark_badge ?? $question->mark_detected !!}
  386. </div>
  387. @endif
  388. </div>
  389. </td>
  390. </tr>
  391. @endforeach
  392. </tbody>
  393. </table>
  394. </div>
  395. {{-- 提交分析按钮 --}}
  396. @if(!$this->hasAnalysisResults)
  397. <div class="card bg-primary/10 border border-primary mt-6">
  398. <div class="card-body">
  399. <div class="flex justify-between items-center">
  400. <div>
  401. <h3 class="font-bold text-lg flex items-center gap-2">
  402. <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  403. <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>
  404. </svg>
  405. 提交 AI 分析
  406. </h3>
  407. <p class="text-sm text-base-content/70 mt-1">
  408. 将使用手动校准的答案(如有),否则使用 OCR 识别结果进行智能分析
  409. </p>
  410. </div>
  411. <button
  412. wire:click="submitForAnalysis"
  413. class="btn btn-primary btn-lg"
  414. wire:loading.attr="disabled"
  415. >
  416. <span wire:loading.remove>
  417. <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  418. <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>
  419. </svg>
  420. </span>
  421. <span wire:loading class="loading loading-spinner loading-sm"></span>
  422. <span wire:loading.remove>提交分析</span>
  423. <span wire:loading>分析中...</span>
  424. </button>
  425. </div>
  426. </div>
  427. </div>
  428. @else
  429. <div class="card bg-success/10 border border-success mt-6">
  430. <div class="card-body">
  431. <div class="flex justify-between items-center">
  432. <div>
  433. <h3 class="font-bold text-lg text-success flex items-center gap-2">
  434. <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  435. <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>
  436. </svg>
  437. AI 分析已完成
  438. </h3>
  439. <p class="text-sm text-base-content/70 mt-1">
  440. 所有题目已完成 AI 智能分析,查看上方表格中的详细分析结果
  441. </p>
  442. @if($record->ai_analyzed_at)
  443. <div class="flex gap-4 mt-2 text-sm text-base-content/60">
  444. <span>分析完成时间:{{ $record->ai_analyzed_at }}</span>
  445. @if($record->ai_analysis_count)
  446. <span>分析题目数:{{ $record->ai_analysis_count }}</span>
  447. @endif
  448. </div>
  449. @endif
  450. </div>
  451. <div class="badge badge-success badge-lg gap-2">
  452. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  453. <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>
  454. </svg>
  455. 已分析
  456. </div>
  457. </div>
  458. </div>
  459. </div>
  460. @endif
  461. @else
  462. <div class="text-center py-12 text-base-content/60">
  463. <svg class="w-12 h-12 mx-auto mb-4 opacity-50" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  464. <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>
  465. </svg>
  466. <p class="text-lg font-medium">暂无识别结果</p>
  467. @if($record->status === 'pending')
  468. <p class="text-sm mt-2">点击上方"开始识别"按钮开始处理</p>
  469. @endif
  470. </div>
  471. @endif
  472. </div>
  473. </div>
  474. {{-- DaisyUI 时间轴 --}}
  475. <div class="card bg-base-100 border border-base-300 shadow-xl">
  476. <div class="card-body">
  477. <h2 class="card-title text-xl flex items-center gap-2 mb-6">
  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="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path>
  480. </svg>
  481. 处理时间线
  482. </h2>
  483. <ul class="timeline timeline-snap-icon timeline-vertical">
  484. <li>
  485. <div class="timeline-middle">
  486. <div class="timeline-box timeline-box-success">
  487. <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  488. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
  489. </svg>
  490. </div>
  491. </div>
  492. <div class="timeline-end">
  493. <time class="text-xs opacity-70">{{ $record->created_at->format('m-d H:i:s') }}</time>
  494. <div class="timeline-title font-bold text-base">上传成功</div>
  495. <div class="timeline-body text-sm opacity-80">卷子图片已上传,等待OCR识别</div>
  496. </div>
  497. <hr class="border-success" />
  498. </li>
  499. @if($record->status === 'processing')
  500. <li>
  501. <div class="timeline-middle">
  502. <div class="timeline-box timeline-box-info animate-pulse">
  503. <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  504. <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>
  505. </svg>
  506. </div>
  507. </div>
  508. <div class="timeline-end">
  509. <time class="text-xs opacity-70">{{ now()->format('m-d H:i:s') }}</time>
  510. <div class="timeline-title font-bold text-base text-info">处理中</div>
  511. <div class="timeline-body text-sm opacity-80">OCR识别正在进行中...</div>
  512. <div class="loading loading-spinner loading-sm mt-2"></div>
  513. </div>
  514. <hr class="border-info" />
  515. </li>
  516. @elseif($record->status === 'completed')
  517. <li>
  518. <div class="timeline-middle">
  519. <div class="timeline-box timeline-box-success">
  520. <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  521. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
  522. </svg>
  523. </div>
  524. </div>
  525. <div class="timeline-end">
  526. <time class="text-xs opacity-70">{{ $record->processed_at?->format('m-d H:i:s') }}</time>
  527. <div class="timeline-title font-bold text-base text-success">OCR识别完成</div>
  528. <div class="timeline-body text-sm opacity-80">
  529. OCR识别已完成,识别出 {{ $record->total_questions ?? 0 }} 道题目
  530. <div class="badge badge-success badge-sm mt-2">
  531. 准确率: {{ number_format(($record->confidence_avg ?? 0) * 100, 1) }}%
  532. </div>
  533. </div>
  534. </div>
  535. <hr class="border-success" />
  536. </li>
  537. @elseif($record->status === 'failed')
  538. <li>
  539. <div class="timeline-middle">
  540. <div class="timeline-box timeline-box-error">
  541. <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  542. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
  543. </svg>
  544. </div>
  545. </div>
  546. <div class="timeline-end">
  547. <time class="text-xs opacity-70">{{ now()->format('m-d H:i:s') }}</time>
  548. <div class="timeline-title font-bold text-base text-error">OCR识别失败</div>
  549. @if($record->error_message)
  550. <div class="timeline-body text-sm text-error bg-error/10 p-2 rounded mt-2">
  551. {{ $record->error_message }}
  552. </div>
  553. @endif
  554. </div>
  555. <hr class="border-error" />
  556. </li>
  557. @endif
  558. {{-- AI Analysis Timeline --}}
  559. @if($record->status === 'completed' && $record->ai_analyzed_at)
  560. <li>
  561. <div class="timeline-middle">
  562. <div class="timeline-box timeline-box-info">
  563. <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  564. <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>
  565. </svg>
  566. </div>
  567. </div>
  568. <div class="timeline-end">
  569. <time class="text-xs opacity-70">{{ $record->ai_analyzed_at }}</time>
  570. <div class="timeline-title font-bold text-base text-info">AI 分析完成</div>
  571. <div class="timeline-body text-sm opacity-80">
  572. 已完成 {{ $record->ai_analysis_count ?? count($record->questions) }} 道题目的智能分析
  573. <div class="flex gap-2 mt-2">
  574. <div class="badge badge-success badge-sm">
  575. <svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  576. <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>
  577. </svg>
  578. 智能分析
  579. </div>
  580. <div class="badge badge-info badge-sm">学习分析</div>
  581. <div class="badge badge-warning badge-sm">掌握度评估</div>
  582. </div>
  583. </div>
  584. </div>
  585. <hr class="border-info" />
  586. </li>
  587. @endif
  588. {{-- 学生仪表板跳转 --}}
  589. @if($record->status === 'completed' && $record->ai_analyzed_at)
  590. <li>
  591. <div class="timeline-middle">
  592. <div class="timeline-box timeline-box-warning">
  593. <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  594. <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>
  595. </svg>
  596. </div>
  597. </div>
  598. <div class="timeline-end">
  599. <div class="timeline-title font-bold text-base text-warning">查看详细分析</div>
  600. <div class="timeline-body text-sm opacity-80">
  601. 在学生仪表板中查看更详细的学习分析报告
  602. <div class="mt-3">
  603. @if($record->student)
  604. <a href="{{ route('filament.admin.pages.student-dashboard') }}?student_id={{ $record->student->student_id }}"
  605. class="btn btn-primary btn-sm gap-2 hover:btn-primary-focus transition-all">
  606. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  607. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7l5 5m0 0l-5 5m5-5H6"></path>
  608. </svg>
  609. 学生仪表板
  610. </a>
  611. @else
  612. <div class="btn btn-disabled btn-sm gap-2">
  613. <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  614. <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>
  615. </svg>
  616. 学生信息缺失
  617. </div>
  618. @endif
  619. </div>
  620. </div>
  621. </div>
  622. </li>
  623. @endif
  624. </ul>
  625. </div>
  626. </div>
  627. @else
  628. <div class="card bg-base-100 border border-base-300 shadow-xl">
  629. <div class="card-body">
  630. <div class="alert alert-error">
  631. <svg class="w-6 h-6 shrink-0 stroke-current" fill="none" viewBox="0 0 24 24">
  632. <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>
  633. </svg>
  634. <div>
  635. <h3 class="font-bold">记录不存在</h3>
  636. <div class="text-xs">找不到ID为 {{ $recordId }} 的OCR记录</div>
  637. </div>
  638. </div>
  639. <div class="mt-4">
  640. <a href="{{ route('filament.admin.pages.ocr-records') }}" class="btn btn-primary">
  641. <svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  642. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"></path>
  643. </svg>
  644. 返回列表
  645. </a>
  646. </div>
  647. </div>
  648. </div>
  649. @endif
  650. </div>
  651. <x-math-render />
  652. </x-filament-panels::page>