统一学生端实训步骤操作

bugfix/ai-assessment-evidence-rescore
陈沅 3 months ago
parent 98efac1f09
commit 4ea4f28402

@ -17,7 +17,6 @@
<section class="section-block"><div class="section-heading"><span>一</span><div><h3>计算各节点转化率</h3><p>根据案例数据计算各个渠道链路节点转化率,参考方法及工具如下:</p></div></div><div class="table-wrap"><table class="funnel-table"><thead><tr><th>链路节点</th><th>天猫</th><th>京东</th><th>抖音</th><th>拼多多</th><th>行业均值</th></tr></thead><tbody><tr v-for="row in conversionRates" :key="row.linkNode"><th>{{ row.linkNode }}</th><td v-for="field in rateFields" :key="field"><el-input-number v-model="row[field]" :min="0" :max="100" :precision="2" :controls="false" :placeholder="row.linkNode === '曝光-点击' && field === 'tmall' ? '示例:11.5%' : '请输入'" /><span class="unit">%</span></td></tr></tbody></table></div></section>
<section class="section-block visual-section"><div class="section-heading"><span>二</span><div><h3>全链路转化漏斗可视化</h3><p>根据节点转化率计算结果,绘制各渠道转化率与行业均值的转化漏斗对比图,可视化呈现多环节情况,参考方法及工具如下:</p></div></div><div class="diagnosis-materials" aria-label="第 2 步参考资料"><div class="diagnosis-materials__item"><strong>1.使用Excel绘图功能,自主完成转化漏斗对比图,可参考《实训操作说明》。</strong><div class="diagnosis-materials__actions"><button type="button" class="secondary-button" @click="downloadFunnelGuide">下载实训操作说明</button></div></div><div class="diagnosis-materials__item"><strong>2.下载Excel模版,填写关键信息,自动计算各环节转化率并生成转化漏斗对比图。</strong><div class="diagnosis-materials__actions"><button type="button" class="secondary-button" @click="downloadFunnelTemplate">下载Excel模板</button></div></div><p class="diagnosis-materials__ai">3.导出数据表上传到通用AI大模型,通过AI大模型辅助完成,参考步骤及提示词如下:请根据表格数据绘制漏斗图,并与行业均值漏斗图进行对比。</p></div><input ref="chartInput" class="visually-hidden" type="file" accept="image/png,image/jpeg,image/webp" @change="handleChartUpload" /><div class="chart-upload-area"><template v-if="funnelChart.url"><div class="chart-preview"><el-image :src="funnelChart.url" :preview-src-list="[funnelChart.url]" fit="cover" preview-teleported /><div><strong>{{ funnelChart.name || '节点转化漏斗对比图' }}</strong><span>点击缩略图可放大预览</span><button type="button" @click="clearChart">移除图片</button></div></div><button type="button" class="secondary-button" :disabled="uploading" @click="chartInput?.click()">{{ uploading ? '上传中…' : '更换对比图' }}</button></template><template v-else><button type="button" class="upload-button" :disabled="uploading" @click="chartInput?.click()">{{ uploading ? '上传中…' : '上传节点转化漏斗对比图' }}</button><p>支持 PNG、JPG、WEBP 格式,图片不超过 5MB;上传后可点击预览。</p></template></div></section>
<section class="section-block diagnosis-section"><div class="section-heading"><span>三</span><div><h3>定位异常节点</h3><p>对比案例行业均值数据,定位异常节点。</p></div></div><div class="table-toolbar"><span>对比案例行业均值数据,定位异常节点。</span><div><button type="button" class="table-button" :disabled="anomalyRows.length >= 5" @click="addAnomalyRow">增加一行</button><button type="button" class="table-button ghost" :disabled="anomalyRows.length <= 1" @click="removeAnomalyRow">删除一行</button></div></div><div class="table-wrap"><table class="diagnosis-table"><thead><tr><th>渠道</th><th>链路节点</th><th>店铺转化率</th><th>行业均值转化率</th><th>异常分析与判定</th></tr></thead><tbody><tr v-for="(row, index) in anomalyRows" :key="index"><td><el-select v-model="row.channel" placeholder="请选择"><el-option v-for="channel in channels" :key="channel.key" :label="channel.label" :value="channel.label" /></el-select></td><td><el-select v-model="row.linkNode" placeholder="请选择"><el-option v-for="node in nodes" :key="node" :label="node" :value="node" /></el-select></td><td><el-input-number v-model="row.storeConversionRate" :min="0" :max="100" :precision="2" :controls="false" placeholder="请输入" /><span class="unit">%</span></td><td><el-input-number v-model="row.industryAverageConversionRate" :min="0" :max="100" :precision="2" :controls="false" placeholder="请输入" /><span class="unit">%</span></td><td><el-input v-model="row.anomalyAnalysis" type="textarea" :rows="2" maxlength="300" show-word-limit placeholder="请填写异常原因或正常判定" /></td></tr></tbody></table></div><p class="diagnosis-step-one-notice">说明:这个表格默认展示一行可填写,最少一行,可以增加行,最多5行,这里填写的渠道需要来源于第一个表的渠道。</p></section>
<div class="actions"><button type="button" class="secondary-button" :disabled="saving" @click="saveStepOneDraft">保存草稿</button><button type="button" class="submit-button" :disabled="saving || uploading" @click="validateStepOne">{{ saving ? '校验中…' : '校验并进入第 2 步' }}</button></div>
</template>
<template v-else-if="currentStep === 2">
@ -25,7 +24,6 @@
<section class="section-block"><div class="section-heading"><span>一</span><div><h3>词云分析</h3><p>导入数据,生成词云,基于案例评论数据自动生成高频问题词云。</p></div></div><input ref="commentInput" class="visually-hidden" type="file" accept=".csv,.txt,.xls,.xlsx,text/csv,text/plain,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" @change="handleCommentImport" /><div class="comment-import"><button type="button" class="upload-button" :disabled="analyzing" @click="commentInput?.click()">{{ analyzing ? '正在生成词云…' : '导入评论数据生成词云' }}</button><p>支持 CSV、TXT、XLS、XLSX,文件不超过 5MB。</p><div v-if="commentPreview.fileName" class="data-preview"><div><strong>{{ commentPreview.fileName }}</strong><span>已解析 {{ commentPreview.totalComments }} 条评论 · 数据预览</span></div><ul><li v-for="(comment, index) in commentPreview.comments" :key="index">{{ comment }}</li></ul></div></div><div v-if="wordCloud.length" class="word-cloud-card"><div class="word-cloud-title"><span>高频问题词云</span><small>基于导入评论自动生成</small></div><div ref="wordCloudRef" class="word-cloud" aria-label="评论高频问题词云"></div></div><div class="top-issues"><p>请根据词云图填写词云中出现频次最高的TOP3问题。</p><div><label v-for="(_, index) in topIssues" :key="index">TOP{{ index + 1 }}:<el-input v-model="topIssues[index]" :placeholder="`填写第 ${index + 1} 个高频问题`" /></label></div></div></section>
<section class="section-block"><div class="section-heading"><span>二</span><div><h3>情感倾向分析</h3></div></div><div class="sentiment-actions"><span>请点击情感倾向分析按钮,系统自动判断各情感类型评论数量,请计算各情感类型占比,正面评论占比=正面评论数量/总评论数量,以此类推,计算结果用百分数表示,保留两位小数。</span><button type="button" class="upload-button" :disabled="!analysisResult" @click="runSentimentAnalysis">情感倾向分析</button></div><div class="table-wrap"><table class="sentiment-table"><thead><tr><th>情感类型</th><th>评论数量(条)</th><th>占比</th></tr></thead><tbody><tr v-for="row in sentiments" :key="row.type"><th>{{ row.type }}</th><td><span class="auto-count">{{ row.count ?? '—' }}</span></td><td><el-input-number v-model="row.percentage" :min="0" :max="100" :precision="2" :controls="false" :disabled="row.count === null" placeholder="请输入" /><span class="unit">%</span></td></tr></tbody></table></div></section>
<section class="section-block root-cause"><p>请结合词云TOP3与情感分析结果,说明本案例的核心问题根本原因;说明高频问题与情感数据是如何验证步骤一漏斗异常结论的</p><el-input v-model="rootCauseAnalysis" type="textarea" :rows="6" maxlength="1000" show-word-limit placeholder="请填写根因分析与对步骤一异常结论的验证说明" /></section>
<div class="actions"><button type="button" class="secondary-button" :disabled="saving" @click="saveStepTwoDraft">保存草稿</button><button type="button" class="submit-button" :disabled="saving || analyzing" @click="validateStepTwo">{{ saving ? '校验中…' : '校验并保存第 2 步' }}</button></div>
</template>
<template v-else>
@ -34,8 +32,8 @@
<section class="section-block"><div class="section-heading"><span>(2)</span><div><h3>AB测试数据填报</h3><p>请从案例资料中获取AB测试两组数据,计算后填入下表并逐项判定:</p></div></div><div class="table-wrap"><table class="ab-table"><thead><tr><th>测试指标</th><th>对照组数据</th><th>实验组数据</th><th>判定与分析</th></tr></thead><tbody><tr v-for="row in abRows" :key="row.metric"><th>{{ row.metric }}</th><td><el-input-number v-model="row.controlValue" :min="0" :max="100" :precision="2" :controls="false" placeholder="示例:56%" /><span class="unit">%</span></td><td><el-input-number v-model="row.experimentValue" :min="0" :max="100" :precision="2" :controls="false" placeholder="示例:64%" /><span class="unit">%</span></td><td><el-input v-model="row.analysis" type="textarea" :rows="2" maxlength="300" show-word-limit placeholder="示例:提升8pp,显著提升,采纳" /></td></tr></tbody></table></div></section>
<section class="section-block"><div class="section-heading"><span>(3)</span><div><h3>可视化呈现</h3><p>绘制AB测试结果对比图,参考方法及工具如下:</p></div></div><input ref="abChartInput" class="visually-hidden" type="file" accept="image/png,image/jpeg,image/webp" @change="handleAbChartUpload" /><div class="chart-upload-area"><template v-if="abChart.url"><div class="chart-preview"><el-image :src="abChart.url" :preview-src-list="[abChart.url]" fit="cover" preview-teleported /><div><strong>{{ abChart.name || 'AB 测试结果对比图' }}</strong><span>点击缩略图可放大预览</span><button type="button" @click="clearAbChart">移除图片</button></div></div><button type="button" class="secondary-button" :disabled="uploading" @click="abChartInput?.click()">{{ uploading ? '上传中…' : '更换对比图' }}</button></template><template v-else><button type="button" class="upload-button" :disabled="uploading" @click="abChartInput?.click()">{{ uploading ? '上传中…' : '上传AB测试结果对比图' }}</button><p>支持 PNG、JPG、WEBP 格式,图片不超过 5MB;上传后可点击预览。</p></template></div><div class="ab-materials"><div><ol><li>1.使用Excel/WPS绘图功能,自主完成AB测试结果对比图,参考《实训操作说明》。</li><li>2.下载Excel模版,填写关键信息,自动计算AB测试数据,并生成测试结果对比图。</li><li>3.导出数据表上传到通用AI大模型,通过AI大模型辅助完成,参考步骤及提示词如下:请根据表格数据,进行对照组和实验组数据对比,采用组合柱状图生成可视化图形。</li></ol></div><div class="ab-materials__actions"><button type="button" class="secondary-button" @click="downloadAbGuide">下载实训操作说明</button><button type="button" class="secondary-button" @click="downloadAbTemplate">下载Excel模板</button></div></div></section>
<section class="section-block"><div class="section-heading"><span>(4)</span><div><h3>诊断结论与迭代优化建议</h3><p>结合全链路数据漏斗诊断、售后评论分析法及AB测试对照诊断,分析产品存在的问题,并提出具体的迭代优化建议。</p></div></div><el-input v-model="iterationRecommendation" type="textarea" :rows="6" maxlength="1200" show-word-limit placeholder="请填写产品问题诊断结论及具体迭代优化建议" /></section>
<div class="actions"><button type="button" class="secondary-button" :disabled="saving" @click="saveStepThreeDraft">保存草稿</button><button type="button" class="submit-button" :disabled="saving || uploading" @click="validateStepThree">{{ saving ? '校验中…' : '校验并保存第 3 步' }}</button></div>
</template>
<div class="actions step-navigation"><button v-if="currentStep > 1" type="button" class="secondary-button" :disabled="saving" @click="currentStep -= 1">上一步</button><button type="button" class="submit-button" :disabled="saving || uploading || analyzing" @click="saveCurrentProgress">保存当前进度</button><button v-if="currentStep < 3" type="button" class="submit-button" :disabled="saving || uploading || analyzing" @click="nextStep">下一步</button></div>
</section>
</main>
<TrainingAiSidebar :study-tip="currentStep === 1 ? '先从案例资料提取各渠道漏斗数据,计算转化率并与行业均值逐层对比。' : currentStep === 2 ? '先导入案例评论数据生成词云,再点击情感倾向分析,并用高频问题与情感占比解释漏斗异常。' : '基于前两步结论设计随机分流的 AB 测试,用五项指标的组间差异验证改进方案。'" :progress-items="progressItems" />
@ -80,10 +78,19 @@ async function saveStepOneDraft() { await persistStepOne(false); } async functio
async function handleCommentImport(event) { const file = event.target?.files?.[0]; if (!file) return; if (!/\.(csv|txt|xls|xlsx)$/i.test(file.name) || file.size > 5 * 1024 * 1024) { proxy?.$modal?.msgError?.("请上传不超过 5MB 的 CSV、TXT、XLS 或 XLSX 评论文件"); event.target.value = ""; return; } analyzing.value = true; try { const result = (await analyzeProductDiagnosisIterationStepTwo(file))?.data; if (!result) throw new Error("未获得评论分析结果"); analysisResult.value = result; commentPreview.value = { fileName: result.sourceFileName || file.name, totalComments: result.totalComments || 0, comments: result.previewComments || [] }; wordCloud.value = result.wordCloud || []; topIssues.value = [0, 1, 2].map((index) => result.topIssues?.[index] || ""); sentiments.value = createSentiments(); await nextTick(); renderWordCloud(); proxy?.$modal?.msgSuccess?.("评论数据已导入,词云已生成"); } catch (error) { proxy?.$modal?.msgError?.(error?.message || "评论数据分析失败,请检查文件格式"); } finally { analyzing.value = false; event.target.value = ""; } }
function renderWordCloud() { if (!wordCloudRef.value || !wordCloud.value.length) return; wordCloudChart?.dispose(); wordCloudChart = echarts.init(wordCloudRef.value); wordCloudChart.setOption({ backgroundColor: "transparent", tooltip: { show: true }, series: [{ type: "wordCloud", shape: "circle", gridSize: 5, sizeRange: [16, 58], rotationRange: [-35, 35], textStyle: { color: () => ["#53e2ff", "#6ae1bb", "#ffd06a", "#91b8ff", "#ff9e88"][Math.floor(Math.random() * 5)] }, data: wordCloud.value }] }); }
function runSentimentAnalysis() { if (!analysisResult.value) return; sentiments.value = [{ type: "正面", count: analysisResult.value.positiveCount, percentage: null }, { type: "中性", count: analysisResult.value.neutralCount, percentage: null }, { type: "负面", count: analysisResult.value.negativeCount, percentage: null }]; proxy?.$modal?.msgSuccess?.("评论数量已自动填充,请计算并填写各类情感占比"); }
async function saveStepTwoDraft() { if (saving.value) return; saving.value = true; try { await saveStudentTrainingAnswer(TASK_KEY, { step2Answer: JSON.stringify(buildStepTwo()), currentStep: 2, submitted: false, saveAction: "SAVE" }); proxy?.$modal?.msgSuccess?.("草稿已保存"); } catch (error) { proxy?.$modal?.msgError?.(error?.message || "保存失败,请重试"); } finally { saving.value = false; } } async function validateStepTwo() { if (saving.value) return; saving.value = true; try { const data = buildStepTwo(); await validateProductDiagnosisIterationStepTwo(data); await saveStudentTrainingAnswer(TASK_KEY, { step2Answer: JSON.stringify(data), currentStep: 2, submitted: false, saveAction: "SAVE" }); proxy?.$modal?.msgSuccess?.("第 2 步校验通过,已保存"); } catch (error) { proxy?.$modal?.msgError?.(error?.message || "请检查词云、情感占比和根因分析"); } finally { saving.value = false; } }
async function saveStepTwoDraft() { if (saving.value) return false; saving.value = true; try { await saveStudentTrainingAnswer(TASK_KEY, { step2Answer: JSON.stringify(buildStepTwo()), currentStep: 2, submitted: false, saveAction: "SAVE" }); proxy?.$modal?.msgSuccess?.("当前步骤已保存"); return true; } catch (error) { proxy?.$modal?.msgError?.(error?.message || "保存失败,请重试"); return false; } finally { saving.value = false; } } async function validateStepTwo() { if (saving.value) return false; saving.value = true; try { const data = buildStepTwo(); await validateProductDiagnosisIterationStepTwo(data); await saveStudentTrainingAnswer(TASK_KEY, { step2Answer: JSON.stringify(data), currentStep: 2, submitted: false, saveAction: "SAVE" }); proxy?.$modal?.msgSuccess?.("第 2 步校验通过,已保存"); return true; } catch (error) { proxy?.$modal?.msgError?.(error?.message || "请检查词云、情感占比和根因分析"); return false; } finally { saving.value = false; } }
function clearAbChart() { if (abChart.value.url.startsWith("blob:")) URL.revokeObjectURL(abChart.value.url); abChart.value = { url: "", name: "" }; }
async function handleAbChartUpload(event) { const file = event.target?.files?.[0]; if (!file) return; const accepted = ["image/jpeg", "image/png", "image/webp"]; if (!accepted.includes(file.type) || file.size > 5 * 1024 * 1024) { proxy?.$modal?.msgError?.("请上传不超过 5MB 的 PNG、JPG 或 WEBP 图片"); event.target.value = ""; return; } uploading.value = true; try { let url = ""; if (isStudentDemo()) url = URL.createObjectURL(file); else { const data = new FormData(); data.append("file", file); const response = await uploadStudentTrainingFile(data); url = response?.url || response?.data?.url || ""; } if (!url) throw new Error("上传成功但未返回图片地址"); clearAbChart(); abChart.value = { url, name: file.name }; proxy?.$modal?.msgSuccess?.("AB 测试结果对比图上传成功,可点击图片预览"); } catch (error) { proxy?.$modal?.msgError?.(error?.message || "图片上传失败,请重试"); } finally { uploading.value = false; event.target.value = ""; } }
async function saveStepThreeDraft() { if (saving.value) return; saving.value = true; try { await saveStudentTrainingAnswer(TASK_KEY, { step3Answer: JSON.stringify(buildStepThree()), currentStep: 3, submitted: false, saveAction: "SAVE" }); proxy?.$modal?.msgSuccess?.("草稿已保存"); } catch (error) { proxy?.$modal?.msgError?.(error?.message || "保存失败,请重试"); } finally { saving.value = false; } }
async function saveCurrentProgress() {
if (currentStep.value === 1) return persistStepOne(true);
if (currentStep.value === 2) return saveStepTwoDraft();
return saveStepThreeDraft();
}
async function nextStep() {
if (currentStep.value === 1) return validateStepOne();
if (currentStep.value === 2 && await validateStepTwo()) currentStep.value = 3;
}
async function validateStepThree() { if (saving.value) return; saving.value = true; try { const data = buildStepThree(); await validateProductDiagnosisIterationStepThree(data); await saveStudentTrainingAnswer(TASK_KEY, { step3Answer: JSON.stringify(data), currentStep: 3, submitted: false, saveAction: "SAVE" }); proxy?.$modal?.msgSuccess?.("第 3 步校验通过,已保存"); } catch (error) { proxy?.$modal?.msgError?.(error?.message || "请检查 AB 测试方案、指标数据和对比图"); } finally { saving.value = false; } }
function restore(answer) { try { const stepOne = JSON.parse(answer?.step1Answer || "{}"); if (Array.isArray(stepOne.conversionRates) && stepOne.conversionRates.length === nodes.length) conversionRates.value = nodes.map((node) => ({ ...createConversionRates().find((row) => row.linkNode === node), ...(stepOne.conversionRates.find((row) => row?.linkNode === node) || {}) })); if (Array.isArray(stepOne.anomalyRows) && stepOne.anomalyRows.length) anomalyRows.value = stepOne.anomalyRows.slice(0, 5).map((row) => ({ ...createAnomalyRow(), ...row })); if (stepOne.funnelChartUrl) funnelChart.value = { url: stepOne.funnelChartUrl, name: stepOne.funnelChartName || "节点转化漏斗对比图" }; const stepTwo = JSON.parse(answer?.step2Answer || "{}"); if (stepTwo.sourceFileName) { commentPreview.value = { fileName: stepTwo.sourceFileName, totalComments: 0, comments: stepTwo.previewComments || [] }; wordCloud.value = stepTwo.wordCloud || []; topIssues.value = [0, 1, 2].map((index) => stepTwo.topIssues?.[index] || ""); sentiments.value = (stepTwo.sentiments || createSentiments()).map((row) => ({ ...createSentiments().find((item) => item.type === row.type), ...row })); rootCauseAnalysis.value = stepTwo.rootCauseAnalysis || ""; nextTick(renderWordCloud); } const stepThree = JSON.parse(answer?.step3Answer || "{}"); if (stepThree.testPlan || stepThree.comparisonChartUrl || stepThree.iterationRecommendation) { abTestPlan.value = stepThree.testPlan || ""; if (Array.isArray(stepThree.rows) && stepThree.rows.length === createAbRows().length) abRows.value = createAbRows().map((row) => ({ ...row, ...(stepThree.rows.find((item) => item?.metric === row.metric) || {}) })); if (stepThree.comparisonChartUrl) abChart.value = { url: stepThree.comparisonChartUrl, name: stepThree.comparisonChartName || "AB 测试结果对比图" }; iterationRecommendation.value = stepThree.iterationRecommendation || ""; } currentStep.value = [1, 2, 3].includes(Number(answer?.currentStep)) ? Number(answer.currentStep) : 1; } catch (error) {} }
onMounted(async () => { try { taskConfig.value = (await getTrainingTaskByKey(TASK_KEY))?.data || null; } catch (error) { taskConfig.value = null; } try { restore((await getStudentTrainingAnswer(TASK_KEY))?.data); } catch (error) {} }); onBeforeUnmount(() => { if (funnelChart.value.url.startsWith("blob:")) URL.revokeObjectURL(funnelChart.value.url); if (abChart.value.url.startsWith("blob:")) URL.revokeObjectURL(abChart.value.url); wordCloudChart?.dispose(); });

@ -162,16 +162,11 @@
</p>
</div>
</el-scrollbar>
<div class="taskfooter">
<el-button @click="submitTask">提交任务</el-button>
<el-button @click="resetTask">重新实训</el-button>
</div>
</div>
</template>
<script setup>
import TrainingLegacyActions from "@/views/components/TrainingLegacyActions.vue";
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
import TrainingIntro from '@/views/components/TrainingIntro.vue';
import useUserStore from "@/store/modules/user";

@ -187,19 +187,13 @@
退货率同比上升50%自动冻结商品上架‌‌
<br />
</p>
<div class="taskfooter">
<el-button @click="submitTask">提交任务</el-button>
<el-button @click="resetTask">重新实训</el-button>
</div>
</div>
<TrainingLegacyActions />
<TrainingAiSidebar />
</div>
</template>
<script setup>
import TrainingLegacyActions from "@/views/components/TrainingLegacyActions.vue";
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
import TrainingTaskToolbar from "@/views/components/TrainingTaskToolbar.vue";
import TrainingIntro from '@/views/components/TrainingIntro.vue';
@ -436,4 +430,3 @@ onMounted(() => {
</style>

@ -304,16 +304,11 @@
</p>
</div>
</el-scrollbar>
<div class="taskfooter">
<el-button @click="submitTask">提交任务</el-button>
<el-button @click="resetTask">重新实训</el-button>
</div>
</div>
</template>
<script setup>
import TrainingLegacyActions from "@/views/components/TrainingLegacyActions.vue";
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
import TrainingIntro from '@/views/components/TrainingIntro.vue';
import useUserStore from "@/store/modules/user";

@ -200,16 +200,11 @@
</p>
</div>
</el-scrollbar>
<div class="taskfooter">
<el-button @click="submitTask">提交任务</el-button>
<el-button @click="resetTask">重新实训</el-button>
</div>
</div>
</template>
<script setup>
import TrainingLegacyActions from "@/views/components/TrainingLegacyActions.vue";
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
import TrainingIntro from '@/views/components/TrainingIntro.vue';
import useUserStore from "@/store/modules/user";

@ -92,16 +92,11 @@
<el-input v-model="from.yhcs" style="width: 70%" :rows="9" type="textarea" placeholder="" />
</div>
</el-scrollbar>
<div class="taskfooter">
<el-button @click="submitTask">提交任务</el-button>
<el-button @click="resetTask">重新实训</el-button>
</div>
</div>
</template>
<script setup>
import TrainingLegacyActions from "@/views/components/TrainingLegacyActions.vue";
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
import TrainingIntro from '@/views/components/TrainingIntro.vue';
import useUserStore from "@/store/modules/user";

@ -166,19 +166,13 @@
</template>
</el-table-column>
</el-table>
<div class="taskfooter">
<el-button @click="submitTask">提交任务</el-button>
<el-button @click="resetTask">重新实训</el-button>
</div>
</div>
<TrainingLegacyActions />
<TrainingAiSidebar />
</div>
</template>
<script setup>
import TrainingLegacyActions from "@/views/components/TrainingLegacyActions.vue";
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
import TrainingIntro from '@/views/components/TrainingIntro.vue';
import popModel from "@/views/components/popModal.vue";
@ -599,4 +593,3 @@ onMounted(() => {

@ -79,9 +79,6 @@
</article>
</section>
<footer class="page-actions">
<el-button type="primary" size="large" @click="saveStepOne">保存并进入渠道评分 <el-icon><CircleCheck /></el-icon></el-button>
</footer>
</template>
<template v-else-if="currentStep === 2">
@ -112,10 +109,6 @@
</div>
</section>
<footer class="page-actions split-actions">
<el-button size="large" @click="currentStep = 1">上一步</el-button>
<el-button type="primary" size="large" @click="saveStepTwo">保存评分结果</el-button>
</footer>
</template>
<template v-else>
@ -171,11 +164,12 @@
</div>
</section>
<footer class="page-actions split-actions">
<el-button size="large" @click="currentStep = 2">上一步</el-button>
<el-button type="primary" size="large" @click="saveStepThree">保存第 3 步</el-button>
</footer>
</template>
<footer class="step-navigation">
<button v-if="currentStep > 1" type="button" class="btn-nav" @click="previousStep">上一步</button>
<button type="button" class="btn-nav btn-primary" @click="saveCurrentProgress">保存当前进度</button>
<button v-if="currentStep < 3" type="button" class="btn-nav btn-primary" @click="nextStep">下一步</button>
</footer>
</section>
</main>
@ -193,7 +187,7 @@
<script setup>
import { computed, onMounted, ref } from "vue";
import { CircleCheck, Delete, Plus } from "@element-plus/icons-vue";
import { Delete, Plus } from "@element-plus/icons-vue";
import { ElMessage } from "element-plus";
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
import TrainingTaskToolbar from "@/views/components/TrainingTaskToolbar.vue";
@ -431,20 +425,21 @@ function applyStepThree(answer) {
return true;
}
async function saveStepOne() {
async function saveStepOne(showMessage = true) {
try {
const result = (await validateSupplierEvaluationStepOne(buildStepOnePayload()))?.data || {};
if (!result?.valid) throw new Error(result?.message || "权重校验未通过");
await saveStudentTrainingAnswer({ taskKey: TASK_KEY, currentStep: 1, saveAction: "SAVE", progressStatus: "IN_PROGRESS", step1Answer: JSON.stringify({ items: result.items }) });
stepOneSaved.value = true;
currentStep.value = 2;
ElMessage.success("权重已保存,请继续完成渠道评分");
if (showMessage) ElMessage.success("当前步骤已保存");
return true;
} catch (error) {
ElMessage.error(error?.message || "保存失败,请检查权重填写");
return false;
}
}
async function saveStepTwo() {
async function saveStepTwo(showMessage = true) {
try {
syncChannelNames();
const result = (await validateSupplierEvaluationStepTwo(buildStepTwoPayload()))?.data || {};
@ -454,25 +449,42 @@ async function saveStepTwo() {
await saveStudentTrainingAnswer({ taskKey: TASK_KEY, currentStep: 2, saveAction: "SAVE", progressStatus: "IN_PROGRESS", step2Answer: JSON.stringify({ weights: result.weights, smallBatchChannels: result.smallBatchChannels, largeBatchChannels: result.largeBatchChannels }) });
stepTwoSaved.value = true;
syncChannelNames();
ElMessage.success("渠道评分已保存,可进入第 3 步形成采购建议");
if (showMessage) ElMessage.success("当前步骤已保存");
return true;
} catch (error) {
ElMessage.error(error?.message || "保存失败,请检查渠道和评分");
return false;
}
}
async function saveStepThree() {
async function saveStepThree(showMessage = true) {
try {
const result = (await validateSupplierEvaluationStepThree(buildStepThreePayload()))?.data || {};
if (!result?.valid) throw new Error(result?.message || "第 3 步校验未通过");
const step3Answer = { scenarioAnalyses: result.scenarioAnalyses, procurementRecommendation: result.procurementRecommendation, risks: result.risks };
await saveStudentTrainingAnswer({ taskKey: TASK_KEY, currentStep: 3, saveAction: "SAVE", progressStatus: "IN_PROGRESS", step3Answer: JSON.stringify(step3Answer) });
applyStepThree({ step3Answer });
ElMessage.success("采购建议与供应风险已保存");
if (showMessage) ElMessage.success("当前步骤已保存");
return true;
} catch (error) {
ElMessage.error(error?.message || "保存失败,请检查填写内容");
return false;
}
}
async function saveCurrentProgress(showMessage = true) {
if (currentStep.value === 1) return saveStepOne(showMessage);
if (currentStep.value === 2) return saveStepTwo(showMessage);
return saveStepThree(showMessage);
}
function previousStep() { if (currentStep.value > 1) currentStep.value -= 1; }
async function nextStep() {
if (currentStep.value >= 3) return;
if (await saveCurrentProgress(false)) currentStep.value += 1;
}
function openStepTwo() {
if (!stepOneSaved.value) {
ElMessage.warning("请先完成并保存第一步权重设置");
@ -560,7 +572,7 @@ onMounted(async () => {
.training-table :deep(.el-input__wrapper), .training-table :deep(.el-textarea__inner), .training-table :deep(.el-select__wrapper) { background: rgba(2, 15, 24, .7); box-shadow: 0 0 0 1px #315f75 inset; }
.training-table :deep(.el-input__inner), .training-table :deep(.el-textarea__inner), .training-table :deep(.el-select__selected-item), .training-table :deep(.el-input-number__decrease), .training-table :deep(.el-input-number__increase) { color: #e7f6fd; }
.training-table :deep(.el-textarea__inner) { min-height: 70px !important; resize: vertical; }
.page-actions { display: flex; justify-content: center; padding-top: 28px; }.split-actions { justify-content: space-between; }
.step-navigation { display:flex; justify-content:center; gap:14px; padding-top:28px; }.btn-nav { display:inline-flex; align-items:center; justify-content:center; min-height:40px; padding:0 18px; border:1px solid rgba(99,217,255,.55); border-radius:999px; color:#e9fbff; background:rgba(17,126,178,.36); font:inherit; font-size:14px; font-weight:800; cursor:pointer; }.btn-nav.btn-primary { border-color:rgba(92,224,255,.7); color:#fff; background:linear-gradient(95deg,#0b84bd,#096491); }
.page-actions :deep(.el-button--primary), .row-actions :deep(.el-button) { border-color: #18b6ec; background: #0e96ca; }
.score-section { margin-bottom: 20px; }.section-heading small { color: #93adbd; }.table-scroll { overflow-x: auto; }
.score-table { min-width: 960px; }.score-table th:first-child, .score-table td:first-child { width: 175px; }.score-table :deep(.el-input-number) { width: 100%; }.total-score { color: #6de4ff !important; font-size: 17px; font-weight: 700; }

@ -18,6 +18,7 @@ import { computed, onMounted, ref, watch } from "vue";
import { CircleCheck, Download, RefreshLeft } from "@element-plus/icons-vue";
import { ElMessage } from "element-plus";
import { getTrainingTaskByKey } from "@/api/trainingTask";
import { deleteStudentTrainingAnswer, saveStudentTrainingAnswer } from "@/api/studentTrainingAnswer";
import { resolveTrainingTaskKey } from "@/views/training/taskKeyMap";
import TrainingMaterialButton from "@/views/components/TrainingMaterialButton.vue";
@ -69,7 +70,7 @@ function triggerExistingAction(action) {
const labelPriority = {
submit: [[/提交任务/], [/完成实训/, /保存并完成/, /校验并完成/]],
reset: [[/重新实训/], [/清空填写/, /清空本步/]],
reset: [[/重新实训/]],
export: [[/导出实训成果/]],
};
const buttons = getCurrentTaskActionButtons();
@ -82,12 +83,12 @@ function triggerExistingAction(action) {
return;
}
const messages = {
submit: "请先完成全部实训步骤,再提交任务。",
reset: "当前步骤没有可重新实训的内容。",
export: "当前任务暂无可导出的实训成果。",
const fallbackActions = {
submit: saveLegacyTraining,
reset: resetLegacyTraining,
export: exportLegacyTraining,
};
ElMessage.warning(messages[action]);
fallbackActions[action]?.();
}
function getCurrentTaskActionButtons() {
@ -106,6 +107,80 @@ function isVisible(element) {
const style = window.getComputedStyle(element);
return style.display !== "none" && style.visibility !== "hidden" && element.getClientRects().length > 0;
}
function getLegacyTrainingScope() {
return document.querySelector(".student-training-shell") || document.querySelector(".training-step-area") || document.body;
}
function collectLegacyFields() {
const scope = getLegacyTrainingScope();
return Array.from(scope.querySelectorAll("input, textarea, select"))
.filter((element) => !element.closest(".training-ai-sidebar") && !element.closest(".training-task-toolbar"))
.map((element, index) => ({
tag: element.tagName.toLowerCase(),
index,
type: element.type || element.tagName.toLowerCase(),
value: element.value ?? "",
checked: Boolean(element.checked),
}));
}
async function saveLegacyTraining() {
if (!resolvedTaskKey.value) {
ElMessage.warning("当前任务暂未配置,无法提交。");
return;
}
try {
await saveStudentTrainingAnswer(resolvedTaskKey.value, {
saveAction: "SUBMIT",
currentStep: 1,
step1Answer: JSON.stringify({
type: "legacy-training-snapshot-v3",
route: route.path,
savedAt: new Date().toISOString(),
fields: collectLegacyFields(),
}),
});
ElMessage.success("提交任务成功");
} catch {
ElMessage.error("提交任务失败,请稍后重试。");
}
}
async function resetLegacyTraining() {
if (!resolvedTaskKey.value) {
ElMessage.warning("当前任务暂未配置,无法重新实训。");
return;
}
try {
await deleteStudentTrainingAnswer(resolvedTaskKey.value);
const scope = getLegacyTrainingScope();
Array.from(scope.querySelectorAll("input, textarea, select")).forEach((element) => {
if (element.closest(".training-ai-sidebar") || element.closest(".training-task-toolbar")) return;
if (element.type === "checkbox" || element.type === "radio") {
element.checked = false;
} else {
element.value = "";
}
element.dispatchEvent(new Event("input", { bubbles: true }));
element.dispatchEvent(new Event("change", { bubbles: true }));
});
ElMessage.success("已清空全部实训步骤,可以重新开始。");
} catch {
ElMessage.error("重新实训失败,请稍后重试。");
}
}
function exportLegacyTraining() {
const blob = new Blob([JSON.stringify(collectLegacyFields(), null, 2)], { type: "application/json;charset=utf-8" });
const link = document.createElement("a");
link.href = URL.createObjectURL(blob);
link.download = `${route.meta?.title || "实训"}-实训成果.json`;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
URL.revokeObjectURL(link.href);
}
</script>
<style lang="scss" scoped>

@ -68,7 +68,6 @@
<div class="table-wrap"><table><thead><tr><th>风险类型</th><th>具体风险描述</th><th>影响程度</th><th>应对措施</th></tr></thead><tbody><tr v-for="risk in form.risks" :key="risk.type"><td class="fixed-cell">{{ risk.type }}</td><td><textarea v-model.trim="risk.description" placeholder="填写具体风险" /></td><td><select v-model="risk.impact"><option value="">请选择</option><option value="高">高</option><option value="中">中</option><option value="低">低</option></select></td><td><textarea v-model.trim="risk.response" placeholder="填写应对措施" /></td></tr></tbody></table></div>
</section>
<div class="step-actions"><button class="action-button primary" type="button" :disabled="saving" @click="validateAndContinue">{{ saving ? '校验并保存中…' : '校验并进入第 2 步' }}</button><button class="action-button" type="button" :disabled="saving" @click="resetForm"><el-icon><RefreshLeft /></el-icon>清空填写</button></div>
</section>
<section v-else-if="currentStep === 2" class="step-card">
@ -86,7 +85,6 @@
<p v-else class="hint">请选择且仅选择 3 项,作为后续立项推进的优先事项。</p>
<div class="priority-grid"><label v-for="item in priorityOptions" :key="item.value" :class="['priority-option', { selected: stepTwo.priorities.includes(item.value) }]"><input v-model="stepTwo.priorities" type="checkbox" :value="item.value" :disabled="stepTwo.decision === 'not-feasible' || (!stepTwo.priorities.includes(item.value) && selectedPriorityCount >= 3)" /><span class="checkbox-mark"><el-icon v-if="stepTwo.priorities.includes(item.value)"><Check /></el-icon></span><span><strong>{{ item.label }}</strong><small>{{ item.detail }}</small></span></label></div>
</section>
<div class="step-actions"><button class="action-button primary" type="button" :disabled="saving" @click="saveStepTwo">{{ saving ? '校验并保存中…' : '保存并进入第 3 步' }}</button><button class="action-button" type="button" :disabled="saving" @click="resetStepTwo"><el-icon><RefreshLeft /></el-icon>清空填写</button></div>
</section>
<section v-else-if="currentStep === 3" class="step-card report-step">
<div class="step-heading"><div><p>Step 03</p><h2>可行性论证报告</h2></div><em>成果提交</em></div>
@ -96,9 +94,9 @@
<template v-if="!report.url"><el-icon class="upload-orbit"><Document /></el-icon><h3>上传可行性论证报告</h3><p>支持 PDF、Word、PNG、JPG,文件不超过 20MB。</p><button class="action-button primary" type="button" :disabled="uploading" @click="openReportPicker"><el-icon><UploadFilled /></el-icon>{{ uploading ? '上传中…' : '选择报告附件' }}</button></template>
<template v-else><div class="report-file-card"><div class="report-file-icon"><el-icon><Document /></el-icon></div><div class="report-file-meta"><strong>{{ report.name || '可行性论证报告' }}</strong><span>{{ reportKindLabel }} · {{ readableSize(report.size) }}</span></div><div class="report-file-actions"><button type="button" @click="openReportPreview"><el-icon><View /></el-icon>预览</button><button type="button" @click="downloadReport"><el-icon><Download /></el-icon>下载</button><button type="button" class="danger" @click="clearReport"><el-icon><Delete /></el-icon>移除</button></div></div><div class="report-replace"><button class="text-action" type="button" :disabled="uploading" @click="openReportPicker"><el-icon><UploadFilled /></el-icon>{{ uploading ? '上传中…' : '更换附件' }}</button><span>附件已上传,可随时预览或下载核对。</span></div></template>
</section>
<div class="step-actions"><button class="action-button primary" type="button" :disabled="saving || uploading" @click="saveStepThree">{{ saving ? '校验并提交中…' : '保存并提交任务' }}</button></div>
<el-dialog v-model="reportPreviewVisible" class="report-preview-dialog" :title="report.name || '可行性论证报告预览'" width="min(1100px, 94vw)" destroy-on-close append-to-body><div class="report-preview"><el-image v-if="reportKind === 'image'" :src="report.url" fit="contain" :preview-src-list="[report.url]" preview-teleported /><iframe v-else :src="reportPreviewUrl" title="可行性论证报告预览"></iframe></div><template #footer><button class="action-button" type="button" @click="downloadReport"><el-icon><Download /></el-icon>下载附件</button></template></el-dialog>
</section>
<div class="step-navigation"><button v-if="currentStep > 1" class="action-button" type="button" :disabled="saving || uploading" @click="previousStep">上一步</button><button class="action-button primary" type="button" :disabled="saving || uploading" @click="saveCurrentProgress">保存当前进度</button><button v-if="currentStep < finalStep" class="action-button primary" type="button" :disabled="saving || uploading" @click="nextStep">下一步</button></div>
</section>
</main>
<TrainingAiSidebar study-tip="先从案例资料中提炼可验证的市场、用户与成本依据,再形成一致的商业论证。" reference-title="可行性论证提示" reference-text="• 结论要有数据或前序分析支撑<br />• 价格、成本和毛利需要逻辑一致<br />• 风险应附带可执行的应对措施" :progress-items="progressItems" />
@ -106,7 +104,7 @@
</template>
<script setup>
import { Check, Delete, Document, Download, RefreshLeft, UploadFilled, View } from "@element-plus/icons-vue";
import { Check, Delete, Document, Download, UploadFilled, View } from "@element-plus/icons-vue";
import { checkBusinessFeasibilityStepOne, checkBusinessFeasibilityStepTwo, checkBusinessFeasibilityStepThree, getStudentTrainingAnswer, saveStudentTrainingAnswer, uploadStudentTrainingFile } from "@/api/studentTrainingAnswer";
import { getTrainingTaskByKey } from "@/api/trainingTask";
import { parseTrainingArray } from "@/views/training/taskKeyMap";
@ -185,6 +183,30 @@ function openReportPreview() { if (report.value.url) reportPreviewVisible.value
function downloadReport() { if (!report.value.url) return; const link = document.createElement("a"); link.href = report.value.url; link.target = "_blank"; link.rel = "noopener"; link.download = report.value.name || "可行性论证报告"; document.body.appendChild(link); link.click(); document.body.removeChild(link); }
function clearReport() { report.value = createReport(); reportPreviewVisible.value = false; stepThreeCompleted.value = false; }
async function saveStepThree() { if (saving.value) return; saving.value = true; try { await checkBusinessFeasibilityStepThree({ reportUrl: report.value.url, reportName: report.value.name }); await saveStudentTrainingAnswer(TASK_KEY, { step3Answer: JSON.stringify({ report: report.value }), currentStep: finalStep.value, submitted: true, saveAction: "SUBMIT" }); stepThreeCompleted.value = true; currentStep.value = finalStep.value; proxy?.$modal?.msgSuccess("报告已保存,任务已提交"); } catch (error) { proxy?.$modal?.msgError?.(error?.message || "请先上传可行性论证报告"); } finally { saving.value = false; } }
async function saveCurrentProgress() {
if (saving.value) return false;
saving.value = true;
try {
if (currentStep.value === 1) {
const result = await checkBusinessFeasibilityStepOne(payload());
const calculated = result?.data || {};
await saveStudentTrainingAnswer(TASK_KEY, { step1Answer: JSON.stringify({ form: form.value, calculations: { unitTotalCost: calculated.unitTotalCost ?? totalCost.value, unitGrossProfit: calculated.unitGrossProfit ?? unitGrossProfit.value, grossMargin: calculated.grossMargin ?? grossMargin.value } }), currentStep: 1, submitted: false, saveAction: "SAVE" });
completed.value = true;
} else if (currentStep.value === 2) {
await checkBusinessFeasibilityStepTwo({ ...stepTwo.value });
await saveStudentTrainingAnswer(TASK_KEY, { step2Answer: JSON.stringify({ stepTwo: stepTwo.value }), currentStep: 2, submitted: false, saveAction: "SAVE" });
stepTwoCompleted.value = true;
} else {
await checkBusinessFeasibilityStepThree({ reportUrl: report.value.url, reportName: report.value.name });
await saveStudentTrainingAnswer(TASK_KEY, { step3Answer: JSON.stringify({ report: report.value }), currentStep: finalStep.value, submitted: false, saveAction: "SAVE" });
stepThreeCompleted.value = true;
}
proxy?.$modal?.msgSuccess("当前步骤已保存");
return true;
} catch (error) { proxy?.$modal?.msgError?.(error?.message || "请完整填写当前步骤内容"); return false; } finally { saving.value = false; }
}
function previousStep() { if (currentStep.value > 1) currentStep.value -= 1; }
async function nextStep() { if (currentStep.value < finalStep.value && await saveCurrentProgress()) currentStep.value += 1; }
function switchStep(step) { const targetStep = clampStep(step); if (targetStep > 1 && !completed.value) { proxy?.$modal?.msgWarning("请先完成并保存第 1 步"); return; } if (targetStep > 2 && !stepTwoCompleted.value) { proxy?.$modal?.msgWarning("请先完成并保存第 2 步"); return; } currentStep.value = targetStep; }
function exportOutcome() { const blob = new Blob([JSON.stringify({ task: taskTitle.value, step: 1, ...payload(), calculations: { unitTotalCost: totalCost.value, unitGrossProfit: unitGrossProfit.value, grossMargin: grossMargin.value } }, null, 2)], { type: "application/json;charset=utf-8" }); const link = document.createElement("a"); link.href = URL.createObjectURL(blob); link.download = "商业可行性论证-第1步.json"; link.click(); URL.revokeObjectURL(link.href); }
</script>

File diff suppressed because one or more lines are too long

@ -112,10 +112,6 @@
</el-button>
</div>
<div class="training-actions">
<el-button class="training-action training-action--submit" :loading="saving" @click="submitTask">提交任务</el-button>
<el-button class="training-action training-action--reset" @click="resetTraining">重新实训</el-button>
</div>
</section>
</section>
</main>

@ -106,10 +106,6 @@
</el-button>
</div>
<div class="training-actions">
<el-button class="training-action training-action--submit" :loading="saving" @click="submitTask">提交任务</el-button>
<el-button class="training-action training-action--reset" @click="resetTraining">重新实训</el-button>
</div>
</section>
</section>
</main>

@ -34,7 +34,6 @@
<tbody><tr v-for="(row, index) in pestRows" :key="row.key"><td>{{ index + 1 }}</td><td class="type-cell">{{ row.label }}</td><td><textarea v-model.trim="form[row.key]" :placeholder="row.placeholder" /></td></tr></tbody>
</table>
</div>
<div class="task-actions"><button type="button" class="btn-nav btn-submit" :disabled="saving" @click="saveAndGoToStepTwo">保存并进入第 2 步</button><button type="button" class="btn-nav" :disabled="saving" @click="resetStepOne"><el-icon><RefreshLeft /></el-icon> 清空当前步骤</button></div>
</template>
<template v-else-if="currentStep === 2">
@ -53,7 +52,6 @@
<tbody><tr v-for="(row, index) in pestRows" :key="row.key"><td>{{ index + 1 }}</td><td class="type-cell">{{ row.label }}</td><td><textarea v-model.trim="supplementForm[row.key]" :disabled="!stepOnePassed" :placeholder="row.placeholder" /></td></tr></tbody>
</table>
</div>
<div class="task-actions"><button type="button" class="btn-nav btn-submit" :disabled="saving || !stepOnePassed" @click="saveAndGoToStepThree">保存并进入第 3 步</button><button type="button" class="btn-nav" :disabled="saving || !stepOnePassed" @click="resetStepTwo"><el-icon><RefreshLeft /></el-icon> 清空当前步骤</button></div>
</template>
<template v-else-if="currentStep === 3">
@ -65,7 +63,6 @@
<tbody><tr v-for="row in pestAnalysisRows" :key="row.key"><td class="type-cell">{{ row.label }}</td><td><textarea v-model.trim="analysisForm[row.key].opportunities" :disabled="!stepTwoPassed" placeholder="例如:政策、需求或技术带来的增长机会" /></td><td><textarea v-model.trim="analysisForm[row.key].challenges" :disabled="!stepTwoPassed" placeholder="例如:合规、成本、竞争或使用门槛" /></td><td><textarea v-model.trim="analysisForm[row.key].strategies" :disabled="!stepTwoPassed" placeholder="例如:针对挑战给出的产品、运营或合规方案" /></td></tr></tbody>
</table>
</div>
<div class="task-actions"><button type="button" class="btn-nav btn-submit" :disabled="saving || !stepTwoPassed" @click="saveAndGoToStepFour">保存并进入第 4 步</button><button type="button" class="btn-nav" :disabled="saving || !stepTwoPassed" @click="resetStepThree"><el-icon><RefreshLeft /></el-icon> 清空当前步骤</button></div>
</template>
<template v-else-if="currentStep === 4">
@ -78,10 +75,14 @@
<section class="conclusion-section"><h4>(3)市场进入需要关注的风险点</h4><p>请指出 2 个以上的风险点。</p><div class="risk-grid"><label>核心风险点 1:<textarea v-model.trim="conclusionForm.riskOne" :disabled="!stepThreePassed" placeholder="填写核心风险点" /></label><label>核心风险点 2:<textarea v-model.trim="conclusionForm.riskTwo" :disabled="!stepThreePassed" placeholder="填写核心风险点" /></label><label>其他风险点:<textarea v-model.trim="conclusionForm.otherRisks" :disabled="!stepThreePassed" placeholder="可补充其他风险点" /></label></div></section>
<section class="conclusion-section"><h4>(4)总结 PEST 环境评估结论</h4><textarea v-model.trim="conclusionForm.summary" :disabled="!stepThreePassed" placeholder="总结该产品的 PEST 环境评估结论" /></section>
</div>
<div class="task-actions"><button type="button" class="btn-nav btn-submit" :disabled="saving || !stepThreePassed" @click="saveCurrentStepFour">保存当前步骤</button><button type="button" class="btn-nav" :disabled="saving || !stepThreePassed" @click="resetStepFour"><el-icon><RefreshLeft /></el-icon> 清空当前步骤</button></div>
</template>
<div v-else class="step-placeholder"><p>第 {{ currentStep }} 步内容待配置</p><span>前序步骤已保存,可从上方步骤栏返回查看。</span></div>
<div class="step-navigation">
<button v-if="currentStep > 1" type="button" class="btn-nav" :disabled="saving" @click="previousStep">上一步</button>
<button type="button" class="btn-nav btn-primary" :disabled="saving" @click="saveCurrentProgress">保存当前进度</button>
<button v-if="currentStep < trainingSteps.length" type="button" class="btn-nav btn-primary" :disabled="saving" @click="nextStep">下一步</button>
</div>
</section>
</section>
</main>
@ -90,7 +91,7 @@
</template>
<script setup>
import { DataAnalysis, RefreshLeft } from "@element-plus/icons-vue";
import { DataAnalysis } from "@element-plus/icons-vue";
import { checkIndustryDemandAnalysisStepOne, checkIndustryDemandAnalysisStepTwo, checkIndustryDemandAnalysisStepThree, checkIndustryDemandAnalysisStepFour, deleteStudentTrainingAnswer, getStudentTrainingAnswer, saveStudentTrainingAnswer } from "@/api/studentTrainingAnswer";
import { getTrainingTaskByKey } from "@/api/trainingTask";
import { parseTrainingArray } from "@/views/training/taskKeyMap";
@ -178,6 +179,29 @@ async function saveAndGoToStepThree() { if (saving.value || !stepOnePassed.value
async function saveAndGoToStepFour() { if (saving.value || !stepTwoPassed.value) return; saving.value = true; try { await checkIndustryDemandAnalysisStepThree({ rows: pestAnalysisRows.map((row) => ({ dimension: row.key, ...analysisForm.value[row.key] })) }); await saveStudentTrainingAnswer(TASK_KEY, { step3Answer: JSON.stringify(buildStepThreeOutcome()), currentStep: 4, submitted: false, saveAction: "SAVE" }); stepThreePassed.value = true; clearDraft(); currentStep.value = 4; proxy?.$modal?.msgSuccess("已保存,已进入第 4 步"); } catch (error) { proxy?.$modal?.msgError?.(error?.message || "请完成每个 PEST 维度的机遇、挑战和应对思路"); } finally { saving.value = false; } }
async function submitTraining() { if (saving.value || !stepThreePassed.value) return; saving.value = true; try { await checkIndustryDemandAnalysisStepFour(conclusionForm.value); await saveStudentTrainingAnswer(TASK_KEY, { step4Answer: JSON.stringify(buildStepFourOutcome()), currentStep: 4, submitted: true, saveAction: "SUBMIT" }); clearDraft(); proxy?.$modal?.msgSuccess("任务提交成功"); } catch (error) { proxy?.$modal?.msgError?.(error?.message || "请完成 PEST 环境评估结论"); } finally { saving.value = false; } }
async function saveCurrentStepFour() { if (saving.value || !stepThreePassed.value) return; saving.value = true; try { await checkIndustryDemandAnalysisStepFour(conclusionForm.value); await saveStudentTrainingAnswer(TASK_KEY, { step4Answer: JSON.stringify(buildStepFourOutcome()), currentStep: 4, submitted: false, saveAction: "SAVE" }); clearDraft(); proxy?.$modal?.msgSuccess("第 4 步已保存"); } catch (error) { proxy?.$modal?.msgError?.(error?.message || "请完成 PEST 环境评估结论"); } finally { saving.value = false; } }
async function saveCurrentProgress(showMessage = true) {
if (saving.value) return false;
saving.value = true;
try {
const payloads = {
1: async () => { await checkIndustryDemandAnalysisStepOne(form.value); return { step1Answer: JSON.stringify(buildStepOneOutcome()), currentStep: 1 }; },
2: async () => { if (!stepOnePassed.value) throw new Error("请先完成第 1 步"); await checkIndustryDemandAnalysisStepTwo(supplementForm.value); return { step2Answer: JSON.stringify(buildStepTwoOutcome()), currentStep: 2 }; },
3: async () => { if (!stepTwoPassed.value) throw new Error("请先完成第 2 步"); await checkIndustryDemandAnalysisStepThree({ rows: pestAnalysisRows.map((row) => ({ dimension: row.key, ...analysisForm.value[row.key] })) }); return { step3Answer: JSON.stringify(buildStepThreeOutcome()), currentStep: 3 }; },
4: async () => { if (!stepThreePassed.value) throw new Error("请先完成第 3 步"); await checkIndustryDemandAnalysisStepFour(conclusionForm.value); return { step4Answer: JSON.stringify(buildStepFourOutcome()), currentStep: 4 }; },
};
const answer = await payloads[currentStep.value]?.();
if (!answer) return false;
await saveStudentTrainingAnswer(TASK_KEY, { ...answer, submitted: false, saveAction: "SAVE" });
if (currentStep.value === 1) stepOnePassed.value = true;
if (currentStep.value === 2) stepTwoPassed.value = true;
if (currentStep.value === 3) stepThreePassed.value = true;
clearDraft();
if (showMessage) proxy?.$modal?.msgSuccess("当前步骤已保存");
return true;
} catch (error) { proxy?.$modal?.msgError?.(error?.message || "请完整填写当前步骤内容"); return false; } finally { saving.value = false; }
}
function previousStep() { if (currentStep.value > 1) currentStep.value -= 1; }
async function nextStep() { if (currentStep.value < trainingSteps.value.length && await saveCurrentProgress(false)) currentStep.value += 1; }
async function resetTraining() { form.value = createForm(); supplementForm.value = createForm(); analysisForm.value = createAnalysisForm(); conclusionForm.value = createConclusionForm(); stepOnePassed.value = false; stepTwoPassed.value = false; stepThreePassed.value = false; currentStep.value = 1; clearDraft(); try { saving.value = true; await deleteStudentTrainingAnswer(TASK_KEY); } catch (error) { /* Local clearing still succeeds. */ } finally { saving.value = false; } proxy?.$modal?.msgSuccess("已重新开始本次实训"); }
function resetStepOne() { form.value = createForm(); stepOnePassed.value = false; proxy?.$modal?.msgSuccess("已清空第 1 步填写内容"); }
function resetStepTwo() { supplementForm.value = createForm(); proxy?.$modal?.msgSuccess("已清空第 2 步填写内容"); }
@ -194,4 +218,5 @@ function exportOutcome() { const blob = new Blob([JSON.stringify(buildDraft(), n
.workbench-head h2 { margin:0; color:#fff; font-size:25px; line-height:1.25; }
.industry-demand-toolbar { flex:0 0 auto; justify-content:flex-end; max-width:100%; }
@media (max-width:720px) { .workbench-head { align-items:flex-start; flex-direction:column; }.industry-demand-toolbar { width:100%; justify-content:flex-start; } }
.step-navigation { display:flex; justify-content:center; gap:14px; margin-top:22px; }.step-navigation .btn-primary { border-color:#36d9ff; color:#fff; background:linear-gradient(110deg,#0eaae4,#0572ac); font-weight:700; }
</style>

@ -44,14 +44,12 @@
<div class="training-step-area">
<component v-if="component" :is="component"></component>
</div>
<TrainingLegacyActions />
<TrainingAiSidebar />
</div>
</template>
<script setup>
import TrainingLegacyActions from "@/views/components/TrainingLegacyActions.vue";
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
import TrainingIntro from '@/views/components/TrainingIntro.vue';
import * as portraitModel from "@/api/portraitModel";
@ -146,4 +144,3 @@ onMounted(() => {

@ -227,16 +227,6 @@
</button>
</div>
<div class="task-actions">
<button type="button" class="btn-nav btn-submit" :disabled="saving || checking" @click="submitTask">
<el-icon><CircleCheck /></el-icon>
{{ checking ? "正在提交" : "提交任务" }}
</button>
<button type="button" class="btn-nav" :disabled="saving" @click="resetExample">
<el-icon><RefreshLeft /></el-icon>
清空填写
</button>
</div>
</section>
</main>

@ -83,15 +83,6 @@
</table>
</div>
<div class="task-actions">
<button type="button" class="btn-nav btn-submit" :disabled="saving" @click="saveAndGoToStepTwo">
保存并进入第 2 步
</button>
<button type="button" class="btn-nav" :disabled="saving" @click="resetStepOne">
<el-icon><RefreshLeft /></el-icon>
清空当前步骤
</button>
</div>
</template>
<template v-else-if="currentStep === 1">
@ -99,7 +90,6 @@
<div class="training-table-wrap"><table class="factor-table"><thead><tr><th class="dimension-col">维度</th><th class="criteria-col">评估项</th><th>成功产品</th><th>失败产品</th></tr></thead><tbody>
<tr v-for="row in stepTwoRows" :key="row.dimension"><td class="dimension-cell">{{ row.dimension }}</td><td class="criteria-cell">{{ row.criteria }}</td><td><textarea v-model="row.successAnalysis" class="table-textarea" placeholder="填写成功产品在该维度的分析" /></td><td><textarea v-model="row.failedAnalysis" class="table-textarea" placeholder="填写失败产品在该维度的分析" /></td></tr>
</tbody></table></div>
<div class="task-actions"><button type="button" class="btn-nav btn-submit" :disabled="saving" @click="saveAndGoToStepThree">保存并进入第 3 步</button><button type="button" class="btn-nav" :disabled="saving" @click="resetStepTwo"><el-icon><RefreshLeft /></el-icon>清空当前步骤</button></div>
</template>
<template v-else-if="currentStep === 2">
@ -107,19 +97,23 @@
<div class="training-table-wrap"><table class="factor-table"><thead><tr><th class="dimension-col">维度</th><th class="criteria-col">评估项</th><th>成功产品</th><th>失败产品</th></tr></thead><tbody>
<tr v-for="row in stepThreeRows" :key="row.dimension"><td class="dimension-cell">{{ row.dimension }}</td><td class="criteria-cell">{{ row.criteria }}</td><td><textarea v-model="row.successAnalysis" class="table-textarea" placeholder="填写成功产品在该维度的分析" /></td><td><textarea v-model="row.failedAnalysis" class="table-textarea" placeholder="填写失败产品在该维度的分析" /></td></tr>
</tbody></table></div>
<div class="task-actions"><button type="button" class="btn-nav btn-submit" :disabled="saving" @click="saveAndGoToStepFour">保存并进入第 4 步</button><button type="button" class="btn-nav" :disabled="saving" @click="resetStepThree"><el-icon><RefreshLeft /></el-icon>清空当前步骤</button></div>
</template>
<template v-else-if="currentStep === 3">
<p class="factor-intro">结合案例信息及前述步骤,分析案例资料中产品一成功的关键因素是什么,产品二失败的关键因素是什么。</p>
<label class="factor-intro">产品成功的关键因素:</label><textarea v-model="stepFourForm.successFactors" class="table-textarea summary-textarea" />
<label class="factor-intro">产品失败的关键因素:</label><textarea v-model="stepFourForm.failedFactors" class="table-textarea summary-textarea" />
<div class="task-actions"><button type="button" class="btn-nav btn-submit" :disabled="saving" @click="saveCurrentStepFour">保存当前步骤</button><button type="button" class="btn-nav" :disabled="saving" @click="resetStepFour">清空当前步骤</button></div>
</template>
<div v-else class="step-placeholder">
<p>第 {{ currentStep + 1 }} 步内容待配置</p>
<span>已保存的分析可从上方步骤栏返回查看。</span>
</div>
<div v-if="trainingSteps.length" class="step-navigation">
<button v-if="currentStep > 0" type="button" class="btn-nav" :disabled="saving" @click="previousStep">上一步</button>
<button type="button" class="btn-nav btn-save" :disabled="saving" @click="saveCurrentProgress">保存当前进度</button>
<button v-if="currentStep < trainingSteps.length - 1" type="button" class="btn-nav btn-primary" :disabled="saving" @click="nextStep">下一步</button>
</div>
</section>
</section>
</main>
@ -135,7 +129,7 @@
</template>
<script setup>
import { Operation, RefreshLeft } from "@element-plus/icons-vue";
import { Operation } from "@element-plus/icons-vue";
import { getTrainingTaskByKey } from "@/api/trainingTask";
import { parseTrainingArray } from "@/views/training/taskKeyMap";
import { checkProductDevelopmentFactorsStepOne, checkProductDevelopmentFactorsStepTwo, checkProductDevelopmentFactorsStepThree, checkProductDevelopmentFactorsStepFour, deleteStudentTrainingAnswer, getStudentTrainingAnswer, saveStudentTrainingAnswer } from "@/api/studentTrainingAnswer";
@ -388,52 +382,47 @@ function buildStepTwoAnswerPayload(saveAction = "SAVE", persistedStep = currentS
function buildStepThreeValidationPayload() { return { factors: stepThreeRows.value.map(({ dimension, successAnalysis, failedAnalysis }) => ({ dimension, successAnalysis, failedAnalysis })) }; }
function buildStepThreeAnswerPayload(saveAction = "SAVE", persistedStep = currentStep.value + 1) { return { step3Answer: JSON.stringify(buildStepThreeOutcome()), currentStep: persistedStep, submitted: false, saveAction }; }
function buildStepFourValidationPayload() { return buildStepFourOutcome(); }
function buildStepFourAnswerPayload(saveAction = "SUBMIT", persistedStep = 4) { return { step4Answer: JSON.stringify(buildStepFourOutcome()), currentStep: persistedStep, submitted: true, saveAction }; }
function buildStepFourAnswerPayload(saveAction = "SUBMIT", persistedStep = 4) { return { step4Answer: JSON.stringify(buildStepFourOutcome()), currentStep: persistedStep, submitted: saveAction === "SUBMIT", saveAction }; }
async function saveAndGoToStepTwo() {
async function saveStepOne(showMessage = true) {
if (saving.value) return;
saving.value = true;
try {
await checkProductDevelopmentFactorsStepOne(buildStepOneValidationPayload());
await saveStudentTrainingAnswer(TASK_KEY, buildStepOneAnswerPayload("SAVE", 2));
await saveStudentTrainingAnswer(TASK_KEY, buildStepOneAnswerPayload("SAVE", 1));
clearDraft();
if (trainingSteps.value.length < 2) {
proxy?.$modal?.msgSuccess("已保存,当前任务尚未配置第 2 步");
return;
}
currentStep.value = 1;
proxy?.$modal?.msgSuccess("已保存,已进入第 2 步");
if (showMessage) proxy?.$modal?.msgSuccess("第 1 步已保存");
return true;
} catch (error) {
proxy?.$modal?.msgError?.(error?.message || "请完成三项成功产品和失败产品分析");
return false;
} finally {
saving.value = false;
}
}
async function saveAndGoToStepThree() {
async function saveStepTwo(showMessage = true) {
if (saving.value) return;
saving.value = true;
try {
await checkProductDevelopmentFactorsStepTwo(buildStepTwoValidationPayload());
await saveStudentTrainingAnswer(TASK_KEY, buildStepTwoAnswerPayload("SAVE", 3));
await saveStudentTrainingAnswer(TASK_KEY, buildStepTwoAnswerPayload("SAVE", 2));
clearDraft();
if (trainingSteps.value.length < 3) { proxy?.$modal?.msgSuccess("已保存,当前任务尚未配置第 3 步"); return; }
currentStep.value = 2;
proxy?.$modal?.msgSuccess("已保存,已进入第 3 步");
} catch (error) { proxy?.$modal?.msgError?.(error?.message || "请完成技术应用和合规与认证分析"); } finally { saving.value = false; }
if (showMessage) proxy?.$modal?.msgSuccess("第 2 步已保存");
return true;
} catch (error) { proxy?.$modal?.msgError?.(error?.message || "请完成技术应用和合规与认证分析"); return false; } finally { saving.value = false; }
}
async function saveAndGoToStepFour() {
async function saveStepThree(showMessage = true) {
if (saving.value) return;
saving.value = true;
try {
await checkProductDevelopmentFactorsStepThree(buildStepThreeValidationPayload());
await saveStudentTrainingAnswer(TASK_KEY, buildStepThreeAnswerPayload("SAVE", 4));
await saveStudentTrainingAnswer(TASK_KEY, buildStepThreeAnswerPayload("SAVE", 3));
clearDraft();
if (trainingSteps.value.length < 4) { proxy?.$modal?.msgSuccess("已保存,当前任务尚未配置第 4 步"); return; }
currentStep.value = 3;
proxy?.$modal?.msgSuccess("已保存,已进入第 4 步");
} catch (error) { proxy?.$modal?.msgError?.(error?.message || "请完成供应链与成本控制、商业模式和市场反馈分析"); } finally { saving.value = false; }
if (showMessage) proxy?.$modal?.msgSuccess("第 3 步已保存");
return true;
} catch (error) { proxy?.$modal?.msgError?.(error?.message || "请完成供应链与成本控制、商业模式和市场反馈分析"); return false; } finally { saving.value = false; }
}
async function submitTraining() { if (saving.value) return; saving.value = true; try { await checkProductDevelopmentFactorsStepFour(buildStepFourValidationPayload()); await saveStudentTrainingAnswer(TASK_KEY, buildStepFourAnswerPayload("SUBMIT", 4)); clearDraft(); proxy?.$modal?.msgSuccess("任务提交成功"); } catch (error) { proxy?.$modal?.msgError?.(error?.message || "请完成关键因素分析"); } finally { saving.value = false; } }
@ -475,21 +464,39 @@ function resetStepFour() {
proxy?.$modal?.msgSuccess("已清空第 4 步填写内容");
}
async function saveCurrentStepFour() {
async function saveStepFour(showMessage = true) {
if (saving.value) return;
saving.value = true;
try {
await checkProductDevelopmentFactorsStepFour(buildStepFourValidationPayload());
await saveStudentTrainingAnswer(TASK_KEY, buildStepFourAnswerPayload("SAVE", 4));
clearDraft();
proxy?.$modal?.msgSuccess("第 4 步已保存");
if (showMessage) proxy?.$modal?.msgSuccess("第 4 步已保存");
return true;
} catch (error) {
proxy?.$modal?.msgError?.(error?.message || "请完成关键因素分析");
return false;
} finally {
saving.value = false;
}
}
async function saveCurrentProgress(showMessage = true) {
const saveStep = [saveStepOne, saveStepTwo, saveStepThree, saveStepFour][currentStep.value];
return saveStep ? saveStep(showMessage) : false;
}
function previousStep() {
if (currentStep.value > 0) currentStep.value -= 1;
}
async function nextStep() {
if (currentStep.value >= trainingSteps.value.length - 1) return;
const saved = await saveCurrentProgress(false);
if (!saved) return;
currentStep.value += 1;
}
function exportOutcome() {
const outcome = buildDraft();
const blob = new Blob([JSON.stringify(outcome, null, 2)], { type: "application/json;charset=utf-8" });
@ -952,11 +959,11 @@ function exportOutcome() {
}
}
.task-actions {
.step-navigation {
display: flex;
justify-content: center;
gap: 52px;
margin-top: 36px;
gap: 14px;
margin-top: 22px;
}
.outline-action,
@ -1023,33 +1030,29 @@ function exportOutcome() {
.btn-nav {
display: inline-flex;
min-width: 172px;
min-height: 64px;
padding: 0 28px;
border: 1px solid #2c83aa;
border-radius: 6px;
color: #dff7ff;
background: rgba(13, 64, 88, 0.62);
min-height: 40px;
padding: 0 18px;
border: 1px solid rgba(99, 217, 255, 0.55);
border-radius: 999px;
color: #e9fbff;
background: rgba(17, 126, 178, 0.36);
box-shadow: none;
font-size: 24px;
font-weight: 900;
font-size: 14px;
font-weight: 800;
line-height: 1;
letter-spacing: 0;
text-shadow: none;
}
.btn-submit {
border-color: #2c83aa;
color: #dff7ff;
background: rgba(13, 64, 88, 0.62);
}
.task-actions .btn-nav .el-icon {
display: none;
.btn-save,
.btn-primary {
border-color: rgba(92, 224, 255, 0.7);
color: #ffffff;
background: linear-gradient(95deg, #0b84bd, #096491);
}
.btn-nav:hover:not(:disabled) {
border-color: #46b5e7;
border-color: rgba(116, 235, 255, 0.85);
color: #ffffff;
background: rgba(18, 85, 116, 0.78);
}
@ -1072,7 +1075,7 @@ function exportOutcome() {
.workbench-head,
.workbench-actions,
.task-actions,
.step-navigation,
.step-indicator,
.step-title-row {
flex-direction: column;

@ -61,10 +61,6 @@
</table>
</div>
<p v-if="checkResult" class="classification-summary" :class="{ 'is-success': checkResult.allCorrect }">本次判题:{{ checkResult.correctCount }} / {{ checkResult.totalCount }} 项分类正确</p>
<div class="task-actions">
<button type="button" class="btn-nav btn-submit" :disabled="checking" @click="saveAndGoToStepTwo">{{ checking ? '判题中…' : '保存并进入第 2 步' }}</button>
<button type="button" class="btn-nav" :disabled="checking" @click="resetStepOne"><el-icon><RefreshLeft /></el-icon>清空当前步骤</button>
</div>
</template>
<template v-else-if="currentStep === 2">
<div class="step-title-row">
@ -92,10 +88,6 @@
</tbody>
</table>
</div>
<div class="task-actions">
<button type="button" class="btn-nav btn-submit" :disabled="checking || !hasCompletedStepOne" @click="saveAndGoToStepThree">{{ checking ? '校验中…' : '保存并进入第 3 步' }}</button>
<button type="button" class="btn-nav" :disabled="checking" @click="resetStepTwo"><el-icon><RefreshLeft /></el-icon>清空当前步骤</button>
</div>
</template>
<template v-else-if="currentStep === 3">
<div class="step-title-row">
@ -124,10 +116,6 @@
<li>导出步骤二信息表,上传到通用AI绘图模型,通过大模型绘制甘特图。参考提示词:请根据产品WBS任务拆解与排期表生成甘特图用于后续项目管理。</li>
</ol>
</section>
<div class="task-actions">
<button type="button" class="btn-nav btn-submit" :disabled="uploadingGantt || !stepTwoPassed" @click="saveAndGoToStepFour">保存并进入第 4 步</button>
<button type="button" class="btn-nav" :disabled="uploadingGantt" @click="resetStepThree"><el-icon><RefreshLeft /></el-icon>清空当前步骤</button>
</div>
</template>
<template v-else-if="currentStep === 4">
<div class="step-title-row">
@ -146,12 +134,13 @@
<label class="reflection-field"><span>场景2:</span><textarea v-model.trim="stepFourForm.aiScenarioTwo" :disabled="!stepThreePassed || checking" placeholder="例如:使用 AI 生成电商详情页文案、主图脚本或运营素材" /></label>
</div>
</section>
<div class="task-actions">
<button type="button" class="btn-nav btn-submit" :disabled="checking || !stepThreePassed" @click="saveCurrentStepFour">保存当前步骤</button>
<button type="button" class="btn-nav" :disabled="checking" @click="resetStepFour"><el-icon><RefreshLeft /></el-icon>清空当前步骤</button>
</div>
</template>
<div v-else class="step-placeholder"><p>第 {{ currentStep }} 步内容待配置</p><span>第 1 步答案已保存,可从上方步骤栏返回查看。</span></div>
<div v-if="trainingSteps.length" class="step-navigation">
<button v-if="currentStep > 1" type="button" class="btn-nav" :disabled="checking || uploadingGantt" @click="previousStep">上一步</button>
<button type="button" class="btn-nav btn-save" :disabled="checking || uploadingGantt" @click="saveCurrentProgress">保存当前进度</button>
<button v-if="currentStep < trainingSteps.length" type="button" class="btn-nav btn-primary" :disabled="checking || uploadingGantt" @click="nextStep">下一步</button>
</div>
</section>
</section>
</main>
@ -166,7 +155,7 @@
</template>
<script setup>
import { Download, Operation, RefreshLeft, Upload } from "@element-plus/icons-vue";
import { Download, Operation, Upload } from "@element-plus/icons-vue";
import * as XLSX from "xlsx";
import { checkProductDevelopmentProcessStepOne, checkProductDevelopmentProcessStepTwo, checkProductDevelopmentProcessStepThree, checkProductDevelopmentProcessStepFour, deleteStudentTrainingAnswer, getStudentTrainingAnswer, saveStudentTrainingAnswer, uploadStudentTrainingFile } from "@/api/studentTrainingAnswer";
import { getTrainingTaskByKey } from "@/api/trainingTask";
@ -392,8 +381,8 @@ function clearFeedback(taskNo) {
checkResult.value = { ...checkResult.value, items: checkResult.value.items.filter((item) => item.taskNo !== taskNo) };
}
async function saveAndGoToStepTwo() {
if (checking.value) return;
async function saveStepOne(showMessage = true) {
if (checking.value) return false;
checking.value = true;
try {
const response = await checkProductDevelopmentProcessStepOne(buildOutcome().items);
@ -402,13 +391,14 @@ async function saveAndGoToStepTwo() {
proxy?.$modal?.msgError?.("存在分类错误,请根据提示修改后再进入第 2 步");
return;
}
await saveStudentTrainingAnswer(TASK_KEY, { step1Answer: JSON.stringify(buildOutcome()), currentStep: 2, submitted: false, saveAction: "SAVE" });
await saveStudentTrainingAnswer(TASK_KEY, { step1Answer: JSON.stringify(buildOutcome()), currentStep: 1, submitted: false, saveAction: "SAVE" });
clearDraft();
stepOnePassed.value = true;
currentStep.value = 2;
proxy?.$modal?.msgSuccess("已保存,已进入第 2 步");
if (showMessage) proxy?.$modal?.msgSuccess("当前步骤已保存");
return true;
} catch (error) {
proxy?.$modal?.msgError?.(error?.message || "请完成全部任务分类后再判题");
return false;
} finally {
checking.value = false;
}
@ -442,23 +432,24 @@ function resetStepOne() {
proxy?.$modal?.msgSuccess("已清空第 1 步填写内容");
}
async function saveAndGoToStepThree() {
if (checking.value || !hasCompletedStepOne.value) return;
async function saveStepTwo(showMessage = true) {
if (checking.value || !hasCompletedStepOne.value) return false;
const validationMessage = getStepTwoValidationMessage();
if (validationMessage) {
proxy?.$modal?.msgWarning?.(validationMessage);
return;
return false;
}
checking.value = true;
try {
await checkProductDevelopmentProcessStepTwo(buildStepTwoOutcome().items);
await saveStudentTrainingAnswer(TASK_KEY, { step2Answer: JSON.stringify(buildStepTwoOutcome()), currentStep: 3, submitted: false, saveAction: "SAVE" });
await saveStudentTrainingAnswer(TASK_KEY, { step2Answer: JSON.stringify(buildStepTwoOutcome()), currentStep: 2, submitted: false, saveAction: "SAVE" });
clearDraft();
stepTwoPassed.value = true;
currentStep.value = 3;
proxy?.$modal?.msgSuccess("已保存,已进入第 3 步");
if (showMessage) proxy?.$modal?.msgSuccess("当前步骤已保存");
return true;
} catch (error) {
proxy?.$modal?.msgError?.(error?.message || "请完整填写任务工期和项目依赖关系");
return false;
} finally {
checking.value = false;
}
@ -497,18 +488,19 @@ async function uploadGanttImage(event) {
}
}
async function saveAndGoToStepFour() {
if (uploadingGantt.value || !stepTwoPassed.value) return;
async function saveStepThree(showMessage = true) {
if (uploadingGantt.value || !stepTwoPassed.value) return false;
checking.value = true;
try {
await checkProductDevelopmentProcessStepThree(buildStepThreeOutcome());
await saveStudentTrainingAnswer(TASK_KEY, { step3Answer: JSON.stringify(buildStepThreeOutcome()), currentStep: 4, submitted: false, saveAction: "SAVE" });
await saveStudentTrainingAnswer(TASK_KEY, { step3Answer: JSON.stringify(buildStepThreeOutcome()), currentStep: 3, submitted: false, saveAction: "SAVE" });
clearDraft();
stepThreePassed.value = true;
currentStep.value = 4;
proxy?.$modal?.msgSuccess("已保存,已进入第 4 步");
if (showMessage) proxy?.$modal?.msgSuccess("当前步骤已保存");
return true;
} catch (error) {
proxy?.$modal?.msgError?.(error?.message || "请先上传甘特图");
return false;
} finally {
checking.value = false;
}
@ -534,21 +526,40 @@ async function submitTraining() {
}
}
async function saveCurrentStepFour() {
if (checking.value || !stepThreePassed.value) return;
async function saveStepFour(showMessage = true) {
if (checking.value || !stepThreePassed.value) return false;
checking.value = true;
try {
await checkProductDevelopmentProcessStepFour(buildStepFourOutcome());
await saveStudentTrainingAnswer(TASK_KEY, { step4Answer: JSON.stringify(buildStepFourOutcome()), currentStep: 4, submitted: false, saveAction: "SAVE" });
clearDraft();
proxy?.$modal?.msgSuccess("第 4 步已保存");
if (showMessage) proxy?.$modal?.msgSuccess("当前步骤已保存");
return true;
} catch (error) {
proxy?.$modal?.msgError?.(error?.message || "请完成并行协同复盘与两个AI应用场景");
return false;
} finally {
checking.value = false;
}
}
async function saveCurrentProgress(showMessage = true) {
if (currentStep.value === 1) return saveStepOne(showMessage);
if (currentStep.value === 2) return saveStepTwo(showMessage);
if (currentStep.value === 3) return saveStepThree(showMessage);
if (currentStep.value === 4) return saveStepFour(showMessage);
return false;
}
function previousStep() {
if (currentStep.value > 1) currentStep.value -= 1;
}
async function nextStep() {
if (currentStep.value >= trainingSteps.value.length) return;
if (await saveCurrentProgress(false)) currentStep.value += 1;
}
function resetStepFour() {
stepFourForm.value = { parallelWorkAnalysis: "", aiScenarioOne: "", aiScenarioTwo: "" };
proxy?.$modal?.msgSuccess("已清空第 4 步填写内容");
@ -653,7 +664,7 @@ function exportOutcome() {
.process-step-card { margin: 0; padding: 16px; border: 1px solid rgba(82, 174, 226, 0.42); border-radius: 20px; background: rgba(0, 25, 42, 0.64); }.step-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 12px; }.step-title-row h3 { margin: 4px 0 0; color: #fff; font-size: 22px; font-weight: 900; line-height: 1.3; }.step-title-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }.schedule-export-action { min-height: 34px; padding: 0 13px; font-size: 13px; }.section-eyebrow { margin: 0; color: #71dfff; font-size: 12px; font-weight: 800; line-height: 1.4; }.step-chip { padding: 6px 12px; border: 1px solid rgba(94, 219, 255, .54); border-radius: 999px; color: #a6ebff; background: rgba(9, 104, 149, .2); font-size: 13px; font-weight: 800; }
.process-intro { margin: 0 0 18px; color: #d7ecff; font-size: 15px; line-height: 1.8; }.training-table-wrap { overflow-x: auto; border: 1px solid rgba(0, 180, 255, .22); border-radius: 22px; background: rgba(1, 14, 26, .72); }.process-table { width: 100%; min-width: 920px; border-collapse: collapse; table-layout: fixed; }.process-table th { padding: 12px; border-right: 1px solid rgba(77, 167, 220, .2); color: #eaffff; background: rgba(8, 55, 82, .98); font-size: 14px; font-weight: 900; text-align: center; }.process-table td { padding: 12px; border-top: 1px solid rgba(77, 167, 220, .2); border-right: 1px solid rgba(77, 167, 220, .2); color: #d7f1ff; background: rgba(1, 14, 26, .48); vertical-align: middle; }.process-table th:last-child, .process-table td:last-child { border-right: 0; }.stage-cell { width: 17%; color: #eafaff; font-size: 14px; font-weight: 900; text-align: center; }.task-no-cell { width: 12%; color: #eafaff; font-size: 14px; font-weight: 800; text-align: center; }.task-cell { color: #cfe8f8; font-size: 14px; line-height: 1.7; text-align: center; }.select-cell { width: 23%; }.select-cell select, .schedule-table input { box-sizing: border-box; width: 100%; min-height: 38px; padding: 7px 10px; border: 1px solid rgba(45, 95, 126, .95); border-radius: 10px; outline: none; color: #eef5ff; background: #0f1a24; font: inherit; }.select-cell select:focus, .schedule-table input:focus { border-color: rgba(92, 224, 255, .7); box-shadow: 0 0 0 3px rgba(0, 174, 255, .13); }.classification-feedback { margin: 6px 0 0; color: #ff9b8f; font-size: 12px; line-height: 1.5; }.is-correct { background: rgba(55, 196, 147, .08); }.is-incorrect { background: rgba(255, 91, 82, .1); }.classification-summary { margin: 16px 0 0; color: #ffbc86; }.classification-summary.is-success { color: #6ee8b1; }
.task-actions { display: flex; justify-content: center; gap: 52px; margin-top: 36px; }.btn-nav { min-width: 172px; min-height: 64px; padding: 0 28px; border: 1px solid #2c83aa; border-radius: 6px; color: #dff7ff; background: rgba(13, 64, 88, .62); box-shadow: none; font-size: 24px; font-weight: 900; line-height: 1; }.btn-submit { border-color: #2c83aa; background: rgba(13, 64, 88, .62); }.task-actions .btn-nav .el-icon { display: none; }.btn-nav:hover:not(:disabled) { border-color: #46b5e7; color: #fff; background: rgba(18, 85, 116, .78); }.btn-nav:disabled { cursor: not-allowed; opacity: .6; }.step-placeholder { display: grid; place-items: center; min-height: 280px; padding: 28px; border: 1px dashed rgba(101, 207, 239, .42); border-radius: 18px; color: #b8d9ec; background: rgba(1, 14, 26, .42); text-align: center; }.step-placeholder p { margin: 0 0 8px; color: #eaffff; font-size: 20px; font-weight: 800; }
.step-navigation { display:flex; justify-content:center; gap:14px; margin-top:22px; }.btn-nav { display:inline-flex; align-items:center; justify-content:center; min-height:40px; padding:0 18px; border:1px solid rgba(99,217,255,.55); border-radius:999px; color:#e9fbff; background:rgba(17,126,178,.36); font:inherit; font-size:14px; font-weight:800; cursor:pointer; }.btn-nav.btn-save,.btn-nav.btn-primary { border-color:rgba(92,224,255,.7); color:#fff; background:linear-gradient(95deg,#0b84bd,#096491); }.btn-nav:hover:not(:disabled) { border-color:#46b5e7; color:#fff; background:rgba(18,85,116,.78); }.btn-nav:disabled { cursor:not-allowed; opacity:.55; }.step-placeholder { display: grid; place-items: center; min-height: 280px; padding: 28px; border: 1px dashed rgba(101, 207, 239, .42); border-radius: 18px; color: #b8d9ec; background: rgba(1, 14, 26, .42); text-align: center; }.step-placeholder p { margin: 0 0 8px; color: #eaffff; font-size: 20px; font-weight: 800; }
.step-warning { margin: 0 0 16px; padding: 10px 14px; border: 1px solid rgba(255, 173, 93, .62); border-radius: 10px; color: #ffd19f; background: rgba(187, 102, 27, .16); }.schedule-table { min-width: 1020px; }.schedule-table .stage-cell { width: 7%; }.schedule-table .task-no-cell { width: 7%; }.schedule-table .task-cell { width: 18%; }.classification-cell { width: 12%; color: #eafaff; font-weight: 800; text-align: center; }.schedule-table th:nth-child(5), .schedule-table td:nth-child(5), .schedule-table th:nth-child(6), .schedule-table td:nth-child(6) { width: 18%; }.schedule-table .dependency-input { min-width: 0; }.schedule-table .dependency-input::placeholder { color: rgba(168, 220, 233, .68); opacity: 1; }.schedule-table th:nth-child(7), .schedule-table td:nth-child(7) { width: 20%; }.schedule-table input:disabled { cursor: not-allowed; opacity: .6; }
.gantt-upload-panel { display: grid; justify-items: center; gap: 22px; min-height: 320px; padding: 32px 16px; border: 1px dashed rgba(71, 204, 255, .55); border-radius: 18px; background: radial-gradient(circle at center, rgba(15, 119, 163, .16), transparent 55%); }.gantt-upload-trigger { display: grid; place-items: center; align-content: center; gap: 9px; width: 280px; height: 138px; border-radius: 12px; color: #fff; background: linear-gradient(135deg, #0ba6e0, #0877ad); cursor: pointer; box-shadow: 0 14px 30px rgba(5, 126, 180, .24); }.gantt-upload-trigger input { position: absolute; width: 1px; height: 1px; opacity: 0; }.gantt-upload-trigger .el-icon { font-size: 26px; }.gantt-upload-trigger span { color: #cbefff; font-size: 12px; }.gantt-upload-trigger.disabled { cursor: not-allowed; opacity: .55; }.gantt-preview { width: min(100%, 760px); margin: 0; text-align: center; }.gantt-preview img { display: block; width: 100%; max-height: 410px; object-fit: contain; border: 1px solid rgba(84, 211, 255, .5); border-radius: 12px; background: #fff; cursor: zoom-in; }.gantt-preview figcaption { margin-top: 8px; color: #a8dce9; font-size: 13px; }.gantt-guide { margin-top: 26px; padding: 18px 22px; border-left: 3px solid #23c4ff; border-radius: 0 14px 14px 0; color: #d4edf6; background: rgba(12, 75, 104, .22); }.gantt-guide h4 { margin: 0 0 14px; color: #fff; }.gantt-guide ol { margin: 0; padding-left: 20px; }.gantt-guide li { margin: 11px 0; line-height: 1.7; }.gantt-guide button { margin-left: 12px; border: 0; border-radius: 6px; padding: 5px 10px; color: #fff; background: #109ed4; cursor: pointer; }
.process-reflection { display: grid; gap: 28px; }.reflection-field { display: grid; gap: 12px; color: #d8edf4; font-size: 16px; line-height: 1.7; }.reflection-field span { color: #f1fbff; font-weight: 600; }.reflection-field textarea { min-height: 190px; resize: vertical; padding: 14px; border: 1px solid rgba(45, 95, 126, .95); border-radius: 14px; color: #eef5ff; background: #0f1a24; font: inherit; line-height: 1.7; }.reflection-field textarea:focus { outline: 0; border-color: rgba(92, 224, 255, .7); box-shadow: 0 0 0 3px rgba(0, 174, 255, .13); }.reflection-field textarea:disabled { cursor: not-allowed; opacity: .55; }.reflection-question { color: #f1fbff; font-size: 16px; font-weight: 600; line-height: 1.8; }.scenario-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }.scenario-grid .reflection-field textarea { min-height: 180px; }.process-reflection.disabled { opacity: .72; }
@ -662,5 +673,5 @@ function exportOutcome() {
.product-process-toolbar { flex:0 0 auto; justify-content:flex-end; max-width:100%; }
@media (max-width: 1100px) { .product-process { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .product-process { padding: 14px 14px 18px; }.process-core { padding: 18px; border-radius: 24px; }.workbench-head, .workbench-actions, .task-actions, .step-indicator, .step-title-row { flex-direction: column; align-items: stretch; }.product-process-toolbar { width:100%; justify-content:flex-start; }.workbench-actions :deep(.material-download), .outline-action { width: 100%; }.step-indicator { width: 100%; margin: 0 0 32px; padding: 16px; overflow-x: visible; border-radius: 20px; }.step-tab { flex: 0 0 auto; width: 100%; min-width: 0; }.step-connector { flex: 0 0 20px; align-self: flex-start; width: 2px; min-width: 0; height: 20px; margin: 4px 0 4px 18px; }.step-connector::after { top: auto; right: auto; bottom: -1px; left: 50%; transform: translateX(-50%) rotate(135deg); }.step-chip { display: none; }.scenario-grid { grid-template-columns: 1fr; gap: 18px; }.task-actions { gap: 14px; }.btn-nav { width: 100%; } }
@media (max-width: 900px) { .product-process { padding: 14px 14px 18px; }.process-core { padding: 18px; border-radius: 24px; }.workbench-head, .workbench-actions, .step-navigation, .step-indicator, .step-title-row { flex-direction: column; align-items: stretch; }.product-process-toolbar { width:100%; justify-content:flex-start; }.workbench-actions :deep(.material-download), .outline-action { width: 100%; }.step-indicator { width: 100%; margin: 0 0 32px; padding: 16px; overflow-x: visible; border-radius: 20px; }.step-tab { flex: 0 0 auto; width: 100%; min-width: 0; }.step-connector { flex: 0 0 20px; align-self: flex-start; width: 2px; min-width: 0; height: 20px; margin: 4px 0 4px 18px; }.step-connector::after { top: auto; right: auto; bottom: -1px; left: 50%; transform: translateX(-50%) rotate(135deg); }.step-chip { display: none; }.scenario-grid { grid-template-columns: 1fr; gap: 18px; }.step-navigation { gap: 14px; }.btn-nav { width: 100%; } }
</style>

@ -284,10 +284,6 @@
</div>
</div>
</el-scrollbar>
<div class="taskfooter">
<el-button @click="submitData">提交任务</el-button>
<el-button @click="retrain">重新实训</el-button>
</div>
<pop-modal :showModel="dialogVisible" @closePop="handlClose">
<template v-slot:content>
<p>

@ -254,10 +254,6 @@
</div>
</div>
</el-scrollbar>
<div class="taskfooter">
<el-button @click="submitData">提交任务</el-button>
<el-button @click="retrain">重新实训</el-button>
</div>
<pop-modal :showModel="dialogVisible" @closePop="handlClose">
<template v-slot:content>
<div v-html="knowledgeHtml"></div>

@ -295,10 +295,6 @@
</div>
<div class="line"></div>
</div>
<div class="taskfooter">
<el-button @click="submitData">提交任务</el-button>
<el-button @click="retrain">重新实训</el-button>
</div>
<pop-modal :showModel="dialogVisible" @closePop="handlClose">
<template v-slot:content>
<div

@ -68,11 +68,6 @@
</div>
<p v-if="checkResult" class="result-message" :class="{ success: checkResult.allCorrect }">{{ checkResult.message || (checkResult.allCorrect ? '分类正确,已解锁下一步。' : `当前 ${checkResult.correctCount}/${checkResult.totalCount} 个分类正确,请继续调整。`) }}</p>
<div class="task-actions">
<button type="button" class="btn-nav btn-submit" :disabled="checking || unassignedFaults.length > 0" @click="checkAndSave">{{ checking ? '判题中…' : '检查分类并保存' }}</button>
<button type="button" class="btn-nav" :disabled="checking" @click="resetFaults"><el-icon><RefreshLeft /></el-icon>重新打乱</button>
<button type="button" class="btn-nav btn-primary" :disabled="!stepOnePassed" @click="goNextStep">进入第 2 步<el-icon><ArrowRight /></el-icon></button>
</div>
</section>
<section v-else-if="currentStep === 2" class="step-card service-design-card">
@ -106,10 +101,6 @@
</div>
<p v-if="stepTwoResult" class="result-message" :class="{ success: stepTwoResult.valid }">{{ stepTwoResult.message }}</p>
<div class="task-actions">
<button type="button" class="btn-nav" :disabled="savingStepTwo" @click="switchStep(1)"><el-icon><ArrowLeft /></el-icon>返回第 1 步</button>
<button type="button" class="btn-nav btn-submit" :disabled="savingStepTwo" @click="validateAndSaveStepTwo">{{ savingStepTwo ? '保存中…' : '保存并进入第 3 步' }}<el-icon><ArrowRight /></el-icon></button>
</div>
</section>
<section v-else-if="currentStep === 3" class="step-card policy-design-card">
@ -164,18 +155,14 @@
</section>
<p v-if="stepThreeResult" class="result-message" :class="{ success: stepThreeResult.valid }">{{ stepThreeResult.message }}</p>
<div class="task-actions">
<button type="button" class="btn-nav" :disabled="savingStepThree" @click="switchStep(2)"><el-icon><ArrowLeft /></el-icon>返回第 2 步</button>
<button type="button" class="btn-nav btn-submit" :disabled="savingStepThree" @click="validateAndSaveStepThree">{{ savingStepThree ? '提交中…' : '校验并提交任务' }}<el-icon><ArrowRight /></el-icon></button>
</div>
</section>
<section v-else class="step-card placeholder-card">
<p class="section-eyebrow">Step {{ String(currentStep).padStart(2, '0') }}</p>
<h3>{{ trainingSteps[currentStep - 1] }}</h3>
<p>第 1 步已通过,后续步骤将在对应实训页面继续完成。</p>
<div class="task-actions"><button type="button" class="btn-nav" @click="switchStep(1)"><el-icon><ArrowLeft /></el-icon>返回第 1 步</button></div>
</section>
<div class="step-navigation"><button v-if="currentStep > 1" type="button" class="btn-nav" @click="previousStep">上一步</button><button type="button" class="btn-nav btn-primary" :disabled="checking || savingStepTwo || savingStepThree" @click="saveCurrentProgress">保存当前进度</button><button v-if="currentStep < 3" type="button" class="btn-nav btn-primary" :disabled="checking || savingStepTwo || savingStepThree" @click="nextStep">下一步</button></div>
</section>
</main>
@ -387,13 +374,16 @@ async function checkAndSave() {
async function goNextStep() { if (!stepOnePassed.value) return; currentStep.value = normalizeStep(currentStep.value + 1); await persist("SAVE"); }
function applyExample(rowId) { const row = SERVICE_ROWS.find((item) => item.id === rowId); if (!row) return; serviceAnswers.value = { ...serviceAnswers.value, [rowId]: { process: row.processExample || "", rule: row.ruleExample || "" } }; clearStepTwoGrade(); }
function clearStepTwoGrade() { stepTwoPassed.value = false; stepTwoResult.value = null; }
async function validateAndSaveStepTwo() {
async function validateAndSaveStepTwo(advance = true) {
if (savingStepTwo.value) return; savingStepTwo.value = true;
try {
const rows = buildStepTwoAnswer().rows; const response = await checkAfterSalesServiceStepTwo({ rows });
stepTwoResult.value = response?.data || null; stepTwoPassed.value = Boolean(stepTwoResult.value?.valid);
if (!stepTwoPassed.value) { proxy?.$modal?.msgWarning(stepTwoResult.value?.message || "请完成五类故障的处理流程和核心规则"); return; }
currentStep.value = normalizeStep(3); await persist("SAVE"); proxy?.$modal?.msgSuccess("服务分级处理方案已保存,已进入第 3 步");
if (!stepTwoPassed.value) { proxy?.$modal?.msgWarning(stepTwoResult.value?.message || "请完成五类故障的处理流程和核心规则"); return false; }
if (advance) currentStep.value = normalizeStep(3);
await persist("SAVE");
proxy?.$modal?.msgSuccess(advance ? "服务分级处理方案已保存,已进入第 3 步" : "当前步骤已保存");
return true;
} catch (error) { proxy?.$modal?.msgError(error?.message || "保存失败,请稍后重试"); } finally { savingStepTwo.value = false; }
}
function clearStepThreeGrade() { stepThreePassed.value = false; stepThreeResult.value = null; }
@ -407,15 +397,25 @@ function applySummaryExample(rowId) {
policyAnswers.value = { ...policyAnswers.value, summary: { ...policyAnswers.value.summary, [rowId]: row.example || "" } };
clearStepThreeGrade();
}
async function validateAndSaveStepThree() {
async function validateAndSaveStepThree(submit = false) {
if (savingStepThree.value) return; savingStepThree.value = true;
try {
const answer = buildStepThreeAnswer(); const response = await checkAfterSalesServiceStepThree(answer);
stepThreeResult.value = response?.data || null; stepThreePassed.value = Boolean(stepThreeResult.value?.valid);
if (!stepThreePassed.value) { proxy?.$modal?.msgWarning(stepThreeResult.value?.message || "请完成售后政策框架与详情页摘要"); return; }
currentStep.value = normalizeStep(3); await persist("SUBMIT"); proxy?.$modal?.msgSuccess("售后政策已校验通过,任务提交成功");
if (!stepThreePassed.value) { proxy?.$modal?.msgWarning(stepThreeResult.value?.message || "请完成售后政策框架与详情页摘要"); return false; }
currentStep.value = normalizeStep(3); await persist(submit ? "SUBMIT" : "SAVE"); proxy?.$modal?.msgSuccess(submit ? "售后政策已校验通过,任务提交成功" : "当前步骤已保存"); return true;
} catch (error) { proxy?.$modal?.msgError(error?.message || "保存失败,请稍后重试"); } finally { savingStepThree.value = false; }
}
async function saveCurrentProgress() {
if (currentStep.value === 1) return checkAndSave();
if (currentStep.value === 2) return validateAndSaveStepTwo(false);
return validateAndSaveStepThree(false);
}
function previousStep() { if (currentStep.value > 1) currentStep.value -= 1; }
async function nextStep() {
if (currentStep.value === 1) { await checkAndSave(); if (stepOnePassed.value) currentStep.value = 2; return; }
if (currentStep.value === 2) { await validateAndSaveStepTwo(); return; }
}
function switchStep(step) {
if (step > 1 && !stepOnePassed.value) { proxy?.$modal?.msgWarning("请先完成故障分类并判题通过"); return; }
if (step > 2 && !stepTwoPassed.value) { proxy?.$modal?.msgWarning("请先完成服务分级与处理方案"); return; }

@ -60,8 +60,7 @@
<div v-if="hasConfiguredSteps" class="step-navigation">
<button v-if="activeStep > 1" type="button" class="btn-nav" @click="goPreviousStep"><el-icon><ArrowLeft /></el-icon>上一步</button>
<button type="button" class="btn-nav btn-save" :disabled="saving" @click="saveCurrentProgress"><el-icon><CircleCheck /></el-icon>保存当前步骤</button>
<button type="button" class="btn-nav" :disabled="saving" @click="clearCurrentStep"><el-icon><RefreshLeft /></el-icon>清空当前步骤</button>
<button type="button" class="btn-nav btn-save" :disabled="saving" @click="saveCurrentProgress"><el-icon><CircleCheck /></el-icon>保存当前进度</button>
<button v-if="activeStep < configuredSteps.length" type="button" class="btn-nav btn-primary" @click="goNextStep">下一步<el-icon><ArrowRight /></el-icon></button>
</div>
</section>
@ -72,7 +71,7 @@
<script setup>
import { computed, getCurrentInstance, onMounted, ref, useSlots } from "vue";
import { ArrowLeft, ArrowRight, CircleCheck, Document, Download, RefreshLeft } from "@element-plus/icons-vue";
import { ArrowLeft, ArrowRight, CircleCheck, Document, Download } from "@element-plus/icons-vue";
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
import TrainingMaterialButton from "@/views/components/TrainingMaterialButton.vue";
import TrainingTaskBrief from "@/views/components/TrainingTaskBrief.vue";
@ -124,13 +123,6 @@ function setCurrentStep(step) { activeStep.value = normalizeActiveStep(step); pe
function goPreviousStep() { setCurrentStep(activeStep.value - 1); }
function goNextStep() { setCurrentStep(activeStep.value + 1); }
async function saveCurrentProgress() { if (saving.value) return; saving.value = true; try { if (hasCustomContent.value) { emit("save"); await persistProgress("SAVE", true); } else { await persistProgress(); } } finally { saving.value = false; } }
function clearCurrentStep() {
const fields = visibleFields.value;
fields.forEach((field) => { form.value[field.key] = ""; });
if (showWorkTable.value) workRows.value = createRows();
if (hasCustomContent.value) emit("clear-current-step", activeStep.value);
proxy?.$modal?.msgSuccess(`已清空第 ${activeStep.value} 步填写内容`);
}
async function submitTask() { if (saving.value) return; saving.value = true; try { if (hasCustomContent.value) { emit("submit"); await persistProgress("SAVE", true); } else { await persistProgress("SUBMIT"); } } finally { saving.value = false; } }
async function resetTask() { if (saving.value) return; saving.value = true; try { if (hasCustomContent.value) emit("reset"); form.value = createForm(); workRows.value = createRows(); activeStep.value = 1; await persistProgress("RESET", hasCustomContent.value); if (!hasCustomContent.value) proxy?.$modal?.msgSuccess("已重新开始本次实训"); } finally { saving.value = false; } }
function exportOutcome() { const blob = new Blob([JSON.stringify(buildProgress(), null, 2)], { type: "application/json;charset=utf-8" }); const url = URL.createObjectURL(blob); const link = document.createElement("a"); link.href = url; link.download = `${taskTitle.value}-实训成果.json`; link.click(); URL.revokeObjectURL(url); }

@ -88,11 +88,6 @@
<p class="row-hint" :class="{ ready: rows.length >= MIN_ROWS }">
{{ rows.length >= MIN_ROWS ? '已达到最低填写要求,还可增加 ' + (MAX_ROWS - rows.length) + ' 行。' : '还需补充 ' + (MIN_ROWS - rows.length) + ' 行后才能保存。' }}
</p>
<div class="task-actions">
<button type="button" class="btn-nav" :disabled="saving" @click="restoreExample">恢复示例</button>
<button type="button" class="btn-nav btn-primary" :disabled="saving" @click="saveStepOne(false)">{{ saving ? "保存中…" : "校验并保存本步骤" }}</button>
<button type="button" class="btn-nav btn-primary" :disabled="saving" @click="saveStepOne(true)">保存并进入第 2 步</button>
</div>
</section>
</section>
@ -147,11 +142,6 @@
</article>
</div>
<p v-if="stepTwoValidation?.message" class="validation-message" :class="{ failed: stepTwoValidation.valid === false }">{{ stepTwoValidation.message }}</p>
<div class="task-actions">
<button type="button" class="btn-nav" :disabled="savingStepTwo" @click="currentStep = 1">返回第 1 步</button>
<button type="button" class="btn-nav btn-primary" :disabled="savingStepTwo || !costRows.length" @click="saveStepTwo">{{ savingStepTwo ? "校验并保存中…" : "校验并保存本步骤" }}</button>
<button type="button" class="btn-nav btn-primary" :disabled="savingStepTwo || !costRows.length" @click="saveStepTwoAndNext">保存并进入第 3 步</button>
</div>
</section>
</section>
@ -202,11 +192,6 @@
{{ stepThree.items.length >= MIN_MANUFACTURING_ROWS ? "已达到最低费用项要求。" : "还需补充 " + (MIN_MANUFACTURING_ROWS - stepThree.items.length) + " 项制造费用后才能保存。" }}
</p>
<p v-if="stepThreeValidation?.message" class="validation-message" :class="{ failed: stepThreeValidation.valid === false }">{{ stepThreeValidation.message }}</p>
<div class="task-actions">
<button type="button" class="btn-nav" :disabled="savingStepThree" @click="currentStep = 2">返回第 2 步</button>
<button type="button" class="btn-nav btn-primary" :disabled="savingStepThree" @click="saveStepThree(false)">{{ savingStepThree ? "校验并保存中…" : "校验并保存本步骤" }}</button>
<button type="button" class="btn-nav btn-primary" :disabled="savingStepThree" @click="saveStepThree(true)">保存并进入第 4 步</button>
</div>
</section>
</section>
@ -269,12 +254,13 @@
<button type="button" class="btn-nav" @click="downloadCostStructureTemplate">下载 Excel 模板</button>
</div>
<p v-if="stepFourValidation?.message" class="validation-message" :class="{ failed: stepFourValidation.valid === false }">{{ stepFourValidation.message }}</p>
<div class="task-actions">
<button type="button" class="btn-nav" :disabled="savingStepFour" @click="currentStep = 3">返回第 3 步</button>
<button type="button" class="btn-nav btn-primary" :disabled="savingStepFour || !!uploadingChart" @click="saveStepFour">{{ savingStepFour ? '保存中…' : '保存成本优化决策' }}</button>
</div>
</section>
</section>
<div class="step-actions">
<button v-if="currentStep > 1" type="button" class="btn-nav" @click="previousStep">上一步</button>
<button type="button" class="btn-nav btn-primary" :disabled="isStepSaving" @click="saveCurrentProgress">保存当前进度</button>
<button v-if="currentStep < 4" type="button" class="btn-nav btn-primary" :disabled="isStepSaving" @click="nextStep">下一步</button>
</div>
</section>
</main>
@ -308,6 +294,7 @@ const MAX_ROWS = 40;
const { proxy } = getCurrentInstance();
const taskConfig = ref({});
const currentStep = ref(1);
const isStepSaving = computed(() => saving.value || savingStepTwo.value || savingStepThree.value || savingStepFour.value || Boolean(uploadingChart.value));
const currentStepTitle = computed(() => ({
1: "核心元器件选型组合",
2: "批量成本核算与约束验证",
@ -618,8 +605,8 @@ async function saveStepFour() {
if (!validated.valid) { notifyError(validated.message || "请完善成本结构图和优化方案"); return; }
await saveStudentTrainingAnswer(TASK_KEY, {
currentStep: 4,
saveAction: "SUBMIT",
submitted: true,
saveAction: "SAVE",
submitted: false,
step4Answer: JSON.stringify({
smallBatchChart: { ...stepFour.smallBatchChart },
largeBatchChart: { ...stepFour.largeBatchChart },
@ -633,6 +620,15 @@ async function saveStepFour() {
savingStepFour.value = false;
}
}
async function saveCurrentProgress() {
if (currentStep.value === 1) { await saveStepOne(false); return Boolean(savedStepOneItems.value.length); }
if (currentStep.value === 2) { await saveStepTwo(); return stepTwoSaved.value; }
if (currentStep.value === 3) { await saveStepThree(false); return stepThreeSaved.value; }
await saveStepFour();
return true;
}
function previousStep() { if (currentStep.value > 1) currentStep.value -= 1; }
async function nextStep() { if (currentStep.value < 4 && await saveCurrentProgress()) currentStep.value += 1; }
function resultClass(field) { return stepTwoValidation.value?.[field] === true ? "passed" : stepTwoValidation.value?.[field] === false ? "failed" : ""; }
function validationLabel(field) { return stepTwoValidation.value?.[field] === true ? "满足成本约束" : stepTwoValidation.value?.[field] === false ? "超出成本约束" : "待校验"; }
async function exportStepTwo() {

@ -190,14 +190,6 @@
</el-button>
</div>
<div class="training-actions">
<el-button class="training-action training-action--submit" :loading="saving" @click="submitTask">
提交任务
</el-button>
<el-button class="training-action training-action--reset" @click="resetTraining">
重新实训
</el-button>
</div>
</section>
</section>
</main>

@ -17,7 +17,6 @@
<div class="step-heading"><div><p>Step 01</p><h2>{{ trainingSteps[0] }}</h2></div><em>指标分类练习</em></div>
<p class="intro">请对实训数据表中的各项指标,按照市场规模、市场潜力、竞争强度、运营难度 4 个类别进行分类。</p>
<div class="table-wrap"><table><thead><tr><th>序号</th><th>指标</th><th>分类</th></tr></thead><tbody><tr v-for="(item, index) in indicators" :key="item.id"><td>{{ index + 1 }}</td><td class="metric">{{ item.name }}</td><td><select v-model="answers[item.id]" :class="{ 'input-error': stepOneCheckResults[item.id] && !stepOneCheckResults[item.id].correct }" :aria-label="`${item.name} 的分类`" @change="clearStepOneCheck(item.id)"><option value="">请选择</option><option v-for="category in categories" :key="category" :value="category">{{ category }}</option></select><small v-if="stepOneCheckResults[item.id] && !stepOneCheckResults[item.id].correct" class="classification-error">{{ stepOneCheckResults[item.id].message }}</small></td></tr></tbody></table></div>
<div class="step-actions"><button class="btn primary" type="button" :disabled="saving" @click="checkAndContinue">判题并进入第 2 步</button><button class="btn" type="button" :disabled="saving" @click="resetStepOne"><el-icon><RefreshLeft /></el-icon> 清空当前步骤</button></div>
</template>
<template v-else-if="currentStep === 2">
<div class="step-heading"><div><p>Step 02</p><h2>{{ trainingSteps[1] }}</h2></div><em>指标权重设定</em></div>
@ -25,7 +24,6 @@
<p v-if="!stepOnePassed" class="warning">请先完成并保存第 1 步的指标分类,再填写本步骤。</p>
<div class="weight-summary"><span>一级指标权重合计</span><strong :class="{ valid: primaryWeightTotal === 100 }">{{ primaryWeightTotal }}%</strong><span>对应总权重合计</span><strong :class="{ valid: correspondingWeightTotal === 100 }">{{ correspondingWeightTotal }}%</strong><small>一级权重合计、每类维度内权重合计、对应总权重均须为 100%</small></div>
<div class="table-wrap"><table class="weight-table"><thead><tr><th>一级指标</th><th>权重占比(%)</th><th>二级指标</th><th>维度内权重(%)</th><th>对应总权重</th></tr></thead><tbody><template v-for="group in indicatorGroups" :key="group.name"><tr v-for="(item, index) in group.items" :key="item.id"><td v-if="index === 0" :rowspan="group.items.length" class="first-level">{{ group.name }}</td><td v-if="index === 0" :rowspan="group.items.length" class="primary-weight"><input v-model.number="primaryWeights[group.name]" :disabled="!stepOnePassed" type="number" min="1" max="100" step="1" :aria-label="`${group.name} 的一级指标权重`" /><span class="percent">%</span><small>建议 {{ group.suggestion }}</small><small>维度内权重合计 <strong :class="{ valid: dimensionWeightTotal(group.name) === 100 }">{{ dimensionWeightTotal(group.name) }}%</strong></small></td><td class="metric">{{ item.name }}</td><td><input v-model.number="weights[item.id]" :disabled="!stepOnePassed" type="number" min="1" max="100" step="1" :aria-label="`${item.name} 的维度内权重`" /><span class="percent">%</span><small>建议 {{ item.suggestion }}</small></td><td class="corresponding-weight">{{ formatWeight(correspondingWeight(item)) }}%</td></tr></template></tbody></table></div>
<div class="step-actions"><button class="btn primary" type="button" :disabled="saving || !stepOnePassed" @click="saveAndGoToStepThree">保存并进入第 3 步</button><button class="btn" type="button" :disabled="saving || !stepOnePassed" @click="resetStepTwo"><el-icon><RefreshLeft /></el-icon> 清空当前步骤</button></div>
</template>
<template v-else-if="currentStep === 3">
<div class="step-heading"><div><p>Step 03</p><h2>{{ trainingSteps[2] }}</h2></div><em>加权评分计算</em></div>
@ -33,7 +31,6 @@
<p v-if="!stepTwoPassed" class="warning">请先完成并保存第 2 步的指标权重设定,再填写本步骤。</p>
<div class="score-table-wrap"><table class="score-table"><thead><tr><th>序号</th><th>产品品类</th><th>综合得分</th></tr></thead><tbody><tr v-for="(product, index) in products" :key="product.id"><td>{{ index + 1 }}</td><td class="metric">{{ product.name }}</td><td><input v-model.number="scores[product.id]" :disabled="!stepTwoPassed" type="number" min="0" max="100" step="0.01" :aria-label="`${product.name} 的综合得分`" /><span class="percent">分</span></td></tr></tbody></table></div>
<div class="calculation-guide"><div><h3>推荐工具及方法如下,自行选择:</h3><p>1. Excel/WPS 表格,自行操作计算,可参考《实训操作说明》完成。</p><p>2. 下载自动化模板,填写案例数据及第 2 步权重,完成指标计算。</p><p>3. 导出实训数据表,上传到通用 AI 大模型,参考提示词完成计算。</p><p>先按 Min-Max 归一法和加权评分法计算品类综合得分;如案例资料提供三段式时间权重,则分别按第 1–20 天、第 21–40 天、第 41–60 天的权重计算最终得分。</p></div><div class="download-stack"><button class="btn" type="button" @click="downloadInstructions">下载实训操作说明</button><button class="btn primary" type="button" @click="downloadTemplate">下载自动化模板</button></div></div>
<div class="step-actions"><button class="btn primary" type="button" :disabled="saving || !stepTwoPassed" @click="saveAndGoToStepFour">保存并进入第 4 步</button><button class="btn" type="button" :disabled="saving || !stepTwoPassed" @click="resetStepThree"><el-icon><RefreshLeft /></el-icon> 清空当前步骤</button></div>
</template>
<template v-else-if="currentStep === 4">
<div class="step-heading"><div><p>Step 04</p><h2>{{ trainingSteps[3] }}</h2></div><em>可视化结果提交</em></div>
@ -46,7 +43,6 @@
<div v-if="visualization.url" class="visualization-preview"><el-image :src="visualization.url" :preview-src-list="[visualization.url]" fit="cover" preview-teleported /><div><strong>{{ visualization.name || "数据可视化结果图" }}</strong><span>点击缩略图可放大查看</span><button class="text-button" type="button" @click="clearVisualization">移除图片</button></div></div>
</div>
<div class="visual-guide"><div><h3>推荐工具及方法如下,自行选择:</h3><p>1. 使用 Excel/WPS 表格计算三类产品的平均得分、最高分和最低分,并生成图表。</p><p>2. 下载自动化模板,填写关键数据,完成指标计算和可视化。</p><p>3. 导出实训数据表,上传到通用 AI 大模型,参考提示词完成计算与图表生成。</p><p>请根据数据表及各指标权重设定表,使用 Min-Max 归一法与加权评分法计算产品综合得分,并汇总平均分、最高分和最低分。</p></div><div class="download-stack"><button class="btn" type="button" @click="downloadVisualizationInstructions">下载实训操作说明</button><button class="btn primary" type="button" @click="downloadVisualizationTemplate">下载自动化模板</button></div></div>
<div class="step-actions"><button class="btn primary" type="button" :disabled="saving || uploading || !stepThreePassed" @click="saveAndGoToStepFive">保存并进入第 5 步</button><button class="btn" type="button" :disabled="saving || uploading || !stepThreePassed" @click="clearVisualization"><el-icon><RefreshLeft /></el-icon> 清空当前步骤</button></div>
</template>
<template v-else-if="currentStep === 5">
<div class="step-heading"><div><p>Step 05</p><h2>{{ trainingSteps[4] }}</h2></div><em>评论数据洞察</em></div>
@ -54,16 +50,19 @@
<p v-if="!stepFourPassed" class="warning">请先完成并保存第 4 步的数据可视化结果,再填写本步骤。</p>
<div class="table-wrap"><table class="insight-table"><thead><tr><th>品类</th><th>好评率(%)</th><th>用户痛点</th><th>未被满足的需求</th></tr></thead><tbody><tr v-for="product in products" :key="product.id"><td class="metric">{{ product.name }}</td><td><input v-model.number="reviewInsights[product.id].favorableRate" :disabled="!stepFourPassed" type="number" min="0" max="100" step="0.01" :aria-label="`${product.name} 的好评率`" /><span class="percent">%</span></td><td><textarea v-model.trim="reviewInsights[product.id].painPoint" :disabled="!stepFourPassed" :aria-label="`${product.name} 的用户痛点`" placeholder="请根据评论数据提炼用户痛点" /></td><td><textarea v-model.trim="reviewInsights[product.id].unmetNeed" :disabled="!stepFourPassed" :aria-label="`${product.name} 的未被满足的需求`" placeholder="请根据评论数据提炼未被满足的需求" /></td></tr></tbody></table></div>
<div class="insight-guide"><div><h3>可参考以下方法:</h3><p>1. 自行根据评价数据计算好评率,阅读评论后分析用户痛点及未被满足的需求。</p><p>2. 导出评论数据表,上传到通用 AI 大模型,通过文本分析完成计算与提炼。</p><p>提示词:请计算 Excel 表中产品评论数据的好评率,提炼用户痛点和未被满足的需求。</p></div></div>
<div class="step-actions"><button class="btn primary" type="button" :disabled="saving || !stepFourPassed" @click="saveAndGoToStepSix">保存并进入第 6 步</button><button class="btn" type="button" :disabled="saving || !stepFourPassed" @click="resetStepFive"><el-icon><RefreshLeft /></el-icon> 清空当前步骤</button></div>
</template>
<template v-else-if="currentStep === 6">
<div class="step-heading"><div><p>Step 06</p><h2>{{ trainingSteps[5] }}</h2></div><em>选品结论</em></div>
<p class="intro">结合前面的数据分析,请说明应该进行开发什么产品,具体原因是什么。</p>
<p v-if="!stepFivePassed" class="warning">请先完成并保存第 5 步的用户需求洞察,再填写本步骤。</p>
<div class="conclusion-field"><label for="market-opportunity-conclusion">开发建议与原因</label><textarea id="market-opportunity-conclusion" v-model.trim="developmentConclusion" :disabled="!stepFivePassed" placeholder="请结合综合得分、评论痛点与未被满足的需求,说明建议开发的产品及具体原因。" /></div>
<div class="step-actions"><button class="btn primary" type="button" :disabled="saving || !stepFivePassed" @click="saveCurrentStepSix">保存当前步骤</button><button class="btn" type="button" :disabled="saving || !stepFivePassed" @click="resetStepSix"><el-icon><RefreshLeft /></el-icon> 清空当前步骤</button></div>
</template>
<div v-else class="placeholder"><p>第 {{ currentStep }} 步内容待配置</p><span>已保存的步骤可从上方步骤栏返回查看。</span></div>
<footer class="step-navigation">
<button v-if="currentStep > 1" class="btn" type="button" :disabled="saving || uploading" @click="previousStep">上一步</button>
<button class="btn primary" type="button" :disabled="saving || uploading" @click="saveCurrentProgress">保存当前进度</button>
<button v-if="currentStep < trainingSteps.length" class="btn primary" type="button" :disabled="saving || uploading" @click="nextStep">下一步</button>
</footer>
</section>
</section>
</main>
@ -73,7 +72,7 @@
<script setup>
import * as XLSX from "xlsx";
import { RefreshLeft, UploadFilled } from "@element-plus/icons-vue";
import { UploadFilled } from "@element-plus/icons-vue";
import { checkMarketOpportunitySelectionStepOne, checkMarketOpportunitySelectionStepTwo, checkMarketOpportunitySelectionStepThree, checkMarketOpportunitySelectionStepFour, checkMarketOpportunitySelectionStepFive, checkMarketOpportunitySelectionStepSix, deleteStudentTrainingAnswer, getStudentTrainingAnswer, saveStudentTrainingAnswer, uploadStudentTrainingFile } from "@/api/studentTrainingAnswer";
import { getTrainingTaskByKey } from "@/api/trainingTask";
import { parseTrainingArray } from "@/views/training/taskKeyMap";
@ -120,7 +119,7 @@ function buildStepFourOutcome() { return { title: taskTitle.value, visualization
function buildStepFiveOutcome() { return { title: taskTitle.value, reviewInsights: Object.fromEntries(products.map((product) => [product.id, { ...reviewInsights.value[product.id] }])) }; }
function buildStepSixOutcome() { return { title: taskTitle.value, developmentConclusion: developmentConclusion.value.trim() }; }
function buildDynamicStepAnswers(overrides) { return { ...dynamicStepAnswers.value, ...overrides }; }
async function checkAndContinue() { if (saving.value) return; saving.value = true; try { const result = await checkMarketOpportunitySelectionStepOne(indicators.map((item) => ({ id: item.id, category: answers.value[item.id] }))); stepOneCheckResults.value = Object.fromEntries((result?.data?.items || []).map((item) => [item.id, item])); if (!result?.data?.allCorrect) throw new Error(`当前答对 ${result?.data?.correctCount || 0}/${indicators.length} 项,请根据表内提示修改`); await saveStudentTrainingAnswer(TASK_KEY, { step1Answer: JSON.stringify(buildStepOneOutcome()), currentStep: 2, submitted: false, saveAction: "SAVE" }); stepOnePassed.value = true; currentStep.value = 2; proxy?.$modal?.msgSuccess("分类正确,已进入第 2 步"); } catch (error) { proxy?.$modal?.msgError?.(error?.message || "请完成指标分类并根据提示修改"); } finally { saving.value = false; } }
async function checkAndContinue(advance = true) { if (saving.value) return false; saving.value = true; try { const result = await checkMarketOpportunitySelectionStepOne(indicators.map((item) => ({ id: item.id, category: answers.value[item.id] }))); stepOneCheckResults.value = Object.fromEntries((result?.data?.items || []).map((item) => [item.id, item])); if (!result?.data?.allCorrect) throw new Error(`当前答对 ${result?.data?.correctCount || 0}/${indicators.length} 项,请根据表内提示修改`); await saveStudentTrainingAnswer(TASK_KEY, { step1Answer: JSON.stringify(buildStepOneOutcome()), currentStep: advance ? 2 : 1, submitted: false, saveAction: "SAVE" }); stepOnePassed.value = true; if (advance) currentStep.value = 2; proxy?.$modal?.msgSuccess(advance ? "分类正确,已进入第 2 步" : "当前步骤已保存"); return true; } catch (error) { proxy?.$modal?.msgError?.(error?.message || "请完成指标分类并根据提示修改"); return false; } finally { saving.value = false; } }
function isIntegerWeight(value) { return value !== null && value !== "" && Number.isInteger(Number(value)) && Number(value) >= 1 && Number(value) <= 100; }
function dimensionWeightTotal(group) { return calculateDimensionWeightTotal(group, weights.value); }
function calculateDimensionWeightTotal(group, dimension) { return indicators.filter((item) => item.group === group).reduce((total, item) => total + (Number(dimension[item.id]) || 0), 0); }
@ -130,8 +129,8 @@ function formatWeight(value) { return Number.isInteger(value) ? value : value.to
function isValidSavedStepTwoOutcome(primary, dimension) { const primaryTotal = categories.reduce((total, group) => total + (Number(primary[group]) || 0), 0); const correspondingTotal = roundWeight(indicators.reduce((total, item) => total + ((Number(primary[item.group]) || 0) * (Number(dimension[item.id]) || 0)) / 100, 0)); return categories.every((group) => isIntegerWeight(primary[group]) && calculateDimensionWeightTotal(group, dimension) === 100) && indicators.every((item) => isIntegerWeight(dimension[item.id])) && primaryTotal === 100 && correspondingTotal === 100; }
function isStepTwoReady() { return isValidSavedStepTwoOutcome(primaryWeights.value, weights.value); }
function switchStep(step) { if (step > 1 && !stepOnePassed.value) { proxy?.$modal?.msgWarning("请先完成第 1 步指标分类"); return; } if (step > 2 && !stepTwoPassed.value) { proxy?.$modal?.msgWarning("请先完成第 2 步指标权重设定"); return; } if (step > 3 && !stepThreePassed.value) { proxy?.$modal?.msgWarning("请先完成第 3 步综合得分计算"); return; } if (step > 4 && !stepFourPassed.value) { proxy?.$modal?.msgWarning("请先完成第 4 步数据可视化"); return; } if (step > 5 && !stepFivePassed.value) { proxy?.$modal?.msgWarning("请先完成第 5 步用户需求洞察"); return; } currentStep.value = step; }
async function saveAndGoToStepThree() { if (saving.value || !stepOnePassed.value) return; if (!isStepTwoReady()) { proxy?.$modal?.msgError?.("请确认一级指标、维度内权重和对应总权重均为 100%"); return; } saving.value = true; try { await checkMarketOpportunitySelectionStepTwo({ primaryWeights: categories.map((group) => ({ group, weight: primaryWeights.value[group] })), dimensionWeights: indicators.map((item) => ({ id: item.id, weight: weights.value[item.id] })) }); await saveStudentTrainingAnswer(TASK_KEY, { step2Answer: JSON.stringify(buildStepTwoOutcome()), currentStep: 3, submitted: false, saveAction: "SAVE" }); stepTwoPassed.value = true; currentStep.value = 3; proxy?.$modal?.msgSuccess("权重校验通过,已进入第 3 步"); } catch (error) { proxy?.$modal?.msgError?.(error?.message || "请确认一级指标、维度内权重和对应总权重均满足规则"); } finally { saving.value = false; } }
async function saveAndGoToStepFour() { if (saving.value || !stepTwoPassed.value) return; saving.value = true; try { await checkMarketOpportunitySelectionStepThree({ scores: products.map((product) => ({ id: product.id, score: scores.value[product.id] })) }); await saveStudentTrainingAnswer(TASK_KEY, { step3Answer: JSON.stringify(buildStepThreeOutcome()), currentStep: 4, submitted: false, saveAction: "SAVE" }); stepThreePassed.value = true; currentStep.value = 4; proxy?.$modal?.msgSuccess("综合得分校验通过,已进入第 4 步"); } catch (error) { proxy?.$modal?.msgError?.(error?.message || "请填写 0 至 100 分、最多保留两位小数的综合得分"); } finally { saving.value = false; } }
async function saveAndGoToStepThree(advance = true) { if (saving.value || !stepOnePassed.value) return false; if (!isStepTwoReady()) { proxy?.$modal?.msgError?.("请确认一级指标、维度内权重和对应总权重均为 100%"); return false; } saving.value = true; try { await checkMarketOpportunitySelectionStepTwo({ primaryWeights: categories.map((group) => ({ group, weight: primaryWeights.value[group] })), dimensionWeights: indicators.map((item) => ({ id: item.id, weight: weights.value[item.id] })) }); await saveStudentTrainingAnswer(TASK_KEY, { step2Answer: JSON.stringify(buildStepTwoOutcome()), currentStep: advance ? 3 : 2, submitted: false, saveAction: "SAVE" }); stepTwoPassed.value = true; if (advance) currentStep.value = 3; proxy?.$modal?.msgSuccess(advance ? "权重校验通过,已进入第 3 步" : "当前步骤已保存"); return true; } catch (error) { proxy?.$modal?.msgError?.(error?.message || "请确认一级指标、维度内权重和对应总权重均满足规则"); return false; } finally { saving.value = false; } }
async function saveAndGoToStepFour(advance = true) { if (saving.value || !stepTwoPassed.value) return false; saving.value = true; try { await checkMarketOpportunitySelectionStepThree({ scores: products.map((product) => ({ id: product.id, score: scores.value[product.id] })) }); await saveStudentTrainingAnswer(TASK_KEY, { step3Answer: JSON.stringify(buildStepThreeOutcome()), currentStep: advance ? 4 : 3, submitted: false, saveAction: "SAVE" }); stepThreePassed.value = true; if (advance) currentStep.value = 4; proxy?.$modal?.msgSuccess(advance ? "综合得分校验通过,已进入第 4 步" : "当前步骤已保存"); return true; } catch (error) { proxy?.$modal?.msgError?.(error?.message || "请填写 0 至 100 分、最多保留两位小数的综合得分"); return false; } finally { saving.value = false; } }
function clearStepOneCheck(id) { if (stepOneCheckResults.value[id]) { const next = { ...stepOneCheckResults.value }; delete next[id]; stepOneCheckResults.value = next; } }
async function resetStepOne() {
answers.value = createAnswers();
@ -174,9 +173,12 @@ function resetStepSix() { developmentConclusion.value = ""; proxy?.$modal?.msgSu
function openVisualizationPicker() { visualizationInput.value?.click(); }
function clearVisualization() { if (visualization.value.url.startsWith("blob:")) URL.revokeObjectURL(visualization.value.url); visualization.value = { url: "", name: "" }; stepFourPassed.value = false; stepFivePassed.value = false; }
async function handleVisualizationUpload(event) { const file = event.target?.files?.[0]; if (!file) return; const acceptedTypes = ["image/jpeg", "image/png", "image/webp"]; if (!acceptedTypes.includes(file.type)) { proxy?.$modal?.msgError?.("请上传 PNG、JPG 或 WEBP 格式的图片"); event.target.value = ""; return; } if (file.size > 5 * 1024 * 1024) { proxy?.$modal?.msgError?.("图片大小不能超过 5MB"); event.target.value = ""; return; } uploading.value = true; try { if (isStudentDemo()) { clearVisualization(); visualization.value = { url: URL.createObjectURL(file), name: file.name }; } else { const formData = new FormData(); formData.append("file", file); const result = await uploadStudentTrainingFile(formData); const url = result?.url || result?.data?.url; if (!url) throw new Error("图片上传失败,请重试"); visualization.value = { url, name: file.name }; } proxy?.$modal?.msgSuccess("可视化结果图上传成功"); } catch (error) { proxy?.$modal?.msgError?.(error?.message || "图片上传失败,请重试"); } finally { uploading.value = false; event.target.value = ""; } }
async function saveAndGoToStepFive() { if (saving.value || !stepThreePassed.value) return; saving.value = true; try { await checkMarketOpportunitySelectionStepFour({ visualizationUrl: visualization.value.url }); await saveStudentTrainingAnswer(TASK_KEY, { step4Answer: JSON.stringify(buildStepFourOutcome()), currentStep: 5, submitted: false, saveAction: "SAVE" }); stepFourPassed.value = true; currentStep.value = 5; proxy?.$modal?.msgSuccess("可视化结果已保存,已进入第 5 步"); } catch (error) { proxy?.$modal?.msgError?.(error?.message || "请上传数据可视化结果图"); } finally { saving.value = false; } }
async function saveAndGoToStepSix() { if (saving.value || !stepFourPassed.value) return; saving.value = true; try { await checkMarketOpportunitySelectionStepFive({ insights: products.map((product) => ({ productId: product.id, ...reviewInsights.value[product.id] })) }); dynamicStepAnswers.value = buildDynamicStepAnswers({ step5: buildStepFiveOutcome() }); await saveStudentTrainingAnswer(TASK_KEY, { dynamicStepAnswers: JSON.stringify(dynamicStepAnswers.value), currentStep: 6, submitted: false, saveAction: "SAVE" }); stepFivePassed.value = true; currentStep.value = 6; proxy?.$modal?.msgSuccess("用户需求洞察已保存,已进入第 6 步"); } catch (error) { proxy?.$modal?.msgError?.(error?.message || "请完整填写三类产品的好评率、用户痛点和未被满足的需求"); } finally { saving.value = false; } }
async function saveAndGoToStepFive(advance = true) { if (saving.value || !stepThreePassed.value) return false; saving.value = true; try { await checkMarketOpportunitySelectionStepFour({ visualizationUrl: visualization.value.url }); await saveStudentTrainingAnswer(TASK_KEY, { step4Answer: JSON.stringify(buildStepFourOutcome()), currentStep: advance ? 5 : 4, submitted: false, saveAction: "SAVE" }); stepFourPassed.value = true; if (advance) currentStep.value = 5; proxy?.$modal?.msgSuccess(advance ? "可视化结果已保存,已进入第 5 步" : "当前步骤已保存"); return true; } catch (error) { proxy?.$modal?.msgError?.(error?.message || "请上传数据可视化结果图"); return false; } finally { saving.value = false; } }
async function saveAndGoToStepSix(advance = true) { if (saving.value || !stepFourPassed.value) return false; saving.value = true; try { await checkMarketOpportunitySelectionStepFive({ insights: products.map((product) => ({ productId: product.id, ...reviewInsights.value[product.id] })) }); dynamicStepAnswers.value = buildDynamicStepAnswers({ step5: buildStepFiveOutcome() }); await saveStudentTrainingAnswer(TASK_KEY, { dynamicStepAnswers: JSON.stringify(dynamicStepAnswers.value), currentStep: advance ? 6 : 5, submitted: false, saveAction: "SAVE" }); stepFivePassed.value = true; if (advance) currentStep.value = 6; proxy?.$modal?.msgSuccess(advance ? "用户需求洞察已保存,已进入第 6 步" : "当前步骤已保存"); return true; } catch (error) { proxy?.$modal?.msgError?.(error?.message || "请完整填写三类产品的好评率、用户痛点和未被满足的需求"); return false; } finally { saving.value = false; } }
async function saveCurrentStepSix() { if (saving.value || !stepFivePassed.value) return; saving.value = true; try { await checkMarketOpportunitySelectionStepSix({ developmentConclusion: developmentConclusion.value }); dynamicStepAnswers.value = buildDynamicStepAnswers({ step5: buildStepFiveOutcome(), step6: buildStepSixOutcome() }); await saveStudentTrainingAnswer(TASK_KEY, { dynamicStepAnswers: JSON.stringify(dynamicStepAnswers.value), currentStep: 6, submitted: false, saveAction: "SAVE" }); proxy?.$modal?.msgSuccess("第 6 步已保存"); } catch (error) { proxy?.$modal?.msgError?.(error?.message || "请填写建议开发的产品及具体原因"); } finally { saving.value = false; } }
async function saveCurrentProgress() { if (currentStep.value === 1) return checkAndContinue(false); if (currentStep.value === 2) return saveAndGoToStepThree(false); if (currentStep.value === 3) return saveAndGoToStepFour(false); if (currentStep.value === 4) return saveAndGoToStepFive(false); if (currentStep.value === 5) return saveAndGoToStepSix(false); return saveCurrentStepSix(); }
function previousStep() { if (currentStep.value > 1) currentStep.value -= 1; }
async function nextStep() { if (currentStep.value === 1) return checkAndContinue(true); if (currentStep.value === 2) return saveAndGoToStepThree(true); if (currentStep.value === 3) return saveAndGoToStepFour(true); if (currentStep.value === 4) return saveAndGoToStepFive(true); if (currentStep.value === 5) return saveAndGoToStepSix(true); }
async function submitTraining() { if (saving.value || !stepFivePassed.value) return; saving.value = true; try { await checkMarketOpportunitySelectionStepSix({ developmentConclusion: developmentConclusion.value }); dynamicStepAnswers.value = buildDynamicStepAnswers({ step5: buildStepFiveOutcome(), step6: buildStepSixOutcome() }); await saveStudentTrainingAnswer(TASK_KEY, { dynamicStepAnswers: JSON.stringify(dynamicStepAnswers.value), currentStep: 6, submitted: true, saveAction: "SUBMIT" }); proxy?.$modal?.msgSuccess("实训成果已提交"); } catch (error) { proxy?.$modal?.msgError?.(error?.message || "请填写建议开发的产品及具体原因"); } finally { saving.value = false; } }
function downloadFile(content, fileName, type) { const blob = new Blob([content], { type }); const url = URL.createObjectURL(blob); const link = document.createElement("a"); link.href = url; link.download = fileName; link.click(); URL.revokeObjectURL(url); }
function downloadInstructions() { downloadBuiltInFile(SCORE_CALCULATION_GUIDE_URL, "6.综合得分计算操作说明.docx"); }
@ -207,5 +209,6 @@ function exportOutcome() { const blob = new Blob([JSON.stringify({ taskName: tas
.workbench-eyebrow { margin:0 0 6px; color:#59dcff; font-size:12px; font-weight:800; letter-spacing:.1em; }
.workbench-head h2 { margin:0; color:#fff; font-size:25px; line-height:1.25; }
.market-opportunity-toolbar { flex:0 0 auto; justify-content:flex-end; max-width:100%; }
.step-navigation { display:flex; justify-content:center; gap:12px; margin-top:26px; }
@media (max-width:720px) { .visual-guide { grid-template-columns:1fr; }.workbench-head { align-items:flex-start; flex-direction:column; }.market-opportunity-toolbar { width:100%; justify-content:flex-start; } }
</style>

@ -20,7 +20,7 @@
<p class="section-eyebrow">PRODUCT PRICING</p>
<h2>{{ currentStepTitle }}</h2>
</div>
<TrainingTaskToolbar class="pricing-toolbar" :task-key="TASK_KEY" :on-export="exportPriceOutcome" />
<TrainingTaskToolbar class="pricing-toolbar" :task-key="TASK_KEY" :on-submit="submitCurrentTask" :on-export="exportPriceOutcome" />
</div>
<nav class="step-indicator" aria-label="新产品定价步骤">
@ -105,10 +105,6 @@
<footer class="workbench-footer">
<p>{{ labels.footerTip }}</p>
<div class="footer-actions">
<el-button plain :disabled="saving" @click="resetStepOne">{{ labels.clear }}</el-button>
<el-button type="primary" :loading="saving" @click="saveStepOne">{{ labels.saveStepOne }}</el-button>
</div>
</footer>
</template>
@ -171,10 +167,6 @@
<footer class="workbench-footer">
<p>{{ labels.valueBasedFooterTip }}</p>
<div class="footer-actions">
<el-button plain :disabled="saving" @click="resetStepThree">{{ labels.clearStepThree }}</el-button>
<el-button type="primary" :loading="saving" @click="saveStepThree">{{ labels.saveStepThree }}</el-button>
</div>
</footer>
</section>
</template>
@ -271,11 +263,6 @@
<p v-if="validationMessage" class="validation-message">{{ validationMessage }}</p>
<div class="step-footer">
<button type="button" class="primary-button" :disabled="saving" @click="saveStepFour">
{{ saving ? labels.psmSaving : labels.psmSave }}
</button>
</div>
</section>
</template>
@ -330,11 +317,6 @@
</section>
<p v-if="validationMessage" class="validation-message">{{ validationMessage }}</p>
<div class="step-footer">
<button type="button" class="primary-button" :disabled="saving" @click="saveStepFive">
{{ saving ? labels.finalPricingSaving : labels.finalPricingSave }}
</button>
</div>
</section>
</template>
@ -428,13 +410,10 @@
<footer class="workbench-footer">
<p>{{ labels.competitorFooterTip }}</p>
<div class="footer-actions">
<el-button plain :disabled="saving" @click="resetStepTwo">{{ labels.clearStepTwo }}</el-button>
<el-button type="primary" :loading="saving" @click="saveStepTwo">{{ labels.saveStepTwo }}</el-button>
</div>
</footer>
</template>
</section>
<footer class="step-navigation"><button v-if="currentStep > 1" type="button" class="secondary-button" :disabled="saving" @click="previousStep">上一步</button><button type="button" class="primary-button" :disabled="saving" @click="saveCurrentProgress">保存当前进度</button><button v-if="currentStep < pricingSteps.length" type="button" class="primary-button" :disabled="saving" @click="nextStep">下一步</button></footer>
</section>
</main>
@ -1042,7 +1021,7 @@ function validateStepFive() {
return "";
}
async function saveStepFive() {
async function saveStepFive(submit = false) {
if (saving.value) return;
const message = validateStepFive();
validationMessage.value = message;
@ -1067,13 +1046,13 @@ async function saveStepFive() {
finalPricingAnalysis.value = validated.finalAnalysis ?? finalPricingAnalysis.value;
dynamicStepAnswers.value = { ...dynamicStepAnswers.value, step5: buildStepFiveProgress() };
await saveStudentTrainingAnswer(TASK_KEY, {
saveAction: "SUBMIT",
saveAction: submit ? "SUBMIT" : "SAVE",
currentStep: 5,
submitted: true,
submitted: submit,
dynamicStepAnswers: JSON.stringify(dynamicStepAnswers.value),
});
hasSavedAnswer.value = true;
proxy?.$modal?.msgSuccess?.(labels.finalPricingSaveSuccess);
proxy?.$modal?.msgSuccess?.(submit ? labels.finalPricingSaveSuccess : "当前步骤已保存");
} finally {
saving.value = false;
}
@ -1303,7 +1282,23 @@ function switchStep(step) {
clearValidation();
}
async function saveStepOne() {
function previousStep() { if (currentStep.value > 1) switchStep(currentStep.value - 1); }
async function saveCurrentProgress() {
if (currentStep.value === 1) return saveStepOne(false);
if (currentStep.value === 2) return saveStepTwo();
if (currentStep.value === 3) return saveStepThree();
if (currentStep.value === 4) return saveStepFour();
return saveStepFive(false);
}
async function nextStep() {
const before = currentStep.value;
if (before === 1) return saveStepOne(true);
await saveCurrentProgress();
if (!validationMessage.value && currentStep.value === before) switchStep(before + 1);
}
async function submitCurrentTask() { return saveStepFive(true); }
async function saveStepOne(advance = true) {
if (saving.value) {
return;
}
@ -1331,12 +1326,12 @@ async function saveStepOne() {
}));
await saveStudentTrainingAnswer(TASK_KEY, {
saveAction: "SAVE",
currentStep: 2,
currentStep: advance ? 2 : 1,
step1Answer: JSON.stringify(buildStepOneProgress()),
});
hasSavedAnswer.value = true;
currentStep.value = 2;
proxy?.$modal?.msgSuccess?.(labels.stepOneSaveSuccess);
if (advance) currentStep.value = 2;
proxy?.$modal?.msgSuccess?.(advance ? labels.stepOneSaveSuccess : "当前步骤已保存");
} finally {
saving.value = false;
}
@ -2438,4 +2433,5 @@ onMounted(async () => {
}
}
.step-connector { overflow: visible; }
.step-navigation { display:flex; justify-content:center; gap:12px; margin-top:24px; }
</style>

@ -14,7 +14,7 @@
<p class="section-eyebrow">{{ currentStep === 3 ? 'PRD document delivery' : currentStep === 2 ? 'PRD detailed specification' : 'PRD module matching' }}</p>
<h2>{{ trainingSteps[currentStep - 1] || '产品需求说明书' }}</h2>
</div>
<TrainingTaskToolbar class="requirements-doc-toolbar" :task-key="TASK_KEY" :on-export="exportOutcome" />
<TrainingTaskToolbar class="requirements-doc-toolbar" :task-key="TASK_KEY" :on-submit="submitTask" :on-export="exportOutcome" />
</div>
<nav class="step-indicator" aria-label="产品需求文档撰写步骤">
@ -78,12 +78,6 @@
</div>
<p v-if="checkResult" class="result-message" :class="{ success: checkResult.allCorrect }">{{ checkResult.message }}</p>
<div class="task-actions">
<button type="button" class="btn-nav" :disabled="saving" @click="saveCurrentMatching">保存当前匹配</button>
<button type="button" class="btn-nav btn-submit" :disabled="checking || !allAssigned" @click="checkAndSave">{{ checking ? '判题中…' : '检查匹配并保存' }}</button>
<button type="button" class="btn-nav" :disabled="checking || saving" @click="resetMatching"><el-icon><RefreshLeft /></el-icon>重新打乱</button>
<button type="button" class="btn-nav btn-primary" :disabled="!stepOnePassed" @click="goNextStep">进入第 2 步 <el-icon><ArrowRight /></el-icon></button>
</div>
</section>
<section v-else-if="currentStep === 2" class="step-card prd-detail-card">
@ -108,11 +102,6 @@
</tbody>
</table>
</div>
<div class="task-actions">
<button type="button" class="btn-nav" :disabled="saving" @click="saveStepTwo">{{ saving ? '保存中…' : '保存详细信息' }}</button>
<button type="button" class="btn-nav btn-submit" @click="exportStepTwoTable"><el-icon><Download /></el-icon>导出 PRD 表格</button>
<button type="button" class="btn-nav btn-primary" :disabled="saving" @click="goToStepThree">进入第 3 步<el-icon><ArrowRight /></el-icon></button>
</div>
</section>
<section v-else-if="currentStep === 3" class="step-card prd-upload-card">
@ -146,11 +135,6 @@
</div>
</article>
<div class="task-actions">
<button type="button" class="btn-nav" :disabled="!isDocumentReady || saving || submitting || documentUploading" @click="saveStepThree">{{ saving ? '保存中…' : '保存文档' }}</button>
<button type="button" class="btn-nav btn-submit" :disabled="!isDocumentReady || documentUploading" @click="showDocumentPreview = true"><el-icon><View /></el-icon>预览文档</button>
<button type="button" class="btn-nav btn-primary" :disabled="!canSubmitTask || saving || submitting || documentUploading" @click="submitTask">{{ submitting ? '提交中…' : '提交任务' }}</button>
</div>
</section>
<section v-else class="step-card upcoming-card">
@ -159,6 +143,11 @@
<p>该步骤将在对应实训页面继续完成。</p>
<button type="button" class="btn-nav" @click="switchStep(2)">返回第 2 步</button>
</section>
<footer class="step-navigation">
<button v-if="currentStep > 1" type="button" class="btn-nav" :disabled="saving || checking || documentUploading" @click="previousStep">上一步</button>
<button type="button" class="btn-nav btn-primary" :disabled="saving || checking || documentUploading" @click="saveCurrentProgress">保存当前进度</button>
<button v-if="currentStep < 3" type="button" class="btn-nav btn-primary" :disabled="saving || checking || documentUploading" @click="nextStep">下一步</button>
</footer>
</section>
<el-dialog v-model="showDocumentPreview" :title="stepThreeDocument.name || '产品需求文档预览'" width="min(1040px, 94vw)" class="prd-preview-dialog" append-to-body>
@ -494,6 +483,20 @@ function switchStep(step) {
proxy?.$modal?.msgInfo("请先完成当前步骤后再进入后续实训。");
}
function goNextStep() { switchStep(2); }
function previousStep() { if (currentStep.value > 1) currentStep.value -= 1; }
async function saveCurrentProgress() {
if (currentStep.value === 1) return saveCurrentMatching();
if (currentStep.value === 2) return saveStepTwo();
return saveStepThree();
}
async function nextStep() {
if (currentStep.value === 1) {
await checkAndSave();
if (stepOnePassed.value) currentStep.value = 2;
return;
}
if (currentStep.value === 2) return goToStepThree();
}
function exportOutcome() { if (currentStep.value === 2) { exportStepTwoTable(); } else if (currentStep.value === 3 && isDocumentReady.value) { showDocumentPreview.value = true; } else { proxy?.$modal?.msgInfo("请进入第 2 步导出 PRD 详细信息表。"); } }
</script>
@ -507,7 +510,7 @@ function exportOutcome() { if (currentStep.value === 2) { exportStepTwoTable();
.step-indicator { display: flex; align-items: stretch; margin: 26px 0; padding: 10px; overflow-x: auto; border: 1px solid rgba(58, 170, 220, .35); border-radius: 18px; background: rgba(0, 15, 28, .45); }.step-tab { display: flex; min-width: 185px; flex: 1; align-items: center; gap: 10px; padding: 10px 12px; border: 0; border-radius: 12px; color: #8baabd; background: transparent; text-align: left; cursor: pointer; }.step-tab.active { color: #fff; background: linear-gradient(90deg, #087eb3, #12a7d5); box-shadow: inset 0 0 0 1px rgba(157, 239, 255, .55); }.step-tab.complete .step-marker { border-color: #53f1d5; color: #53f1d5; }.step-marker { display: inline-grid; width: 33px; height: 33px; flex: 0 0 33px; place-items: center; border: 1px solid #4c91b5; border-radius: 50%; font-weight: 700; }.step-copy { display: grid; gap: 3px; }.step-copy small { font-size: 11px; }.step-connector { width: 22px; min-width: 22px; align-self: center; height: 1px; background: #287596; }
.step-card { padding: 25px; border: 1px solid rgba(50, 162, 208, .42); border-radius: 18px; background: rgba(2, 18, 30, .58); }.step-desc { margin: 18px 0; color: #c0d2df; line-height: 1.8; }.matching-tip, .prd-note { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 20px; padding: 10px 13px; border-left: 3px solid #2ed4f0; border-radius: 5px; color: #a9ddeb; background: rgba(28, 122, 157, .15); font-size: 14px; line-height: 1.65; }
.matching-workspace { display: grid; grid-template-columns: minmax(0, 1.22fr) minmax(350px, .78fr); gap: 24px; align-items: start; }.module-list { display: grid; gap: 10px; }.module-row { display: grid; grid-template-columns: minmax(185px, .31fr) minmax(0, .69fr); min-height: 84px; overflow: hidden; border: 1px solid rgba(124, 166, 189, .45); border-radius: 10px; background: rgba(11, 39, 56, .48); transition: .18s ease; cursor: pointer; }.module-row--over { border-color: #48e3ff; box-shadow: 0 0 0 3px rgba(55, 215, 248, .16); }.module-row--filled { border-color: rgba(74, 220, 182, .56); }.module-label { display: flex; align-items: center; gap: 12px; padding: 16px; border-right: 1px solid rgba(124, 166, 189, .35); color: #eef9ff; background: rgba(13, 81, 113, .28); }.module-label span { display: grid; width: 27px; height: 27px; place-items: center; border-radius: 50%; color: #7ee6ff; background: rgba(11, 172, 214, .16); font-size: 12px; }.module-drop-zone { display: flex; align-items: center; padding: 10px 12px; }.drop-placeholder { color: #7696a8; font-size: 14px; }
.purpose-bank { position: sticky; top: 22px; padding: 18px; border: 1px solid rgba(66, 178, 226, .45); border-radius: 14px; background: linear-gradient(180deg, rgba(10, 71, 100, .38), rgba(7, 29, 45, .72)); transition: .18s ease; }.purpose-bank--over { border-color: #ffba67; box-shadow: 0 0 0 3px rgba(255, 186, 103, .16); }.purpose-bank__head strong { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid rgba(97, 222, 255, .58); border-radius: 50%; color: #8eeaff; }.purpose-bank > p { margin: 12px 0 15px; color: #9cb8c7; font-size: 13px; line-height: 1.65; }.purpose-card-list { display: grid; gap: 9px; max-height: 570px; overflow: auto; padding-right: 3px; }.purpose-card { display: flex; align-items: center; width: 100%; gap: 8px; padding: 11px 12px; border: 1px solid rgba(111, 158, 179, .5); border-radius: 8px; color: #e4f4fb; background: rgba(7, 31, 47, .72); text-align: left; line-height: 1.55; cursor: grab; transition: .18s ease; }.purpose-card:hover, .purpose-card.selected { border-color: #53ddfb; background: rgba(14, 116, 153, .43); }.purpose-card.dragging { opacity: .5; }.purpose-card--assigned { cursor: grab; }.purpose-card--assigned span { flex: 1; }.purpose-card--assigned button { display: inline-grid; width: 26px; height: 26px; flex: 0 0 26px; place-items: center; border: 0; border-radius: 50%; color: #b9ebfa; background: rgba(104, 196, 224, .17); cursor: pointer; }.purpose-card--assigned button:hover { color: #fff; background: #bd5068; }.drag-grip { color: #5fd5ed; letter-spacing: -3px; }.purpose-bank__empty { padding: 22px 8px; color: #82b3c8; text-align: center; }.result-message { margin: 20px 0 0; padding: 11px 14px; border: 1px solid rgba(255, 168, 112, .52); border-radius: 8px; color: #ffd5ad; background: rgba(157, 77, 35, .14); }.result-message.success { border-color: rgba(84, 230, 187, .56); color: #a6f4d8; background: rgba(16, 134, 99, .16); }.task-actions { justify-content: flex-end; margin-top: 21px; }
.purpose-bank { position: sticky; top: 22px; padding: 18px; border: 1px solid rgba(66, 178, 226, .45); border-radius: 14px; background: linear-gradient(180deg, rgba(10, 71, 100, .38), rgba(7, 29, 45, .72)); transition: .18s ease; }.purpose-bank--over { border-color: #ffba67; box-shadow: 0 0 0 3px rgba(255, 186, 103, .16); }.purpose-bank__head strong { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid rgba(97, 222, 255, .58); border-radius: 50%; color: #8eeaff; }.purpose-bank > p { margin: 12px 0 15px; color: #9cb8c7; font-size: 13px; line-height: 1.65; }.purpose-card-list { display: grid; gap: 9px; max-height: 570px; overflow: auto; padding-right: 3px; }.purpose-card { display: flex; align-items: center; width: 100%; gap: 8px; padding: 11px 12px; border: 1px solid rgba(111, 158, 179, .5); border-radius: 8px; color: #e4f4fb; background: rgba(7, 31, 47, .72); text-align: left; line-height: 1.55; cursor: grab; transition: .18s ease; }.purpose-card:hover, .purpose-card.selected { border-color: #53ddfb; background: rgba(14, 116, 153, .43); }.purpose-card.dragging { opacity: .5; }.purpose-card--assigned { cursor: grab; }.purpose-card--assigned span { flex: 1; }.purpose-card--assigned button { display: inline-grid; width: 26px; height: 26px; flex: 0 0 26px; place-items: center; border: 0; border-radius: 50%; color: #b9ebfa; background: rgba(104, 196, 224, .17); cursor: pointer; }.purpose-card--assigned button:hover { color: #fff; background: #bd5068; }.drag-grip { color: #5fd5ed; letter-spacing: -3px; }.purpose-bank__empty { padding: 22px 8px; color: #82b3c8; text-align: center; }.result-message { margin: 20px 0 0; padding: 11px 14px; border: 1px solid rgba(255, 168, 112, .52); border-radius: 8px; color: #ffd5ad; background: rgba(157, 77, 35, .14); }.result-message.success { border-color: rgba(84, 230, 187, .56); color: #a6f4d8; background: rgba(16, 134, 99, .16); }.task-actions { justify-content: flex-end; margin-top: 21px; }.step-navigation { display:flex; justify-content:center; gap:12px; margin-top:24px; }
.prd-detail-card { overflow: hidden; }.prd-table-wrap { overflow: auto; border: 1px solid rgba(102, 184, 223, .5); border-radius: 12px; }.prd-detail-table { width: 100%; min-width: 1000px; border-collapse: separate; border-spacing: 0; table-layout: fixed; }.prd-detail-table th { padding: 13px; color: #effbff; background: linear-gradient(90deg, #087da9, #0b9bca); font-weight: 700; }.prd-detail-table td { padding: 12px; border-top: 1px solid rgba(115, 165, 188, .38); border-right: 1px solid rgba(115, 165, 188, .38); vertical-align: top; background: rgba(9, 38, 57, .44); }.prd-detail-table th:not(:last-child) { border-right: 1px solid rgba(212, 246, 255, .25); }.prd-detail-table td:last-child { border-right: 0; }.prd-detail-table th:nth-child(1), .module-number { width: 72px; text-align: center; }.prd-detail-table th:nth-child(2), .module-name { width: 155px; }.prd-detail-table th:nth-child(3), .submodule-name { width: 245px; }.module-number, .module-name, .submodule-name { color: #dff6ff; vertical-align: middle !important; }.module-name { background: rgba(10, 90, 122, .28) !important; font-weight: 700; }.submodule-name { background: rgba(20, 69, 92, .28) !important; }.detail-editor-cell { min-width: 480px; }.example-bar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 9px; color: #7fa6ba; font-size: 13px; line-height: 1.6; }.example-bar button { flex: 0 0 auto; padding: 4px 8px; border: 1px solid rgba(96, 201, 237, .5); border-radius: 6px; color: #9deaff; background: rgba(5, 86, 124, .24); cursor: pointer; }.example-bar button:hover { color: #fff; background: rgba(12, 139, 182, .6); }.detail-editor-cell textarea { display: block; width: 100%; min-height: 92px; resize: vertical; box-sizing: border-box; padding: 10px; border: 1px solid rgba(108, 182, 215, .36); border-radius: 8px; outline: none; color: #eaf8ff; background: rgba(1, 18, 29, .62); font: inherit; line-height: 1.65; }.detail-editor-cell textarea:focus { border-color: #3ddff9; box-shadow: 0 0 0 3px rgba(55, 215, 248, .12); }.detail-editor-cell textarea::placeholder { color: #66899c; }.upcoming-card { text-align: center; }.upcoming-card h3 { margin: 8px 0; }.upcoming-card p:not(.section-eyebrow) { color: #a6c2d2; }
.file-input-hidden { display: none; }.prd-upload-card { overflow: hidden; }.prd-delivery-guide { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 22px; align-items: center; padding: 20px 22px; border: 1px solid rgba(72, 201, 255, .2); border-radius: 16px; background: linear-gradient(135deg, rgba(20, 86, 127, .28), rgba(8, 32, 54, .2)); }.prd-delivery-guide h3 { margin: 0 0 10px; font-size: 18px; color: #eef9ff; }.prd-delivery-guide ol { margin: 0; padding-left: 20px; color: #b8d3e2; line-height: 1.8; }.document-drop-zone { display: grid; min-height: 270px; place-content: center; justify-items: center; gap: 14px; padding: 30px; margin-top: 20px; border: 1px dashed rgba(81, 207, 255, .5); border-radius: 18px; background: radial-gradient(circle at 50% 0, rgba(41, 180, 235, .16), transparent 52%), rgba(8, 33, 52, .56); text-align: center; transition: .2s ease; }.document-drop-zone:hover { border-color: #4ad4ff; background-color: rgba(14, 65, 95, .66); transform: translateY(-2px); }.document-upload-icon { font-size: 42px; color: #42d8ff; }.document-drop-zone h3 { margin: 0; color: #eefaff; font-size: 21px; }.document-drop-zone p { max-width: 560px; margin: 0; color: #a6c2d2; line-height: 1.7; }.uploaded-document-card { display: flex; align-items: center; gap: 16px; padding: 18px 20px; margin-top: 20px; border: 1px solid rgba(69, 206, 255, .3); border-radius: 16px; background: rgba(9, 45, 70, .72); }.document-file-icon { flex: 0 0 auto; font-size: 32px; color: #55dcff; }.uploaded-document-main { min-width: 0; flex: 1; }.uploaded-document-main h3 { overflow: hidden; margin: 0 0 5px; color: #f0fbff; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }.uploaded-document-main p { margin: 0; color: #9cc1d4; font-size: 13px; }.uploaded-document-actions { display: flex; flex: 0 0 auto; flex-wrap: wrap; gap: 9px; }.btn-danger { border: 1px solid rgba(255, 115, 127, .45); color: #ffacb3; background: rgba(116, 32, 48, .25); }.btn-danger:hover { border-color: #ff7884; background: rgba(150, 38, 55, .38); color: #fff; }.prd-pdf-preview { height: min(68vh, 780px); overflow: hidden; border: 1px solid #d8e4ea; border-radius: 10px; background: #fff; }.prd-pdf-preview iframe { width: 100%; height: 100%; border: 0; }.prd-text-preview { max-height: min(68vh, 780px); overflow: auto; padding: 20px; border: 1px solid #d8e4ea; border-radius: 10px; color: #263849; background: #f8fbfd; font-family: "Microsoft YaHei", sans-serif; line-height: 1.8; white-space: pre-wrap; word-break: break-word; }
@media (max-width: 1020px) { .matching-workspace { grid-template-columns: 1fr; }.purpose-bank { position: static; }.purpose-card-list { max-height: 360px; }.workbench-head { align-items: flex-start; flex-direction: column; }.requirements-doc-toolbar { width: 100%; justify-content: flex-start; } }

@ -14,7 +14,7 @@
<p class="section-eyebrow">Smart hardware architecture</p>
<h3>{{ trainingSteps[currentStep - 1] || '产品架构设计' }}</h3>
</div>
<TrainingTaskToolbar class="architecture-toolbar" :task-key="TASK_KEY" :on-export="exportOutcome" />
<TrainingTaskToolbar class="architecture-toolbar" :task-key="TASK_KEY" :on-submit="checkAndSaveStepFour" :on-export="exportOutcome" />
</div>
<nav class="step-indicator" aria-label="产品架构设计步骤">
@ -47,11 +47,6 @@
</div>
<p v-if="checkResult" class="result-message" :class="{ success: checkResult.allCorrect }">{{ checkResult.message || (checkResult.allCorrect ? '排序正确,已解锁下一步。' : `当前仅 ${checkResult.correctPositionCount}/${checkResult.totalCount} 个位置正确,请继续调整。`) }}</p>
<div class="task-actions">
<button type="button" class="btn-nav btn-submit" :disabled="checking" @click="checkAndSave">{{ checking ? '判题中…' : '检查排序并保存' }}</button>
<button type="button" class="btn-nav" :disabled="checking" @click="shuffleLayers"><el-icon><RefreshLeft /></el-icon>重新打乱</button>
<button type="button" class="btn-nav btn-primary" :disabled="!stepOnePassed" @click="goNextStep">进入第 2 步<el-icon><ArrowRight /></el-icon></button>
</div>
</section>
<section v-else-if="currentStep === 2" class="step-card">
@ -74,11 +69,6 @@
</div>
<p v-if="stepTwoCheckResult" class="result-message" :class="{ success: stepTwoCheckResult.allCorrect }">{{ stepTwoCheckResult.message || (stepTwoCheckResult.allCorrect ? '排序正确,已解锁下一步。' : `当前仅 ${stepTwoCheckResult.correctPositionCount}/${stepTwoCheckResult.totalCount} 个位置正确,请继续调整。`) }}</p>
<div class="task-actions">
<button type="button" class="btn-nav btn-submit" :disabled="checking" @click="checkAndSaveStepTwo">{{ checking ? '判题中…' : '检查排序并保存' }}</button>
<button type="button" class="btn-nav" :disabled="checking" @click="shuffleFlow"><el-icon><RefreshLeft /></el-icon>重新打乱</button>
<button type="button" class="btn-nav btn-primary" :disabled="!stepTwoPassed" @click="goNextStep">进入第 3 步<el-icon><ArrowRight /></el-icon></button>
</div>
</section>
<section v-else-if="currentStep === 3" class="step-card">
@ -113,10 +103,6 @@
</div>
<p v-if="stepThreeCheckResult" class="result-message" :class="{ success: stepThreeCheckResult.valid }">{{ stepThreeCheckResult.message }}</p>
<div class="task-actions">
<button type="button" class="btn-nav btn-submit" :disabled="checking" @click="checkAndSaveStepThree">{{ checking ? '校验中…' : '校验并保存' }}</button>
<button type="button" class="btn-nav btn-primary" :disabled="!stepThreePassed" @click="goNextStep">进入第 4 步<el-icon><ArrowRight /></el-icon></button>
</div>
</section>
<section v-else-if="currentStep === 4" class="step-card">
@ -139,9 +125,9 @@
</section>
<section class="architecture-guide"><h4>参考工具及方案</h4><ol><li>下载模板,按应用功能层、算法处理层、驱动感知层、硬件物理层补全逻辑调用关系。</li><li>每张图围绕一个核心功能绘制,使用箭头清晰标注信号流向。</li></ol><button type="button" @click="downloadArchitectureTemplate">下载模板</button></section>
<p v-if="stepFourCheckResult" class="result-message" :class="{ success: stepFourCheckResult.valid }">{{ stepFourCheckResult.message }}</p>
<div class="task-actions"><button type="button" class="btn-nav" :disabled="uploadingArchitectureImage !== null || checking" @click="saveStepFour">保存进度</button><button type="button" class="btn-nav btn-submit" :disabled="uploadingArchitectureImage !== null || checking" @click="checkAndSaveStepFour">{{ checking ? '校验中…' : '校验并完成实训' }}</button></div>
</section>
<section v-else class="step-card placeholder-card"><p class="section-eyebrow">Step {{ String(currentStep).padStart(2, '0') }}</p><h3>{{ trainingSteps[currentStep - 1] }}</h3></section>
<footer class="step-navigation"><button v-if="currentStep > 1" type="button" class="btn-nav" :disabled="checking || uploadingArchitectureImage !== null" @click="previousStep">上一步</button><button type="button" class="btn-nav btn-primary" :disabled="checking || uploadingArchitectureImage !== null" @click="saveCurrentProgress">保存当前进度</button><button v-if="currentStep < trainingSteps.length" type="button" class="btn-nav btn-primary" :disabled="checking || uploadingArchitectureImage !== null" @click="nextStep">下一步</button></footer>
</section>
</main>
@ -150,7 +136,7 @@
</template>
<script setup>
import { ArrowLeft, ArrowRight, Download, Operation, RefreshLeft, Upload } from "@element-plus/icons-vue";
import { Download, Operation, Upload } from "@element-plus/icons-vue";
import { checkProductArchitectureDesignStepOne, checkProductArchitectureDesignStepTwo, checkProductArchitectureDesignStepThree, checkProductArchitectureDesignStepFour, getStudentTrainingAnswer, saveStudentTrainingAnswer, uploadStudentTrainingFile } from "@/api/studentTrainingAnswer";
import { getTrainingTaskByKey } from "@/api/trainingTask";
import { parseTrainingArray } from "@/views/training/taskKeyMap";
@ -373,6 +359,17 @@ async function goNextStep() {
if ((currentStep.value === 1 && !stepOnePassed.value) || (currentStep.value === 2 && !stepTwoPassed.value) || (currentStep.value === 3 && !stepThreePassed.value)) return;
currentStep.value = Math.min(currentStep.value + 1, trainingSteps.value.length); await persist("SAVE");
}
function previousStep() { if (currentStep.value > 1) currentStep.value -= 1; }
async function saveCurrentProgress() {
if (currentStep.value === 1) return checkAndSave();
if (currentStep.value === 2) return checkAndSaveStepTwo();
if (currentStep.value === 3) return checkAndSaveStepThree();
return saveStepFour();
}
async function nextStep() {
await saveCurrentProgress();
if ((currentStep.value === 1 && stepOnePassed.value) || (currentStep.value === 2 && stepTwoPassed.value) || (currentStep.value === 3 && stepThreePassed.value)) return goNextStep();
}
function switchStep(step) {
if (step > 1 && !stepOnePassed.value) { proxy?.$modal?.msgWarning("请先完成第 1 步排序并判题通过"); return; }
if (step > 2 && !stepTwoPassed.value) { proxy?.$modal?.msgWarning("请先完成第 2 步排序并判题通过"); return; }
@ -392,4 +389,5 @@ function exportOutcome() { const blob = new Blob([JSON.stringify(buildAnswer(),
@media (max-width: 720px) {
.architecture-toolbar { width: 100%; justify-content: flex-start; }
}
.step-navigation{display:flex;justify-content:center;gap:12px;margin-top:24px}
</style>

@ -40,14 +40,12 @@
<funnelAnalysis></funnelAnalysis>
</div>
<TrainingLegacyActions />
<TrainingAiSidebar />
</div>
</template>
<script setup>
import TrainingLegacyActions from "@/views/components/TrainingLegacyActions.vue";
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
import TrainingIntro from '@/views/components/TrainingIntro.vue';
import popModel from "@/views/components/popModal.vue";
@ -72,4 +70,3 @@ const dialogVisible = ref(false);

@ -14,7 +14,7 @@
<p class="section-eyebrow">STEP {{ String(activeStep).padStart(2, "0") }}</p>
<h2>{{ stepTitle }}</h2>
</div>
<TrainingTaskToolbar class="release-channel-toolbar" task-key="release-channel-evaluation" />
<TrainingTaskToolbar class="release-channel-toolbar" task-key="release-channel-evaluation" :on-submit="validateRankingStep" />
</header>
<nav class="step-tabs" aria-label="产品发布渠道评估步骤">
@ -158,7 +158,6 @@
<footer class="footer-actions">
<el-button @click="activeStep = 3">上一步</el-button>
<el-button :loading="saving" @click="saveRankingStep">保存当前进度</el-button>
<el-button type="primary" :loading="validating" @click="validateRankingStep">提交任务</el-button>
</footer>
</section>
</section>

@ -82,19 +82,13 @@
广告C:点击率和转化率都低,需重新评估广告策略或优化广告内容。
</p>
<div class="taskfooter">
<el-button @click="submitTask">提交任务</el-button>
<el-button @click="resetTask">重新实训</el-button>
</div>
</div>
<TrainingLegacyActions />
<TrainingAiSidebar />
</div>
</template>
<script setup>
import TrainingLegacyActions from "@/views/components/TrainingLegacyActions.vue";
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
import TrainingIntro from '@/views/components/TrainingIntro.vue';
import useUserStore from "@/store/modules/user";
@ -306,4 +300,3 @@ onMounted(() => {

@ -66,7 +66,7 @@
</table>
</div>
<p v-if="!availableChannels.length" class="source-warning">尚未读取到产品发布渠道评估的渠道数据。请先完成并保存该模块的渠道数据。</p>
<footer class="footer-actions"><el-button :loading="saving" @click="saveBudgetDraft">保存当前进度</el-button><el-button type="primary" :loading="validating" @click="validateBudgetAndContinue">保存并进入下一步 <el-icon><ArrowRight /></el-icon></el-button></footer>
<footer class="footer-actions"><el-button :loading="saving" @click="saveBudgetDraft">保存当前进度</el-button><el-button type="primary" :loading="validating" @click="validateBudgetAndContinue">下一步 <el-icon><ArrowRight /></el-icon></el-button></footer>
</section>
<section v-else-if="activeStep === 2" class="strategy-form">
@ -95,7 +95,7 @@
</div>
</el-collapse-item>
</el-collapse>
<footer class="footer-actions"><el-button @click="activeStep = 1">上一步</el-button><el-button :loading="saving" @click="saveStrategyDraft">保存当前进度</el-button><el-button type="primary" :loading="validating" @click="validateStrategies">保存并校验 <el-icon><ArrowRight /></el-icon></el-button></footer>
<footer class="footer-actions"><el-button @click="activeStep = 1">上一步</el-button><el-button :loading="saving" @click="saveStrategyDraft">保存当前进度</el-button><el-button type="primary" :loading="validating" @click="validateStrategies">下一步 <el-icon><ArrowRight /></el-icon></el-button></footer>
</section>
<section v-else-if="activeStep === 3" class="performance-form">
@ -130,7 +130,7 @@
</table>
</div>
</section>
<footer class="footer-actions"><el-button @click="activeStep = 2">上一步</el-button><el-button :loading="saving" @click="savePerformanceDraft">保存当前进度</el-button><el-button type="primary" :loading="validating" @click="validatePerformance">保存并校验 <el-icon><ArrowRight /></el-icon></el-button></footer>
<footer class="footer-actions"><el-button @click="activeStep = 2">上一步</el-button><el-button :loading="saving" @click="savePerformanceDraft">保存当前进度</el-button><el-button type="primary" :loading="validating" @click="validatePerformance">下一步 <el-icon><ArrowRight /></el-icon></el-button></footer>
</section>
<section v-else class="evaluation-form">
@ -159,7 +159,7 @@
<p>结合整体 ROI 与各渠道达标情况,总结本方案是否需要调整、调整方向,以及优先调整的渠道。</p>
<el-input v-model="optimizationDecision" type="textarea" :autosize="{ minRows: 7, maxRows: 14 }" placeholder="填写整体 ROI 是否达标、拖累整体效果的渠道及优先优化方向" />
</section>
<footer class="footer-actions"><el-button @click="activeStep = 3">上一步</el-button><el-button :loading="saving" @click="saveEvaluationDraft">保存当前进度</el-button><el-button type="primary" :loading="validating" @click="submitEvaluation">提交任务 <el-icon><ArrowRight /></el-icon></el-button></footer>
<footer class="footer-actions"><el-button @click="activeStep = 3">上一步</el-button><el-button type="primary" :loading="saving" @click="saveEvaluationDraft">保存当前进度</el-button></footer>
</section>
</section>
</main>

@ -33,10 +33,10 @@
</div>
</section>
<footer class="actions">
<el-button @click="router.back()">返回任务</el-button>
<el-button :loading="saving" @click="save(false)">保存草稿</el-button>
<el-button type="primary" :loading="saving" @click="save(true)">提交本步骤</el-button>
<footer class="actions step-navigation">
<el-button v-if="stepIndex > 0" :disabled="saving" @click="goPrevious">上一步</el-button>
<el-button type="primary" :loading="saving" @click="save(false)">保存当前进度</el-button>
<el-button v-if="stepIndex < taskSteps.length - 1" type="primary" :disabled="saving" @click="goNext">下一步</el-button>
</footer>
</main>
<el-empty v-else description="未找到这个自定义实训步骤" />
@ -58,6 +58,8 @@ const dynamicAnswers = ref({});
const fileInput = ref(null);
const saving = ref(false);
const uploading = ref(false);
const taskSteps = computed(() => parseSteps(task.value?.steps));
const stepIndex = computed(() => taskSteps.value.findIndex((item) => item.id === step.value?.id));
watch(
() => [route.params.taskKey, route.params.stepId],
@ -153,6 +155,16 @@ async function save(submitStep) {
saving.value = false;
}
}
function goPrevious() {
const previous = taskSteps.value[stepIndex.value - 1];
if (previous) router.push(`/training-step/${route.params.taskKey}/${previous.id}`);
}
async function goNext() {
await save(false);
const next = taskSteps.value[stepIndex.value + 1];
if (next) router.push(`/training-step/${route.params.taskKey}/${next.id}`);
}
</script>
<style lang="scss" scoped>

@ -386,6 +386,12 @@
</section>
<footer v-if="configuredSteps.length" class="step-navigation" aria-label="步骤操作">
<el-button v-if="currentStep > 1" plain @click="goPreviousStep">上一步</el-button>
<el-button type="primary" :loading="saving" @click="saveCurrentProgress">保存当前进度</el-button>
<el-button v-if="currentStep < configuredSteps.length" plain @click="goNextStep">下一步</el-button>
</footer>
</section>
</main>
@ -1503,14 +1509,16 @@ function buildAnswerPayload(saveAction = "SAVE") {
}
async function saveAnswer(saveAction = "SAVE") {
if (!pageKey.value || saving.value) return;
if (!pageKey.value || saving.value) return false;
saving.value = true;
try {
await saveStudentTrainingAnswer(pageKey.value, buildAnswerPayload(saveAction));
hasSavedAnswer.value = hasAnyAnswer.value;
proxy?.$modal?.msgSuccess(saveAction === "SUBMIT" ? "提交成功" : "已保存");
return true;
} catch (error) {
proxy?.$modal?.msgError?.(saveAction === "SUBMIT" ? "提交失败" : "保存失败");
return false;
} finally {
saving.value = false;
}
@ -1520,6 +1528,20 @@ function saveCurrentProgress() {
return saveAnswer("SAVE");
}
function goPreviousStep() {
if (currentStep.value > 1) {
currentStep.value -= 1;
}
}
async function goNextStep() {
if (currentStep.value >= configuredSteps.value.length) return;
const saved = await saveCurrentProgress();
if (saved) {
currentStep.value += 1;
}
}
function submitTask() {
return saveAnswer("SUBMIT");
}
@ -1767,6 +1789,36 @@ function exportOutcome() {
gap: 10px;
}
.step-navigation {
display: flex;
justify-content: center;
align-items: center;
gap: 12px;
margin-top: 22px;
padding-top: 20px;
border-top: 1px solid rgba(0, 180, 255, 0.18);
:deep(.el-button) {
min-width: 112px;
height: 38px;
margin: 0;
border-radius: 999px;
font-weight: 800;
}
:deep(.el-button--primary) {
border-color: #18b9ee;
background: linear-gradient(100deg, #14b8f2, #0785c2);
box-shadow: 0 0 18px rgba(28, 191, 245, 0.2);
}
:deep(.el-button.is-plain) {
border-color: rgba(80, 204, 247, 0.62);
color: #b7efff;
background: rgba(8, 78, 112, 0.42);
}
}
.material-download {
display: inline-flex;
align-items: center;
@ -2531,6 +2583,14 @@ function exportOutcome() {
justify-content: flex-start;
}
.step-navigation {
flex-wrap: wrap;
:deep(.el-button) {
flex: 1 1 132px;
}
}
.form-grid {
grid-template-columns: 1fr;
}

Loading…
Cancel
Save