|
|
|
|
@ -315,7 +315,7 @@
|
|
|
|
|
<span class="section-number">03</span>
|
|
|
|
|
<div class="section-info">
|
|
|
|
|
<h4>资料与步骤</h4>
|
|
|
|
|
<p>上传案例资料、案例数据、实训指导手册与AI排错指导手册,配置实训步骤</p>
|
|
|
|
|
<p>上传案例资料、案例数据、实训指导手册、AI辅助指导手册与参考答案,配置实训步骤</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-for="slot in materialSlots" :key="slot.key" class="material-row">
|
|
|
|
|
@ -331,7 +331,7 @@
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="material-ops">
|
|
|
|
|
<el-upload v-if="!isReadonly" action="#" :auto-upload="false" :show-file-list="false" :on-change="(file) => handleMaterialChange(slot.key, file)">
|
|
|
|
|
<el-upload v-if="!isReadonly" action="#" :auto-upload="false" :show-file-list="false" :accept="slot.accept" :on-change="(file) => handleMaterialChange(slot.key, file)">
|
|
|
|
|
<el-button type="primary" :loading="uploadingField === slot.key" class="upload-btn">
|
|
|
|
|
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
|
|
|
<path d="M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4" />
|
|
|
|
|
@ -418,12 +418,13 @@ const saving = ref(false);
|
|
|
|
|
const uploadingField = ref("");
|
|
|
|
|
const choiceEditorVisible = ref(false);
|
|
|
|
|
const bankPickerVisible = ref(false);
|
|
|
|
|
// 四类资料槽位:key 对应 taskForm 的 `${key}Name` / `${key}Url` 字段
|
|
|
|
|
// 五类资料槽位:key 对应 taskForm 的 `${key}Name` / `${key}Url` 字段。
|
|
|
|
|
const materialSlots = [
|
|
|
|
|
{ key: "material", label: "案例资料" },
|
|
|
|
|
{ key: "trainingData", label: "案例数据" },
|
|
|
|
|
{ key: "guideManual", label: "实训指导手册" },
|
|
|
|
|
{ key: "aiManual", label: "AI辅助指导手册" },
|
|
|
|
|
{ key: "referenceAnswer", label: "参考答案", accept: ".doc,.docx,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document" },
|
|
|
|
|
];
|
|
|
|
|
const tasks = ref([]);
|
|
|
|
|
const dialogVisible = ref(false);
|
|
|
|
|
@ -519,6 +520,8 @@ function createEmptyTask() {
|
|
|
|
|
guideManualUrl: "",
|
|
|
|
|
aiManualName: "",
|
|
|
|
|
aiManualUrl: "",
|
|
|
|
|
referenceAnswerName: "",
|
|
|
|
|
referenceAnswerUrl: "",
|
|
|
|
|
stepOneQuestions: [],
|
|
|
|
|
steps: createBuiltinSteps(),
|
|
|
|
|
sort: 0,
|
|
|
|
|
@ -554,6 +557,7 @@ function normalizeTask(task) {
|
|
|
|
|
const trainingData = normalizeMaterial(task.trainingDataName, task.trainingDataUrl);
|
|
|
|
|
const guideManual = normalizeMaterial(task.guideManualName, task.guideManualUrl);
|
|
|
|
|
const aiManual = normalizeMaterial(task.aiManualName, task.aiManualUrl);
|
|
|
|
|
const referenceAnswer = normalizeMaterial(task.referenceAnswerName, task.referenceAnswerUrl);
|
|
|
|
|
return {
|
|
|
|
|
id: task.id,
|
|
|
|
|
taskKey: task.taskKey,
|
|
|
|
|
@ -570,6 +574,8 @@ function normalizeTask(task) {
|
|
|
|
|
guideManualUrl: guideManual.url,
|
|
|
|
|
aiManualName: aiManual.name,
|
|
|
|
|
aiManualUrl: aiManual.url,
|
|
|
|
|
referenceAnswerName: referenceAnswer.name,
|
|
|
|
|
referenceAnswerUrl: referenceAnswer.url,
|
|
|
|
|
stepOneQuestions: parseStepOneChoiceQuestions(task.stepOneQuestions),
|
|
|
|
|
steps: normalizeSteps(parseArray(task.steps, createBuiltinSteps())),
|
|
|
|
|
sort: task.sort || 0,
|
|
|
|
|
@ -678,6 +684,10 @@ async function handleImportChange(file) {
|
|
|
|
|
async function handleMaterialChange(slotKey, file) {
|
|
|
|
|
const rawFile = file?.raw;
|
|
|
|
|
if (!rawFile) return;
|
|
|
|
|
if (slotKey === "referenceAnswer" && !isWordFile(rawFile)) {
|
|
|
|
|
proxy?.$modal?.msgError?.("参考答案仅支持 Word 文件(.doc 或 .docx)");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const data = new FormData();
|
|
|
|
|
data.append("file", rawFile);
|
|
|
|
|
uploadingField.value = slotKey;
|
|
|
|
|
@ -693,6 +703,11 @@ async function handleMaterialChange(slotKey, file) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function isWordFile(file) {
|
|
|
|
|
const name = String(file?.name || "").trim().toLowerCase();
|
|
|
|
|
return name.endsWith(".doc") || name.endsWith(".docx");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function clearMaterial(slotKey) {
|
|
|
|
|
taskForm[`${slotKey}Name`] = "";
|
|
|
|
|
taskForm[`${slotKey}Url`] = "";
|
|
|
|
|
@ -743,6 +758,8 @@ function buildPayload() {
|
|
|
|
|
guideManualUrl: taskForm.guideManualUrl,
|
|
|
|
|
aiManualName: taskForm.aiManualName,
|
|
|
|
|
aiManualUrl: taskForm.aiManualUrl,
|
|
|
|
|
referenceAnswerName: taskForm.referenceAnswerName,
|
|
|
|
|
referenceAnswerUrl: taskForm.referenceAnswerUrl,
|
|
|
|
|
stepOneQuestions: JSON.stringify(taskForm.stepOneQuestions || []),
|
|
|
|
|
sort: taskForm.sort,
|
|
|
|
|
enabled: taskForm.enabled,
|
|
|
|
|
|