student-dashboard.blade.php 58 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895
  1. <div class="min-h-screen bg-gray-50 p-8">
  2. {{-- 页面标题区域 --}}
  3. <div class="mb-8">
  4. <div class="bg-white rounded-xl shadow-sm p-6 border border-gray-200">
  5. <div class="flex items-center justify-between mb-6">
  6. <div>
  7. <h1 class="text-3xl font-bold text-gray-900 flex items-center">
  8. <svg class="w-8 h-8 mr-3 text-indigo-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  9. <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>
  10. </svg>
  11. 学生仪表板
  12. </h1>
  13. <p class="mt-2 text-sm text-gray-600 ml-11">
  14. 全面展示学生的学习分析数据,包括掌握度、技能熟练度、提分预测和学习路径
  15. </p>
  16. </div>
  17. </div>
  18. {{-- 选择器区域 --}}
  19. <div class="bg-gray-50 rounded-lg p-4 border border-gray-200">
  20. <div class="grid grid-cols-1 gap-4 sm:grid-cols-2">
  21. {{-- 选择老师 --}}
  22. <div class="form-control w-full">
  23. <label class="label">
  24. <span class="label-text font-medium">选择老师</span>
  25. </label>
  26. <select
  27. wire:model.live="teacherId"
  28. class="select select-bordered w-full"
  29. >
  30. <option value="">请选择老师...</option>
  31. @foreach($this->teachers as $teacher)
  32. <option value="{{ $teacher->teacher_id }}">
  33. {{ trim($teacher->name ?? $teacher->teacher_id) . ($teacher->subject ? " ({$teacher->subject})" : '') }}
  34. </option>
  35. @endforeach
  36. </select>
  37. <label class="label">
  38. <span class="label-text text-xs text-gray-500">选择要查看的老师</span>
  39. </label>
  40. </div>
  41. {{-- 选择学生 --}}
  42. <div class="form-control w-full">
  43. <label class="label">
  44. <span class="label-text font-medium">选择学生</span>
  45. </label>
  46. <select
  47. wire:model.live="studentId"
  48. class="select select-bordered w-full"
  49. @if(empty($teacherId)) disabled @endif
  50. >
  51. <option value="">
  52. @if(empty($teacherId))
  53. 请先选择老师
  54. @else
  55. 请选择学生...
  56. @endif
  57. </option>
  58. @foreach($this->students as $student)
  59. <option value="{{ $student->student_id }}">
  60. {{ trim($student->name ?? $student->student_id) . " ({$student->grade} - {$student->class_name})" }}
  61. </option>
  62. @endforeach
  63. </select>
  64. <label class="label">
  65. <span class="label-text text-xs text-gray-500">选择要查看的学生</span>
  66. </label>
  67. </div>
  68. </div>
  69. <div class="mt-4 pb-0.5 flex space-x-2">
  70. <button
  71. wire:click="loadDashboardData"
  72. wire:loading.attr="disabled"
  73. class="inline-flex items-center px-6 py-2.5 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 transition-colors duration-200"
  74. >
  75. <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">
  76. <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
  77. <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>
  78. </svg>
  79. 刷新数据
  80. </button>
  81. </div>
  82. </div>
  83. </div>
  84. </div>
  85. @php
  86. $mindmapAvg = collect($mindmapMasteryData ?? [])
  87. ->pluck('mastery_level')
  88. ->filter(fn ($v) => is_numeric($v))
  89. ->avg() ?? 0;
  90. $mindmapError = collect($mindmapMasteryData ?? [])
  91. ->map(fn ($item) => is_array($item) ? max(0, 1 - ($item['accuracy_rate'] ?? 0)) : 0)
  92. ->avg() ?? 0;
  93. @endphp
  94. <div
  95. class="mb-10 space-y-4"
  96. x-data="studentMindmapPanel('{{ $this->getId() }}')"
  97. x-init="initEventListener(); initMindmap()"
  98. data-knowledge-mindmap-root
  99. >
  100. <div class="relative overflow-hidden rounded-2xl border border-slate-200 shadow-sm bg-white">
  101. <div
  102. wire:ignore
  103. id="student-mindmap"
  104. class="knowledge-mindmap-canvas relative h-[64vh] min-h-[560px] w-full"
  105. >
  106. </div>
  107. </div>
  108. {{-- 内联知识点详情 --}}
  109. <template x-if="selectedNode">
  110. <div class="grid grid-cols-1 gap-4 lg:grid-cols-3">
  111. <div class="lg:col-span-2 rounded-xl border border-slate-200 bg-white p-4 shadow-sm">
  112. <div class="flex items-start justify-between">
  113. <div>
  114. <p class="text-sm text-slate-500">选中知识点</p>
  115. <h3 class="text-xl font-semibold text-slate-900" x-text="selectedNode.label || selectedNode.code"></h3>
  116. <p class="text-sm text-slate-500 mt-1" x-text="`ID: ${selectedNode.id || ''} · Code: ${selectedNode.code || ''}`"></p>
  117. </div>
  118. <div class="text-right">
  119. <p class="text-sm text-slate-500">掌握度</p>
  120. <p class="text-2xl font-bold" x-text="(selectedNode.mastery * 100).toFixed(1) + '%'"></p>
  121. <p class="text-xs text-slate-500" x-show="selectedNode.accuracy">准确率 <span x-text="(selectedNode.accuracy * 100).toFixed(1) + '%'"></span></p>
  122. <p class="text-xs text-slate-500" x-show="selectedNode.attempts">练习次数 <span x-text="selectedNode.attempts"></span></p>
  123. </div>
  124. </div>
  125. <div class="mt-4">
  126. <p class="text-sm font-semibold text-slate-700 mb-2">技能要点</p>
  127. <div class="flex flex-wrap gap-2">
  128. <template x-if="selectedNode.skills && selectedNode.skills.length">
  129. <template x-for="skill in selectedNode.skills" :key="skill">
  130. <span class="rounded-full bg-slate-100 px-3 py-1 text-xs font-medium text-slate-700" x-text="skill"></span>
  131. </template>
  132. </template>
  133. <span x-show="!selectedNode.skills || !selectedNode.skills.length" class="text-sm text-slate-500">暂无技能要点</span>
  134. </div>
  135. <div class="mt-4">
  136. <a
  137. class="inline-flex items-center rounded-md bg-indigo-600 px-3 py-2 text-sm font-medium text-white hover:bg-indigo-700"
  138. :href="selectedNode.code ? `/admin/knowledge-point-detail?kp_code=${encodeURIComponent(selectedNode.code)}` : '#'"
  139. target="_blank"
  140. >
  141. 查看知识点详情
  142. </a>
  143. </div>
  144. </div>
  145. </div>
  146. <div class="rounded-xl border border-slate-200 bg-white p-4 shadow-sm space-y-2">
  147. <p class="text-sm font-semibold text-slate-700">快速信息</p>
  148. <div class="text-sm text-slate-600 space-y-1">
  149. <p><span class="font-medium text-slate-900">ID:</span><span x-text="selectedNode.id"></span></p>
  150. <p><span class="font-medium text-slate-900">Code:</span><span x-text="selectedNode.code"></span></p>
  151. <p><span class="font-medium text-slate-900">推荐关注:</span><span x-text="selectedNode.recommended ? '是' : '否'"></span></p>
  152. </div>
  153. </div>
  154. </div>
  155. </template>
  156. <x-mindmap.detail-drawer
  157. :open="$mindmapDrawerOpen"
  158. :details="$mindmapNodeDetails"
  159. closeAction="closeMindmapDrawer"
  160. selectAction="openMindmapDrawer"
  161. panelTitle="知识点详情"
  162. />
  163. </div>
  164. {{-- 错误提示 --}}
  165. @if ($errorMessage)
  166. <div class="mb-8">
  167. <div class="bg-red-50 border border-red-200 rounded-xl p-4">
  168. <div class="flex items-start">
  169. <div class="flex-shrink-0">
  170. <svg class="h-5 w-5 text-red-400" viewBox="0 0 20 20" fill="currentColor">
  171. <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd" />
  172. </svg>
  173. </div>
  174. <div class="ml-3">
  175. <h3 class="text-sm font-medium text-red-800">加载错误</h3>
  176. <div class="mt-2 text-sm text-red-700">
  177. <p>{{ $errorMessage }}</p>
  178. </div>
  179. </div>
  180. </div>
  181. </div>
  182. </div>
  183. @endif
  184. {{-- 加载状态 --}}
  185. @if ($isLoading)
  186. <div class="mb-8">
  187. <div class="bg-white rounded-xl shadow-sm p-12 border border-gray-200">
  188. <div class="flex flex-col items-center justify-center">
  189. <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">
  190. <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
  191. <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>
  192. </svg>
  193. <p class="mt-4 text-sm text-gray-600">正在加载数据,请稍候...</p>
  194. </div>
  195. </div>
  196. </div>
  197. @else
  198. {{-- 加载完成后显示内容 --}}
  199. {{-- 快速概览卡片 --}}
  200. {{-- 快速概览卡片 --}}
  201. <div class="mb-8">
  202. <div class="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-4">
  203. {{-- 掌握度概览 --}}
  204. @if (isset($dashboardData['mastery']['overview']))
  205. <div class="bg-white overflow-hidden shadow-sm rounded-xl border border-gray-200 hover:shadow-md transition-shadow duration-200">
  206. <div class="p-6">
  207. <div class="flex items-center justify-between">
  208. <div class="flex items-center">
  209. <div class="flex-shrink-0">
  210. <div class="w-12 h-12 bg-gradient-to-br from-indigo-500 to-indigo-600 rounded-xl flex items-center justify-center shadow-lg">
  211. <svg class="w-6 h-6 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  212. <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>
  213. </svg>
  214. </div>
  215. </div>
  216. <div class="ml-4">
  217. <p class="text-sm font-medium text-gray-600">平均掌握度</p>
  218. <p class="text-2xl font-bold text-gray-900 mt-1">
  219. {{ number_format($dashboardData['mastery']['overview']['average_mastery_level'] * 100, 1) }}%
  220. </p>
  221. </div>
  222. </div>
  223. </div>
  224. </div>
  225. <div class="bg-gray-50 px-6 py-4 border-t border-gray-100">
  226. <div class="flex justify-between text-xs">
  227. <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">
  228. 已掌握: {{ $dashboardData['mastery']['overview']['mastered_knowledge_points'] }}
  229. </span>
  230. <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-red-100 text-red-800">
  231. 薄弱: {{ $dashboardData['mastery']['overview']['weak_knowledge_points'] }}
  232. </span>
  233. </div>
  234. </div>
  235. </div>
  236. @endif
  237. {{-- 技能熟练度概览 --}}
  238. @if (isset($dashboardData['skill']['summary']))
  239. <div class="bg-white overflow-hidden shadow-sm rounded-xl border border-gray-200 hover:shadow-md transition-shadow duration-200">
  240. <div class="p-6">
  241. <div class="flex items-center justify-between">
  242. <div class="flex items-center">
  243. <div class="flex-shrink-0">
  244. <div class="w-12 h-12 bg-gradient-to-br from-green-500 to-green-600 rounded-xl flex items-center justify-center shadow-lg">
  245. <svg class="w-6 h-6 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  246. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"></path>
  247. </svg>
  248. </div>
  249. </div>
  250. <div class="ml-4">
  251. <p class="text-sm font-medium text-gray-600">技能熟练度</p>
  252. <p class="text-2xl font-bold text-gray-900 mt-1">
  253. {{ number_format($dashboardData['skill']['summary']['average_proficiency_level'] * 100, 1) }}%
  254. </p>
  255. </div>
  256. </div>
  257. </div>
  258. </div>
  259. <div class="bg-gray-50 px-6 py-4 border-t border-gray-100">
  260. <div class="flex justify-between text-xs">
  261. <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800">
  262. 技能: {{ $dashboardData['skill']['summary']['total_skills'] }}
  263. </span>
  264. <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-purple-100 text-purple-800">
  265. 练习: {{ $dashboardData['skill']['summary']['total_questions_attempted'] }}
  266. </span>
  267. </div>
  268. </div>
  269. </div>
  270. @endif
  271. {{-- 提分潜力 --}}
  272. @if (isset($dashboardData['prediction']['quick']))
  273. <div class="bg-white overflow-hidden shadow-sm rounded-xl border border-gray-200 hover:shadow-md transition-shadow duration-200">
  274. <div class="p-6">
  275. <div class="flex items-center justify-between">
  276. <div class="flex items-center">
  277. <div class="flex-shrink-0">
  278. <div class="w-12 h-12 bg-gradient-to-br from-yellow-500 to-orange-500 rounded-xl flex items-center justify-center shadow-lg">
  279. <svg class="w-6 h-6 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  280. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7h8m0 0v8m0-8l-8 8-4-4-6 6"></path>
  281. </svg>
  282. </div>
  283. </div>
  284. <div class="ml-4">
  285. <p class="text-sm font-medium text-gray-600">预期提分</p>
  286. <p class="text-2xl font-bold text-gray-900 mt-1">
  287. +{{ $dashboardData['prediction']['quick']['quick_prediction']['improvement_potential'] ?? 0 }}
  288. <span class="text-lg text-gray-500">分</span>
  289. </p>
  290. </div>
  291. </div>
  292. </div>
  293. </div>
  294. <div class="bg-gray-50 px-6 py-4 border-t border-gray-100">
  295. <div class="flex justify-between text-xs">
  296. <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-orange-100 text-orange-800">
  297. 学习: {{ $dashboardData['prediction']['quick']['quick_prediction']['estimated_study_hours'] ?? 0 }}小时
  298. </span>
  299. <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800">
  300. 置信度: {{ number_format(($dashboardData['prediction']['quick']['quick_prediction']['confidence_level'] ?? 0) * 100, 0) }}%
  301. </span>
  302. </div>
  303. </div>
  304. </div>
  305. @endif
  306. {{-- 专题测试 / 智能出卷入口 --}}
  307. @if(!empty($studentId))
  308. <div class="bg-white overflow-hidden shadow-sm rounded-xl border border-gray-200 hover:shadow-md transition-shadow duration-200">
  309. <div class="p-6 flex items-center justify-between">
  310. <div class="flex items-center">
  311. <div class="flex-shrink-0">
  312. <div class="w-12 h-12 bg-gradient-to-br from-indigo-500 to-indigo-600 rounded-xl flex items-center justify-center shadow-lg">
  313. <svg class="w-6 h-6 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  314. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8c-1.1 0-2 .9-2 2v8h4v-8c0-1.1-.9-2-2-2zm0 0V4m0 16h.01M6 12h.01M18 12h.01" />
  315. </svg>
  316. </div>
  317. </div>
  318. <div class="ml-4">
  319. <p class="text-sm font-medium text-gray-600">专题测试</p>
  320. <p class="text-lg font-semibold text-gray-900">智能出卷</p>
  321. <p class="text-sm text-gray-500">携带学生ID直达出卷,题目偏向薄弱点</p>
  322. </div>
  323. </div>
  324. <a
  325. href="{{ url('/admin/intelligent-exam-generation') }}?student_id={{ $studentId }}"
  326. class="inline-flex items-center px-4 py-2 rounded-lg bg-indigo-600 text-white text-sm font-medium hover:bg-indigo-700"
  327. >
  328. 前往出卷
  329. </a>
  330. </div>
  331. </div>
  332. @endif
  333. {{-- 学习路径 --}}
  334. @if (isset($dashboardData['learning_path']['analytics']))
  335. <div class="bg-white overflow-hidden shadow-sm rounded-xl border border-gray-200 hover:shadow-md transition-shadow duration-200">
  336. <div class="p-6">
  337. <div class="flex items-center justify-between">
  338. <div class="flex items-center">
  339. <div class="flex-shrink-0">
  340. <div class="w-12 h-12 bg-gradient-to-br from-purple-500 to-purple-600 rounded-xl flex items-center justify-center shadow-lg">
  341. <svg class="w-6 h-6 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  342. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 20l-5.447-2.724A1 1 0 013 16.382V5.618a1 1 0 011.447-.894L9 7m0 13l6-3m-6 3V7m6 10l4.553 2.276A1 1 0 0021 18.382V7.618a1 1 0 00-.553-.894L15 4m0 13V4m0 0L9 7"></path>
  343. </svg>
  344. </div>
  345. </div>
  346. <div class="ml-4">
  347. <p class="text-sm font-medium text-gray-600">活跃路径</p>
  348. <p class="text-2xl font-bold text-gray-900 mt-1">
  349. {{ $dashboardData['learning_path']['analytics']['active_paths'] ?? 0 }}
  350. </p>
  351. </div>
  352. </div>
  353. </div>
  354. </div>
  355. <div class="bg-gray-50 px-6 py-4 border-t border-gray-100">
  356. <div class="flex justify-between text-xs">
  357. <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">
  358. 已完成: {{ $dashboardData['learning_path']['analytics']['completed_paths'] ?? 0 }}
  359. </span>
  360. <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-indigo-100 text-indigo-800">
  361. 效率: {{ number_format(($dashboardData['learning_path']['analytics']['average_efficiency_score'] ?? 0) * 100, 0) }}%
  362. </span>
  363. </div>
  364. </div>
  365. </div>
  366. @endif
  367. </div>
  368. </div>
  369. {{-- 主要内容区域 --}}
  370. <div class="mb-8">
  371. <div class="grid grid-cols-1 gap-6 lg:grid-cols-2">
  372. {{-- 掌握度分析 --}}
  373. <div class="bg-white shadow-sm rounded-xl border border-gray-200">
  374. <div class="px-6 py-5 border-b border-gray-100 flex items-center justify-between">
  375. <h3 class="text-lg font-semibold text-gray-900 flex items-center">
  376. <svg class="w-5 h-5 mr-2 text-indigo-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  377. <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>
  378. </svg>
  379. 知识点掌握度
  380. </h3>
  381. <button
  382. wire:click="batchUpdateSkills"
  383. class="inline-flex items-center px-3 py-1.5 border border-transparent text-xs font-medium rounded-lg text-indigo-700 bg-indigo-100 hover:bg-indigo-200 transition-colors duration-150"
  384. >
  385. <svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  386. <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>
  387. </svg>
  388. 刷新
  389. </button>
  390. </div>
  391. <div class="p-6">
  392. @if (isset($dashboardData['mastery']['overview']['total_knowledge_points']))
  393. <div class="space-y-4">
  394. <div class="flex items-center justify-between text-sm">
  395. <span class="text-gray-600">总知识点数</span>
  396. <span class="font-medium text-gray-900">{{ $dashboardData['mastery']['overview']['total_knowledge_points'] }}</span>
  397. </div>
  398. <div class="w-full bg-gray-200 rounded-full h-2">
  399. <div class="bg-indigo-600 h-2 rounded-full" style="width: {{ $dashboardData['mastery']['overview']['average_mastery_level'] * 100 }}%"></div>
  400. </div>
  401. <div class="grid grid-cols-3 gap-4 mt-4">
  402. <div class="text-center">
  403. <div class="text-2xl font-semibold text-green-600">{{ $dashboardData['mastery']['overview']['mastered_knowledge_points'] }}</div>
  404. <div class="text-xs text-gray-500">已掌握 (≥85%)</div>
  405. </div>
  406. <div class="text-center">
  407. <div class="text-2xl font-semibold text-blue-600">{{ $dashboardData['mastery']['overview']['good_knowledge_points'] }}</div>
  408. <div class="text-xs text-gray-500">良好 (70-85%)</div>
  409. </div>
  410. <div class="text-center">
  411. <div class="text-2xl font-semibold text-red-600">{{ $dashboardData['mastery']['overview']['weak_knowledge_points'] }}</div>
  412. <div class="text-xs text-gray-500">薄弱 (<50%)</div>
  413. </div>
  414. </div>
  415. @if (!empty($dashboardData['mastery']['overview']['weak_knowledge_points_list']))
  416. <div class="mt-6">
  417. <h4 class="text-sm font-medium text-gray-900 mb-3">薄弱知识点</h4>
  418. <div class="space-y-2">
  419. @foreach (array_slice($dashboardData['mastery']['overview']['weak_knowledge_points_list'], 0, 5) as $weak)
  420. <div class="flex items-center justify-between p-3 bg-red-50 rounded-lg">
  421. <div class="flex items-center">
  422. <div class="w-2 h-2 bg-red-500 rounded-full mr-3"></div>
  423. <span class="text-sm font-medium text-gray-900">{{ $weak['kp_code'] ?? $weak['knowledge_point_code'] ?? 'N/A' }}</span>
  424. </div>
  425. <div class="flex items-center space-x-3">
  426. <span class="text-sm text-gray-600">{{ number_format(($weak['mastery_level'] ?? $weak['mastery'] ?? 0) * 100, 1) }}%</span>
  427. <button
  428. wire:click="recalculateMastery('{{ $weak['kp_code'] ?? $weak['knowledge_point_code'] ?? '' }}')"
  429. class="text-xs text-indigo-600 hover:text-indigo-800"
  430. >
  431. 重新计算
  432. </button>
  433. </div>
  434. </div>
  435. @endforeach
  436. </div>
  437. </div>
  438. @endif
  439. </div>
  440. @else
  441. <div class="text-center py-8 text-gray-500">
  442. 暂无掌握度数据
  443. </div>
  444. @endif
  445. </div>
  446. </div>
  447. {{-- 技能熟练度 --}}
  448. <div class="bg-white shadow-sm rounded-xl border border-gray-200">
  449. <div class="px-6 py-5 border-b border-gray-100 flex items-center justify-between">
  450. <h3 class="text-lg font-semibold text-gray-900 flex items-center">
  451. <svg class="w-5 h-5 mr-2 text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  452. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"></path>
  453. </svg>
  454. 技能熟练度
  455. </h3>
  456. <button
  457. wire:click="batchUpdateSkills"
  458. class="inline-flex items-center px-3 py-1.5 border border-transparent text-xs font-medium rounded-lg text-green-700 bg-green-100 hover:bg-green-200 transition-colors duration-150"
  459. >
  460. <svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  461. <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>
  462. </svg>
  463. 批量更新
  464. </button>
  465. </div>
  466. <div class="p-6">
  467. @php
  468. $skillData = $dashboardData['skill']['proficiency']['data'] ?? [];
  469. if (!is_array($skillData)) {
  470. $skillData = [];
  471. }
  472. @endphp
  473. @if (!empty($skillData))
  474. <div class="space-y-4">
  475. @foreach (array_slice($skillData, 0, 5) as $skill)
  476. <div class="flex items-center justify-between">
  477. <div class="flex items-center flex-1">
  478. <div class="w-2 h-2 bg-green-500 rounded-full mr-3"></div>
  479. <div class="flex-1">
  480. <div class="text-sm font-medium text-gray-900">{{ $skill['skill_name'] ?? 'N/A' }}</div>
  481. <div class="w-full bg-gray-200 rounded-full h-1.5 mt-1">
  482. <div class="bg-green-500 h-1.5 rounded-full" style="width: {{ (($skill['proficiency_level'] ?? 0) * 100) }}%"></div>
  483. </div>
  484. </div>
  485. </div>
  486. <div class="ml-4 text-right">
  487. <div class="text-sm font-semibold text-gray-900">{{ number_format(($skill['proficiency_level'] ?? 0) * 100, 1) }}%</div>
  488. <div class="text-xs text-gray-500">{{ $skill['total_questions_attempted'] ?? 0 }}题</div>
  489. </div>
  490. </div>
  491. @endforeach
  492. </div>
  493. @else
  494. <div class="text-center py-8 text-gray-500">
  495. 暂无技能数据
  496. </div>
  497. @endif
  498. </div>
  499. </div>
  500. </div>
  501. {{-- 技能熟练度雷达图 - 已隐藏(功能已实现但暂时隐藏以简化界面) --}}
  502. {{-- <div class="mb-8">
  503. <div class="bg-white shadow-sm rounded-xl border border-gray-200">
  504. <div class="px-6 py-5 border-b border-gray-100">
  505. <h3 class="text-lg font-semibold text-gray-900 flex items-center">
  506. <svg class="w-5 h-5 mr-2 text-blue-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  507. <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>
  508. </svg>
  509. 技能熟练度雷达图
  510. </h3>
  511. </div>
  512. <div class="p-6">
  513. <livewire:skill-proficiency-radar :student-id="$studentId" />
  514. </div>
  515. </div>
  516. </div> --}}
  517. {{-- 提分预测和学习路径 - 已实现 --}}
  518. <div class="mb-8">
  519. <div class="grid grid-cols-1 gap-6 lg:grid-cols-2">
  520. {{-- 提分预测 --}}
  521. <div class="bg-white shadow-sm rounded-xl border border-gray-200">
  522. <div class="px-6 py-5 border-b border-gray-100 flex items-center justify-between">
  523. <h3 class="text-lg font-semibold text-gray-900 flex items-center">
  524. <svg class="w-5 h-5 mr-2 text-yellow-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  525. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7h8m0 0v8m0-8l-8 8-4-4-6 6"></path>
  526. </svg>
  527. 提分预测
  528. </h3>
  529. <button
  530. wire:click="generateQuickPrediction"
  531. class="inline-flex items-center px-3 py-1.5 border border-transparent text-xs font-medium rounded-lg text-yellow-700 bg-yellow-100 hover:bg-yellow-200 transition-colors duration-150"
  532. >
  533. <svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  534. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"></path>
  535. </svg>
  536. 快速预测
  537. </button>
  538. </div>
  539. <div class="p-6">
  540. {{-- 快速预测结果 --}}
  541. @if (isset($dashboardData['prediction']['quick']) && !empty($dashboardData['prediction']['quick']['quick_prediction']))
  542. @php
  543. $quickPrediction = $dashboardData['prediction']['quick']['quick_prediction'];
  544. @endphp
  545. {{-- 主要预测信息卡片 --}}
  546. <div class="bg-gradient-to-r from-blue-50 to-indigo-50 rounded-lg p-6 mb-6 border border-blue-200">
  547. <div class="flex items-center justify-between mb-4">
  548. <div>
  549. <h4 class="text-lg font-semibold text-gray-900">智能提分预测</h4>
  550. <p class="text-sm text-gray-600 mt-1">基于当前学习数据的AI分析</p>
  551. </div>
  552. <div class="text-right">
  553. <div class="text-2xl font-bold text-green-600">
  554. +{{ number_format($quickPrediction['improvement_potential'] ?? 0, 1) }}分
  555. </div>
  556. <div class="text-sm text-gray-500">预期提分</div>
  557. </div>
  558. </div>
  559. <div class="grid grid-cols-3 gap-4 mb-4">
  560. <div class="text-center">
  561. <div class="text-lg font-semibold text-gray-900">
  562. {{ $quickPrediction['current_score'] ?? 0 }}分
  563. </div>
  564. <div class="text-xs text-gray-500">当前分数</div>
  565. </div>
  566. <div class="text-center">
  567. <div class="text-lg font-semibold text-blue-600">
  568. {{ $quickPrediction['predicted_score'] ?? 0 }}分
  569. </div>
  570. <div class="text-xs text-gray-500">预测分数</div>
  571. </div>
  572. <div class="text-center">
  573. <div class="text-lg font-semibold text-purple-600">
  574. {{ $quickPrediction['estimated_study_hours'] ?? 0 }}h
  575. </div>
  576. <div class="text-xs text-gray-500">建议学习时间</div>
  577. </div>
  578. </div>
  579. <div class="flex items-center justify-between">
  580. <div class="flex items-center space-x-2">
  581. <span class="text-sm text-gray-600">置信度:</span>
  582. <div class="flex items-center">
  583. <div class="w-20 bg-gray-200 rounded-full h-2 mr-2">
  584. <div class="bg-blue-600 h-2 rounded-full" style="width: {{ ($quickPrediction['confidence_level'] ?? 0) * 100 }}%"></div>
  585. </div>
  586. <span class="text-sm font-medium text-gray-900">{{ number_format(($quickPrediction['confidence_level'] ?? 0) * 100, 0) }}%</span>
  587. </div>
  588. </div>
  589. <div class="text-xs text-gray-500">
  590. {{ $quickPrediction['weak_knowledge_points_count'] ?? 0 }}个薄弱知识点
  591. </div>
  592. </div>
  593. </div>
  594. {{-- 优先学习主题 --}}
  595. @if (!empty($quickPrediction['priority_topics']))
  596. <div class="mb-6">
  597. <h5 class="text-sm font-medium text-gray-900 mb-3 flex items-center">
  598. <svg class="w-4 h-4 mr-2 text-yellow-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  599. <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>
  600. </svg>
  601. 优先学习主题 (前5个)
  602. </h5>
  603. <div class="space-y-2">
  604. @foreach (array_slice($quickPrediction['priority_topics'], 0, 5) as $topic)
  605. <div class="flex items-center justify-between p-3 bg-yellow-50 rounded-lg border border-yellow-200">
  606. <div class="flex items-center space-x-3">
  607. <div class="w-8 h-8 bg-yellow-100 rounded-full flex items-center justify-center">
  608. <span class="text-xs font-medium text-yellow-800">{{ substr($topic['kp_code'] ?? '', -2) }}</span>
  609. </div>
  610. <div>
  611. <div class="text-sm font-medium text-gray-900">{{ $topic['kp_code'] ?? 'N/A' }}</div>
  612. <div class="text-xs text-gray-500">掌握度: {{ number_format(($topic['mastery_level'] ?? 0) * 100, 1) }}%</div>
  613. </div>
  614. </div>
  615. <div class="text-right">
  616. <div class="text-sm font-medium text-gray-900">优先级</div>
  617. <div class="text-xs text-gray-500">{{ number_format($topic['priority_score'] ?? 0, 2) }}</div>
  618. </div>
  619. </div>
  620. @endforeach
  621. </div>
  622. </div>
  623. @endif
  624. {{-- 学习建议 --}}
  625. @if (!empty($quickPrediction['recommended_actions']))
  626. <div>
  627. <h5 class="text-sm font-medium text-gray-900 mb-3 flex items-center">
  628. <svg class="w-4 h-4 mr-2 text-blue-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  629. <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>
  630. </svg>
  631. 个性化学习建议
  632. </h5>
  633. <div class="space-y-3">
  634. @foreach (array_slice($quickPrediction['recommended_actions'], 0, 3) as $recommendation)
  635. <div class="p-3 bg-blue-50 rounded-lg border border-blue-200">
  636. <div class="flex items-center justify-between mb-2">
  637. <span class="text-sm font-medium text-gray-900">{{ $recommendation['kp_code'] ?? 'N/A' }}</span>
  638. <span class="text-xs text-gray-500">
  639. {{ number_format(($recommendation['current_mastery'] ?? 0) * 100, 0) }}% → {{ number_format(($recommendation['target_mastery'] ?? 0) * 100, 0) }}%
  640. </span>
  641. </div>
  642. <div class="flex flex-wrap gap-1">
  643. @foreach (($recommendation['actions'] ?? []) as $action)
  644. <span class="inline-flex items-center px-2 py-1 rounded-full text-xs bg-blue-100 text-blue-800">
  645. {{ $action }}
  646. </span>
  647. @endforeach
  648. </div>
  649. </div>
  650. @endforeach
  651. </div>
  652. </div>
  653. @endif
  654. {{-- 历史预测记录 --}}
  655. @elseif (!empty($dashboardData['prediction']['list']['predictions']))
  656. @php
  657. $historicalPredictions = $dashboardData['prediction']['list']['predictions'];
  658. @endphp
  659. <div class="space-y-4">
  660. <h5 class="text-sm font-medium text-gray-900 mb-3">历史预测记录</h5>
  661. @foreach (array_slice($historicalPredictions, 0, 3) as $prediction)
  662. <div class="p-4 border border-gray-200 rounded-lg">
  663. <div class="flex items-center justify-between mb-2">
  664. <div class="text-sm font-medium text-gray-900">{{ $prediction['target_entity'] ?? 'N/A' }}</div>
  665. <span class="text-xs text-gray-500">{{ $prediction['prediction_date'] ?? date('m-d') }}</span>
  666. </div>
  667. <div class="flex items-center justify-between">
  668. <div class="text-sm text-gray-600">
  669. 当前: {{ $prediction['current_score'] ?? 0 }}分 →
  670. <span class="font-semibold text-gray-900">{{ $prediction['predicted_score'] ?? 0 }}分</span>
  671. </div>
  672. <div class="text-sm font-semibold text-green-600">
  673. +{{ number_format(($prediction['predicted_score'] ?? 0) - ($prediction['current_score'] ?? 0), 1) }}分
  674. </div>
  675. </div>
  676. </div>
  677. @endforeach
  678. </div>
  679. @else
  680. <div class="text-center py-8 text-gray-500">
  681. <div class="mb-4">
  682. <svg class="w-12 h-12 mx-auto text-gray-300" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  683. <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>
  684. </svg>
  685. </div>
  686. <p class="text-sm font-medium text-gray-900 mb-1">暂无预测数据</p>
  687. <p class="text-xs text-gray-500 mb-4">点击"快速预测"按钮生成AI预测分析</p>
  688. <button
  689. wire:click="generateQuickPrediction"
  690. class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-lg text-white bg-blue-600 hover:bg-blue-700 transition-colors duration-200"
  691. >
  692. <svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  693. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"></path>
  694. </svg>
  695. 生成快速预测
  696. </button>
  697. </div>
  698. @endif
  699. </div>
  700. </div>
  701. </div>
  702. {{-- 掌握度热力图 - 已隐藏(功能已实现但暂时隐藏以简化界面) --}}
  703. {{-- <div class="mb-8">
  704. <div class="bg-white shadow-sm rounded-xl border border-gray-200">
  705. <div class="px-6 py-5 border-b border-gray-100">
  706. <h3 class="text-lg font-semibold text-gray-900 flex items-center">
  707. <svg class="w-5 h-5 mr-2 text-red-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  708. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 5a1 1 0 011-1h14a1 1 0 011 1v2a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM4 13a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H5a1 1 0 01-1-1v-6zM16 13a1 1 0 011-1h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6z"></path>
  709. </svg>
  710. 知识点掌握度热力图
  711. </h3>
  712. </div>
  713. <div class="p-6">
  714. <livewire:mastery-heatmap :student-id="$studentId" />
  715. </div>
  716. </div>
  717. </div> --}}
  718. {{-- 知识点依赖关系图 - 已隐藏(功能已实现但暂时隐藏以简化界面) --}}
  719. {{-- <div class="mb-8">
  720. <div class="bg-white shadow-sm rounded-xl border border-gray-200">
  721. <div class="px-6 py-5 border-b border-gray-100">
  722. <h3 class="text-lg font-semibold text-gray-900 flex items-center">
  723. <svg class="w-5 h-5 mr-2 text-blue-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  724. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"></path>
  725. </svg>
  726. 知识点依赖关系图
  727. </h3>
  728. </div>
  729. <div class="p-6">
  730. <livewire:knowledge-dependency-graph :student-id="$studentId" />
  731. </div>
  732. </div>
  733. </div> --}}
  734. {{-- 推荐学习路径 - 已隐藏(功能已实现但暂时隐藏以简化界面) --}}
  735. {{-- @if (isset($dashboardData['learning_path']['recommendations']['recommendations']))
  736. <div class="mb-8">
  737. <div class="bg-white shadow-sm rounded-xl border border-gray-200">
  738. <div class="px-6 py-5 border-b border-gray-100">
  739. <h3 class="text-lg font-semibold text-gray-900 flex items-center">
  740. <svg class="w-5 h-5 mr-2 text-indigo-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  741. <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>
  742. </svg>
  743. 推荐学习路径
  744. </h3>
  745. </div>
  746. <div class="p-6">
  747. <div class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3">
  748. @foreach ($dashboardData['learning_path']['recommendations']['recommendations'] as $recommendation)
  749. <div class="p-4 border border-gray-200 rounded-lg hover:border-indigo-300 transition-colors">
  750. <div class="flex items-center mb-3">
  751. <div class="w-8 h-8 bg-indigo-100 rounded-full flex items-center justify-center mr-3">
  752. <svg class="w-4 h-4 text-indigo-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  753. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"></path>
  754. </svg>
  755. </div>
  756. <div class="flex-1">
  757. <div class="text-sm font-medium text-gray-900">{{ $recommendation['target_kp_name'] }}</div>
  758. <div class="text-xs text-gray-500">{{ $recommendation['target_kp_code'] }}</div>
  759. </div>
  760. </div>
  761. <div class="mb-3">
  762. <div class="flex items-center justify-between text-xs text-gray-600 mb-1">
  763. <span>当前掌握度</span>
  764. <span class="font-medium">{{ number_format($recommendation['current_mastery'] * 100, 1) }}%</span>
  765. </div>
  766. <div class="w-full bg-gray-200 rounded-full h-1.5">
  767. <div class="bg-indigo-500 h-1.5 rounded-full" style="width: {{ $recommendation['current_mastery'] * 100 }}%"></div>
  768. </div>
  769. </div>
  770. <p class="text-xs text-gray-600 mb-3">{{ $recommendation['reason'] }}</p>
  771. <button class="w-full text-xs bg-indigo-600 text-white py-2 px-3 rounded-md hover:bg-indigo-700 transition-colors">
  772. 生成学习路径
  773. </button>
  774. </div>
  775. @endforeach
  776. </div>
  777. </div>
  778. </div>
  779. @endif --}}
  780. </div>
  781. </div>
  782. @endif
  783. @push('styles')
  784. <style>
  785. .knowledge-mindmap-canvas {
  786. background: #ffffff;
  787. }
  788. </style>
  789. @endpush
  790. @push('scripts')
  791. <script src="https://gw.alipayobjects.com/os/lib/antv/g6/4.8.24/dist/g6.min.js"></script>
  792. <script src="{{ asset('js/g6-custom-node.js') }}"></script>
  793. <script src="{{ asset('js/knowledge-mindmap-graph.js') }}"></script>
  794. <script>
  795. document.addEventListener('alpine:init', () => {
  796. window.studentMindmapPanel = (livewireId = null) => ({
  797. graphInstance: null,
  798. stats: { nodes: 0, extraEdges: 0 },
  799. livewireId,
  800. selectedNode: null,
  801. initEventListener() {
  802. window.addEventListener('mindmap-node-selected', (evt) => {
  803. const model = evt.detail || {};
  804. const code = model?.meta?.code || model?.id;
  805. const mastery = model?.meta?.mastery_level ?? this.graphInstance?.masteryData?.[code]?.mastery_level ?? 0;
  806. const accuracy = model?.meta?.accuracy_rate ?? this.graphInstance?.masteryData?.[code]?.accuracy_rate ?? null;
  807. const attempts = model?.meta?.total_attempts ?? this.graphInstance?.masteryData?.[code]?.total_attempts ?? null;
  808. this.selectedNode = {
  809. id: model?.id,
  810. code,
  811. label: model?.label,
  812. mastery,
  813. accuracy,
  814. attempts,
  815. recommended: model?.meta?.recommended ?? false,
  816. skills: model?.meta?.skills || this.graphInstance?.masteryData?.[code]?.skills || [],
  817. };
  818. });
  819. },
  820. async initMindmap() {
  821. if (!window.KnowledgeMindmapGraph) {
  822. return;
  823. }
  824. this.graphInstance = new KnowledgeMindmapGraph({
  825. containerId: 'student-mindmap',
  826. livewireMethod: 'openMindmapDrawer',
  827. highlightLowMastery: true,
  828. livewireId: this.livewireId,
  829. onNodeSelect: (model) => {
  830. const code = model?.meta?.code || model?.id;
  831. const mastery = model?.meta?.mastery_level ?? this.graphInstance?.masteryData?.[code]?.mastery_level ?? 0;
  832. const accuracy = model?.meta?.accuracy_rate ?? this.graphInstance?.masteryData?.[code]?.accuracy_rate ?? null;
  833. const attempts = model?.meta?.total_attempts ?? this.graphInstance?.masteryData?.[code]?.total_attempts ?? null;
  834. this.selectedNode = {
  835. id: model?.id,
  836. code,
  837. label: model?.label,
  838. mastery,
  839. accuracy,
  840. attempts,
  841. recommended: model?.meta?.recommended ?? false,
  842. skills: model?.meta?.skills || this.graphInstance?.masteryData?.[code]?.skills || [],
  843. };
  844. },
  845. });
  846. this.graphInstance.masteryData = @js($mindmapMasteryData ?? []);
  847. await this.graphInstance.init();
  848. this.stats = this.graphInstance.stats;
  849. },
  850. });
  851. });
  852. </script>
  853. @endpush
  854. {{-- 通知脚本 --}}
  855. <script>
  856. document.addEventListener('notify', (event) => {
  857. const message = event.detail.message;
  858. const type = event.detail.type || 'info';
  859. alert(message);
  860. });
  861. </script>