exam-analysis-standard.blade.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <x-filament-panels::page>
  2. <div class="space-y-6">
  3. @if($loading)
  4. <x-exam-analysis.loading message="正在分析试卷数据..." />
  5. @else
  6. <!-- 页面头部 -->
  7. <x-exam-analysis.header :recordData="$recordData" title="📊 试卷分析报告" />
  8. <!-- 试卷基本信息 -->
  9. <div class="bg-white rounded-lg shadow-sm border border-gray-200">
  10. <div class="p-6 border-b border-gray-200">
  11. <h2 class="text-lg font-semibold text-gray-900">📝 试卷信息</h2>
  12. </div>
  13. <div class="p-6">
  14. <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
  15. <div>
  16. <label class="block text-sm font-medium text-gray-500 mb-1">试卷名称</label>
  17. <p class="text-lg font-medium text-gray-900">{{ $recordData['paper_name'] ?? 'N/A' }}</p>
  18. </div>
  19. <div>
  20. <label class="block text-sm font-medium text-gray-500 mb-1">试卷编号</label>
  21. <p class="text-lg font-mono text-gray-900">{{ $recordData['paper_id'] ?? 'N/A' }}</p>
  22. </div>
  23. <div>
  24. <label class="block text-sm font-medium text-gray-500 mb-1">题目数量</label>
  25. <p class="text-lg font-medium text-gray-900">{{ $recordData['total_questions'] ?? 0 }} 题</p>
  26. </div>
  27. </div>
  28. </div>
  29. </div>
  30. <!-- ChatGPT智能识别 -->
  31. <div class="bg-white rounded-lg shadow-sm border border-gray-200">
  32. <div class="p-6 border-b border-gray-200">
  33. <div class="flex items-center justify-between">
  34. <h2 class="text-lg font-semibold text-gray-900">🤖 ChatGPT智能识别</h2>
  35. <div class="flex items-center gap-2">
  36. <input type="checkbox" wire:model="useChatGPT" id="useChatGPT" class="rounded border-gray-300 text-blue-600 focus:ring-blue-500">
  37. <label for="useChatGPT" class="text-sm text-gray-700">启用ChatGPT识别</label>
  38. </div>
  39. </div>
  40. </div>
  41. @if($useChatGPT)
  42. <div class="p-6">
  43. <div class="space-y-4">
  44. <div>
  45. <label class="block text-sm font-medium text-gray-700 mb-2">
  46. 试卷图片URL <span class="text-red-500">*</span>
  47. </label>
  48. <input
  49. type="url"
  50. wire:model="imageUrl"
  51. placeholder="请输入试卷图片的完整URL地址"
  52. class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
  53. />
  54. <p class="text-xs text-gray-500 mt-1">
  55. 支持JPG、PNG格式图片,建议图片清晰、光线充足
  56. </p>
  57. </div>
  58. @if(!empty($imageUrl))
  59. <div class="flex items-center gap-4">
  60. <button
  61. wire:click="analyzeWithChatGPT"
  62. wire:loading.attr="disabled"
  63. class="px-6 py-3 bg-blue-600 text-white font-medium rounded-lg hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2"
  64. >
  65. @if($isAnalyzing)
  66. <svg class="animate-spin h-5 w-5 text-white" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
  67. <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
  68. <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>
  69. </svg>
  70. 分析中...
  71. @else
  72. <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  73. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"></path>
  74. </svg>
  75. 开始智能识别
  76. @endif
  77. </button>
  78. <button
  79. wire:click="resetChatGPTForm"
  80. class="px-4 py-2 bg-gray-200 text-gray-700 font-medium rounded-lg hover:bg-gray-300 focus:outline-none focus:ring-2 focus:ring-gray-400"
  81. >
  82. 重置
  83. </button>
  84. </div>
  85. <!-- 图片预览 -->
  86. <div class="mt-4">
  87. <p class="text-sm font-medium text-gray-700 mb-2">图片预览</p>
  88. <div class="border border-gray-300 rounded-lg overflow-hidden max-w-2xl">
  89. <img src="{{ $imageUrl }}" alt="试卷图片" class="w-full h-auto" onerror="this.style.display='none'">
  90. </div>
  91. </div>
  92. @endif
  93. <!-- ChatGPT分析结果 -->
  94. @if(!empty($chatGPTResult))
  95. <div class="mt-6 p-4 bg-green-50 border border-green-200 rounded-lg">
  96. <h3 class="text-sm font-semibold text-green-900 mb-2">✅ ChatGPT分析完成</h3>
  97. <div class="text-sm text-green-800">
  98. <p>已成功分析 {{ count($chatGPTResult['questions'] ?? []) }} 道题目</p>
  99. <p>总体得分:{{ $chatGPTResult['score_obtained'] ?? 0 }} / {{ $chatGPTResult['total_score'] ?? 0 }}</p>
  100. <p>整体掌握度:{{ number_format(($chatGPTResult['summary']['overall_mastery'] ?? 0) * 100, 1) }}%</p>
  101. </div>
  102. </div>
  103. <!-- ChatGPT分析详情 -->
  104. @if(isset($chatGPTResult['questions']))
  105. <div class="mt-4">
  106. <h4 class="text-sm font-semibold text-gray-700 mb-3">题目分析详情</h4>
  107. <div class="space-y-3 max-h-96 overflow-y-auto">
  108. @foreach($chatGPTResult['questions'] as $q)
  109. <div class="border rounded-lg p-3 {{ $q['is_correct'] ? 'border-green-200 bg-green-50' : 'border-red-200 bg-red-50' }}">
  110. <div class="flex items-start justify-between mb-2">
  111. <span class="text-sm font-medium text-gray-900">第{{ $q['q'] }}题</span>
  112. <span class="text-xs px-2 py-1 rounded-full {{ $q['is_correct'] ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800' }}">
  113. {{ $q['is_correct'] ? '正确' : '错误' }}
  114. </span>
  115. </div>
  116. <div class="text-xs text-gray-600 space-y-1">
  117. <p><span class="font-medium">学生答案:</span>{{ $q['student_answer'] ?? '未识别到答案' }}</p>
  118. <p><span class="font-medium">正确答案:</span>{{ $q['correct_answer'] ?? 'N/A' }}</p>
  119. @if(isset($q['knowledge_points'][0]))
  120. <p><span class="font-medium">知识点:</span>{{ $q['knowledge_points'][0]['name'] ?? $q['knowledge_points'][0]['id'] }}</p>
  121. <p><span class="font-medium">掌握度:</span>{{ number_format($q['knowledge_points'][0]['mastery'] ?? 0, 1) }}%</p>
  122. @endif
  123. </div>
  124. </div>
  125. @endforeach
  126. </div>
  127. </div>
  128. @endif
  129. <!-- 学习建议 -->
  130. @if(isset($chatGPTResult['summary']['suggested_study_path']))
  131. <div class="mt-4 p-4 bg-blue-50 border border-blue-200 rounded-lg">
  132. <h4 class="text-sm font-semibold text-blue-900 mb-2">📚 个性化学习建议</h4>
  133. <div class="text-sm text-blue-800 space-y-1">
  134. @foreach($chatGPTResult['summary']['suggested_study_path'] as $path)
  135. <p>• {{ $path }}</p>
  136. @endforeach
  137. </div>
  138. </div>
  139. @endif
  140. @endif
  141. </div>
  142. </div>
  143. @else
  144. <div class="p-6 text-center text-gray-500">
  145. <svg class="w-12 h-12 mx-auto text-gray-300 mb-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  146. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"></path>
  147. </svg>
  148. <p class="text-sm">启用ChatGPT识别功能,直接从图片中识别学生答案并智能分析</p>
  149. </div>
  150. @endif
  151. </div>
  152. <!-- 学习统计概览 -->
  153. @if(!empty($analysisData))
  154. <div class="bg-white rounded-lg shadow-sm border border-gray-200">
  155. <div class="p-6 border-b border-gray-200">
  156. <h2 class="text-lg font-semibold text-gray-900">📊 学习统计概览</h2>
  157. </div>
  158. <div class="p-6">
  159. <div class="grid grid-cols-1 md:grid-cols-4 gap-6">
  160. <div class="bg-white rounded-lg shadow-sm border border-gray-200 p-6">
  161. <div class="flex items-center">
  162. <div class="p-3 rounded-full bg-blue-100 text-blue-600">
  163. <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  164. <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>
  165. </svg>
  166. </div>
  167. <div class="ml-4">
  168. <p class="text-sm text-gray-500">整体掌握度</p>
  169. <p class="text-2xl font-bold text-gray-900">{{ number_format(($analysisData['overall_mastery'] ?? 0) * 100, 1) }}%</p>
  170. </div>
  171. </div>
  172. </div>
  173. <div class="bg-white rounded-lg shadow-sm border border-gray-200 p-6">
  174. <div class="flex items-center">
  175. <div class="p-3 rounded-full bg-green-100 text-green-600">
  176. <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  177. <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>
  178. </svg>
  179. </div>
  180. <div class="ml-4">
  181. <p class="text-sm text-gray-500">知识点数量</p>
  182. <p class="text-2xl font-bold text-gray-900">{{ $analysisData['total_knowledge_points'] ?? 0 }}</p>
  183. </div>
  184. </div>
  185. </div>
  186. <div class="bg-white rounded-lg shadow-sm border border-gray-200 p-6">
  187. <div class="flex items-center">
  188. <div class="p-3 rounded-full bg-yellow-100 text-yellow-600">
  189. <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  190. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"></path>
  191. </svg>
  192. </div>
  193. <div class="ml-4">
  194. <p class="text-sm text-gray-500">薄弱知识点</p>
  195. <p class="text-2xl font-bold text-gray-900">{{ count($analysisData['weak_areas'] ?? []) }}</p>
  196. </div>
  197. </div>
  198. </div>
  199. <div class="bg-white rounded-lg shadow-sm border border-gray-200 p-6">
  200. <div class="flex items-center">
  201. <div class="p-3 rounded-full bg-purple-100 text-purple-600">
  202. <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  203. <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>
  204. </svg>
  205. </div>
  206. <div class="ml-4">
  207. <p class="text-sm text-gray-500">总答题数</p>
  208. <p class="text-2xl font-bold text-gray-900">{{ $recordData['total_questions'] ?? 0 }}</p>
  209. </div>
  210. </div>
  211. </div>
  212. </div>
  213. <!-- 知识点掌握情况 -->
  214. @if(isset($analysisData['knowledge_points']) && !empty($analysisData['knowledge_points']))
  215. <div class="mt-6">
  216. <h3 class="text-sm font-semibold text-gray-700 mb-3">知识点掌握情况</h3>
  217. <div class="space-y-3">
  218. @foreach($analysisData['knowledge_points'] as $kp)
  219. <div class="border rounded-lg p-4
  220. {{ ($kp['mastery_level'] ?? 0) < 0.6 ? 'border-red-200 bg-red-50' :
  221. (($kp['mastery_level'] ?? 0) < 0.8 ? 'border-yellow-200 bg-yellow-50' :
  222. 'border-green-200 bg-green-50') }}">
  223. <div class="flex items-center justify-between mb-2">
  224. <h4 class="font-medium text-gray-900">{{ $kp['kp_code'] ?? 'Unknown' }}</h4>
  225. <span class="text-sm font-bold
  226. {{ ($kp['mastery_level'] ?? 0) < 0.6 ? 'text-red-600' :
  227. (($kp['mastery_level'] ?? 0) < 0.8 ? 'text-yellow-600' : 'text-green-600') }}">
  228. {{ number_format(($kp['mastery_level'] ?? 0) * 100, 1) }}%
  229. </span>
  230. </div>
  231. <div class="w-full bg-gray-200 rounded-full h-2 mb-2">
  232. <div class="h-2 rounded-full
  233. {{ ($kp['mastery_level'] ?? 0) < 0.6 ? 'bg-red-400' :
  234. (($kp['mastery_level'] ?? 0) < 0.8 ? 'bg-yellow-400' : 'bg-green-400') }}"
  235. style="width: {{ ($kp['mastery_level'] ?? 0) * 100 }}%"></div>
  236. </div>
  237. <p class="text-xs text-gray-600">
  238. 正确率: {{ number_format(($kp['accuracy_rate'] ?? 0) * 100, 1) }}% |
  239. 练习次数: {{ $kp['total_attempts'] ?? 0 }}
  240. </p>
  241. </div>
  242. @endforeach
  243. </div>
  244. </div>
  245. @endif
  246. </div>
  247. </div>
  248. @endif
  249. <!-- 题目详情分析 -->
  250. <x-exam-analysis.question-details :questions="$recordData['questions'] ?? []" />
  251. <!-- 学习建议 -->
  252. @if(isset($analysisData['recommendations']))
  253. <x-exam-analysis.recommendations :recommendations="$analysisData['recommendations']" />
  254. @endif
  255. @endif
  256. </div>
  257. </x-filament-panels::page>