| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <div class="space-y-6">
- {{-- Header --}}
- <div class="bg-white rounded-lg shadow-sm border border-gray-200 p-6">
- <h3 class="text-lg font-semibold text-gray-900">知识点掌握度热力图</h3>
- <p class="text-sm text-gray-500 mt-1">点击知识点查看详情</p>
- </div>
- {{-- Loading State --}}
- @if($loading)
- <div class="bg-white rounded-lg shadow-sm border border-gray-200 p-12 text-center">
- <div class="animate-spin rounded-full h-12 w-12 border-b-2 border-indigo-600 mx-auto"></div>
- <p class="mt-4 text-gray-500">加载热力图数据中...</p>
- </div>
- {{-- Error State --}}
- @elseif($error)
- <div class="bg-red-50 border border-red-200 rounded-lg p-6">
- <div class="flex">
- <svg class="h-5 w-5 text-red-400" fill="currentColor" viewBox="0 0 20 20">
- <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>
- </svg>
- <div class="ml-3">
- <h3 class="text-sm font-medium text-red-800">加载失败</h3>
- <p class="mt-2 text-sm text-red-700">{{ $error }}</p>
- </div>
- </div>
- </div>
- {{-- Heatmap --}}
- @else
- <div class="bg-white rounded-lg shadow-sm border border-gray-200 p-6">
- @if(empty($heatmapData))
- <div class="text-center py-12 text-gray-500">
- <svg class="mx-auto h-12 w-12 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 3.055A9.001 9.001 0 1020.945 13H11V3.055z"></path>
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20.488 9H15V3.512A9.025 9.025 0 0120.488 9z"></path>
- </svg>
- <p class="mt-2">暂无掌握度数据</p>
- </div>
- @else
- {{-- Legend --}}
- <div class="mb-6 flex items-center justify-center space-x-6">
- <div class="flex items-center">
- <div class="w-4 h-4 rounded bg-red-500 mr-2"></div>
- <span class="text-sm text-gray-600">0-20%</span>
- </div>
- <div class="flex items-center">
- <div class="w-4 h-4 rounded bg-orange-500 mr-2"></div>
- <span class="text-sm text-gray-600">20-40%</span>
- </div>
- <div class="flex items-center">
- <div class="w-4 h-4 rounded bg-yellow-500 mr-2"></div>
- <span class="text-sm text-gray-600">40-60%</span>
- </div>
- <div class="flex items-center">
- <div class="w-4 h-4 rounded bg-blue-500 mr-2"></div>
- <span class="text-sm text-gray-600">60-80%</span>
- </div>
- <div class="flex items-center">
- <div class="w-4 h-4 rounded bg-green-500 mr-2"></div>
- <span class="text-sm text-gray-600">80-100%</span>
- </div>
- </div>
- {{-- Heatmap Grid --}}
- <div class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-3">
- @foreach($heatmapData as $item)
- <div
- class="relative group cursor-pointer rounded-lg p-4 {{ $item['bgClass'] }} text-white transition-transform hover:scale-105"
- title="{{ $item['name'] }}: {{ $item['mastery'] }}%"
- >
- <div class="text-center">
- <p class="font-semibold text-lg">{{ $item['mastery'] }}%</p>
- <p class="text-xs mt-1 opacity-90">{{ $item['code'] }}</p>
- <p class="text-xs mt-1 opacity-75 truncate">{{ $item['name'] }}</p>
- <div class="mt-2 pt-2 border-t border-white/20">
- <p class="text-xs opacity-75">答题: {{ $item['total_attempts'] }}</p>
- <p class="text-xs opacity-75">正确: {{ $item['correct_attempts'] }}</p>
- </div>
- </div>
-
- {{-- Tooltip --}}
- <div class="absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 px-3 py-2 bg-gray-900 text-white text-xs rounded-lg opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none whitespace-nowrap z-10">
- {{ $item['name'] }}<br>
- 掌握度: {{ $item['mastery'] }}%<br>
- 答题: {{ $item['total_attempts'] }} 次
- <div class="absolute top-full left-1/2 transform -translate-x-1/2">
- <div class="w-2 h-2 bg-gray-900 rotate-45"></div>
- </div>
- </div>
- </div>
- @endforeach
- </div>
- @endif
- </div>
- @endif
- </div>
|