首次提交:初始化项目代码

This commit is contained in:
sunct
2026-07-31 14:44:48 +08:00
commit a4fe393571
119 changed files with 29105 additions and 0 deletions
+220
View File
@@ -0,0 +1,220 @@
<div class="bg-white rounded-xl shadow-sm border border-slate-200 overflow-hidden">
<div class="border-b border-slate-200 px-6 py-4 bg-slate-50">
<div class="flex items-center justify-between">
<div>
<h3 class="font-semibold text-slate-800 flex items-center gap-2">
<i class="fas fa-question-circle text-purple-500"></i> 面试答题管理
</h3>
<p class="text-sm text-slate-500 mt-1">管理用户的面试题库、答题记录和学习进度</p>
</div>
</div>
</div>
<div class="p-6">
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-6">
<div class="bg-gradient-to-br from-blue-50 to-blue-100 rounded-xl p-5 border border-blue-200">
<div class="flex items-center justify-between">
<div>
<p class="text-sm text-blue-600 font-medium">总用户数</p>
<p class="text-2xl font-bold text-blue-800 mt-1">{{ len .UsersWithStats }}</p>
</div>
<div class="w-12 h-12 rounded-full bg-blue-200 flex items-center justify-center">
<i class="fas fa-users text-blue-600"></i>
</div>
</div>
</div>
<div class="bg-gradient-to-br from-green-50 to-green-100 rounded-xl p-5 border border-green-200">
<div class="flex items-center justify-between">
<div>
<p class="text-sm text-green-600 font-medium">总答题次数</p>
<p class="text-2xl font-bold text-green-800 mt-1">{{ .TotalStats.TotalAttempts }}</p>
</div>
<div class="w-12 h-12 rounded-full bg-green-200 flex items-center justify-center">
<i class="fas fa-check-circle text-green-600"></i>
</div>
</div>
</div>
<div class="bg-gradient-to-br from-yellow-50 to-yellow-100 rounded-xl p-5 border border-yellow-200">
<div class="flex items-center justify-between">
<div>
<p class="text-sm text-yellow-600 font-medium">收藏题目</p>
<p class="text-2xl font-bold text-yellow-800 mt-1">{{ .TotalStats.TotalFavorites }}</p>
</div>
<div class="w-12 h-12 rounded-full bg-yellow-200 flex items-center justify-center">
<i class="fas fa-star text-yellow-600"></i>
</div>
</div>
</div>
<div class="bg-gradient-to-br from-red-50 to-red-100 rounded-xl p-5 border border-red-200">
<div class="flex items-center justify-between">
<div>
<p class="text-sm text-red-600 font-medium">错题数量</p>
<p class="text-2xl font-bold text-red-800 mt-1">{{ .TotalStats.TotalWrong }}</p>
</div>
<div class="w-12 h-12 rounded-full bg-red-200 flex items-center justify-center">
<i class="fas fa-times-circle text-red-600"></i>
</div>
</div>
</div>
</div>
<div class="overflow-x-auto">
<table class="table">
<thead>
<tr class="bg-slate-50 border-b border-slate-200">
<th class="text-left px-6 py-4 text-sm font-semibold text-slate-600">用户信息</th>
<th class="text-left px-6 py-4 text-sm font-semibold text-slate-600">答题统计</th>
<th class="text-left px-6 py-4 text-sm font-semibold text-slate-600">正确率</th>
<th class="text-left px-6 py-4 text-sm font-semibold text-slate-600">收藏/错题</th>
<th class="text-left px-6 py-4 text-sm font-semibold text-slate-600">最近答题</th>
<th class="text-left px-6 py-4 text-sm font-semibold text-slate-600">操作</th>
</tr>
</thead>
<tbody>
{{ range .UsersWithStats }}
<tr class="border-b border-slate-100 hover:bg-slate-50 transition-colors">
<td class="px-6 py-4">
<div class="flex items-center gap-3">
<div class="w-10 h-10 rounded-full bg-gradient-to-br from-purple-500 to-purple-600 flex items-center justify-center text-white font-bold shadow-md">
{{ if .User.Name }}{{ substr .User.Name 0 1 }}{{ else }}{{ substr .User.Username 0 1 }}{{ end }}
</div>
<div>
<p class="font-medium text-slate-800">{{ if .User.Name }}{{ .User.Name }}{{ else }}{{ .User.Username }}{{ end }}</p>
<p class="text-sm text-slate-500">{{ .User.Email }}</p>
</div>
</div>
</td>
<td class="px-6 py-4">
<div class="flex items-center gap-4">
<div>
<p class="text-xs text-slate-500">答题次数</p>
<p class="font-semibold text-slate-800">{{ .TotalAttempts }}</p>
</div>
<div class="w-px h-10 bg-slate-200"></div>
<div>
<p class="text-xs text-slate-500">平均得分</p>
<p class="font-semibold text-slate-800">{{ printf "%.1f" .AvgScore }}</p>
</div>
</div>
</td>
<td class="px-6 py-4">
<div class="flex items-center gap-3">
<div class="w-20 h-3 bg-slate-100 rounded-full overflow-hidden">
<div class="h-full rounded-full transition-all"
style="width: {{ .CorrectRate }}%; background-color: {{ if ge .CorrectRate 80 }}#22c55e{{ else if ge .CorrectRate 60 }}#eab308{{ else }}#ef4444{{ end }}"></div>
</div>
<span class="text-sm font-medium text-slate-700">{{ .CorrectRate }}%</span>
</div>
</td>
<td class="px-6 py-4">
<div class="flex items-center gap-3">
<span class="flex items-center gap-1 text-yellow-600">
<i class="fas fa-star"></i>
<span class="text-sm font-medium">{{ .FavoriteCount }}</span>
</span>
<span class="flex items-center gap-1 text-red-500">
<i class="fas fa-times-circle"></i>
<span class="text-sm font-medium">{{ .WrongCount }}</span>
</span>
</div>
</td>
<td class="px-6 py-4">
<span class="text-sm text-slate-500">{{ if .LastAttemptDate }}{{ .LastAttemptDate }}{{ else }}暂无记录{{ end }}</span>
</td>
<td class="px-6 py-4">
<div class="flex items-center gap-2">
<a href="{{$.AdminPath}}/user/{{.User.ID}}/quiz/generate" class="btn btn-primary btn-xs" title="AI生成题目">
<i class="fas fa-robot"></i> 生成题目
</a>
<a href="{{$.AdminPath}}/user/{{.User.ID}}/quiz" class="btn btn-info btn-xs" title="查看题库">
<i class="fas fa-book-open"></i> 题库
</a>
</div>
</td>
</tr>
{{ else }}
<tr>
<td colspan="6" class="px-6 py-12 text-center text-slate-500">
<div class="w-16 h-16 mx-auto mb-4 rounded-full bg-slate-100 flex items-center justify-center">
<i class="fas fa-users text-slate-400 text-2xl"></i>
</div>
<p>暂无用户,请先添加用户</p>
</td>
</tr>
{{ end }}
</tbody>
</table>
</div>
{{ if gt .TotalPages 1 }}
<div class="border-t border-slate-200 px-6 py-4 bg-slate-50 flex items-center justify-between">
<div class="text-sm text-slate-500">共 {{ .TotalRecords }} 条记录,第 {{ .CurrentPage }} / {{ .TotalPages }} 页</div>
<div class="flex items-center gap-2">
<a href="?page=1" class="btn btn-sm btn-slate {{ if eq .CurrentPage 1 }}opacity-50 cursor-not-allowed{{ end }}" {{ if eq .CurrentPage 1 }}onclick="return false"{{ end }}>
<i class="fas fa-chevron-left"></i>
<i class="fas fa-chevron-left"></i>
</a>
<a href="?page={{ if eq .CurrentPage 1 }}1{{ else }}{{ subtract .CurrentPage 1 }}{{ end }}" class="btn btn-sm btn-slate {{ if eq .CurrentPage 1 }}opacity-50 cursor-not-allowed{{ end }}" {{ if eq .CurrentPage 1 }}onclick="return false"{{ end }}>
<i class="fas fa-chevron-left"></i>
</a>
{{ range $i := to 1 $.TotalPages }}
{{ if or (eq $i 1) (eq $i $.TotalPages) (and (ge $i (subtract $.CurrentPage 2)) (le $i (add $.CurrentPage 2))) }}
<a href="?page={{ $i }}" class="btn btn-sm {{ if eq $i $.CurrentPage }}btn-primary{{ else }}btn-slate{{ end }}">{{ $i }}</a>
{{ else if and (eq $i 2) (gt (subtract $.CurrentPage 3) 1) }}
<span class="text-slate-400 px-2">...</span>
{{ else if and (eq $i (subtract $.TotalPages 1)) (lt (add $.CurrentPage 3) $.TotalPages) }}
<span class="text-slate-400 px-2">...</span>
{{ end }}
{{ end }}
<a href="?page={{ if eq .CurrentPage .TotalPages }}{{ .TotalPages }}{{ else }}{{ add .CurrentPage 1 }}{{ end }}" class="btn btn-sm btn-slate {{ if eq .CurrentPage .TotalPages }}opacity-50 cursor-not-allowed{{ end }}" {{ if eq .CurrentPage .TotalPages }}onclick="return false"{{ end }}>
<i class="fas fa-chevron-right"></i>
</a>
<a href="?page={{ .TotalPages }}" class="btn btn-sm btn-slate {{ if eq .CurrentPage .TotalPages }}opacity-50 cursor-not-allowed{{ end }}" {{ if eq .CurrentPage .TotalPages }}onclick="return false"{{ end }}>
<i class="fas fa-chevron-right"></i>
<i class="fas fa-chevron-right"></i>
</a>
</div>
</div>
{{ end }}
<div class="mt-6 bg-slate-50 rounded-xl p-5">
<h4 class="font-medium text-slate-700 mb-4 flex items-center gap-2">
<i class="fas fa-chart-line text-purple-500"></i> 功能说明
</h4>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
<div class="bg-white p-4 rounded-lg border border-slate-200">
<div class="flex items-center gap-3 mb-2">
<div class="w-8 h-8 rounded-full bg-blue-100 flex items-center justify-center">
<i class="fas fa-robot text-blue-600"></i>
</div>
<span class="font-medium text-slate-700">AI生成题目</span>
</div>
<p class="text-sm text-slate-500">基于简历内容或关键词智能生成面试题目,支持多种难度级别</p>
</div>
<div class="bg-white p-4 rounded-lg border border-slate-200">
<div class="flex items-center gap-3 mb-2">
<div class="w-8 h-8 rounded-full bg-yellow-100 flex items-center justify-center">
<i class="fas fa-star text-yellow-600"></i>
</div>
<span class="font-medium text-slate-700">收藏题目</span>
</div>
<p class="text-sm text-slate-500">收藏重要题目,方便复习回顾,支持快速筛选查看</p>
</div>
<div class="bg-white p-4 rounded-lg border border-slate-200">
<div class="flex items-center gap-3 mb-2">
<div class="w-8 h-8 rounded-full bg-red-100 flex items-center justify-center">
<i class="fas fa-times-circle text-red-600"></i>
</div>
<span class="font-medium text-slate-700">错题本</span>
</div>
<p class="text-sm text-slate-500">自动记录答错的题目,支持针对性练习和错题回顾</p>
</div>
<div class="bg-white p-4 rounded-lg border border-slate-200">
<div class="flex items-center gap-3 mb-2">
<div class="w-8 h-8 rounded-full bg-green-100 flex items-center justify-center">
<i class="fas fa-chart-bar text-green-600"></i>
</div>
<span class="font-medium text-slate-700">数据统计</span>
</div>
<p class="text-sm text-slate-500">查看答题记录、正确率、得分趋势等学习数据</p>
</div>
</div>
</div>
</div>
</div>