teacher-dashboard.blade.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <div class="space-y-6">
  2. {{-- Stats Cards --}}
  3. <div class="grid grid-cols-1 md:grid-cols-4 gap-6">
  4. <div class="bg-white rounded-lg shadow-sm border border-gray-200 p-6">
  5. <div class="flex items-center">
  6. <div class="p-3 rounded-full bg-indigo-100 text-indigo-600">
  7. <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  8. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z"></path>
  9. </svg>
  10. </div>
  11. <div class="ml-4">
  12. <p class="text-sm text-gray-500">学生总数</p>
  13. <p class="text-2xl font-bold text-gray-900">{{ $stats['total_students'] ?? 0 }}</p>
  14. </div>
  15. </div>
  16. </div>
  17. <div class="bg-white rounded-lg shadow-sm border border-gray-200 p-6">
  18. <div class="flex items-center">
  19. <div class="p-3 rounded-full bg-green-100 text-green-600">
  20. <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  21. <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>
  22. </svg>
  23. </div>
  24. <div class="ml-4">
  25. <p class="text-sm text-gray-500">已掌握知识点</p>
  26. <p class="text-2xl font-bold text-gray-900">{{ $stats['total_mastered_points'] ?? 0 }}</p>
  27. </div>
  28. </div>
  29. </div>
  30. <div class="bg-white rounded-lg shadow-sm border border-gray-200 p-6">
  31. <div class="flex items-center">
  32. <div class="p-3 rounded-full bg-blue-100 text-blue-600">
  33. <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  34. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7h8m0 0v8m0-8l-8 8-4-4-6 6"></path>
  35. </svg>
  36. </div>
  37. <div class="ml-4">
  38. <p class="text-sm text-gray-500">平均掌握度</p>
  39. <p class="text-2xl font-bold text-gray-900">{{ $stats['avg_mastery'] ?? 0 }}%</p>
  40. </div>
  41. </div>
  42. </div>
  43. <div class="bg-white rounded-lg shadow-sm border border-gray-200 p-6">
  44. <div class="flex items-center">
  45. <div class="p-3 rounded-full bg-yellow-100 text-yellow-600">
  46. <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  47. <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>
  48. </svg>
  49. </div>
  50. <div class="ml-4">
  51. <p class="text-sm text-gray-500">总答题数</p>
  52. <p class="text-2xl font-bold text-gray-900">{{ $stats['total_attempts'] ?? 0 }}</p>
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. {{-- Loading State --}}
  58. @if($loading)
  59. <div class="bg-white rounded-lg shadow-sm border border-gray-200 p-12 text-center">
  60. <div class="animate-spin rounded-full h-12 w-12 border-b-2 border-indigo-600 mx-auto"></div>
  61. <p class="mt-4 text-gray-500">加载学生数据中...</p>
  62. </div>
  63. {{-- Error State --}}
  64. @elseif($error)
  65. <div class="bg-red-50 border border-red-200 rounded-lg p-6">
  66. <div class="flex">
  67. <svg class="h-5 w-5 text-red-400" fill="currentColor" viewBox="0 0 20 20">
  68. <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"></path>
  69. </svg>
  70. <div class="ml-3">
  71. <h3 class="text-sm font-medium text-red-800">加载失败</h3>
  72. <p class="mt-2 text-sm text-red-700">{{ $error }}</p>
  73. </div>
  74. </div>
  75. </div>
  76. {{-- Students Table --}}
  77. @else
  78. <div class="bg-white rounded-lg shadow-sm border border-gray-200">
  79. <div class="px-6 py-4 border-b border-gray-200">
  80. <h3 class="text-lg font-semibold text-gray-900">学生列表</h3>
  81. </div>
  82. @if(empty($students))
  83. <div class="text-center py-12 text-gray-500">
  84. <svg class="mx-auto h-12 w-12 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  85. <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>
  86. </svg>
  87. <p class="mt-2">暂无学生数据</p>
  88. </div>
  89. @else
  90. <div class="overflow-x-auto">
  91. <table class="min-w-full divide-y divide-gray-200">
  92. <thead class="bg-gray-50">
  93. <tr>
  94. <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">学生</th>
  95. <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">班级</th>
  96. <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">平均掌握度</th>
  97. <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">已掌握</th>
  98. <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">答题数</th>
  99. <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">操作</th>
  100. </tr>
  101. </thead>
  102. <tbody class="bg-white divide-y divide-gray-200">
  103. @foreach($students as $student)
  104. <tr class="hover:bg-gray-50">
  105. <td class="px-6 py-4 whitespace-nowrap">
  106. <div class="flex items-center">
  107. <div class="flex-shrink-0 h-10 w-10">
  108. <div class="h-10 w-10 rounded-full bg-indigo-100 flex items-center justify-center">
  109. <span class="text-sm font-medium text-indigo-600">
  110. {{ substr($student['name'], 0, 1) }}
  111. </span>
  112. </div>
  113. </div>
  114. <div class="ml-4">
  115. <div class="text-sm font-medium text-gray-900">{{ $student['name'] }}</div>
  116. <div class="text-sm text-gray-500">{{ $student['student_id'] }}</div>
  117. </div>
  118. </div>
  119. </td>
  120. <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
  121. {{ $student['grade'] }} {{ $student['class'] }}
  122. </td>
  123. <td class="px-6 py-4 whitespace-nowrap">
  124. <div class="flex items-center">
  125. <div class="flex-1">
  126. <div class="w-full bg-gray-200 rounded-full h-2">
  127. @php
  128. $mastery = $student['avg_mastery'];
  129. if ($mastery >= 80) {
  130. $barClass = 'bg-green-500';
  131. } elseif ($mastery >= 60) {
  132. $barClass = 'bg-blue-500';
  133. } elseif ($mastery >= 40) {
  134. $barClass = 'bg-yellow-500';
  135. } else {
  136. $barClass = 'bg-red-500';
  137. }
  138. @endphp
  139. <div class="{{ $barClass }} h-2 rounded-full" style="width: {{ $mastery }}%"></div>
  140. </div>
  141. </div>
  142. <span class="ml-3 text-sm font-medium text-gray-900">{{ $student['avg_mastery'] }}%</span>
  143. </div>
  144. </td>
  145. <td class="px-6 py-4 whitespace-nowrap">
  146. <span class="text-sm text-gray-900">{{ $student['mastered_points'] }} / {{ $student['total_knowledge_points'] }}</span>
  147. </td>
  148. <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
  149. {{ $student['total_attempts'] }}
  150. </td>
  151. <td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
  152. <button
  153. class="text-indigo-600 hover:text-indigo-900 mr-4"
  154. onclick="window.location.href='{{ route('filament.admin.auth.login') }}'"
  155. >
  156. 查看详情
  157. </button>
  158. </td>
  159. </tr>
  160. @endforeach
  161. </tbody>
  162. </table>
  163. </div>
  164. @endif
  165. </div>
  166. @endif
  167. </div>