fix(training-pdf-import): 修复培训试题PDF导入判断题解析

This commit is contained in:
runny committed 2026-07-06 01:39:08 +08:00
1 parent 3a22df736e
commit 91758ef2b4
19 files changed
+1767 -12

No files matched your search

@@ -1,4 +1,4 @@
<script setup lang="ts">
<script setup lang="ts">
import { ref, onMounted, computed } from 'vue';
import { useI18n } from 'vue-i18n';
import { Plus, Trash2, Edit2, Play, FileText, Image as ImageIcon } from 'lucide-vue-next';
@@ -19,6 +19,7 @@ const form = ref({
file_name: '',
file_path: '',
file_type: 'pdf',
guide_usage: 'general',
file_size: 0,
remark: '',
sort_order: 0,
@@ -68,6 +69,7 @@ const openCreateModal = () => {
file_name: '',
file_path: '',
file_type: 'pdf',
guide_usage: 'general',
file_size: 0,
remark: '',
sort_order: 0,
@@ -84,6 +86,7 @@ const openEditModal = (guide: any) => {
file_name: guide.file_name,
file_path: guide.file_path,
file_type: guide.file_type,
guide_usage: guide.guide_usage || 'general',
file_size: guide.file_size,
remark: guide.remark,
sort_order: guide.sort_order,
@@ -105,6 +108,12 @@ const handleFileUpload = async (event: Event) => {
form.value.file_path = res.file_path;
form.value.file_type = res.file_type;
form.value.file_size = res.file_size;
if (form.value.guide_usage === 'training_video' && res.file_type !== 'video') {
form.value.guide_usage = 'general';
}
if (form.value.guide_usage === 'training_exam_pdf' && res.file_type !== 'pdf') {
form.value.guide_usage = 'general';
}
if (!form.value.file_name) {
form.value.file_name = res.file_name;
}
@@ -215,6 +224,7 @@ const getIcon = (type: string) => {
<tr>
<th class="px-6 py-4">类型</th>
<th class="px-6 py-4">资料名称</th>
<th class="px-6 py-4">{{ t('admin.platformApps.guideUsage') }}</th>
<th class="px-6 py-4">Agent应用</th>
<th class="px-6 py-4">文件大小</th>
<th class="px-6 py-4">排序</th>
@@ -231,6 +241,11 @@ const getIcon = (type: string) => {
<div class="font-medium text-default">{{ guide.file_name }}</div>
<div class="text-xs text-muted mt-1 truncate max-w-[200px]">{{ guide.remark }}</div>
</td>
<td class="px-6 py-4 text-muted">
<span v-if="guide.guide_usage === 'training_video'">{{ t('admin.platformApps.trainingVideo') }}</span>
<span v-else-if="guide.guide_usage === 'training_exam_pdf'">{{ t('admin.platformApps.trainingExamPdf') }}</span>
<span v-else>{{ t('admin.platformApps.generalGuide') }}</span>
</td>
<td class="px-6 py-4">
<span class="inline-flex items-center px-2 py-1 rounded-md text-xs font-medium bg-brand-50 text-brand-700 border border-brand-100">
{{ currentAgentName }}
@@ -296,6 +311,15 @@ const getIcon = (type: string) => {
</div>
<div class="grid grid-cols-2 gap-4">
<div class="space-y-2">
<label class="text-sm font-medium text-default">{{ t('admin.platformApps.guideUsage') }}</label>
<select v-model="form.guide_usage" class="input-field w-full">
<option value="general">{{ t('admin.platformApps.generalGuide') }}</option>
<option value="training_video" :disabled="form.file_type !== 'video'">{{ t('admin.platformApps.trainingVideo') }}</option>
<option value="training_exam_pdf" :disabled="form.file_type !== 'pdf'">{{ t('admin.platformApps.trainingExamPdf') }}</option>
</select>
<p class="text-xs text-muted">{{ t('admin.platformApps.guideUsageHint') }}</p>
</div>
<div class="space-y-2">
<label class="text-sm font-medium text-default">排序权重</label>
<input v-model.number="form.sort_order" type="number" class="input-field w-full" />