| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 |
- <x-filament-panels::page>
- <div class="space-y-6">
- <!-- 页面标题 -->
- <div class="flex justify-between items-center">
- <div>
- <h2 class="text-2xl font-bold text-gray-900">卷子历史记录</h2>
- <p class="mt-1 text-sm text-gray-500">
- 查看所有历史生成的试卷,支持导出、复制和删除操作
- </p>
- </div>
- </div>
- <!-- 筛选器 - 使用 DaisyUI -->
- <div class="card bg-base-100 shadow-xl">
- <div class="card-body">
- <div class="grid grid-cols-1 md:grid-cols-4 gap-4">
- <input
- type="text"
- wire:model.live="search"
- placeholder="搜索试卷名称..."
- class="input input-bordered input-primary w-full"
- />
- <select wire:model.live="statusFilter" class="select select-bordered select-primary w-full">
- <option value="">-- 全部状态 --</option>
- <option value="draft">草稿</option>
- <option value="completed">已完成</option>
- <option value="graded">已评分</option>
- </select>
- <select wire:model.live="difficultyFilter" class="select select-bordered select-primary w-full">
- <option value="">-- 全部难度 --</option>
- <option value="基础">基础</option>
- <option value="进阶">进阶</option>
- <option value="竞赛">竞赛</option>
- </select>
- <button
- wire:click="$refresh"
- type="button"
- class="btn btn-outline btn-secondary">
- 重置
- </button>
- </div>
- </div>
- </div>
- <!-- 试卷列表 - 表格视图 -->
- <div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
- <!-- 左侧:试卷列表 -->
- <div class="lg:col-span-2">
- <div class="card bg-base-100 shadow-xl overflow-hidden">
- <div class="overflow-x-auto">
- <table class="table table-zebra w-full">
- <thead>
- <tr>
- <th>试卷名称</th>
- <th>状态</th>
- <th>难度</th>
- <th>题目/总分</th>
- <th>创建时间</th>
- <th>操作</th>
- </tr>
- </thead>
- <tbody>
- @forelse($this->exams()['data'] as $exam)
- <tr class="hover cursor-pointer {{ $selectedExamId == $exam['id'] ? 'active' : '' }}"
- wire:click="viewExamDetail('{{ $exam['id'] }}')">
- <td>
- <div class="font-bold">{{ $exam['paper_name'] }}</div>
- <div class="text-xs opacity-50">{{ $exam['id'] }}</div>
- </td>
- <td>
- <span class="badge badge-{{ $this->getStatusColor($exam['status']) }} badge-sm">
- {{ $this->getStatusLabel($exam['status']) }}
- </span>
- </td>
- <td>
- <span class="badge badge-{{ $this->getDifficultyColor($exam['difficulty_category']) }} badge-sm">
- {{ $exam['difficulty_category'] }}
- </span>
- </td>
- <td>
- <div class="text-sm">{{ $exam['question_count'] }} 题</div>
- <div class="text-xs opacity-50">{{ $exam['total_score'] }} 分</div>
- </td>
- <td class="text-sm">
- {{ \Carbon\Carbon::parse($exam['created_at'])->format('Y-m-d H:i') }}
- </td>
- <td>
- <div class="flex gap-2">
- <button
- wire:click.stop="exportPdf('{{ $exam['id'] }}')"
- class="btn btn-ghost btn-xs tooltip"
- data-tip="导出PDF">
- <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"></path></svg>
- </button>
- <button
- wire:click.stop="duplicateExam({{ json_encode($exam) }})"
- class="btn btn-ghost btn-xs tooltip"
- data-tip="复制配置">
- <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"></path></svg>
- </button>
- </div>
- </td>
- </tr>
- @empty
- <tr>
- <td colspan="6" class="text-center py-8">
- <div class="flex flex-col items-center justify-center text-gray-500">
- <svg class="w-12 h-12 mb-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path>
- </svg>
- <p>暂无试卷记录</p>
- <a href="{{ url('/admin/intelligent-exam-generation') }}" class="btn btn-primary btn-sm mt-2">
- 去出卷
- </a>
- </div>
- </td>
- </tr>
- @endforelse
- </tbody>
- </table>
- </div>
-
- <!-- 分页 -->
- <div class="p-4 border-t">
- <div class="flex justify-between items-center">
- <div class="text-sm text-gray-500">
- 共 {{ $this->meta()['total'] }} 条记录
- </div>
- <div class="join">
- <button class="join-item btn btn-sm" wire:click="$set('currentPage', {{ max(1, $this->currentPage - 1) }})" {{ $this->currentPage <= 1 ? 'disabled' : '' }}>«</button>
- <button class="join-item btn btn-sm">第 {{ $this->currentPage }} 页</button>
- <button class="join-item btn btn-sm" wire:click="$set('currentPage', {{ $this->currentPage + 1 }})" {{ $this->currentPage >= $this->meta()['total_pages'] ? 'disabled' : '' }}>»</button>
- </div>
- </div>
- </div>
- </div>
- </div>
- <!-- 右侧:试卷详情与预览 -->
- <div class="lg:col-span-1">
- @if($selectedExamId)
- <div class="card bg-base-100 shadow-xl sticky top-6">
- <div class="card-body">
- <div class="flex items-center justify-between mb-4">
- <h3 class="card-title">试卷详情</h3>
- <button
- wire:click="$set('selectedExamId', null)"
- class="btn btn-ghost btn-sm btn-circle">
- <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg>
- </button>
- </div>
- <div class="space-y-4">
- <div>
- <div class="text-sm text-gray-500">试卷名称</div>
- <div class="font-medium text-gray-900">{{ $selectedExamDetail['paper']['paper_name'] ?? '' }}</div>
- </div>
- <div class="stats stats-vertical shadow w-full">
- <div class="stat">
- <div class="stat-title">题目数量</div>
- <div class="stat-value text-primary">{{ $selectedExamDetail['paper']['question_count'] ?? 0 }}</div>
- <div class="stat-desc">题</div>
- </div>
- <div class="stat">
- <div class="stat-title">总分</div>
- <div class="stat-value text-secondary">{{ $selectedExamDetail['paper']['total_score'] ?? 0 }}</div>
- <div class="stat-desc">分</div>
- </div>
- </div>
- <div>
- <div class="text-sm text-gray-500">创建时间</div>
- <div class="font-medium text-gray-900">
- {{ \Carbon\Carbon::parse($selectedExamDetail['paper']['created_at'])->format('Y-m-d H:i') }}
- </div>
- </div>
- <div class="divider"></div>
- <div class="space-y-2">
- <a href="{{ route('filament.admin.auth.intelligent-exam.pdf', ['paper_id' => $selectedExamId]) }}"
- target="_blank"
- class="btn btn-primary w-full">
- 查看 PDF 试卷
- </a>
- <button
- wire:click="duplicateExam({{ json_encode($selectedExamDetail['paper'] ?? []) }})"
- class="btn btn-outline w-full">
- 复制试卷配置
- </button>
- </div>
- </div>
- </div>
- </div>
- @else
- <div class="card bg-base-100 shadow-xl h-64">
- <div class="card-body items-center justify-center text-center text-gray-400">
- <svg class="w-16 h-16 mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path>
- </svg>
- <p>点击左侧列表查看试卷详情及预览</p>
- </div>
- </div>
- @endif
- </div>
- </div>
- </div>
- </x-filament-panels::page>
|