fix/exam-question-access-material-excel-delete-draft
qinzhenpen 3 months ago
commit 97ce7b394e

@ -17,6 +17,14 @@ import cache from "@/plugins/cache";
import { removeUserInfo, removeToken } from "@/utils/auth.js";
const stepNameSelector = ".step-tab .step-copy > strong, .step-tab .step-copy > b, .step-tab .step-copy > .step-name";
const stepActionSelector = [
".student-training-shell .step-actions > button",
".student-training-shell .step-navigation > button",
".student-training-shell .footer-actions > button",
".student-training-shell .training-actions > button",
".student-training-shell .task-actions > button",
".student-training-shell .taskfooter > button",
].join(",");
let stepNameObserver;
let stepTitleRefreshQueued = false;
@ -27,11 +35,24 @@ function addStepNameTitles() {
});
}
function normalizeStepActionStyles() {
document.querySelectorAll(stepActionSelector).forEach((button) => {
const label = String(button.textContent || "").replace(/\s+/g, " ").trim();
const isPrevious = label.includes("上一步");
const isPrimary = label.includes("保存当前进度") || label.includes("下一步");
if (!isPrevious && !isPrimary) return;
button.classList.add("student-step-action");
button.classList.toggle("student-step-action--primary", isPrimary);
button.classList.toggle("student-step-action--secondary", isPrevious);
});
}
function queueStepNameTitleRefresh() {
if (stepTitleRefreshQueued) return;
stepTitleRefreshQueued = true;
requestAnimationFrame(() => {
addStepNameTitles();
normalizeStepActionStyles();
stepTitleRefreshQueued = false;
});
}

@ -734,3 +734,181 @@
margin-left: 0 !important;
}
}
/*
* 学生端所有步骤底部操作统一为同一视觉与布局契约。
* 页面可以保留原有的按钮文案和业务处理函数,只需使用任一标准操作容器。
*/
.student-training-shell .step-actions,
.student-training-shell .step-navigation,
.student-training-shell .footer-actions,
.student-training-shell .training-actions,
.student-training-shell .task-actions,
.student-training-shell .taskfooter {
display: flex !important;
flex-wrap: wrap !important;
align-items: center !important;
justify-content: center !important;
gap: 14px !important;
margin-top: 30px !important;
padding: 0 !important;
}
.student-training-shell .step-actions > button,
.student-training-shell .step-actions .el-button,
.student-training-shell .step-navigation > button,
.student-training-shell .step-navigation .el-button,
.student-training-shell .footer-actions > button,
.student-training-shell .footer-actions .el-button,
.student-training-shell .training-actions .el-button.training-action,
.student-training-shell .training-actions button.training-action,
.student-training-shell .task-actions > button,
.student-training-shell .taskfooter .el-button {
box-sizing: border-box !important;
display: inline-flex !important;
align-items: center !important;
justify-content: center !important;
gap: 8px !important;
min-width: 132px !important;
width: auto !important;
height: 42px !important;
min-height: 42px !important;
margin: 0 !important;
padding: 0 18px !important;
border: 1px solid #2cc9ff !important;
border-radius: var(--student-radius-pill) !important;
color: #dff8ff !important;
background: rgba(8, 87, 121, 0.55) !important;
box-shadow: none !important;
font-size: 15px !important;
font-weight: 800 !important;
line-height: 1 !important;
letter-spacing: 0 !important;
}
.student-training-shell .step-actions > button:hover:not(:disabled),
.student-training-shell .step-actions .el-button:hover:not(.is-disabled),
.student-training-shell .step-navigation > button:hover:not(:disabled),
.student-training-shell .step-navigation .el-button:hover:not(.is-disabled),
.student-training-shell .footer-actions > button:hover:not(:disabled),
.student-training-shell .footer-actions .el-button:hover:not(.is-disabled),
.student-training-shell .training-actions .el-button.training-action:hover:not(.is-disabled),
.student-training-shell .training-actions button.training-action:hover:not(:disabled),
.student-training-shell .task-actions > button:hover:not(:disabled),
.student-training-shell .taskfooter .el-button:hover:not(.is-disabled) {
border-color: #75e6ff !important;
color: #fff !important;
background: rgba(18, 146, 204, 0.58) !important;
transform: translateY(-1px);
}
.student-training-shell .step-actions > .btn-primary,
.student-training-shell .step-actions > .primary,
.student-training-shell .step-actions > .action-button.primary,
.student-training-shell .step-actions .step-action--save,
.student-training-shell .step-actions .step-action--next,
.student-training-shell .step-actions .step-action-btn--save,
.student-training-shell .step-actions .step-action-btn--next,
.student-training-shell .step-navigation > .btn-primary,
.student-training-shell .step-navigation > .btn-save,
.student-training-shell .step-navigation > .nav-button--primary,
.student-training-shell .step-navigation > .nav-button--save,
.student-training-shell .footer-actions .el-button--primary,
.student-training-shell .training-actions .training-action--submit,
.student-training-shell .task-actions > .btn-submit,
.student-training-shell .task-actions > .btn-primary,
.student-training-shell .taskfooter .el-button:first-child {
border-color: #36d9ff !important;
color: #fff !important;
background: linear-gradient(110deg, #0eaae4, #0572ac) !important;
}
.student-training-shell .step-actions > button:disabled,
.student-training-shell .step-actions .el-button.is-disabled,
.student-training-shell .step-navigation > button:disabled,
.student-training-shell .step-navigation .el-button.is-disabled,
.student-training-shell .footer-actions > button:disabled,
.student-training-shell .footer-actions .el-button.is-disabled,
.student-training-shell .training-actions .el-button.is-disabled,
.student-training-shell .task-actions > button:disabled,
.student-training-shell .taskfooter .el-button.is-disabled {
cursor: not-allowed !important;
opacity: .5 !important;
transform: none !important;
}
@media (max-width: 720px) {
.student-training-shell .step-actions,
.student-training-shell .step-navigation,
.student-training-shell .footer-actions,
.student-training-shell .training-actions,
.student-training-shell .task-actions,
.student-training-shell .taskfooter {
align-items: stretch !important;
}
.student-training-shell .step-actions > button,
.student-training-shell .step-actions .el-button,
.student-training-shell .step-navigation > button,
.student-training-shell .step-navigation .el-button,
.student-training-shell .footer-actions > button,
.student-training-shell .footer-actions .el-button,
.student-training-shell .training-actions .el-button.training-action,
.student-training-shell .training-actions button.training-action,
.student-training-shell .task-actions > button,
.student-training-shell .taskfooter .el-button {
width: 100% !important;
}
}
/*
* 页面历史上使用了多套按钮类名。由 App.vue 为步骤操作标记统一语义类,
* 这里作为最终覆盖层,保证所有学生端底部导航的尺寸、圆角和主次层级一致。
*/
.student-training-shell .step-actions > button.student-step-action,
.student-training-shell .step-navigation > button.student-step-action,
.student-training-shell .footer-actions > button.student-step-action,
.student-training-shell .training-actions > button.student-step-action,
.student-training-shell .task-actions > button.student-step-action,
.student-training-shell .taskfooter > button.student-step-action {
box-sizing: border-box !important;
display: inline-flex !important;
align-items: center !important;
justify-content: center !important;
min-width: 132px !important;
height: 42px !important;
min-height: 42px !important;
margin: 0 !important;
padding: 0 18px !important;
border: 1px solid #2cc9ff !important;
border-radius: 999px !important;
color: #dff8ff !important;
background: rgba(8, 87, 121, 0.55) !important;
box-shadow: none !important;
font-size: 15px !important;
font-weight: 800 !important;
line-height: 1 !important;
letter-spacing: 0 !important;
}
.student-training-shell .step-actions > button.student-step-action--primary,
.student-training-shell .step-navigation > button.student-step-action--primary,
.student-training-shell .footer-actions > button.student-step-action--primary,
.student-training-shell .training-actions > button.student-step-action--primary,
.student-training-shell .task-actions > button.student-step-action--primary,
.student-training-shell .taskfooter > button.student-step-action--primary {
border-color: #36d9ff !important;
color: #ffffff !important;
background: linear-gradient(110deg, #0eaae4, #0572ac) !important;
}
.student-training-shell .step-actions > button.student-step-action--secondary,
.student-training-shell .step-navigation > button.student-step-action--secondary,
.student-training-shell .footer-actions > button.student-step-action--secondary,
.student-training-shell .training-actions > button.student-step-action--secondary,
.student-training-shell .task-actions > button.student-step-action--secondary,
.student-training-shell .taskfooter > button.student-step-action--secondary {
border-color: #2cc9ff !important;
color: #dff8ff !important;
background: rgba(8, 87, 121, 0.55) !important;
}

@ -14,7 +14,6 @@
<component v-if="!route.meta.link" v-show="!studentTaskLoading" :is="Component" :key="route.path" />
</keep-alive>
</router-view>
<DynamicTrainingStepNavigator v-if="Number(role) === 4 && route.meta?.pageKey && !route.meta?.hideSupplementSteps" v-show="!studentTaskLoading" :task-key="route.meta.pageKey" />
<div v-if="studentTaskLoading" class="student-task-loading" role="status" aria-live="polite">
<div class="student-task-loading__panel">
<span class="student-task-loading__label">正在加载当前实训配置</span>
@ -32,7 +31,6 @@ import * as indexApi from "@/api/index";
const { proxy } = getCurrentInstance();
import { dynamicRoutes } from "@/router";
import iframeToggle from "./IframeToggle/index";
import DynamicTrainingStepNavigator from "@/views/components/DynamicTrainingStepNavigator.vue";
import useTagsViewStore from "@/store/modules/tagsView";
import { getUserInfo } from "@/utils/auth";
import useUserStore from "@/store/modules/user";

@ -2,9 +2,9 @@
<div class="diagnosis-page student-training-shell">
<main class="diagnosis-core">
<section class="task-header"><span>核心实训 · 产品上线与运营推广</span><h1>{{ taskTitle }}</h1></section>
<TrainingTaskBrief :background="taskBackground" :goals="taskGoals" :requirements="taskRequirement" :show-material="false" />
<TrainingTaskBrief :background="taskBackground" :goals="taskGoals" :requirements="taskRequirement" :show-material="false" :show-toolbar="false" />
<section class="workbench">
<div class="workbench-top"><div><p>产品问题诊断与迭代</p><h2>{{ currentStep === 1 ? '全链路转化漏斗诊断' : currentStep === 2 ? '用户评论根因分析' : 'AB 测试验证方案' }}</h2></div><TrainingMaterialButton :material-name="taskConfig?.materialName" :material-url="taskConfig?.materialUrl" /></div>
<div class="workbench-top"><div><p>产品问题诊断与迭代</p><h2>{{ currentStep === 1 ? '全链路转化漏斗诊断' : currentStep === 2 ? '用户评论根因分析' : 'AB 测试验证方案' }}</h2></div><TrainingTaskToolbar class="diagnosis-toolbar" :task-key="TASK_KEY" :on-submit="submitTask" :on-reset="resetTraining" :on-export="exportTrainingOutcome" /></div>
<nav class="step-tabs" aria-label="产品问题诊断步骤"><button type="button" :class="['step-tab', { active: currentStep === 1, complete: currentStep > 1 }]" :aria-current="currentStep === 1 ? 'step' : undefined" @click="currentStep = 1"><span class="step-marker">01</span><span class="step-copy"><b>全链路漏斗诊断</b><small>{{ currentStep === 1 ? '当前步骤 →' : '点击切换 →' }}</small></span></button><span class="step-connector" aria-hidden="true" /><button type="button" :class="['step-tab', { active: currentStep === 2, complete: currentStep > 2 }]" :aria-current="currentStep === 2 ? 'step' : undefined" @click="currentStep = 2"><span class="step-marker">02</span><span class="step-copy"><b>用户评论根因分析</b><small>{{ currentStep === 2 ? '当前步骤 →' : '点击切换 →' }}</small></span></button><span class="step-connector" aria-hidden="true" /><button type="button" :class="['step-tab', { active: currentStep === 3 }]" :aria-current="currentStep === 3 ? 'step' : undefined" @click="currentStep = 3"><span class="step-marker">03</span><span class="step-copy"><b>AB测试验证</b><small>{{ currentStep === 3 ? '当前步骤 →' : '点击切换 →' }}</small></span></button></nav>
<template v-if="currentStep === 1">
@ -17,15 +17,13 @@
<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">
<p class="lead">漏斗只能定位“哪个环节出了问题”,要回答为什么出问题,需要分析用户最真实的反馈。本步骤通过词云分析和情感倾向分析,从用户评价中提取高频问题,判断整体口碑倾向,验证漏斗异常背后的真实根因。</p>
<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"><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 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" />
@ -47,10 +45,10 @@ import { computed, getCurrentInstance, nextTick, onBeforeUnmount, onMounted, ref
import * as echarts from "echarts";
import "echarts-wordcloud";
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
import TrainingMaterialButton from "@/views/components/TrainingMaterialButton.vue";
import TrainingTaskToolbar from "@/views/components/TrainingTaskToolbar.vue";
import TrainingTaskBrief from "@/views/components/TrainingTaskBrief.vue";
import { getTrainingTaskByKey } from "@/api/trainingTask";
import { analyzeProductDiagnosisIterationStepTwo, getStudentTrainingAnswer, saveStudentTrainingAnswer, uploadStudentTrainingFile, validateProductDiagnosisIterationStepOne, validateProductDiagnosisIterationStepTwo, validateProductDiagnosisIterationStepThree } from "@/api/studentTrainingAnswer";
import { analyzeProductDiagnosisIterationStepTwo, deleteStudentTrainingAnswer, getStudentTrainingAnswer, saveStudentTrainingAnswer, uploadStudentTrainingFile, validateProductDiagnosisIterationStepOne, validateProductDiagnosisIterationStepTwo, validateProductDiagnosisIterationStepThree } from "@/api/studentTrainingAnswer";
import { parseTrainingArray } from "@/views/training/taskKeyMap";
import { isStudentDemo } from "@/utils/studentDemo";
@ -79,12 +77,75 @@ async function handleChartUpload(event) { const file = event.target?.files?.[0];
async function saveStepOneDraft() { await persistStepOne(false); } async function validateStepOne() { if (saving.value) return; saving.value = true; try { const data = buildStepOne(); await validateProductDiagnosisIterationStepOne(data); await saveStudentTrainingAnswer(TASK_KEY, { step1Answer: JSON.stringify(data), currentStep: 2, submitted: false, saveAction: "SAVE" }); currentStep.value = 2; proxy?.$modal?.msgSuccess?.("第 1 步校验通过,已进入第 2 步"); } catch (error) { proxy?.$modal?.msgError?.(error?.message || "请检查第 1 步填写内容"); } finally { saving.value = false; } } async function persistStepOne(showMessage) { if (saving.value) return; saving.value = true; try { await saveStudentTrainingAnswer(TASK_KEY, { step1Answer: JSON.stringify(buildStepOne()), currentStep: 1, submitted: false, saveAction: "SAVE" }); if (showMessage !== false) proxy?.$modal?.msgSuccess?.("草稿已保存"); } catch (error) { proxy?.$modal?.msgError?.(error?.message || "保存失败,请重试"); } finally { saving.value = false; } }
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; } }
function runSentimentAnalysis() {
if (!analysisResult.value) return;
const counts = [analysisResult.value.positiveCount, analysisResult.value.neutralCount, analysisResult.value.negativeCount].map((value) => Number(value) || 0);
const total = counts.reduce((sum, value) => sum + value, 0);
sentiments.value = ["正面", "中性", "负面"].map((type, index) => ({
type,
count: counts[index],
percentage: total > 0 ? Number((counts[index] * 100 / total).toFixed(2)) : null,
}));
proxy?.$modal?.msgSuccess?.("情感评论数量与占比已自动计算");
}
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; } }
async function submitTask() {
if (saving.value || uploading.value || analyzing.value) return false;
saving.value = true;
try {
const stepOne = buildStepOne();
await validateProductDiagnosisIterationStepOne(stepOne);
await saveStudentTrainingAnswer(TASK_KEY, { step1Answer: JSON.stringify(stepOne), currentStep: 1, submitted: false, saveAction: "SAVE" });
const stepTwo = buildStepTwo();
await validateProductDiagnosisIterationStepTwo(stepTwo);
await saveStudentTrainingAnswer(TASK_KEY, { step2Answer: JSON.stringify(stepTwo), currentStep: 2, submitted: false, saveAction: "SAVE" });
const stepThree = buildStepThree();
await validateProductDiagnosisIterationStepThree(stepThree);
await saveStudentTrainingAnswer(TASK_KEY, { step3Answer: JSON.stringify(stepThree), currentStep: 3, submitted: true, saveAction: "SUBMIT" });
currentStep.value = 3;
proxy?.$modal?.msgSuccess?.("实训任务已提交");
return true;
} catch (error) {
proxy?.$modal?.msgError?.(error?.message || "提交失败,请检查三个步骤的填写内容");
return false;
} finally {
saving.value = false;
}
}
async function resetTraining() {
if (saving.value || uploading.value || analyzing.value) return false;
try {
await deleteStudentTrainingAnswer(TASK_KEY);
clearChart(); clearAbChart(); wordCloudChart?.dispose(); wordCloudChart = null;
conversionRates.value = createConversionRates(); anomalyRows.value = [createAnomalyRow()]; analysisResult.value = null;
commentPreview.value = { fileName: "", totalComments: 0, comments: [] }; wordCloud.value = []; topIssues.value = ["", "", ""]; sentiments.value = createSentiments(); rootCauseAnalysis.value = "";
abTestPlan.value = ""; abRows.value = createAbRows(); iterationRecommendation.value = ""; currentStep.value = 1;
proxy?.$modal?.msgSuccess?.("已清空全部实训步骤,可以重新开始");
return true;
} catch (error) {
proxy?.$modal?.msgError?.(error?.message || "重新实训失败,请稍后重试");
return false;
}
}
function exportTrainingOutcome() {
const outcome = { taskName: taskTitle.value, exportedAt: new Date().toISOString(), step1: buildStepOne(), step2: buildStepTwo(), step3: buildStepThree() };
const url = URL.createObjectURL(new Blob([JSON.stringify(outcome, null, 2)], { type: "application/json;charset=utf-8" }));
const link = document.createElement("a"); link.href = url; link.download = "产品问题诊断与迭代-实训成果.json"; document.body.appendChild(link); link.click(); document.body.removeChild(link); URL.revokeObjectURL(url);
proxy?.$modal?.msgSuccess?.("实训成果已导出");
}
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(); });
</script>
@ -127,4 +188,6 @@ onMounted(async () => { try { taskConfig.value = (await getTrainingTaskByKey(TAS
.workbench .step-tabs .step-connector::after{width:8px;height:8px;border-color:#73c8e7}
.sentiment-table td:last-child{white-space:nowrap}.sentiment-table td:last-child :deep(.el-input-number){display:inline-flex;width:calc(100% - 32px);vertical-align:middle}.sentiment-table td:last-child .unit{display:inline-flex;align-items:center;height:32px;margin-left:6px;vertical-align:middle}
@media(max-width:1100px){.diagnosis-page{grid-template-columns:1fr}}@media(max-width:720px){.diagnosis-page{padding:12px}.diagnosis-core{padding:16px;border-radius:20px}.workbench{padding:16px}.workbench-top,.table-toolbar,.sentiment-actions{align-items:stretch;flex-direction:column}.step-tabs{align-items:stretch;flex-direction:column}.step-tabs button{flex:0 0 auto;width:100%}.step-tabs i{flex:0 0 12px;width:2px;height:12px;margin-left:17px}.diagnosis-materials__item,.ab-materials{align-items:stretch;flex-direction:column}.top-issues>div{grid-template-columns:1fr}.chart-preview{align-items:flex-start;flex-direction:column}.chart-preview :deep(.el-image){width:100%;height:170px}}
.diagnosis-toolbar{align-self:center;justify-content:flex-end;max-width:100%}
@media(max-width:720px){.diagnosis-toolbar{width:100%;justify-content:flex-start}}
</style>

@ -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";

@ -6,7 +6,7 @@
<h1>{{ taskTitle }}</h1>
</section>
<TrainingTaskBrief :background="taskBackground" :goals="taskGoals" :requirements="taskRequirement" :show-material="false" />
<TrainingTaskBrief :background="taskBackground" :goals="taskGoals" :requirements="taskRequirement" :show-material="false" :show-toolbar="false" />
<section class="task-card">
<div class="workbench-head">
@ -14,10 +14,7 @@
<p class="section-eyebrow">CATEGORY OPERATIONS</p>
<h2>{{ activeStepName }}</h2>
</div>
<div class="workbench-actions">
<TrainingMaterialButton :material-name="taskConfig?.materialName" :material-url="taskConfig?.materialUrl" />
<button class="outline-action" type="button" @click="exportOutcome"><el-icon><Download /></el-icon>导出实训成果</button>
</div>
<TrainingTaskToolbar class="optimization-toolbar" :task-key="TASK_KEY" :on-submit="submitTask" :on-reset="resetTask" :on-export="exportOutcome" />
</div>
<nav v-if="hasConfiguredSteps" class="step-indicator" aria-label="品类结构优化步骤">
@ -169,13 +166,9 @@
</section>
<div v-if="hasConfiguredSteps" class="step-navigation">
<button type="button" class="nav-button" :disabled="activeStep === 1" @click="setCurrentStep(activeStep - 1)"><el-icon><ArrowLeft /></el-icon>上一步</button>
<button v-if="activeStep > 1" type="button" class="nav-button" @click="setCurrentStep(activeStep - 1)"><el-icon><ArrowLeft /></el-icon>上一步</button>
<button type="button" class="nav-button nav-button--save" :disabled="saving" @click="saveCurrentProgress"><el-icon><CircleCheck /></el-icon>保存当前进度</button>
<button type="button" class="nav-button nav-button--primary" :disabled="activeStep === configuredSteps.length" @click="goNextStep">下一步<el-icon><ArrowRight /></el-icon></button>
</div>
<div class="training-actions">
<el-button class="training-action" :loading="saving" @click="submitTask">提交任务</el-button>
<el-button class="training-action" :loading="saving" @click="resetTask">清空填写</el-button>
<button v-if="activeStep < configuredSteps.length" type="button" class="nav-button nav-button--primary" @click="goNextStep">下一步<el-icon><ArrowRight /></el-icon></button>
</div>
</section>
</main>
@ -185,10 +178,10 @@
<script setup>
import { computed, defineAsyncComponent, onMounted, ref } from "vue";
import { ArrowLeft, ArrowRight, CircleCheck, Delete, Download, Minus, Plus, TrendCharts, UploadFilled } from "@element-plus/icons-vue";
import { ArrowLeft, ArrowRight, CircleCheck, Delete, Minus, Plus, TrendCharts, UploadFilled } from "@element-plus/icons-vue";
import { ElMessage } from "element-plus";
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
import TrainingMaterialButton from "@/views/components/TrainingMaterialButton.vue";
import TrainingTaskToolbar from "@/views/components/TrainingTaskToolbar.vue";
import TrainingTaskBrief from "@/views/components/TrainingTaskBrief.vue";
import { getTrainingTaskByKey } from "@/api/trainingTask";
import { getStudentTrainingAnswer, saveStudentTrainingAnswer, uploadStudentTrainingFile, validateCategoryOptimizationStepOne, validateCategoryOptimizationStepTwo, validateCategoryOptimizationStepThree, validateCategoryOptimizationStepFour, validateCategoryOptimizationStepFive } from "@/api/studentTrainingAnswer";
@ -392,6 +385,8 @@ onMounted(async () => {
.strategy-step{display:grid;gap:16px}.subsection-heading{margin:8px 0 0;font-size:18px}.subsection-copy{margin:-8px 0 0;color:var(--muted);line-height:1.6}.category-matrix{position:relative;width:min(100%,820px);height:430px;margin:12px auto 22px;padding:38px 52px 52px 78px}.matrix-grid{display:grid;grid-template-columns:1fr 1fr;grid-template-rows:1fr 1fr;width:100%;height:100%;border-left:2px solid rgba(185,240,255,.82);border-bottom:2px solid rgba(185,240,255,.82);background:linear-gradient(135deg,rgba(24,169,209,.12),rgba(3,25,38,.16))}.matrix-cell{display:grid;place-content:center;gap:7px;padding:18px;border-right:1px solid rgba(185,240,255,.65);border-bottom:1px solid rgba(185,240,255,.65);text-align:center}.matrix-cell:nth-child(2n){border-right:0}.matrix-cell:nth-child(n+3){border-bottom:0}.matrix-cell strong{font-size:18px}.matrix-cell small{color:#8dddf5}.matrix-y-title,.matrix-x-title,.matrix-y-high,.matrix-y-low,.matrix-x-high,.matrix-x-low{position:absolute;color:#d9f8ff;font-weight:800}.matrix-y-title{top:5px;left:78px}.matrix-x-title{right:0;bottom:15px}.matrix-y-high{top:63px;left:39px}.matrix-y-low{bottom:61px;left:39px}.matrix-x-low{bottom:29px;left:79px}.matrix-x-high{right:44px;bottom:29px}.matrix-inputs{display:grid;grid-template-columns:minmax(210px,.42fr) 1fr;gap:16px}.matrix-inputs label{display:grid;gap:8px;color:#d9f8ff;font-weight:700}.strategy-table{min-width:1120px}.strategy-table td{vertical-align:top}.strategy-table :deep(.el-select){width:100%;min-width:160px}.strategy-table :deep(.el-textarea__inner){min-height:78px}.current-classification{display:inline-block;padding:8px 10px;border-radius:8px;color:#a5efff;background:rgba(17,126,178,.24);white-space:nowrap}
.operations-table{min-width:1050px}.operations-table th{color:#fff;background:linear-gradient(100deg,#08a6df,#098bc1);font-size:16px}.operations-table td{vertical-align:middle}.operations-table td:first-child{width:17%;font-weight:800}.operations-table td:nth-child(2){width:34%}.operations-table td:nth-child(3){width:25%}.operations-table td:last-child{width:24%}.operations-table :deep(.el-textarea__inner){min-height:86px;text-align:left}.operations-table :deep(.el-select){width:100%;min-width:160px}.layer-cell{color:#dff8ff;font-size:16px;background:rgba(15,103,137,.18)!important}
:deep(.el-input__wrapper){background:rgba(1,15,25,.76);box-shadow:0 0 0 1px rgba(94,213,245,.28) inset}:deep(.el-input__inner){color:#fff;text-align:center}@media(max-width:1100px){.optimization{grid-template-columns:1fr}}@media(max-width:720px){.optimization{padding:12px}.training-core{padding:16px;border-radius:20px}.workbench-head,.table-toolbar{flex-direction:column;align-items:stretch}.workbench-actions,.table-toolbar>div,.step-navigation,.training-actions{justify-content:stretch}.workbench-actions>*,.action-button,.nav-button,.training-actions :deep(.training-action){flex:1;width:100%}.category-step,.analysis-step{padding:16px}}
.optimization-toolbar{align-self:center;justify-content:flex-end;max-width:100%}
@media(max-width:720px){.optimization-toolbar{width:100%;justify-content:flex-start}}
.step-tab { min-width: 0; }
.step-tab.active { background: linear-gradient(115deg, rgba(4, 109, 155, 0.78), rgba(5, 62, 102, 0.64)); }
.step-connector { position: relative; flex: 0 1 32px; min-width: 18px; height: 2px; overflow: visible; background: rgba(98, 169, 201, .34); }

@ -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";

@ -2,11 +2,11 @@
<div class="channel student-training-shell">
<main class="training-core">
<section class="task-header"><div class="task-badge"><el-icon><TrendCharts /></el-icon> 核心实训 · 供应渠道管理</div><h1 class="task-title">{{ taskTitle }}</h1></section>
<TrainingTaskBrief :background="taskBackground" :goals="taskGoals" :requirements="taskRequirement" :show-material="false" />
<TrainingTaskBrief :background="taskBackground" :goals="taskGoals" :requirements="taskRequirement" :show-material="false" :show-toolbar="false" />
<section class="task-card">
<div class="workbench-head workbench-head--actions-only"><div class="workbench-actions"><TrainingMaterialButton :material-name="taskConfig?.materialName" :material-url="taskConfig?.materialUrl" /><button type="button" class="outline-action" @click="exportOutcome"><el-icon><Download /></el-icon>导出实训成果</button></div></div>
<div class="workbench-head"><div><p class="section-eyebrow">PURCHASE DEMAND FORECAST</p><h2>{{ activeStepName }}</h2></div><TrainingTaskToolbar class="purchase-forecast-toolbar" :task-key="TASK_KEY" :on-submit="submitTask" :on-reset="resetTask" :on-export="exportOutcome" /></div>
<nav v-if="hasConfiguredSteps" class="step-indicator" aria-label="采购需求预测步骤"><template v-for="(step,index) in configuredSteps" :key="`${step}-${index}`"><button type="button" :class="['step-tab',{active:activeStep===index+1,complete:activeStep>index+1}]" :aria-current="activeStep===index+1?'step':undefined" :aria-label="`第${index+1}步:${step}`" @click="setCurrentStep(index+1)"><span class="step-marker">{{ String(index+1).padStart(2,'0') }}</span><span class="step-copy"><strong class="step-name" :title="step">{{ step }}</strong><span class="step-action">{{ activeStep===index+1?'当前步骤':'点击切换' }} <span aria-hidden="true">→</span></span></span></button><span v-if="index<configuredSteps.length-1" class="step-connector" aria-hidden="true"></span></template></nav>
<section v-show="isSectionVisible(1)" class="step-card"><div class="step-title-row"><div><p class="section-eyebrow">Step {{ String(activeStep).padStart(2,'0') }}</p><h3>{{ activeStepName }}</h3></div></div>
<section v-show="isSectionVisible(1)" class="step-card">
<p class="linear-forecast-intro">线性预测的核心是拟合趋势线(y=a+bt),是基于历史数据预测未来销量的有效方法。根据案例资料及数据,预测案例店铺产品未来 3 个月市场需求数据。</p>
<div class="linear-forecast-panel">
@ -29,7 +29,7 @@
</div>
<el-button type="primary" class="practice-guide-button" @click="downloadPracticeGuide">下载实训操作说明</el-button>
</section>
</section><section v-show="isSectionVisible(2)" class="step-card"><div class="step-title-row"><div><p class="section-eyebrow">Step {{ String(activeStep).padStart(2,'0') }}</p><h3>{{ activeStepName }}</h3></div></div>
</section><section v-show="isSectionVisible(2)" class="step-card">
<p class="forecast-visual-intro">计算未来 3 个月需求量后,使用散点图 + 趋势线绘制需求量预测趋势图,呈现已知的 12 个月销量以及预测数据的整体走势。</p>
<section class="forecast-visual-upload-card">
<label v-if="!demandForecastChart.url" class="forecast-visual-dropzone" :class="{ 'is-uploading': uploadingDemandForecastChart }">
@ -57,7 +57,7 @@
</div>
<el-button type="primary" class="practice-guide-button" @click="downloadPracticeGuide">下载实训操作说明</el-button>
</section>
</section><section v-show="isSectionVisible(3)" class="step-card"><div class="step-title-row"><div><p class="section-eyebrow">Step {{ String(activeStep).padStart(2,'0') }}</p><h3>{{ activeStepName }}</h3></div></div>
</section><section v-show="isSectionVisible(3)" class="step-card">
<p class="procurement-plan-intro">基于步骤一预测的未来3个月销量,结合安全库存和期初库存,计算各月采购量,填报采购预测表。</p>
<section class="procurement-plan-rules">
<h4>采购规则</h4>
@ -94,7 +94,7 @@
</el-table>
</div>
<p class="procurement-plan-hint">预测销量由第 1 步同步带入。提交时将按题设规则校验安全库存、期初库存和采购量。</p>
</section><section v-show="isSectionVisible(4)" class="step-card"><div class="step-title-row"><div><p class="section-eyebrow">Step {{ String(activeStep).padStart(2,'0') }}</p><h3>{{ activeStepName }}</h3></div></div>
</section><section v-show="isSectionVisible(4)" class="step-card">
<p>未来需求预测,使用线性回归模型预测2025年采购量:</p>
<el-table
:data="forecastData"
@ -120,8 +120,7 @@
</p>
<div id="forecastChart" ref="forecastChart" style="width: 80%; height: 400px"></div>
</section>
<div v-if="hasConfiguredSteps" class="step-navigation"><button type="button" class="btn-nav" :disabled="activeStep===1" @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 btn-primary" :disabled="activeStep===configuredSteps.length" @click="goNextStep">下一步<el-icon><ArrowRight /></el-icon></button></div>
<div class="taskfooter"><el-button @click="submitTask" :loading="saving">提交任务</el-button><el-button @click="resetTask" :loading="saving">清空填写</el-button></div>
<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 v-if="activeStep < configuredSteps.length" type="button" class="btn-nav btn-primary" @click="goNextStep">下一步<el-icon><ArrowRight /></el-icon></button></div>
<pop-model :showModel="runResultShow" title="设置代码" @closePop="closeCode">
<template v-slot:content>
<div>
@ -138,12 +137,12 @@
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
import TrainingMaterialButton from "@/views/components/TrainingMaterialButton.vue";
import TrainingTaskToolbar from "@/views/components/TrainingTaskToolbar.vue";
import TrainingTaskBrief from "@/views/components/TrainingTaskBrief.vue";
import * as analysisAPI from "@/api/market-demand-mining.js";
import * as echarts from "echarts";
import useUserStore from "@/store/modules/user";
import { ArrowLeft, ArrowRight, CircleCheck, Download, TrendCharts } from "@element-plus/icons-vue";
import { ArrowLeft, ArrowRight, CircleCheck, TrendCharts } from "@element-plus/icons-vue";
import { getTrainingTaskByKey } from "@/api/trainingTask";
import { getStudentTrainingAnswer, saveStudentTrainingAnswer, uploadStudentTrainingFile, validatePurchaseDemandForecastStepOne } from "@/api/studentTrainingAnswer";
import { parseTrainingArray } from "@/views/training/taskKeyMap";
@ -959,6 +958,50 @@ onMounted(async () => {
border-bottom: 0;
}
.workbench-head h2 {
margin: 4px 0 0;
color: #fff;
font-size: 24px;
font-weight: 800;
line-height: 1.3;
}
.purchase-forecast-toolbar {
align-self: center;
justify-content: flex-end;
max-width: 100%;
}
/* Keep task controls consistent with the product-pricing toolbar. */
.purchase-forecast-toolbar :deep(.el-button) {
border-color: rgba(99, 217, 255, 0.55) !important;
color: #e9fbff !important;
background: rgba(17, 126, 178, 0.36) !important;
}
.purchase-forecast-toolbar :deep(.task-toolbar-button--submit) {
border-color: rgba(66, 224, 187, 0.7) !important;
background: rgba(13, 137, 111, 0.34) !important;
}
.purchase-forecast-toolbar :deep(.el-button:hover) {
border-color: rgba(116, 235, 255, 0.85) !important;
color: #e9fbff !important;
background: rgba(18, 146, 204, 0.5) !important;
}
.purchase-forecast-toolbar :deep(.task-toolbar-button--submit:hover) {
border-color: rgba(100, 245, 208, 0.9) !important;
background: rgba(14, 164, 132, 0.45) !important;
}
@media (max-width:900px) {
.purchase-forecast-toolbar {
width: 100%;
justify-content: flex-start;
}
}
.linear-forecast-intro {
margin: 0 0 22px;
color: #d7ecff;

@ -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(() => {

@ -8,10 +8,6 @@
<h1>{{ taskTitle }}</h1>
<p>分别从试产与量产场景评估供应渠道,形成可执行的采购与风险管理建议。</p>
</div>
<div class="workspace-header__actions">
<TrainingMaterialButton :material-name="taskConfig?.materialName" :material-url="taskConfig?.materialUrl" />
<span class="task-badge">实训任务</span>
</div>
</header>
<TrainingTaskBrief
@ -19,8 +15,17 @@
:goals="taskGoals"
:requirements="taskRequirement"
:show-material="false"
:show-toolbar="false"
/>
<header class="step-workbench-header">
<div>
<p class="eyebrow">SUPPLIER CHANNEL EVALUATION</p>
<h2>{{ currentStepTitle }}</h2>
</div>
<TrainingTaskToolbar class="supplier-toolbar" :task-key="TASK_KEY" />
</header>
<nav class="step-nav" aria-label="供应渠道评估步骤">
<button :class="['step-tab', { active: currentStep === 1, complete: currentStep > 1 }]" :aria-current="currentStep === 1 ? 'step' : undefined" @click="currentStep = 1">
<span class="step-marker">01</span><span class="step-copy"><b>设置评估权重</b><small>{{ currentStep === 1 ? '当前步骤 →' : '点击切换 →' }}</small></span>
@ -37,8 +42,6 @@
<template v-if="currentStep === 1">
<section class="intro-card">
<p class="step-caption">Step 01</p>
<h2>设置两种采购场景的评估权重</h2>
<p>试产更关注交付周期和采购灵活性;量产更关注采购成本和品质可靠性。每个场景的权重合计必须为 100%。</p>
</section>
@ -76,15 +79,10 @@
</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">
<section class="intro-card compact">
<p class="step-caption">Step 02</p>
<h2>为供应渠道评分并比较结果</h2>
<p>每项评分为 0–10 分,渠道名称和评分均由学生填写;系统会按第一步已保存的权重自动计算加权总分。</p>
</section>
@ -111,16 +109,10 @@
</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>
<section class="intro-card compact">
<p class="step-caption">Step 03</p>
<h2>渠道优选、采购建议与供应风险</h2>
<p>最优和次优渠道由第二步的加权评分自动排名生成,学生需要分析差异、形成采购建议,并完成供应风险评估。</p>
</section>
@ -172,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>
@ -194,10 +187,10 @@
<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 TrainingMaterialButton from "@/views/components/TrainingMaterialButton.vue";
import TrainingTaskToolbar from "@/views/components/TrainingTaskToolbar.vue";
import TrainingTaskBrief from "@/views/components/TrainingTaskBrief.vue";
import { getTrainingTaskByKey } from "@/api/trainingTask";
import { parseTrainingArray } from "@/views/training/taskKeyMap";
@ -228,6 +221,11 @@ const currentStudyTip = computed(() => {
};
return tips[currentStep.value] || tips[1];
});
const currentStepTitle = computed(() => ({
1: "设置两种采购场景的评估权重",
2: "为供应渠道评分并比较结果",
3: "渠道优选、采购建议与供应风险",
})[currentStep.value] || "供应渠道评估");
const progressItems = computed(() => [
{ text: "设置评估权重", status: stepOneSaved.value ? "done" : currentStep.value === 1 ? "doing" : "" },
{ text: "渠道评分与对比", status: stepTwoSaved.value ? "done" : currentStep.value === 2 ? "doing" : "" },
@ -427,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 || {};
@ -450,23 +449,40 @@ 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() {
@ -529,7 +545,8 @@ onMounted(async () => {
.workspace-shell { box-sizing: border-box; width: min(100%, 1520px); margin: 0 auto; padding: 28px; border: 1px solid rgba(0, 180, 255, .25); border-radius: 36px; background: rgba(8, 18, 28, .6); box-shadow: inset 0 1px 0 rgba(169, 229, 255, .08), 0 22px 48px rgba(0, 0, 0, .22); }
.supplier-page .training-core { box-sizing: border-box; min-width: 0; width: 100%; margin: 0; padding: 28px; border: 1px solid rgba(0, 180, 255, .25); border-radius: 36px; background: rgba(8, 18, 28, .6); box-shadow: inset 0 1px 0 rgba(169, 229, 255, .08), 0 22px 48px rgba(0, 0, 0, .22); }
.supplier-page .workspace-shell { width: 100%; max-width: none; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.workspace-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }.workspace-header__actions { display: flex; align-items: center; gap: 10px; }
.workspace-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }.supplier-toolbar { align-self: center; justify-content: flex-end; max-width: 100%; }
.step-workbench-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin: 24px 0 18px; padding: 0 0 18px; border-bottom: 1px solid rgba(0, 180, 255, .2); }.step-workbench-header h2 { margin: 5px 0 0; color: #fff; font-size: 24px; font-weight: 800; line-height: 1.3; }
.eyebrow, .step-caption { margin: 0 0 7px; color: #63dcff; font-weight: 700; letter-spacing: .1em; }
.workspace-header h1, .intro-card h2 { margin: 0; color: #fff; }.workspace-header h1 { margin-top: 12px; font-size: 30px; font-weight: 900; line-height: 1.3; }
.workspace-header p:not(.eyebrow), .intro-card > p:last-child { margin: 10px 0 0; color: #9db4c4; line-height: 1.75; }
@ -555,14 +572,14 @@ 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; }
.analysis-panel + .analysis-panel { margin-top: 20px; }.ranking-table { min-width: 940px; }.ranking-table th:first-child { width: 18%; }.ranking-table th:nth-child(2), .ranking-table th:nth-child(3) { width: 19%; }.scene-name { color: #71dcfb !important; font-weight: 700; }.rank-result { display: flex; flex-direction: column; gap: 5px; }.rank-result strong { color: #f3fbff; }.rank-result span { color: #62cef1; font-size: 13px; }
.recommendation-card { margin-top: 20px; }.recommendation-card label { display: block; margin-bottom: 9px; color: #e7f5fb; font-weight: 700; }.recommendation-card :deep(.el-textarea__inner) { min-height: 130px !important; color: #e7f6fd; background: rgba(2, 15, 24, .7); box-shadow: 0 0 0 1px #315f75 inset; }
.risk-heading { align-items: flex-end; }.row-actions { display: flex; gap: 10px; }.panel-tip { margin: -4px 0 16px; color: #9db8c6; line-height: 1.7; }.risk-table { min-width: 1080px; }.risk-table th:nth-child(1) { width: 15%; }.risk-table th:nth-child(2) { width: 29%; }.risk-table th:nth-child(3) { width: 16%; }.risk-table :deep(.el-select) { width: 100%; }.default-risk-row :deep(.el-input__inner), .default-risk-row :deep(.el-textarea__inner), .default-risk-row :deep(.el-select__selected-item) { color: #b7cbd6; font-style: italic; }
@media (max-width: 980px) { .weights-grid { grid-template-columns: 1fr; }.step-nav { grid-template-columns: 1fr; gap: 8px; }.step-nav i { display: none; }.workspace-header { flex-direction: column; }.risk-heading { align-items: flex-start; flex-direction: column; }.split-actions { gap: 12px; }.supplier-page { padding: 12px; }.workspace-shell { padding: 16px; } }
@media (max-width: 980px) { .weights-grid { grid-template-columns: 1fr; }.step-nav { grid-template-columns: 1fr; gap: 8px; }.step-nav i { display: none; }.workspace-header,.step-workbench-header { flex-direction: column; }.supplier-toolbar { width: 100%; justify-content: flex-start; }.risk-heading { align-items: flex-start; flex-direction: column; }.split-actions { gap: 12px; }.supplier-page { padding: 12px; }.workspace-shell { padding: 16px; } }
.step-tab.active { background: linear-gradient(115deg, rgba(4, 109, 155, 0.78), rgba(5, 62, 102, 0.64)); }
.step-connector { position: relative; height: 2px; overflow: visible; background: rgba(86, 198, 235, .48); }
.step-connector::after { position: absolute; top: 50%; right: -1px; width: 7px; height: 7px; border-top: 1px solid #73b1ce; border-right: 1px solid #73b1ce; content: ''; transform: translateY(-50%) rotate(45deg); }

@ -37,9 +37,14 @@
</button>
</div>
<TrainingTaskToolbar
v-if="showToolbar"
class="brief-material"
:material-name="materialName"
:material-url="materialUrl"
:task-key="taskKey"
:on-submit="onSubmit"
:on-reset="onReset"
:on-export="onExport"
/>
</div>
@ -91,6 +96,26 @@ const props = defineProps({
type: Boolean,
default: true,
},
showToolbar: {
type: Boolean,
default: true,
},
taskKey: {
type: String,
default: "",
},
onSubmit: {
type: Function,
default: null,
},
onReset: {
type: Function,
default: null,
},
onExport: {
type: Function,
default: null,
},
});
const { materialName, materialUrl } = toRefs(props);

@ -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";
@ -25,6 +26,9 @@ const props = defineProps({
materialName: { type: String, default: "" },
materialUrl: { type: String, default: "" },
taskKey: { type: String, default: "" },
onSubmit: { type: Function, default: null },
onReset: { type: Function, default: null },
onExport: { type: Function, default: null },
});
const route = useRoute();
@ -53,13 +57,23 @@ async function loadMaterial() {
}
function triggerExistingAction(action) {
const directActions = {
submit: props.onSubmit,
reset: props.onReset,
export: props.onExport,
};
if (directActions[action]) {
directActions[action]();
return;
}
const labelPriority = {
submit: [[/提交任务/], [/完成实训/, /保存并完成/, /校验并完成/]],
reset: [[/重新实训/], [/清空填写/]],
reset: [[/重新实训/]],
export: [[/导出实训成果/]],
};
const buttons = Array.from(document.querySelectorAll("button"))
.filter((button) => !button.closest(".training-task-toolbar") && isVisible(button) && !button.disabled);
const buttons = getCurrentTaskActionButtons();
const target = labelPriority[action]
.map((matchers) => buttons.find((button) => matchers.some((matcher) => matcher.test(button.innerText || ""))))
.find(Boolean);
@ -69,18 +83,104 @@ 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() {
const shell = document.querySelector(".student-training-shell") || document;
const actionAreas = Array.from(shell.querySelectorAll(
".step-actions, .step-navigation, .footer-actions, .training-actions, .task-actions, .taskfooter, .training-step-area"
));
const candidates = actionAreas.length
? actionAreas.flatMap((area) => Array.from(area.querySelectorAll("button")))
: Array.from(shell.querySelectorAll("button"));
return Array.from(new Set(candidates))
.filter((button) => !button.closest(".training-task-toolbar") && isVisible(button) && !button.disabled);
}
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>

@ -6,12 +6,15 @@
<h1>{{ taskTitle }}</h1>
</header>
<TrainingTaskBrief :background="taskBackground" :goals="taskGoals" :requirements="taskRequirement" :show-material="false" />
<TrainingTaskBrief :background="taskBackground" :goals="taskGoals" :requirements="taskRequirement" :show-material="false" :show-toolbar="false" />
<section class="workbench">
<div class="workbench-actions">
<TrainingMaterialButton :material-name="taskConfig?.materialName" :material-url="taskConfig?.materialUrl" />
<button class="action-button" type="button" @click="exportOutcome"><el-icon><Download /></el-icon>导出实训成果</button>
<div class="workbench-head">
<div>
<p class="workbench-eyebrow">Demand insight · business case</p>
<h2>{{ trainingSteps[currentStep - 1] || '商业可行性论证' }}</h2>
</div>
<TrainingTaskToolbar class="business-feasibility-toolbar" :task-key="TASK_KEY" :on-export="exportOutcome" />
</div>
<nav class="step-indicator" aria-label="商业可行性论证步骤">
@ -65,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">
@ -83,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>
@ -93,10 +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 ? '校验并保存中…' : '保存并进入第 4 步' }}</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>
<section v-else class="step-card placeholder"><p>第 {{ currentStep }} 步将在后续实训页面中配置。</p><button class="action-button" type="button" @click="currentStep = 3">返回第 3 步</button></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" />
@ -104,16 +104,16 @@
</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";
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
import TrainingMaterialButton from "@/views/components/TrainingMaterialButton.vue";
import TrainingTaskToolbar from "@/views/components/TrainingTaskToolbar.vue";
import TrainingTaskBrief from "@/views/components/TrainingTaskBrief.vue";
const TASK_KEY = "business-feasibility";
const DEFAULT_STEPS = ["商业可行性论证", "项目初步决策", "可行性论证报告", "决策结论"];
const DEFAULT_STEPS = ["商业可行性论证", "项目初步决策", "可行性论证报告"];
const overviewFields = [
{ key: "projectBackground", label: "项目背景", placeholder: "示例:根据案例信息简述公司基本情况,再简要阐述智能家居、个护健康、美妆工具等相关市场发展情况和需求情况。" },
{ key: "productPositioning", label: "产品定位", placeholder: "示例:阐述项目产品针对的目标市场用户、核心卖点、使用场景、差异化理由以及用户收益。" },
@ -150,7 +150,8 @@ const priorityOptions = [
const defaultTask = { title: "商业可行性论证", background: "在产品开发前,综合市场机会、用户需求、竞争态势、成本收益和风险,判断项目是否具有可推进的商业价值。", goals: ["掌握商业可行性论证的基本维度", "形成市场、用户、成本与收益的一致判断", "识别主要风险并提出应对措施"], requirement: "请以案例资料和前序分析为依据,完成表格全部内容;成本与价格数据需真实、合理且逻辑一致。" };
const { proxy } = getCurrentInstance();
const taskConfig = ref(null); const currentStep = ref(1); const saving = ref(false); const uploading = ref(false); const completed = ref(false); const stepTwoCompleted = ref(false); const stepThreeCompleted = ref(false); const reportInput = ref(null); const reportPreviewVisible = ref(false); const report = ref(createReport()); const form = ref(createForm()); const stepTwo = ref(createStepTwo());
const taskTitle = computed(() => taskConfig.value?.taskName || defaultTask.title); const taskBackground = computed(() => taskConfig.value?.background || defaultTask.background); const taskGoals = computed(() => parseArray(taskConfig.value?.objectives, defaultTask.goals)); const taskRequirement = computed(() => taskConfig.value?.requirements || defaultTask.requirement); const trainingSteps = computed(() => parseTrainingArray(taskConfig.value?.steps, DEFAULT_STEPS));
const taskTitle = computed(() => taskConfig.value?.taskName || defaultTask.title); const taskBackground = computed(() => taskConfig.value?.background || defaultTask.background); const taskGoals = computed(() => parseArray(taskConfig.value?.objectives, defaultTask.goals)); const taskRequirement = computed(() => taskConfig.value?.requirements || defaultTask.requirement); const trainingSteps = computed(() => parseTrainingArray(taskConfig.value?.steps, DEFAULT_STEPS).slice(0, 3));
const finalStep = computed(() => Math.max(1, trainingSteps.value.length));
const totalCost = computed(() => form.value.costs.reduce((sum, cost) => sum + numeric(cost.amount), 0)); const unitGrossProfit = computed(() => numeric(form.value.targetPrice) - totalCost.value); const grossMargin = computed(() => totalCost.value > 0 ? unitGrossProfit.value / totalCost.value * 100 : null);
const progressItems = computed(() => [{ text: completed.value ? "项目论证已保存" : "待完成项目论证", status: completed.value ? "done" : "" }, { text: totalCost.value > 0 ? "成本与毛利已计算" : "待填写成本与售价", status: totalCost.value > 0 ? "done" : "" }, { text: form.value.risks.filter((risk) => risk.description && risk.response && risk.impact).length === 4 ? "风险评估已完成" : "待完成风险评估", status: form.value.risks.filter((risk) => risk.description && risk.response && risk.impact).length === 4 ? "done" : "" }]);
const selectedPriorityCount = computed(() => stepTwo.value.priorities.length);
@ -164,8 +165,9 @@ function numeric(value) { const number = Number(value); return Number.isFinite(n
function currency(value) { return Number(value || 0).toFixed(2); }
function percent(value) { return value === null || !Number.isFinite(value) ? "--" : `${Number(value).toFixed(2)}%`; }
function parseArray(value, fallback) { if (Array.isArray(value) && value.length) return value; if (!value) return fallback; try { const parsed = JSON.parse(value); return Array.isArray(parsed) && parsed.length ? parsed.map((item) => String(item?.name ?? item).trim()).filter(Boolean) : fallback; } catch (_) { const items = String(value).split(/[,,|]/).map((item) => item.trim()).filter(Boolean); return items.length ? items : fallback; } }
async function loadTaskConfig() { try { taskConfig.value = (await getTrainingTaskByKey(TASK_KEY))?.data || null; } catch (_) { taskConfig.value = null; } }
async function loadSavedAnswer() { try { const saved = (await getStudentTrainingAnswer(TASK_KEY))?.data; if (!saved) return; if (saved.step1Answer) { const parsed = JSON.parse(saved.step1Answer); form.value = mergeForm(parsed?.form || parsed); completed.value = true; } if (saved.step2Answer) { const parsed = JSON.parse(saved.step2Answer); stepTwo.value = { ...createStepTwo(), ...(parsed?.stepTwo || parsed || {}), priorities: Array.isArray(parsed?.stepTwo?.priorities || parsed?.priorities) ? (parsed?.stepTwo?.priorities || parsed?.priorities) : [] }; stepTwoCompleted.value = true; } if (saved.step3Answer) { const parsed = JSON.parse(saved.step3Answer); report.value = { ...createReport(), ...(parsed?.report || parsed || {}) }; stepThreeCompleted.value = Boolean(report.value.url); } if (Number(saved.currentStep) > 0) currentStep.value = Number(saved.currentStep); } catch (_) { /* keep a new answer editable */ } }
function clampStep(value) { return Math.min(Math.max(1, Number(value) || 1), finalStep.value); }
async function loadTaskConfig() { try { taskConfig.value = (await getTrainingTaskByKey(TASK_KEY))?.data || null; currentStep.value = clampStep(currentStep.value); } catch (_) { taskConfig.value = null; } }
async function loadSavedAnswer() { try { const saved = (await getStudentTrainingAnswer(TASK_KEY))?.data; if (!saved) return; if (saved.step1Answer) { const parsed = JSON.parse(saved.step1Answer); form.value = mergeForm(parsed?.form || parsed); completed.value = true; } if (saved.step2Answer) { const parsed = JSON.parse(saved.step2Answer); stepTwo.value = { ...createStepTwo(), ...(parsed?.stepTwo || parsed || {}), priorities: Array.isArray(parsed?.stepTwo?.priorities || parsed?.priorities) ? (parsed?.stepTwo?.priorities || parsed?.priorities) : [] }; stepTwoCompleted.value = true; } if (saved.step3Answer) { const parsed = JSON.parse(saved.step3Answer); report.value = { ...createReport(), ...(parsed?.report || parsed || {}) }; stepThreeCompleted.value = Boolean(report.value.url); } if (Number(saved.currentStep) > 0) currentStep.value = clampStep(saved.currentStep); } catch (_) { /* keep a new answer editable */ } }
function mergeForm(value) { const fallback = createForm(); const merged = { ...fallback, ...(value || {}), projectOverview: { ...fallback.projectOverview, ...(value?.projectOverview || {}) }, marketAnalysis: { ...fallback.marketAnalysis, ...(value?.marketAnalysis || {}) }, targetUsers: Array.isArray(value?.targetUsers) && value.targetUsers.length === 3 ? value.targetUsers : fallback.targetUsers, businessModels: Array.isArray(value?.businessModels) && value.businessModels.length === 2 ? value.businessModels : fallback.businessModels, costs: fallback.costs.map((cost) => ({ ...cost, ...(value?.costs || []).find((item) => item?.id === cost.id) })), risks: fallback.risks.map((risk) => ({ ...risk, ...(value?.risks || []).find((item) => item?.type === risk.type) })) }; return merged; }
function payload() { return { ...form.value, costs: form.value.costs.map(({ id, amount }) => ({ id, amount: amount === "" ? null : Number(amount) })), targetPrice: form.value.targetPrice === "" ? null : Number(form.value.targetPrice) }; }
async function validateAndContinue() { if (saving.value) return; saving.value = true; try { const result = await checkBusinessFeasibilityStepOne(payload()); const calculated = result?.data || {}; form.value.costs = form.value.costs.map((cost) => ({ ...cost, amount: cost.amount === "" ? "" : Number(cost.amount) })); 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: 2, submitted: false, saveAction: "SAVE" }); completed.value = true; currentStep.value = 2; proxy?.$modal?.msgSuccess("已完成校验并保存,已进入第 2 步"); } catch (error) { proxy?.$modal?.msgError?.(error?.message || "请完整填写本步骤内容后再提交"); } finally { saving.value = false; } }
@ -180,8 +182,32 @@ function readableSize(size) { const value = Number(size || 0); return value > 10
function openReportPreview() { if (report.value.url) reportPreviewVisible.value = true; }
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: 4, submitted: false, saveAction: "SAVE" }); stepThreeCompleted.value = true; currentStep.value = 4; proxy?.$modal?.msgSuccess("报告已保存,已进入第 4 步"); } catch (error) { proxy?.$modal?.msgError?.(error?.message || "请先上传可行性论证报告"); } finally { saving.value = false; } }
function switchStep(step) { if (step > 1 && !completed.value) { proxy?.$modal?.msgWarning("请先完成并保存第 1 步"); return; } if (step > 2 && !stepTwoCompleted.value) { proxy?.$modal?.msgWarning("请先完成并保存第 2 步"); return; } if (step > 3 && !stepThreeCompleted.value) { proxy?.$modal?.msgWarning("请先上传并保存第 3 步报告"); return; } currentStep.value = step; }
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>
@ -192,4 +218,9 @@ function exportOutcome() { const blob = new Blob([JSON.stringify({ task: taskTit
@media (max-width:1280px) { .feasibility-page { grid-template-columns:1fr; }.step-indicator { overflow-x:auto; }.step-tab { min-width:170px; }.market-table { grid-template-columns:1fr; }.market-table label { border-right:0; }.cost-layout { grid-template-columns:1fr; } }
@media (max-width:720px) { .feasibility-page { padding:10px; }.task-header,.workbench,.step-card { padding:16px; }.task-header h1 { font-size:25px; }.workbench-actions { justify-content:flex-start; flex-wrap:wrap; }.form-table label { grid-template-columns:1fr; }.form-table label > span { justify-content:flex-start; }.step-heading em { display:none; }.step-actions { flex-wrap:wrap; }.decision-grid,.priority-grid { grid-template-columns:1fr; }.decision-section { padding:16px; }.hint { margin-left:0; }.report-upload-panel { padding:22px 14px; }.report-file-card { align-items:flex-start; flex-wrap:wrap; }.report-file-actions { width:100%; justify-content:flex-end; }.report-replace { flex-wrap:wrap; justify-content:center; } }
.table-wrap th { display:table-cell; text-align:center; }
.workbench-head { display:flex; align-items:center; justify-content:space-between; gap:18px; padding-bottom:18px; border-bottom:1px solid rgba(0,180,255,.2); }
.workbench-eyebrow { margin:0; color:#59d9ff; font-size:12px; font-weight:800; letter-spacing:.1em; text-transform:uppercase; }
.workbench-head h2 { margin:5px 0 0; color:#fff; font-size:26px; }
.business-feasibility-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; }.business-feasibility-toolbar { width:100%; justify-content:flex-start; } }
</style>

File diff suppressed because one or more lines are too long

@ -11,17 +11,16 @@
:goals="taskGoals"
:requirements="taskRequirement"
:show-material="false"
:show-toolbar="false"
/>
<section class="task-card">
<div class="workbench-head workbench-head--actions-only">
<div class="workbench-actions">
<TrainingMaterialButton :material-name="taskConfig?.materialName" :material-url="taskConfig?.materialUrl" />
<button type="button" class="outline-action" @click="exportOutcome">
<el-icon><Download /></el-icon>
导出实训成果
</button>
<div class="workbench-head">
<div>
<p class="section-eyebrow">Consumer demand behavior</p>
<h3>{{ activeStepName || taskTitle }}</h3>
</div>
<TrainingTaskToolbar class="consumer-behavior-toolbar" :task-key="TASK_KEY" :on-submit="submitTask" :on-reset="resetTraining" :on-export="exportOutcome" />
</div>
<nav v-if="flowSteps.length" class="step-indicator" aria-label="消费者需求与行为步骤">
@ -245,7 +244,7 @@
</section>
<div class="step-actions">
<el-button class="nav-action nav-action--previous" :disabled="form.activeStep === 0" @click="goPrev">
<el-button v-if="form.activeStep > 0" class="nav-action nav-action--previous" @click="goPrev">
<el-icon><ArrowLeft /></el-icon>
上一步
</el-button>
@ -253,20 +252,12 @@
<el-icon><CircleCheck /></el-icon>
保存当前进度
</el-button>
<el-button class="nav-action nav-action--next" :disabled="form.activeStep === flowSteps.length - 1" @click="goNext">
<el-button v-if="form.activeStep < flowSteps.length - 1" class="nav-action nav-action--next" @click="goNext">
下一步
<el-icon><ArrowRight /></el-icon>
</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>
@ -286,7 +277,7 @@ import { computed, getCurrentInstance, nextTick, onMounted, ref } from "vue";
import { useRouter } from "vue-router";
import { ArrowLeft, ArrowRight, CircleCheck, Document, Download, Upload } from "@element-plus/icons-vue";
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
import TrainingMaterialButton from "@/views/components/TrainingMaterialButton.vue";
import TrainingTaskToolbar from "@/views/components/TrainingTaskToolbar.vue";
import TrainingTaskBrief from "@/views/components/TrainingTaskBrief.vue";
import { getTrainingTaskByKey } from "@/api/trainingTask";
import { parseTrainingArray } from "@/views/training/taskKeyMap";
@ -2377,4 +2368,14 @@ function downloadSurveyReportTemplate() {
padding-bottom: 0;
border-bottom: 0;
}
.consumer-behavior-toolbar {
flex: 0 0 auto;
justify-content: flex-end;
max-width: 100%;
}
@media (max-width: 900px) {
.consumer-behavior-toolbar { width: 100%; justify-content: flex-start; }
}
</style>

@ -11,17 +11,16 @@
:goals="taskGoals"
:requirements="taskRequirement"
:show-material="false"
:show-toolbar="false"
/>
<section class="task-card">
<div class="workbench-head workbench-head--actions-only">
<div class="workbench-actions">
<TrainingMaterialButton :material-name="taskConfig?.materialName" :material-url="taskConfig?.materialUrl" />
<button type="button" class="outline-action" @click="exportOutcome">
<el-icon><Download /></el-icon>
导出实训成果
</button>
<div class="workbench-head">
<div>
<p class="section-eyebrow">Consumer scenario analysis</p>
<h3>{{ activeStepName || taskTitle }}</h3>
</div>
<TrainingTaskToolbar class="consumer-scenario-toolbar" :task-key="TASK_KEY" :on-submit="submitTask" :on-reset="resetTraining" :on-export="exportOutcome" />
</div>
<nav v-if="trainingSteps.length" class="step-indicator" aria-label="消费场景解构步骤">
@ -218,7 +217,7 @@
</section>
<div v-if="hasConfiguredSteps" class="step-actions">
<button type="button" class="nav-action nav-action--previous" :disabled="form.activeStep === 1" @click="goPreviousStep">
<button v-if="form.activeStep > 1" type="button" class="nav-action nav-action--previous" @click="goPreviousStep">
<el-icon><ArrowLeft /></el-icon>
上一步
</button>
@ -226,20 +225,12 @@
<el-icon><CircleCheck /></el-icon>
保存当前进度
</button>
<button type="button" class="nav-action nav-action--next" :disabled="form.activeStep >= trainingSteps.length" @click="goNextStep">
<button v-if="form.activeStep < trainingSteps.length" type="button" class="nav-action nav-action--next" @click="goNextStep">
下一步
<el-icon><ArrowRight /></el-icon>
</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>
@ -258,7 +249,7 @@
import { computed, getCurrentInstance, onMounted, ref } from "vue";
import { ArrowLeft, ArrowRight, CircleCheck, Download, UploadFilled } from "@element-plus/icons-vue";
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
import TrainingMaterialButton from "@/views/components/TrainingMaterialButton.vue";
import TrainingTaskToolbar from "@/views/components/TrainingTaskToolbar.vue";
import TrainingTaskBrief from "@/views/components/TrainingTaskBrief.vue";
import { getTrainingTaskByKey } from "@/api/trainingTask";
import { parseTrainingArray } from "@/views/training/taskKeyMap";
@ -2264,5 +2255,14 @@ function exportOutcome() {
padding-bottom: 0;
border-bottom: 0;
}
</style>
.consumer-scenario-toolbar {
flex: 0 0 auto;
justify-content: flex-end;
max-width: 100%;
}
@media (max-width: 900px) {
.consumer-scenario-toolbar { width: 100%; justify-content: flex-start; }
}
</style>

@ -98,7 +98,7 @@
</label>
<div v-if="trainingSteps.length" class="step-actions">
<el-button class="step-action-btn step-action-btn--previous" :disabled="currentStep === 1" @click="previousStep">
<el-button v-if="currentStep > 1" class="step-action-btn step-action-btn--previous" @click="previousStep">
<el-icon><ArrowLeft /></el-icon>
上一步
</el-button>
@ -106,16 +106,12 @@
<el-icon><CircleCheck /></el-icon>
保存当前进度
</el-button>
<el-button class="step-action-btn step-action-btn--next" :disabled="currentStep === trainingSteps.length" @click="nextStep">
<el-button v-if="currentStep < trainingSteps.length" class="step-action-btn step-action-btn--next" @click="nextStep">
下一步
<el-icon><ArrowRight /></el-icon>
</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>

@ -11,17 +11,16 @@
:goals="taskGoals"
:requirements="taskRequirement"
:show-material="false"
:show-toolbar="false"
/>
<section class="task-card">
<div class="workbench-head workbench-head--actions-only">
<div class="workbench-actions">
<TrainingMaterialButton :material-name="taskConfig?.materialName" :material-url="taskConfig?.materialUrl" />
<button type="button" class="outline-action" @click="exportOutcome">
<el-icon><Download /></el-icon>
导出实训成果
</button>
<div class="workbench-head">
<div>
<p class="section-eyebrow">Feature conversion</p>
<h3>{{ activeStepName || taskTitle }}</h3>
</div>
<TrainingTaskToolbar class="feature-conversion-toolbar" :task-key="TASK_KEY" :on-submit="submitTask" :on-reset="resetTraining" :on-export="exportOutcome" />
</div>
<nav v-if="flowSteps.length" class="step-indicator" aria-label="需求转化为功能步骤">
@ -188,7 +187,7 @@
</section>
<div v-if="hasConfiguredSteps" class="step-navigation">
<button type="button" class="btn-nav" :disabled="form.activeStep === 1" @click="goPreviousStep">
<button v-if="form.activeStep > 1" type="button" class="btn-nav" @click="goPreviousStep">
<el-icon><ArrowLeft /></el-icon>
上一步
</button>
@ -196,20 +195,12 @@
<el-icon><CircleCheck /></el-icon>
保存当前进度
</button>
<button type="button" class="btn-nav btn-primary" :disabled="form.activeStep === flowSteps.length" @click="goNextStep">
<button v-if="form.activeStep < flowSteps.length" type="button" class="btn-nav btn-primary" @click="goNextStep">
下一步
<el-icon><ArrowRight /></el-icon>
</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>
</main>
@ -225,9 +216,9 @@
<script setup>
import { computed, getCurrentInstance, onMounted, ref } from "vue";
import { ArrowLeft, ArrowRight, CircleCheck, Download } from "@element-plus/icons-vue";
import { ArrowLeft, ArrowRight, CircleCheck } from "@element-plus/icons-vue";
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
import TrainingMaterialButton from "@/views/components/TrainingMaterialButton.vue";
import TrainingTaskToolbar from "@/views/components/TrainingTaskToolbar.vue";
import TrainingTaskBrief from "@/views/components/TrainingTaskBrief.vue";
import { getTrainingTaskByKey } from "@/api/trainingTask";
import { parseTrainingArray } from "@/views/training/taskKeyMap";
@ -2009,6 +2000,14 @@ function exportOutcome() {
padding-bottom: 0;
border-bottom: 0;
}
</style>
.feature-conversion-toolbar {
flex: 0 0 auto;
justify-content: flex-end;
max-width: 100%;
}
@media (max-width: 900px) {
.feature-conversion-toolbar { width: 100%; justify-content: flex-start; }
}
</style>

@ -92,7 +92,7 @@
</label>
<div v-if="trainingSteps.length" class="step-actions">
<el-button class="step-action-btn step-action-btn--previous" :disabled="currentStep === 1" @click="previousStep">
<el-button v-if="currentStep > 1" class="step-action-btn step-action-btn--previous" @click="previousStep">
<el-icon><ArrowLeft /></el-icon>
上一步
</el-button>
@ -100,16 +100,12 @@
<el-icon><CircleCheck /></el-icon>
保存当前进度
</el-button>
<el-button class="step-action-btn step-action-btn--next" :disabled="currentStep === trainingSteps.length" @click="nextStep">
<el-button v-if="currentStep < trainingSteps.length" class="step-action-btn step-action-btn--next" @click="nextStep">
下一步
<el-icon><ArrowRight /></el-icon>
</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>

File diff suppressed because one or more lines are too long

@ -11,17 +11,16 @@
:goals="taskGoals"
:requirements="taskRequirement"
:show-material="false"
:show-toolbar="false"
/>
<section class="task-card">
<div class="workbench-head workbench-head--actions-only">
<div class="workbench-actions">
<TrainingMaterialButton :material-name="taskConfig?.materialName" :material-url="taskConfig?.materialUrl" />
<button type="button" class="outline-action" @click="exportOutcome">
<el-icon><Download /></el-icon>
导出实训成果
</button>
<div class="workbench-head">
<div>
<p class="section-eyebrow">Target user profile</p>
<h3>{{ activeStepName || taskTitle }}</h3>
</div>
<TrainingTaskToolbar class="target-profile-toolbar" :task-key="TASK_KEY" :on-submit="submitTask" :on-reset="resetTraining" :on-export="exportOutcome" />
</div>
<nav v-if="steps.length" class="step-indicator" aria-label="目标用户画像步骤">
@ -296,7 +295,7 @@
</section>
<div v-if="steps.length" class="step-actions">
<el-button class="step-action step-action--previous" :disabled="currentStep <= 1" @click="currentStep -= 1">
<el-button v-if="currentStep > 1" class="step-action step-action--previous" @click="currentStep -= 1">
<el-icon><ArrowLeft /></el-icon>
上一步
</el-button>
@ -304,20 +303,12 @@
<el-icon><CircleCheck /></el-icon>
保存当前进度
</el-button>
<el-button class="step-action step-action--next" :disabled="currentStep >= steps.length" @click="goNext">
<el-button v-if="currentStep < steps.length" class="step-action step-action--next" @click="goNext">
下一步
<el-icon><ArrowRight /></el-icon>
</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>
@ -333,10 +324,10 @@
</template>
<script setup>
import { ArrowLeft, ArrowRight, CircleCheck, Document, Download, Upload } from "@element-plus/icons-vue";
import { ArrowLeft, ArrowRight, CircleCheck, Document, Upload } from "@element-plus/icons-vue";
import * as XLSX from "xlsx";
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
import TrainingMaterialButton from "@/views/components/TrainingMaterialButton.vue";
import TrainingTaskToolbar from "@/views/components/TrainingTaskToolbar.vue";
import TrainingTaskBrief from "@/views/components/TrainingTaskBrief.vue";
import { getTrainingTaskByKey } from "@/api/trainingTask";
import { parseTrainingArray } from "@/views/training/taskKeyMap";
@ -2476,4 +2467,14 @@ function exportOutcome() {
padding-bottom: 0;
border-bottom: 0;
}
.target-profile-toolbar {
flex: 0 0 auto;
justify-content: flex-end;
max-width: 100%;
}
@media (max-width: 900px) {
.target-profile-toolbar { width: 100%; justify-content: flex-start; }
}
</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(() => {

@ -9,17 +9,15 @@
<h1 class="task-title">{{ taskTitle }}</h1>
</section>
<TrainingTaskBrief :background="taskBackground" :goals="taskGoals" :requirements="taskRequirement" :show-material="false" />
<TrainingTaskBrief :background="taskBackground" :goals="taskGoals" :requirements="taskRequirement" :show-material="false" :show-toolbar="false" />
<section class="task-card">
<div class="workbench-head workbench-head--actions-only">
<div class="workbench-actions">
<TrainingMaterialButton :material-name="taskConfig?.materialName" :material-url="taskConfig?.materialUrl" />
<button type="button" class="outline-action" @click="exportOutcome">
<el-icon><Download /></el-icon>
导出实训成果
</button>
<div class="workbench-head">
<div>
<p class="workbench-eyebrow">PRODUCT DEVELOPMENT · NEW PRODUCT SURVEY</p>
<h2>{{ getStepName(currentStep) || taskTitle }}</h2>
</div>
<TrainingTaskToolbar class="new-product-survey-toolbar" :task-key="TASK_KEY" :on-export="exportOutcome" />
</div>
<nav class="step-indicator" aria-label="新产品调查与分析步骤">
@ -215,7 +213,7 @@
</section>
<div class="step-navigation">
<button type="button" class="btn-nav" :disabled="currentStep === 1" @click="prevStep">
<button v-if="currentStep > 1" type="button" class="btn-nav" @click="prevStep">
<el-icon><ArrowLeft /></el-icon>
上一步
</button>
@ -223,22 +221,12 @@
<el-icon><CircleCheck /></el-icon>
保存当前进度
</button>
<button type="button" class="btn-nav btn-primary" :disabled="currentStep === steps.length || saving || checking || uploadingImages" @click="nextStep">
<button v-if="currentStep < steps.length" type="button" class="btn-nav btn-primary" :disabled="saving || checking || uploadingImages" @click="nextStep">
{{ checking ? "正在判题" : "下一步" }}
<el-icon><ArrowRight /></el-icon>
</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>
@ -262,7 +250,6 @@ import {
ArrowRight,
CircleCheck,
DataAnalysis,
Download,
Operation,
Opportunity,
RefreshLeft,
@ -275,8 +262,8 @@ import useUserStore from "@/store/modules/user";
import { isExternal } from "@/utils/validate";
import { extractTrainingStepNames } from "@/views/training/taskKeyMap";
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
import TrainingMaterialButton from "@/views/components/TrainingMaterialButton.vue";
import TrainingTaskBrief from "@/views/components/TrainingTaskBrief.vue";
import TrainingTaskToolbar from "@/views/components/TrainingTaskToolbar.vue";
const TASK_KEY = "new-product-survey";
const { proxy } = getCurrentInstance();
@ -1852,4 +1839,32 @@ function exportOutcome() {
}
}
}
.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;
}
.new-product-survey-toolbar {
flex: 0 0 auto;
justify-content: flex-end;
max-width: 100%;
}
@media (max-width: 900px) {
.new-product-survey-toolbar {
width: 100%;
justify-content: flex-start;
}
}
</style>

@ -9,17 +9,15 @@
<h1 class="task-title">{{ taskTitle }}</h1>
</section>
<TrainingTaskBrief :background="taskBackground" :goals="taskGoals" :requirements="taskRequirement" :show-material="false" />
<TrainingTaskBrief :background="taskBackground" :goals="taskGoals" :requirements="taskRequirement" :show-material="false" :show-toolbar="false" />
<section class="factors-workbench">
<div class="workbench-head workbench-head--actions-only">
<div class="workbench-actions">
<TrainingMaterialButton :material-name="taskConfig?.materialName" :material-url="taskConfig?.materialUrl" />
<button type="button" class="outline-action" @click="exportOutcome">
<el-icon><Download /></el-icon>
导出实训成果
</button>
<div class="workbench-head">
<div>
<p class="workbench-eyebrow">PRODUCT DEVELOPMENT · KEY FACTORS</p>
<h2>{{ trainingSteps[currentStep] || taskTitle }}</h2>
</div>
<TrainingTaskToolbar class="product-factors-toolbar" :task-key="TASK_KEY" :on-submit="submitTraining" :on-reset="resetTraining" :on-export="exportOutcome" />
</div>
<nav v-if="trainingSteps.length" class="step-indicator" aria-label="实训步骤">
@ -85,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="resetTraining">
<el-icon><RefreshLeft /></el-icon>
清空填写
</button>
</div>
</template>
<template v-else-if="currentStep === 1">
@ -101,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="resetTraining"><el-icon><RefreshLeft /></el-icon>清空填写</button></div>
</template>
<template v-else-if="currentStep === 2">
@ -109,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="resetTraining"><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="submitTraining">提交任务</button><button type="button" class="btn-nav" :disabled="saving" @click="resetTraining">清空填写</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>
@ -137,14 +129,14 @@
</template>
<script setup>
import { Download, 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, getStudentTrainingAnswer, saveStudentTrainingAnswer } from "@/api/studentTrainingAnswer";
import { checkProductDevelopmentFactorsStepOne, checkProductDevelopmentFactorsStepTwo, checkProductDevelopmentFactorsStepThree, checkProductDevelopmentFactorsStepFour, deleteStudentTrainingAnswer, getStudentTrainingAnswer, saveStudentTrainingAnswer } from "@/api/studentTrainingAnswer";
import useUserStore from "@/store/modules/user";
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
import TrainingMaterialButton from "@/views/components/TrainingMaterialButton.vue";
import TrainingTaskBrief from "@/views/components/TrainingTaskBrief.vue";
import TrainingTaskToolbar from "@/views/components/TrainingTaskToolbar.vue";
const { proxy } = getCurrentInstance();
const TASK_KEY = "product-development-factors";
@ -390,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; } }
@ -448,13 +435,66 @@ async function resetTraining() {
clearDraft();
try {
saving.value = true;
await saveStudentTrainingAnswer(TASK_KEY, buildStepOneAnswerPayload("RESET", 1));
await deleteStudentTrainingAnswer(TASK_KEY);
} catch (error) {
// Clearing the page should still work locally even when backend reset fails.
} finally {
saving.value = false;
}
proxy?.$modal?.msgSuccess("已清空填写内容");
proxy?.$modal?.msgSuccess("已重新开始本次实训");
}
function resetStepOne() {
stepOneRows.value = createStepOneRows();
proxy?.$modal?.msgSuccess("已清空第 1 步填写内容");
}
function resetStepTwo() {
stepTwoRows.value = createStepTwoRows();
proxy?.$modal?.msgSuccess("已清空第 2 步填写内容");
}
function resetStepThree() {
stepThreeRows.value = createStepThreeRows();
proxy?.$modal?.msgSuccess("已清空第 3 步填写内容");
}
function resetStepFour() {
stepFourForm.value = { successFactors: "", failedFactors: "" };
proxy?.$modal?.msgSuccess("已清空第 4 步填写内容");
}
async function saveStepFour(showMessage = true) {
if (saving.value) return;
saving.value = true;
try {
await checkProductDevelopmentFactorsStepFour(buildStepFourValidationPayload());
await saveStudentTrainingAnswer(TASK_KEY, buildStepFourAnswerPayload("SAVE", 4));
clearDraft();
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() {
@ -919,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,
@ -990,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);
}
@ -1039,7 +1075,7 @@ function exportOutcome() {
.workbench-head,
.workbench-actions,
.task-actions,
.step-navigation,
.step-indicator,
.step-title-row {
flex-direction: column;
@ -1078,10 +1114,31 @@ function exportOutcome() {
}
}
.workbench-head--actions-only {
.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;
}
.product-factors-toolbar {
flex: 0 0 auto;
justify-content: flex-end;
margin-bottom: 18px;
padding-bottom: 0;
border-bottom: 0;
max-width: 100%;
}
@media (max-width: 900px) {
.product-factors-toolbar {
width: 100%;
justify-content: flex-start;
}
}
</style>

@ -6,14 +6,15 @@
<h1 class="task-title">{{ taskTitle }}</h1>
</section>
<TrainingTaskBrief :background="taskBackground" :goals="taskGoals" :requirements="taskRequirement" :show-material="false" />
<TrainingTaskBrief :background="taskBackground" :goals="taskGoals" :requirements="taskRequirement" :show-material="false" :show-toolbar="false" />
<section class="process-workbench">
<div class="workbench-head workbench-head--actions-only">
<div class="workbench-actions">
<TrainingMaterialButton :material-name="taskConfig?.materialName" :material-url="taskConfig?.materialUrl" />
<button type="button" class="outline-action" @click="exportOutcome"><el-icon><Download /></el-icon>导出实训成果</button>
<div class="workbench-head">
<div>
<p class="workbench-eyebrow">PRODUCT DEVELOPMENT · PROCESS</p>
<h2>{{ trainingSteps[currentStep - 1] || taskTitle }}</h2>
</div>
<TrainingTaskToolbar class="product-process-toolbar" :task-key="TASK_KEY" :on-submit="submitTraining" :on-reset="resetTraining" :on-export="exportOutcome" />
</div>
<nav v-if="trainingSteps.length" class="step-indicator" aria-label="产品开发主要流程步骤">
@ -60,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="resetTraining"><el-icon><RefreshLeft /></el-icon>清空填写</button>
</div>
</template>
<template v-else-if="currentStep === 2">
<div class="step-title-row">
@ -91,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">
@ -123,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">
@ -145,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="submitTraining">提交任务</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>
@ -165,15 +155,15 @@
</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, getStudentTrainingAnswer, saveStudentTrainingAnswer, uploadStudentTrainingFile } from "@/api/studentTrainingAnswer";
import { checkProductDevelopmentProcessStepOne, checkProductDevelopmentProcessStepTwo, checkProductDevelopmentProcessStepThree, checkProductDevelopmentProcessStepFour, deleteStudentTrainingAnswer, getStudentTrainingAnswer, saveStudentTrainingAnswer, uploadStudentTrainingFile } from "@/api/studentTrainingAnswer";
import { getTrainingTaskByKey } from "@/api/trainingTask";
import { parseTrainingArray } from "@/views/training/taskKeyMap";
import useUserStore from "@/store/modules/user";
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
import TrainingMaterialButton from "@/views/components/TrainingMaterialButton.vue";
import TrainingTaskBrief from "@/views/components/TrainingTaskBrief.vue";
import TrainingTaskToolbar from "@/views/components/TrainingTaskToolbar.vue";
const { proxy } = getCurrentInstance();
const userStore = useUserStore();
@ -391,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);
@ -401,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;
}
@ -425,32 +416,40 @@ async function resetTraining() {
clearDraft();
try {
checking.value = true;
await saveStudentTrainingAnswer(TASK_KEY, { step1Answer: JSON.stringify(buildOutcome()), currentStep: 1, submitted: false, saveAction: "RESET" });
await deleteStudentTrainingAnswer(TASK_KEY);
} catch (error) {
// The local reset remains effective if the backend is temporarily unavailable.
} finally {
checking.value = false;
}
proxy?.$modal?.msgSuccess("已清空填写内容");
proxy?.$modal?.msgSuccess("已重新开始本次实训");
}
function resetStepOne() {
processRows.value = processRows.value.map((row) => ({ ...row, classification: "" }));
checkResult.value = null;
stepOnePassed.value = false;
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;
}
@ -489,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;
}
@ -526,6 +526,40 @@ async function submitTraining() {
}
}
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();
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 步填写内容");
@ -630,11 +664,14 @@ 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; }
.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; }
.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; }.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

@ -6,18 +6,15 @@
<h1 class="task-title">{{ taskTitle }}</h1>
</section>
<TrainingTaskBrief :background="taskBackground" :goals="taskGoals" :requirements="taskRequirement" :show-material="false" />
<TrainingTaskBrief :background="taskBackground" :goals="taskGoals" :requirements="taskRequirement" :show-material="false" :show-toolbar="false" />
<section class="task-card">
<div class="workbench-head">
<div>
<p class="section-eyebrow">After-sales diagnostic routing</p>
<h2>售后故障类型分类</h2>
</div>
<div class="workbench-actions">
<TrainingMaterialButton :material-name="taskConfig?.materialName" :material-url="taskConfig?.materialUrl" />
<button type="button" class="outline-action" @click="exportOutcome"><el-icon><Download /></el-icon>导出实训成果</button>
<p class="section-eyebrow">After-sales service design</p>
<h2>{{ trainingSteps[currentStep - 1] || '售后服务流程设计' }}</h2>
</div>
<TrainingTaskToolbar class="after-sales-toolbar" :task-key="TASK_KEY" :on-export="exportOutcome" />
</div>
<nav class="step-indicator" aria-label="售后服务流程设计步骤">
@ -71,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">
@ -109,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">
@ -167,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>
@ -193,9 +177,9 @@
<script setup>
import { computed, defineComponent, getCurrentInstance, h, onMounted, ref } from "vue";
import { ArrowLeft, ArrowRight, Download, RefreshLeft, Service } from "@element-plus/icons-vue";
import { ArrowLeft, ArrowRight, RefreshLeft, Service } from "@element-plus/icons-vue";
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
import TrainingMaterialButton from "@/views/components/TrainingMaterialButton.vue";
import TrainingTaskToolbar from "@/views/components/TrainingTaskToolbar.vue";
import TrainingTaskBrief from "@/views/components/TrainingTaskBrief.vue";
import { checkAfterSalesServiceStepOne, checkAfterSalesServiceStepTwo, checkAfterSalesServiceStepThree, getStudentTrainingAnswer, saveStudentTrainingAnswer } from "@/api/studentTrainingAnswer";
import { getTrainingTaskByKey } from "@/api/trainingTask";
@ -390,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; }
@ -410,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; }
@ -458,4 +455,9 @@ function exportOutcome() { const blob = new Blob([JSON.stringify({ currentStep:
.fault-select-label { grid-column: 2; justify-content: flex-start; white-space: nowrap; }
.fault-select-label span { white-space: nowrap; }
.fault-select-label select { width: 126px; max-width: none; flex: 0 0 126px; }
.after-sales-toolbar { flex: 0 0 auto; justify-content: flex-end; max-width: 100%; }
@media (max-width: 720px) {
.after-sales-toolbar { width: 100%; justify-content: flex-start; }
}
</style>

@ -6,7 +6,7 @@
<h1 class="task-title">{{ taskTitle }}</h1>
</section>
<TrainingTaskBrief :background="taskBackground" :goals="taskGoals" :requirements="taskRequirement" :show-material="false" />
<TrainingTaskBrief :background="taskBackground" :goals="taskGoals" :requirements="taskRequirement" :show-material="false" :task-key="taskKey" :on-submit="submitTask" :on-reset="resetTask" :on-export="exportOutcome" />
<section class="task-card">
<div class="workbench-head workbench-head--actions-only">
@ -59,13 +59,9 @@
</section>
<div v-if="hasConfiguredSteps" class="step-navigation">
<button type="button" class="btn-nav" :disabled="activeStep === 1" @click="goPreviousStep"><el-icon><ArrowLeft /></el-icon>上一步</button>
<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 btn-primary" :disabled="activeStep === configuredSteps.length" @click="goNextStep">下一步<el-icon><ArrowRight /></el-icon></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" :loading="saving" @click="resetTask">清空填写</el-button>
<button v-if="activeStep < configuredSteps.length" type="button" class="btn-nav btn-primary" @click="goNextStep">下一步<el-icon><ArrowRight /></el-icon></button>
</div>
</section>
</main>
@ -85,7 +81,7 @@ import { getStudentTrainingPage } from "@/views/training/studentTrainingPages";
import { parseTrainingArray } from "@/views/training/taskKeyMap";
const props = defineProps({ taskKey: { type: String, required: true }, title: { type: String, default: "" }, background: { type: String, default: "" }, requirement: { type: String, default: "" }, goals: { type: Array, default: () => [] }, badgeText: { type: String, default: "核心实训 · 产品规划与设计" } });
const emit = defineEmits(["save", "submit", "reset"]);
const emit = defineEmits(["save", "submit", "reset", "clear-current-step"]);
const slots = useSlots();
const { proxy } = getCurrentInstance();
const taskConfig = ref(null);
@ -128,7 +124,7 @@ 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; } }
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; } }
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); }
</script>

@ -9,17 +9,15 @@
<h1 class="task-title">{{ taskTitle }}</h1>
</section>
<TrainingTaskBrief :background="taskBackground" :goals="taskGoals" :requirements="taskRequirement" :show-material="false" />
<TrainingTaskBrief :background="taskBackground" :goals="taskGoals" :requirements="taskRequirement" :show-material="false" :show-toolbar="false" />
<section class="task-card">
<div class="workbench-head workbench-head--actions-only">
<div class="workbench-actions">
<TrainingMaterialButton :material-name="taskConfig?.materialName" :material-url="taskConfig?.materialUrl" />
<button type="button" class="outline-action" @click="exportOutcome">
<el-icon><Download /></el-icon>
导出实训成果
</button>
<div class="workbench-head">
<div>
<p class="section-eyebrow">Value proposition positioning</p>
<h3>{{ activeStepName || taskTitle }}</h3>
</div>
<TrainingTaskToolbar class="product-positioning-toolbar" :task-key="TASK_KEY" :on-submit="submitTask" :on-reset="resetTraining" :on-export="exportOutcome" />
</div>
<nav v-if="configuredSteps.length" class="step-indicator" aria-label="产品价值主张及定位步骤">
@ -216,7 +214,7 @@
</section>
<div v-if="hasConfiguredSteps" class="step-navigation">
<button type="button" class="btn-nav" :disabled="form.activeStep === 1" @click="goPreviousStep">
<button v-if="form.activeStep > 1" type="button" class="btn-nav" @click="goPreviousStep">
<el-icon><ArrowLeft /></el-icon>
上一步
</button>
@ -225,9 +223,9 @@
保存当前进度
</button>
<button
v-if="form.activeStep < configuredSteps.length"
type="button"
class="btn-nav btn-primary"
:disabled="form.activeStep === configuredSteps.length"
@click="goNextStep"
>
下一步
@ -235,10 +233,6 @@
</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>
</main>
@ -255,7 +249,7 @@
import { computed, getCurrentInstance, onMounted, ref } from "vue";
import { ArrowLeft, ArrowRight, CircleCheck, Download, Operation, UploadFilled } from "@element-plus/icons-vue";
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
import TrainingMaterialButton from "@/views/components/TrainingMaterialButton.vue";
import TrainingTaskToolbar from "@/views/components/TrainingTaskToolbar.vue";
import TrainingTaskBrief from "@/views/components/TrainingTaskBrief.vue";
import { getTrainingTaskByKey } from "@/api/trainingTask";
import { checkProductValuePositioningStepOne, checkProductValuePositioningStepTwo, checkProductValuePositioningStepThree, checkProductValuePositioningStepFour, getStudentTrainingAnswer, saveStudentTrainingAnswer, uploadStudentTrainingFile } from "@/api/studentTrainingAnswer";
@ -753,6 +747,12 @@ async function handleValueCanvasUpload(event) {
flex-shrink: 0;
}
.product-positioning-toolbar {
flex: 0 0 auto;
justify-content: flex-end;
max-width: 100%;
}
.outline-action,
.btn-nav {
display: inline-flex;
@ -1389,6 +1389,7 @@ async function handleValueCanvasUpload(event) {
.outline-action,
.btn-nav,
.training-actions :deep(.training-action) { width: 100%; }
.product-positioning-toolbar { width: 100%; justify-content: flex-start; }
.step-indicator {
align-items: stretch;
flex-direction: column;

@ -11,15 +11,22 @@
:goals="taskGoals"
:requirements="taskRequirement"
:show-material="false"
:show-toolbar="false"
/>
<section class="task-card hardware-workbench">
<div class="workbench-head hardware-workbench-head">
<div>
<p class="section-eyebrow">BOM cost workspace</p>
<h2>智能硬件成本估算</h2>
<h2>{{ currentStepTitle }}</h2>
</div>
<TrainingMaterialButton :material-name="taskConfig?.materialName" :material-url="taskConfig?.materialUrl" />
<TrainingTaskToolbar
class="hardware-cost-toolbar"
:task-key="TASK_KEY"
:on-submit="submitTask"
:on-reset="resetTraining"
:on-export="exportTrainingOutcome"
/>
</div>
<nav class="step-indicator" aria-label="智能硬件成本估算步骤">
@ -45,13 +52,6 @@
</nav>
<section v-if="currentStep === 1" class="step-card hardware-step-card">
<div class="workbench-head">
<div>
<p class="section-eyebrow">Step 01 · BOM selection</p>
<h2>核心元器件选型组合</h2>
</div>
</div>
<section class="cost-brief">
<span class="cost-brief__index">01</span>
<p>在目标成本约束下,权衡性能与成本,为每个元器件选择合适档位。请基于案例资料中的“元器件选型库”,完成核心元器件的选型组合。</p>
@ -94,20 +94,11 @@
<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>
<section v-else-if="currentStep === 2" class="step-card hardware-step-card">
<div class="workbench-head">
<div>
<p class="section-eyebrow">Step 02 · Volume costing</p>
<h2>批量成本核算与约束验证</h2>
</div>
<div class="step-utility-actions">
<button type="button" class="btn-nav" :disabled="exporting || !costRows.length" @click="exportStepTwo">{{ exporting ? "导出中…" : "导出成本核算表" }}</button>
</div>
<section class="cost-brief">
@ -157,20 +148,11 @@
</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>
<section v-else-if="currentStep === 3" class="step-card hardware-step-card">
<div class="workbench-head">
<div>
<p class="section-eyebrow">Step 03 · Manufacturing costing</p>
<h2>制造费用与单件总成本核算</h2>
</div>
<div class="step-utility-actions">
<button type="button" class="btn-nav" :disabled="exportingStepThree" @click="exportStepThree">
{{ exportingStepThree ? "导出中…" : "导出单件总成本表" }}
</button>
@ -216,20 +198,11 @@
{{ 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>
<section v-else class="step-card hardware-step-card">
<div class="workbench-head">
<div>
<p class="section-eyebrow">Step 04 · Cost optimisation</p>
<h2>成本结构可视化与优化决策</h2>
</div>
<div class="step-utility-actions">
<span class="step-chip">以第 2、3 步核算结果为依据</span>
</div>
@ -287,12 +260,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>
@ -311,11 +285,11 @@
<script setup>
import { computed, getCurrentInstance, onMounted, reactive, ref } from "vue";
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
import TrainingMaterialButton from "@/views/components/TrainingMaterialButton.vue";
import TrainingTaskToolbar from "@/views/components/TrainingTaskToolbar.vue";
import TrainingTaskBrief from "@/views/components/TrainingTaskBrief.vue";
import { getTrainingTaskByKey } from "@/api/trainingTask";
import { parseTrainingArray } from "@/views/training/taskKeyMap";
import { getStudentTrainingAnswer, saveStudentTrainingAnswer, uploadStudentTrainingFile, validateHardwareCostStepOne, validateHardwareCostStepTwo, validateHardwareCostStepThree, validateHardwareCostStepFour } from "@/api/studentTrainingAnswer";
import { deleteStudentTrainingAnswer, getStudentTrainingAnswer, saveStudentTrainingAnswer, uploadStudentTrainingFile, validateHardwareCostStepOne, validateHardwareCostStepTwo, validateHardwareCostStepThree, validateHardwareCostStepFour } from "@/api/studentTrainingAnswer";
import { isStudentDemo } from "@/utils/studentDemo";
const TASK_KEY = "hardware-cost";
@ -326,6 +300,13 @@ 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 || submittingTraining.value || Boolean(uploadingChart.value));
const currentStepTitle = computed(() => ({
1: "核心元器件选型组合",
2: "批量成本核算与约束验证",
3: "制造费用与单件总成本核算",
4: "成本结构可视化与优化决策",
})[currentStep.value] || "智能硬件成本估算");
let rowSeed = 1;
const rows = ref([createExampleRow()]);
const savedStepOneItems = ref([]);
@ -337,6 +318,7 @@ const savingStepThree = ref(false);
const exportingStepThree = ref(false);
const stepThreeSaved = ref(false);
const savingStepFour = ref(false);
const submittingTraining = ref(false);
const uploadingChart = ref("");
const stepTwoValidation = ref(null);
const stepTwo = reactive({ smallBatchConstraint: "", largeBatchConstraint: "", items: [] });
@ -620,7 +602,7 @@ async function handleCostChartUpload(event, type) {
uploadingChart.value = "";
}
}
async function saveStepFour() {
async function saveStepFour(saveAction = "SAVE") {
savingStepFour.value = true;
try {
const payload = stepFourPayload();
@ -630,21 +612,170 @@ async function saveStepFour() {
if (!validated.valid) { notifyError(validated.message || "请完善成本结构图和优化方案"); return; }
await saveStudentTrainingAnswer(TASK_KEY, {
currentStep: 4,
saveAction: "SUBMIT",
submitted: true,
saveAction,
submitted: saveAction === "SUBMIT",
step4Answer: JSON.stringify({
smallBatchChart: { ...stepFour.smallBatchChart },
largeBatchChart: { ...stepFour.largeBatchChart },
optimizationPlan: payload.optimizationPlan,
}),
});
notifySuccess("成本优化决策已保存");
notifySuccess(saveAction === "SUBMIT" ? "实训任务已提交" : "成本优化决策已保存");
return true;
} catch (error) {
notifyError(error?.message || "成本优化决策保存失败,请检查填写内容");
return false;
} finally {
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; }
return saveStepFour();
}
function buildStepOneAnswer(items, total) {
return JSON.stringify({ items, totalAmount: Number(total).toFixed(2) });
}
function buildStepTwoAnswer(validated) {
return JSON.stringify({
items: stepTwo.items,
smallBatchConstraint: validated.smallBatchConstraint,
largeBatchConstraint: validated.largeBatchConstraint,
smallBatchTotal: validated.smallBatchTotal,
largeBatchTotal: validated.largeBatchTotal,
});
}
function buildStepThreeAnswer(validated) {
return JSON.stringify({
items: stepThree.items,
smallBatchManufacturingCost: validated.smallBatchManufacturingCost,
largeBatchManufacturingCost: validated.largeBatchManufacturingCost,
smallBatchBomCost: validated.smallBatchBomCost,
largeBatchBomCost: validated.largeBatchBomCost,
smallBatchUnitTotalCost: validated.smallBatchUnitTotalCost,
largeBatchUnitTotalCost: validated.largeBatchUnitTotalCost,
});
}
function buildStepFourAnswer() {
return JSON.stringify({
smallBatchChart: { ...stepFour.smallBatchChart },
largeBatchChart: { ...stepFour.largeBatchChart },
optimizationPlan: stepFourPayload().optimizationPlan,
});
}
async function submitTask() {
if (isStepSaving.value) return false;
submittingTraining.value = true;
try {
// 顶部“提交任务”必须使用本页四步真实数据,不能走通用 DOM 快照提交。
const stepOneResult = (await validateHardwareCostStepOne(stepOnePayload()))?.data || {};
if (stepOneResult.valid === false) throw new Error(stepOneResult.message || "请完善第 1 步 BOM 物料选型");
const normalizedRows = Array.isArray(stepOneResult.items) && stepOneResult.items.length
? normalizeRows(stepOneResult.items)
: normalizeRows(stepOnePayload().items);
rows.value = normalizedRows;
const stepOneItems = stepOnePayload(normalizedRows).items;
savedStepOneItems.value = stepOneItems;
syncStepTwoRows(stepOneItems);
await saveStudentTrainingAnswer(TASK_KEY, {
currentStep: 1,
saveAction: "SAVE",
step1Answer: buildStepOneAnswer(stepOneItems, stepOneResult.totalAmount ?? totalAmount.value),
});
const stepTwoResult = (await validateHardwareCostStepTwo(stepTwoPayload()))?.data || {};
applyValidationResult(stepTwoResult);
if (!stepTwoResult.valid) throw new Error(stepTwoResult.message || "请完善第 2 步批量成本核算");
await saveStudentTrainingAnswer(TASK_KEY, {
currentStep: 2,
saveAction: "SAVE",
step2Answer: buildStepTwoAnswer(stepTwoResult),
});
stepTwoSaved.value = true;
const stepThreeResult = (await validateHardwareCostStepThree(stepThreePayload()))?.data || {};
applyStepThreeValidation(stepThreeResult);
if (!stepThreeResult.valid) throw new Error(stepThreeResult.message || "请完善第 3 步制造成本核算");
await saveStudentTrainingAnswer(TASK_KEY, {
currentStep: 3,
saveAction: "SAVE",
step3Answer: buildStepThreeAnswer(stepThreeResult),
});
stepThreeSaved.value = true;
const stepFourResult = (await validateHardwareCostStepFour(stepFourPayload()))?.data || {};
stepFourValidation.value = stepFourResult;
if (!stepFourResult.valid) throw new Error(stepFourResult.message || "请完善第 4 步成本优化决策");
await saveStudentTrainingAnswer(TASK_KEY, {
currentStep: 4,
saveAction: "SUBMIT",
submitted: true,
step4Answer: buildStepFourAnswer(),
});
currentStep.value = 4;
notifySuccess("实训任务已提交");
return true;
} catch (error) {
notifyError(error?.message || "提交失败,请检查四个步骤的填写内容");
return false;
} finally {
submittingTraining.value = false;
}
}
async function resetTraining() {
if (isStepSaving.value) return false;
try {
await deleteStudentTrainingAnswer(TASK_KEY);
rows.value = [createExampleRow()];
savedStepOneItems.value = [];
stepTwo.smallBatchConstraint = "";
stepTwo.largeBatchConstraint = "";
stepTwo.items = [];
stepTwoSaved.value = false;
stepTwoValidation.value = null;
stepThree.items = createDefaultManufacturingRows();
stepThreeSaved.value = false;
stepThreeValidation.value = null;
resetStepFour();
currentStep.value = 1;
notifySuccess("已清空全部实训步骤,可以重新开始");
return true;
} catch (error) {
notifyError(error?.message || "重新实训失败,请稍后重试");
return false;
}
}
function exportTrainingOutcome() {
const outcome = {
taskName: taskTitle.value,
exportedAt: new Date().toISOString(),
step1: { items: stepOnePayload().items, totalAmount: totalAmount.value },
step2: { ...stepTwoPayload(), smallBatchTotal: smallBatchTotal.value, largeBatchTotal: largeBatchTotal.value },
step3: { ...stepThreePayload(), smallBatchUnitTotalCost: smallBatchUnitTotalCost.value, largeBatchUnitTotalCost: largeBatchUnitTotalCost.value },
step4: JSON.parse(buildStepFourAnswer()),
};
const url = URL.createObjectURL(new Blob([JSON.stringify(outcome, null, 2)], { type: "application/json;charset=utf-8" }));
const link = document.createElement("a");
link.href = url;
link.download = "智能硬件成本估算-实训成果.json";
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
URL.revokeObjectURL(url);
notifySuccess("实训成果已导出");
}
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() {
@ -845,6 +976,18 @@ onMounted(async () => {
line-height: 1.3;
}
.hardware-cost-page .hardware-cost-toolbar {
align-self: center;
justify-content: flex-end;
max-width: 100%;
}
.hardware-cost-page .step-utility-actions {
display: flex;
justify-content: flex-end;
margin: 0 0 16px;
}
.hardware-cost-page .hardware-workbench > .step-indicator {
margin: 0 0 30px !important;
}
@ -934,6 +1077,11 @@ onMounted(async () => {
.step-tab.complete + .step-connector::after { border-color: #63e6f1; }
@media (max-width: 900px) {
.hardware-cost-page .hardware-cost-toolbar {
width: 100%;
justify-content: flex-start;
}
.step-indicator {
flex-direction: column;
align-items: stretch;

@ -176,7 +176,7 @@
</section>
<div v-if="steps.length" class="step-actions">
<el-button class="step-action-btn step-action-btn--previous" :disabled="currentStep === 1" @click="previousStep">
<el-button v-if="currentStep > 1" class="step-action-btn step-action-btn--previous" @click="previousStep">
<el-icon><ArrowLeft /></el-icon>
上一步
</el-button>
@ -184,20 +184,12 @@
<el-icon><CircleCheck /></el-icon>
保存当前进度
</el-button>
<el-button class="step-action-btn step-action-btn--next" :disabled="currentStep === steps.length" @click="nextStep">
<el-button v-if="currentStep < steps.length" class="step-action-btn step-action-btn--next" @click="nextStep">
下一步
<el-icon><ArrowRight /></el-icon>
</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>

@ -2,16 +2,21 @@
<div class="opportunity-page student-training-shell">
<main class="opportunity-core">
<header class="task-header"><span>产品规划与设计 · MARKET SIGNALS</span><h1>{{ taskTitle }}</h1></header>
<TrainingTaskBrief :background="taskBackground" :goals="taskGoals" :requirements="taskRequirement" :show-material="false" />
<TrainingTaskBrief :background="taskBackground" :goals="taskGoals" :requirements="taskRequirement" :show-material="false" :show-toolbar="false" />
<section class="workbench">
<div class="workbench-actions"><TrainingMaterialButton :material-name="taskConfig?.materialName" :material-url="taskConfig?.materialUrl" /><button class="btn" type="button" @click="exportOutcome"><el-icon><Download /></el-icon> 导出实训成果</button></div>
<div class="workbench-head">
<div>
<p class="workbench-eyebrow">PRODUCT PLANNING · MARKET SIGNALS</p>
<h2>{{ trainingSteps[currentStep - 1] || taskTitle }}</h2>
</div>
<TrainingTaskToolbar class="market-opportunity-toolbar" :task-key="TASK_KEY" :on-submit="submitTraining" :on-reset="resetTraining" :on-export="exportOutcome" />
</div>
<nav class="step-indicator" aria-label="市场机会识别与选品步骤"><template v-for="(step, index) in trainingSteps" :key="step"><button type="button" :class="['step-tab', { active: currentStep === index + 1, complete: currentStep > index + 1 }]" @click="switchStep(index + 1)"><b>{{ String(index + 1).padStart(2, '0') }}</b><span><strong>{{ step }}</strong><small>{{ currentStep === index + 1 ? '当前步骤' : '点击切换' }} →</small></span></button><i v-if="index < trainingSteps.length - 1" /></template></nav>
<section class="step-card">
<template v-if="currentStep === 1">
<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>
@ -19,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>
@ -27,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>
@ -40,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></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>
@ -48,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="saveAndCompleteTraining">保存并完成实训</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>
@ -67,14 +72,14 @@
<script setup>
import * as XLSX from "xlsx";
import { Download, 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";
import { isStudentDemo } from "@/utils/studentDemo";
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
import TrainingMaterialButton from "@/views/components/TrainingMaterialButton.vue";
import TrainingTaskBrief from "@/views/components/TrainingTaskBrief.vue";
import TrainingTaskToolbar from "@/views/components/TrainingTaskToolbar.vue";
const TASK_KEY = "market-opportunity-selection";
const SCORE_CALCULATION_GUIDE_URL = "/file/training-materials/market-opportunity-selection/6.综合得分计算操作说明.docx";
@ -114,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); }
@ -124,10 +129,16 @@ 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();
stepOneCheckResults.value = {};
stepOnePassed.value = false;
proxy?.$modal?.msgSuccess("已清空第 1 步填写内容");
}
async function resetTraining() {
if (saving.value) return;
saving.value = true;
try {
@ -148,7 +159,7 @@ async function resetStepOne() {
stepFourPassed.value = false;
stepFivePassed.value = false;
currentStep.value = 1;
proxy?.$modal?.msgSuccess("已清空本实训填写内容");
proxy?.$modal?.msgSuccess("已重新开始本次实训");
} catch (error) {
proxy?.$modal?.msgError?.(error?.message || "清空失败,请重试");
} finally {
@ -162,9 +173,13 @@ 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 saveAndCompleteTraining() { 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; } }
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"); }
// 远端版本:下载入口已改为后端内置 Excel 模板;以下旧生成逻辑仅保留作迁移参考。
@ -190,5 +205,10 @@ function exportOutcome() { const blob = new Blob([JSON.stringify({ taskName: tas
.visual-guide { display:grid; grid-template-columns:minmax(0,1fr) 210px; gap:22px; }.visual-guide .download-stack { align-content:center; }.visual-guide .download-stack .btn { border-radius:8px; }
.insight-table th:first-child { width:18%; }.insight-table th:nth-child(2) { width:16%; }.insight-table th:nth-child(3),.insight-table th:nth-child(4) { width:33%; }.insight-table td { padding:12px; vertical-align:top; }.insight-table td:first-child { vertical-align:middle; }.insight-table input { display:inline-block; width:105px; margin:0; text-align:center; }.insight-table .percent { margin-left:7px; color:#78d9f7; }.insight-table textarea { display:block; box-sizing:border-box; width:100%; min-height:106px; resize:vertical; border:1px solid rgba(115,220,255,.58); border-radius:7px; padding:10px 12px; color:#e9faff; background:#09293c; font:inherit; line-height:1.65; }.insight-table textarea::placeholder { color:#77a8bc; }.insight-guide { margin-top:24px; padding:18px 22px; border-left:3px solid #31d1ff; color:#c9e9f4; background:rgba(8,78,108,.18); line-height:1.75; }.insight-guide h3 { margin:0 0 7px; color:#fff; font-size:16px; }.insight-guide p { margin:5px 0; }
.conclusion-field { display:grid; gap:10px; }.conclusion-field label { color:#d9f5ff; font-weight:800; }.conclusion-field textarea { box-sizing:border-box; width:100%; min-height:280px; resize:vertical; border:1px solid rgba(115,220,255,.58); border-radius:12px; padding:16px 18px; color:#e9faff; background:linear-gradient(135deg,rgba(9,41,60,.96),rgba(2,27,43,.84)); font:inherit; font-size:16px; line-height:1.8; }.conclusion-field textarea::placeholder { color:#77a8bc; }
@media (max-width:720px) { .visual-guide { grid-template-columns:1fr; } }
.workbench-head { display:flex; align-items:center; justify-content:space-between; gap:18px; padding-bottom:18px; border-bottom:1px solid rgba(0,180,255,.2); }
.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>

@ -11,19 +11,16 @@
:goals="taskGoals"
:requirements="taskRequirement"
:show-material="false"
:show-toolbar="false"
/>
<section class="price-workbench">
<div class="workbench-head workbench-head--actions-only">
<div class="workbench-actions">
<TrainingMaterialButton
:material-name="taskConfig?.materialName"
:material-url="taskConfig?.materialUrl"
/>
<button type="button" class="outline-action" @click="exportPriceOutcome">
<el-icon><Download /></el-icon>导出实训成果
</button>
<div class="workbench-head">
<div>
<p class="section-eyebrow">PRODUCT PRICING</p>
<h2>{{ currentStepTitle }}</h2>
</div>
<TrainingTaskToolbar class="pricing-toolbar" :task-key="TASK_KEY" :on-submit="submitCurrentTask" :on-export="exportPriceOutcome" />
</div>
<nav class="step-indicator" aria-label="新产品定价步骤">
@ -46,12 +43,6 @@
</nav>
<section class="step-card">
<header class="step-title-row">
<div>
<p class="section-eyebrow">STEP {{ String(currentStep).padStart(2, "0") }}</p>
<h3>{{ currentStepTitle }}</h3>
</div>
</header>
<template v-if="currentStep === 1">
<p class="intro-copy">{{ labels.formulaTip }}</p>
@ -114,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>
@ -180,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>
@ -280,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>
@ -339,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>
@ -437,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>
@ -459,10 +429,9 @@
</template>
<script setup>
import { Download } from "@element-plus/icons-vue";
import { computed, getCurrentInstance, onMounted, reactive, ref } from "vue";
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
import TrainingMaterialButton from "@/views/components/TrainingMaterialButton.vue";
import TrainingTaskToolbar from "@/views/components/TrainingTaskToolbar.vue";
import TrainingTaskBrief from "@/views/components/TrainingTaskBrief.vue";
import {
getStudentTrainingAnswer,
@ -1052,7 +1021,7 @@ function validateStepFive() {
return "";
}
async function saveStepFive() {
async function saveStepFive(submit = false) {
if (saving.value) return;
const message = validateStepFive();
validationMessage.value = message;
@ -1077,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;
}
@ -1313,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;
}
@ -1341,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;
}
@ -1593,10 +1578,28 @@ onMounted(async () => {
background: rgba(0, 25, 42, 0.64);
}
.workbench-head--actions-only {
.workbench-head {
display: flex;
justify-content: flex-end;
align-items: flex-start;
justify-content: space-between;
gap: 18px;
margin-bottom: 18px;
padding-bottom: 18px;
border-bottom: 1px solid rgba(99, 217, 255, 0.27);
}
.section-eyebrow {
margin: 0;
color: #71dfff;
font-size: 12px;
font-weight: 800;
letter-spacing: 0.12em;
}
.workbench-head h2 {
margin: 5px 0 0;
color: #fff;
font-size: 24px;
}
.workbench-actions {
@ -1607,6 +1610,12 @@ onMounted(async () => {
margin-left: auto;
}
.pricing-toolbar {
align-self: center;
justify-content: flex-end;
max-width: 100%;
}
.outline-action {
display: inline-flex;
align-items: center;
@ -2227,6 +2236,11 @@ onMounted(async () => {
.footer-actions {
justify-content: flex-end;
}
.pricing-toolbar {
width: 100%;
justify-content: flex-start;
}
}
}
/* PSM dark theme */
@ -2419,4 +2433,5 @@ onMounted(async () => {
}
}
.step-connector { overflow: visible; }
.step-navigation { display:flex; justify-content:center; gap:12px; margin-top:24px; }
</style>

@ -6,18 +6,15 @@
<h1 class="task-title">{{ taskTitle }}</h1>
</section>
<TrainingTaskBrief :background="taskBackground" :goals="taskGoals" :requirements="taskRequirement" :show-material="false" />
<TrainingTaskBrief :background="taskBackground" :goals="taskGoals" :requirements="taskRequirement" :show-material="false" :show-toolbar="false" />
<section class="task-card">
<div class="workbench-head">
<div>
<p class="section-eyebrow">{{ currentStep === 3 ? 'PRD document delivery' : currentStep === 2 ? 'PRD detailed specification' : 'PRD module matching' }}</p>
<h2>{{ currentStep === 3 ? '生成并提交产品需求文档' : currentStep === 2 ? '填写 PRD 七大模块详细信息' : '认识 PRD 的核心模块' }}</h2>
</div>
<div class="workbench-actions">
<TrainingMaterialButton :material-name="taskConfig?.materialName" :material-url="taskConfig?.materialUrl" />
<button type="button" class="outline-action" @click="exportOutcome"><el-icon><Download /></el-icon>{{ currentStep === 3 ? '预览产品需求说明书' : '导出实训成果' }}</button>
<h2>{{ trainingSteps[currentStep - 1] || '产品需求说明书' }}</h2>
</div>
<TrainingTaskToolbar class="requirements-doc-toolbar" :task-key="TASK_KEY" :on-submit="submitTask" :on-export="exportOutcome" />
</div>
<nav class="step-indicator" aria-label="产品需求文档撰写步骤">
@ -35,13 +32,6 @@
</nav>
<section v-if="currentStep === 1" class="step-card">
<div class="step-title-row">
<div>
<p class="section-eyebrow">Step 01</p>
<h3>{{ trainingSteps[0] }}</h3>
</div>
<span class="step-chip">拖拽匹配判题</span>
</div>
<p class="step-desc">PRD 是产品开发的纲领性文件,通常包含文档说明、产品概述、用户需求与场景、核心功能需求、非功能需求、硬件规格与设计需求、测试需求、项目规划和需求变更管理等模块。请把右侧被打乱的“核心作用”卡片拖入左侧对应模块;全部匹配正确后才能进入第 2 步。</p>
<div class="matching-tip" role="status">
@ -88,22 +78,9 @@
</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">
<div class="step-title-row">
<div>
<p class="section-eyebrow">Step 02</p>
<h3>{{ trainingSteps[1] }}</h3>
</div>
<span class="step-chip">可编辑 PRD 架构表</span>
</div>
<p class="step-desc">PRD 的每一个模块都需要言之有物、数据支撑。请基于案例资料和前期实训成果,完成以下七大模块的详细信息。</p>
<div class="prd-note"><el-icon><InfoFilled /></el-icon><span>灰色文字为参考示例,可点击“填入示例”后再修改。导出表格会同时包含示例内容和你的填写内容。</span></div>
@ -125,21 +102,9 @@
</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">
<div class="step-title-row">
<div>
<p class="section-eyebrow">Step 03</p>
<h3>{{ trainingSteps[2] || '生成产品需求文档' }}</h3>
</div>
<span class="step-chip">Word / PDF 在线预览</span>
</div>
<p class="step-desc">PRD 是跨团队协作的基准文档。请基于第 2 步的核心模块信息,结合案例资料中的完整数据,生成一份完整的产品需求文档后上传。</p>
<div class="prd-delivery-guide">
@ -170,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">
@ -183,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>
@ -207,7 +172,7 @@
import { computed, getCurrentInstance, onMounted, ref } from "vue";
import { ArrowRight, Close, Delete, Document, Download, InfoFilled, RefreshLeft, UploadFilled, View } from "@element-plus/icons-vue";
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
import TrainingMaterialButton from "@/views/components/TrainingMaterialButton.vue";
import TrainingTaskToolbar from "@/views/components/TrainingTaskToolbar.vue";
import TrainingTaskBrief from "@/views/components/TrainingTaskBrief.vue";
import { checkRequirementsDocumentStepOne, getStudentTrainingAnswer, previewRequirementsDocumentFile, saveStudentTrainingAnswer, uploadStudentTrainingFile } from "@/api/studentTrainingAnswer";
import { getTrainingTaskByKey } from "@/api/trainingTask";
@ -518,21 +483,36 @@ 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>
<style scoped>
.requirements-doc-page { min-height: 100vh; color: #dcebf8; background: radial-gradient(circle at 15% -10%, rgba(23, 134, 205, .22), transparent 36%), #071521; }
.training-core { width: min(1480px, calc(100% - 48px)); margin: 0 auto; padding: 30px 0 60px; }
/* 该页处于带 AI 侧栏的双栏工作区,不能再用居中最大宽度,否则两侧会出现大面积空白。 */
.training-core { width: 100%; max-width: none; min-height: 0; margin: 0; padding: 0; }
.task-header { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }.task-badge, .step-chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border: 1px solid rgba(68, 203, 255, .42); border-radius: 999px; color: #8ee7ff; background: rgba(6, 86, 129, .28); font-size: 13px; }.task-title { margin: 0; color: #f1f8ff; font-size: 26px; letter-spacing: .02em; }
.task-card { padding: 26px; border: 1px solid rgba(66, 181, 237, .42); border-radius: 24px; background: rgba(4, 24, 39, .78); box-shadow: 0 18px 42px rgba(0, 0, 0, .2); }.workbench-head, .step-title-row, .purpose-bank__head, .task-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }.workbench-head h2, .step-title-row h3, .purpose-bank h4 { margin: 4px 0 0; color: #f2f9ff; }.section-eyebrow { margin: 0; color: #55d8ff; font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.task-card { padding: 26px; border: 1px solid rgba(66, 181, 237, .42); border-radius: 24px; background: rgba(4, 24, 39, .78); box-shadow: 0 18px 42px rgba(0, 0, 0, .2); }.workbench-head, .step-title-row, .purpose-bank__head, .task-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }.workbench-head { padding-bottom: 18px; border-bottom: 1px solid rgba(0, 180, 255, .2); }.workbench-head h2, .step-title-row h3, .purpose-bank h4 { margin: 4px 0 0; color: #f2f9ff; }.workbench-head h2 { font-size: 24px; }.requirements-doc-toolbar { align-self: center; justify-content: flex-end; max-width: 100%; }.section-eyebrow { margin: 0; color: #55d8ff; font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.workbench-actions, .task-actions { display: flex; flex-wrap: wrap; }.outline-action, .btn-nav { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 0 15px; border: 1px solid rgba(98, 208, 255, .48); border-radius: 9px; color: #dff6ff; background: rgba(10, 87, 126, .35); cursor: pointer; transition: .2s ease; }.outline-action:hover, .btn-nav:hover:not(:disabled) { border-color: #56dcff; background: rgba(18, 137, 190, .48); transform: translateY(-1px); }.btn-submit { border-color: #26c9ed; color: #fff; background: linear-gradient(135deg, #087baa, #18b7df); }.btn-primary { border-color: #8a72ff; background: linear-gradient(135deg, #5a4fc9, #8c6ef1); }.btn-nav:disabled { cursor: not-allowed; opacity: .48; }
.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; } }
@media (max-width: 680px) { .training-core { width: min(100% - 24px, 1480px); padding-top: 16px; }.task-card, .step-card { padding: 15px; }.module-row { grid-template-columns: 1fr; }.module-label { border-right: 0; border-bottom: 1px solid rgba(124, 166, 189, .35); }.task-header { align-items: flex-start; flex-direction: column; }.task-title { font-size: 22px; }.step-indicator { margin: 18px 0; }.step-tab { min-width: 165px; }.workbench-actions, .task-actions { width: 100%; }.outline-action, .btn-nav { flex: 1; }.purpose-bank { padding: 14px; }.example-bar { flex-direction: column; } }
@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; } }
@media (max-width: 680px) { .training-core { width: 100%; padding-top: 0; }.task-card, .step-card { padding: 15px; }.module-row { grid-template-columns: 1fr; }.module-label { border-right: 0; border-bottom: 1px solid rgba(124, 166, 189, .35); }.task-header { align-items: flex-start; flex-direction: column; }.task-title { font-size: 22px; }.step-indicator { margin: 18px 0; }.step-tab { min-width: 165px; }.workbench-actions, .task-actions { width: 100%; }.outline-action, .btn-nav { flex: 1; }.purpose-bank { padding: 14px; }.example-bar { flex-direction: column; } }
</style>

@ -6,18 +6,15 @@
<h1 class="task-title">{{ taskTitle }}</h1>
</section>
<TrainingTaskBrief :background="taskBackground" :goals="taskGoals" :requirements="taskRequirement" :show-material="false" />
<TrainingTaskBrief :background="taskBackground" :goals="taskGoals" :requirements="taskRequirement" :show-material="false" :show-toolbar="false" />
<section class="task-card">
<div class="workbench-head">
<div>
<p class="section-eyebrow">智能硬件架构训练</p>
<h3>从底层到顶层完成模块化分层</h3>
</div>
<div class="workbench-actions">
<TrainingMaterialButton :material-name="taskConfig?.materialName" :material-url="taskConfig?.materialUrl" />
<button type="button" class="outline-action" @click="exportOutcome"><el-icon><Download /></el-icon>导出实训成果</button>
<p class="section-eyebrow">Smart hardware architecture</p>
<h3>{{ trainingSteps[currentStep - 1] || '产品架构设计' }}</h3>
</div>
<TrainingTaskToolbar class="architecture-toolbar" :task-key="TASK_KEY" :on-submit="checkAndSaveStepFour" :on-export="exportOutcome" />
</div>
<nav class="step-indicator" aria-label="产品架构设计步骤">
@ -50,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">
@ -77,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">
@ -116,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">
@ -142,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>
@ -153,12 +136,12 @@
</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";
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
import TrainingMaterialButton from "@/views/components/TrainingMaterialButton.vue";
import TrainingTaskToolbar from "@/views/components/TrainingTaskToolbar.vue";
import TrainingTaskBrief from "@/views/components/TrainingTaskBrief.vue";
import { SCENARIO_FIELDS, getCompletedScenarioCount, getRowsForScenarioValidation, getScenarioValidationMessage } from "./productArchitectureScenarioValidation.mjs";
@ -376,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; }
@ -390,4 +384,10 @@ function exportOutcome() { const blob = new Blob([JSON.stringify(buildAnswer(),
.flow-workspace{max-width:1000px;margin:0 auto}.flow-caption{display:flex;align-items:center;gap:12px;margin:0 0 14px;color:#71dfff;font-size:12px;font-weight:800}.flow-caption i{flex:1;height:1px;background:linear-gradient(90deg,#167da9,#71dfff)}.flow-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.flow-card{display:grid;grid-template-columns:32px 22px minmax(0,1fr) auto;gap:14px;align-items:center;padding:17px 18px;border:1px solid rgba(102,194,232,.42);border-radius:14px;background:linear-gradient(100deg,rgba(21,91,125,.5),rgba(12,39,58,.8));cursor:grab;transition:.2s}.flow-card:hover,.flow-card.dragging{border-color:#6de5ff;box-shadow:0 10px 22px rgba(0,0,0,.22);transform:translateY(-2px)}@media (max-width:720px){.flow-list{grid-template-columns:1fr}.flow-card{grid-template-columns:30px 17px minmax(0,1fr)}.flow-card .move-actions{grid-column:3;grid-template-columns:repeat(2,32px)}}
.scene-toolbar{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:14px;color:#d9efff;font-weight:800}.scene-toolbar em{color:#71dfff;font-style:normal;font-size:12px}.scene-toolbar__actions{display:flex;gap:8px}.scenario-table-wrap{overflow:auto;border:1px solid rgba(102,194,232,.42);border-radius:14px;background:rgba(3,22,36,.6)}.scenario-table{width:100%;min-width:1400px;border-collapse:collapse;table-layout:fixed}.scenario-table th{padding:13px 8px;border-right:1px solid rgba(102,194,232,.42);border-bottom:1px solid rgba(102,194,232,.42);color:#dff7ff;background:rgba(14,126,177,.48);font-size:14px;line-height:1.45}.scenario-table th small{color:#9edff5;font-size:12px}.scenario-table td{padding:9px;border-right:1px solid rgba(102,194,232,.28);border-bottom:1px solid rgba(102,194,232,.28);vertical-align:middle}.scenario-table th:first-child,.scenario-table td:first-child{width:52px}.scenario-table th:nth-child(2),.scenario-table td:nth-child(2){width:170px}.scenario-index{color:#71dfff;font-weight:900;text-align:center}.scenario-table :deep(.el-textarea__inner){min-height:82px!important;border:0;border-radius:8px;color:#edfaff;background:rgba(9,51,75,.52);box-shadow:none;line-height:1.55}.scenario-table :deep(.el-textarea__inner::placeholder){color:#91b7c9}.scenario-table tr:last-child td{border-bottom:0}.scenario-table th:last-child,.scenario-table td:last-child{border-right:0}@media (max-width:720px){.scene-toolbar{align-items:flex-start;flex-direction:column}.scene-toolbar__actions{width:100%}.scene-toolbar__actions .btn-nav{flex:1}}
.architecture-image-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}.architecture-image-card{min-width:0;padding:16px;border:1px solid rgba(102,194,232,.42);border-radius:16px;background:linear-gradient(145deg,rgba(13,71,98,.55),rgba(3,23,38,.82))}.architecture-image-card__head{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:13px;color:#fff;font-weight:900}.architecture-image-card__head small{color:#7ce4ff;font-size:12px}.architecture-image-trigger{display:grid;place-items:center;align-content:center;gap:7px;min-height:154px;border:1px dashed rgba(105,221,255,.65);border-radius:12px;color:#e8fbff;background:rgba(5,73,104,.22);cursor:pointer;text-align:center;transition:.2s}.architecture-image-trigger:hover{border-color:#77edff;background:rgba(8,122,169,.28)}.architecture-image-trigger input{position:absolute;width:1px;height:1px;overflow:hidden;opacity:0}.architecture-image-trigger .el-icon{font-size:24px;color:#76e5ff}.architecture-image-trigger span{color:#a3d9e9;font-size:12px}.architecture-image-preview{margin:13px 0 0}.architecture-image-preview :deep(.el-image){display:block;width:100%;height:170px;overflow:hidden;border:1px solid rgba(109,229,255,.5);border-radius:10px;background:#fff;cursor:zoom-in}.architecture-image-preview figcaption{display:flex;justify-content:space-between;gap:10px;align-items:center;margin-top:9px;color:#add8e8;font-size:12px}.architecture-image-preview figcaption span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.architecture-image-preview button,.architecture-guide button{border:0;border-radius:7px;padding:5px 9px;color:#fff;background:#0d91c7;font:inherit;cursor:pointer}.architecture-guide{margin-top:24px;padding:18px 22px;border-left:3px solid #27c8ff;border-radius:0 14px 14px 0;color:#c9e8f5;background:rgba(11,79,109,.22);line-height:1.75}.architecture-guide h4{margin:0 0 8px;color:#fff}.architecture-guide ol{margin:0 0 10px;padding-left:20px}.architecture-guide li{margin:5px 0}@media (max-width:1000px){.architecture-image-grid{grid-template-columns:1fr}}
.architecture-toolbar { flex: 0 0 auto; justify-content: flex-end; max-width: 100%; }
@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);

@ -6,7 +6,7 @@
<h1>{{ taskTitle }}</h1>
</section>
<TrainingTaskBrief :background="taskBackground" :goals="taskGoals" :requirements="taskRequirement" :show-material="false" />
<TrainingTaskBrief :background="taskBackground" :goals="taskGoals" :requirements="taskRequirement" :show-material="false" :show-toolbar="false" />
<section class="task-card">
<header class="workbench-head">
@ -14,7 +14,7 @@
<p class="section-eyebrow">STEP {{ String(activeStep).padStart(2, "0") }}</p>
<h2>{{ stepTitle }}</h2>
</div>
<TrainingMaterialButton :material-name="taskConfig?.materialName" :material-url="taskConfig?.materialUrl" />
<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>
@ -172,7 +171,7 @@ import { computed, onMounted, ref } from "vue";
import { ArrowRight, Document, Download, Minus, Plus } from "@element-plus/icons-vue";
import { ElMessage } from "element-plus";
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
import TrainingMaterialButton from "@/views/components/TrainingMaterialButton.vue";
import TrainingTaskToolbar from "@/views/components/TrainingTaskToolbar.vue";
import TrainingTaskBrief from "@/views/components/TrainingTaskBrief.vue";
import { getTrainingTaskByKey } from "@/api/trainingTask";
import { getStudentTrainingAnswer, saveStudentTrainingAnswer, validateReleaseChannelEvaluationStepOne, validateReleaseChannelEvaluationStepTwo, validateReleaseChannelEvaluationStepThree, validateReleaseChannelEvaluationStepFour } from "@/api/studentTrainingAnswer";
@ -250,7 +249,7 @@ onMounted(async () => { try { const result = await getTrainingTaskByKey(TASK_KEY
</script>
<style scoped lang="scss">
.release-channel-page{display:grid;grid-template-columns:minmax(720px,1fr) 340px;gap:24px;min-height:calc(100vh - 76px);padding:24px;color:#eef5ff;background:#06111d}.training-core{min-width:0;padding:28px;border:1px solid rgba(0,180,255,.25);border-radius:30px;background:rgba(8,18,28,.6)}.task-header{margin-bottom:24px}.task-badge{display:inline-flex;gap:8px;align-items:center;padding:5px 14px;border:1px solid rgba(99,217,255,.55);border-radius:999px;color:#dff5ff;background:rgba(17,126,178,.36);font-size:12px;font-weight:700}.task-header h1{margin:12px 0 0;color:#fff;font-size:30px}.task-card{margin-top:28px;padding:24px;border:1px solid rgba(82,174,226,.42);border-radius:24px;background:rgba(0,25,42,.64)}.workbench-head{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;padding-bottom:18px;border-bottom:1px solid rgba(0,180,255,.2)}.section-eyebrow{margin:0;color:#71dfff;font-size:12px;font-weight:800}.workbench-head h2{margin:4px 0 0;color:#fff;font-size:24px}.step-tabs{display:flex;gap:10px;margin:20px 0}.step-tabs button{min-height:36px;padding:0 15px;border:1px solid rgba(99,183,222,.42);border-radius:8px;color:#a8cde0;background:rgba(3,27,43,.56);font:inherit;font-size:13px;font-weight:800;cursor:pointer}.step-tabs button.active{border-color:#48d5ff;color:#fff;background:rgba(9,125,177,.7)}.lead,.scoring-guide{margin:22px 0;color:#e2f3ff;font-size:16px;line-height:1.9}.scoring-guide{padding:16px 18px;border-left:3px solid #48d5ff;border-radius:0 12px 12px 0;background:rgba(16,85,121,.2)}.table-actions{display:flex;justify-content:flex-end;gap:12px;margin:0 0 16px}.table-actions :deep(.el-button){min-width:110px;height:42px;font-weight:800}.table-wrap{overflow-x:auto;border:1px solid rgba(99,183,222,.46);border-radius:14px}.table-wrap table{width:100%;border-collapse:collapse}.weight-table{min-width:900px}.channel-table{min-width:1320px}.scoring-table{min-width:1780px}.ranking-table{min-width:880px}.table-wrap th,.table-wrap td{padding:12px;border-right:1px solid rgba(99,183,222,.35);border-bottom:1px solid rgba(99,183,222,.35);vertical-align:middle}.table-wrap th{white-space:nowrap;color:#effaff;background:#0c9dd6;font-size:14px}.table-wrap td{background:rgba(2,21,34,.58)}.weight-table tbody td:nth-child(1){width:22%}.weight-table tbody td:nth-child(2){width:43%}.weight-table tbody td:nth-child(3){width:23%}.channel-table td{min-width:134px}.channel-table td:first-child{min-width:110px}.scoring-table th:first-child{min-width:108px}.scoring-table td{min-width:108px}.scoring-table thead tr:nth-child(2) th{background:rgba(7,116,161,.94)}.ranking-table td{min-width:170px}.ranking-table td:first-child{min-width:100px}.rank-cell,.core-cell{text-align:center;font-weight:900}.core-cell .core{display:inline-flex;align-items:center;justify-content:center;min-width:30px;height:26px;border:1px solid rgba(99,235,204,.8);border-radius:999px;color:#062f30;background:#68edce}.weight-cell{color:#a8d9eb;text-align:center;font-weight:800}.analysis-field{display:block;margin-top:28px}.analysis-field>span{display:block;margin-bottom:10px;color:#dff5ff;font-size:15px;font-weight:800}.analysis-field :deep(.el-textarea__inner){min-height:180px!important;border:1px solid rgba(111,190,225,.3);border-radius:12px;box-shadow:none;color:#fff;background:#102233;line-height:1.7}.table-wrap :deep(.el-input__wrapper),.table-wrap :deep(.el-input-number){width:100%;background:#102233}.table-wrap :deep(.el-input__wrapper){box-shadow:0 0 0 1px rgba(111,190,225,.3) inset}.table-wrap :deep(.el-input__inner){color:#fff}.table-wrap :deep(.el-input-number .el-input__wrapper){background:#102233}.table-wrap small{display:block;margin-top:7px;color:#8fa8b8;font-size:12px}.operation-column{width:100px;text-align:center}.empty-row{text-align:center;color:#99b5c7}.table-wrap tfoot th,.table-wrap tfoot td{border-bottom:0;background:rgba(7,49,72,.74)}.total-error{color:#ff8c8c;font-weight:900}.hint{margin:18px 0 0;color:#95b2c3;line-height:1.8}.footer-actions{display:flex;justify-content:center;gap:16px;margin-top:30px}.footer-actions :deep(.el-button){min-width:156px;height:44px;font-weight:800}.footer-actions :deep(.el-button .el-icon){margin-left:5px}@media (max-width: 1100px){.release-channel-page{grid-template-columns: 1fr;}}@media (max-width:720px){.release-channel-page{padding:14px}.training-core{padding:18px}.task-card{padding:18px}.workbench-head{flex-direction:column}.table-actions,.footer-actions{align-items:stretch;flex-direction:column}.table-actions :deep(.el-button),.footer-actions :deep(.el-button){width:100%}}
.release-channel-page{display:grid;grid-template-columns:minmax(720px,1fr) 340px;gap:24px;min-height:calc(100vh - 76px);padding:24px;color:#eef5ff;background:#06111d}.training-core{min-width:0;padding:28px;border:1px solid rgba(0,180,255,.25);border-radius:30px;background:rgba(8,18,28,.6)}.task-header{margin-bottom:24px}.task-badge{display:inline-flex;gap:8px;align-items:center;padding:5px 14px;border:1px solid rgba(99,217,255,.55);border-radius:999px;color:#dff5ff;background:rgba(17,126,178,.36);font-size:12px;font-weight:700}.task-header h1{margin:12px 0 0;color:#fff;font-size:30px}.task-card{margin-top:28px;padding:24px;border:1px solid rgba(82,174,226,.42);border-radius:24px;background:rgba(0,25,42,.64)}.workbench-head{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;padding-bottom:18px;border-bottom:1px solid rgba(0,180,255,.2)}.release-channel-toolbar{align-self:center;justify-content:flex-end;max-width:100%}.section-eyebrow{margin:0;color:#71dfff;font-size:12px;font-weight:800}.workbench-head h2{margin:4px 0 0;color:#fff;font-size:24px}.step-tabs{display:flex;gap:10px;margin:20px 0}.step-tabs button{min-height:36px;padding:0 15px;border:1px solid rgba(99,183,222,.42);border-radius:8px;color:#a8cde0;background:rgba(3,27,43,.56);font:inherit;font-size:13px;font-weight:800;cursor:pointer}.step-tabs button.active{border-color:#48d5ff;color:#fff;background:rgba(9,125,177,.7)}.lead,.scoring-guide{margin:22px 0;color:#e2f3ff;font-size:16px;line-height:1.9}.scoring-guide{padding:16px 18px;border-left:3px solid #48d5ff;border-radius:0 12px 12px 0;background:rgba(16,85,121,.2)}.table-actions{display:flex;justify-content:flex-end;gap:12px;margin:0 0 16px}.table-actions :deep(.el-button){min-width:110px;height:42px;font-weight:800}.table-wrap{overflow-x:auto;border:1px solid rgba(99,183,222,.46);border-radius:14px}.table-wrap table{width:100%;border-collapse:collapse}.weight-table{min-width:900px}.channel-table{min-width:1320px}.scoring-table{min-width:1780px}.ranking-table{min-width:880px}.table-wrap th,.table-wrap td{padding:12px;border-right:1px solid rgba(99,183,222,.35);border-bottom:1px solid rgba(99,183,222,.35);vertical-align:middle}.table-wrap th{white-space:nowrap;color:#effaff;background:#0c9dd6;font-size:14px}.table-wrap td{background:rgba(2,21,34,.58)}.weight-table tbody td:nth-child(1){width:22%}.weight-table tbody td:nth-child(2){width:43%}.weight-table tbody td:nth-child(3){width:23%}.channel-table td{min-width:134px}.channel-table td:first-child{min-width:110px}.scoring-table th:first-child{min-width:108px}.scoring-table td{min-width:108px}.scoring-table thead tr:nth-child(2) th{background:rgba(7,116,161,.94)}.ranking-table td{min-width:170px}.ranking-table td:first-child{min-width:100px}.rank-cell,.core-cell{text-align:center;font-weight:900}.core-cell .core{display:inline-flex;align-items:center;justify-content:center;min-width:30px;height:26px;border:1px solid rgba(99,235,204,.8);border-radius:999px;color:#062f30;background:#68edce}.weight-cell{color:#a8d9eb;text-align:center;font-weight:800}.analysis-field{display:block;margin-top:28px}.analysis-field>span{display:block;margin-bottom:10px;color:#dff5ff;font-size:15px;font-weight:800}.analysis-field :deep(.el-textarea__inner){min-height:180px!important;border:1px solid rgba(111,190,225,.3);border-radius:12px;box-shadow:none;color:#fff;background:#102233;line-height:1.7}.table-wrap :deep(.el-input__wrapper),.table-wrap :deep(.el-input-number){width:100%;background:#102233}.table-wrap :deep(.el-input__wrapper){box-shadow:0 0 0 1px rgba(111,190,225,.3) inset}.table-wrap :deep(.el-input__inner){color:#fff}.table-wrap :deep(.el-input-number .el-input__wrapper){background:#102233}.table-wrap small{display:block;margin-top:7px;color:#8fa8b8;font-size:12px}.operation-column{width:100px;text-align:center}.empty-row{text-align:center;color:#99b5c7}.table-wrap tfoot th,.table-wrap tfoot td{border-bottom:0;background:rgba(7,49,72,.74)}.total-error{color:#ff8c8c;font-weight:900}.hint{margin:18px 0 0;color:#95b2c3;line-height:1.8}.footer-actions{display:flex;justify-content:center;gap:16px;margin-top:30px}.footer-actions :deep(.el-button){min-width:156px;height:44px;font-weight:800}.footer-actions :deep(.el-button .el-icon){margin-left:5px}@media (max-width: 1100px){.release-channel-page{grid-template-columns: 1fr;}}@media (max-width:720px){.release-channel-page{padding:14px}.training-core{padding:18px}.task-card{padding:18px}.workbench-head{flex-direction:column}.release-channel-toolbar{width:100%;justify-content:flex-start}.table-actions,.footer-actions{align-items:stretch;flex-direction:column}.table-actions :deep(.el-button),.footer-actions :deep(.el-button){width:100%}}
.step-three-notice{margin:20px 0 0;padding:12px 16px;border:1px solid rgba(255,112,112,.52);border-radius:10px;color:#ffb3b3;background:rgba(126,31,35,.16);line-height:1.7}.step-three-materials{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-top:18px;padding:16px 18px;border-left:3px solid #48d5ff;border-radius:0 12px 12px 0;background:rgba(16,85,121,.2);color:#d7edf8;line-height:1.7}.step-three-materials p{margin:0}.step-three-materials__button{flex:0 0 auto;font-weight:800}
/* 与标准实训页保持一致的步骤条:编号、步骤状态和箭头连接均可清晰识别。 */
.step-tabs{display:flex;align-items:center;gap:8px;margin:20px 0 28px;padding:18px 22px;overflow-x:auto;border:1px solid rgba(0,180,255,.3);border-radius:22px;background:rgba(1,18,31,.62)}.step-tabs .step-tab{display:flex;flex:1 1 0;align-items:center;min-width:145px;min-height:66px;gap:10px;padding:8px 12px;border:1px solid rgba(68,141,177,.35);border-radius:12px;color:#9ab3d0;background:rgba(3,27,43,.52);font:inherit;text-align:left;cursor:pointer;transition:.2s ease}.step-tabs .step-tab:hover{border-color:rgba(89,223,255,.82);color:#fff;background:rgba(8,92,131,.52);transform:translateY(-1px)}.step-tabs .step-tab:focus-visible{outline:2px solid #72e8ff;outline-offset:3px}.step-tabs .step-marker{display:grid;flex:0 0 38px;width:38px;height:38px;place-items:center;border:1px solid rgba(101,176,208,.6);border-radius:50%;color:#a6c4d9;background:rgba(3,25,40,.8);font-size:12px;font-weight:900}.step-tabs .step-copy{display:grid;min-width:0;gap:4px}.step-tabs .step-copy b{overflow:hidden;font-size:14px;font-weight:800;text-overflow:ellipsis;white-space:nowrap}.step-tabs .step-copy small{color:#66b6d4;font-size:10px;font-weight:800;letter-spacing:.06em}.step-tabs .step-tab.active{border-color:#53d8fb;color:#fff;background:linear-gradient(135deg,rgba(7,156,207,.85),rgba(13,105,161,.92));box-shadow:inset 0 0 24px rgba(77,213,255,.22)}.step-tabs .step-tab.active .step-marker{border-color:#72e8ff;color:#fff;background:linear-gradient(135deg,#08b7e8,#1375d0);box-shadow:0 0 0 5px rgba(25,179,237,.14),0 0 18px rgba(46,208,255,.58)}.step-tabs .step-tab.complete{color:#dffbff}.step-tabs .step-tab.complete .step-marker{border-color:rgba(84,230,221,.85);color:#062b37;background:#6ef0e1}.step-tabs .step-connector{position:relative;flex:0 0 24px;height:2px;background:rgba(86,198,235,.48)}.step-tabs .step-connector::after{position:absolute;top:50%;right:0;width:7px;height:7px;border-top:1px solid #73b1ce;border-right:1px solid #73b1ce;content:'';transform:translateY(-50%) rotate(45deg)}

@ -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(() => {

File diff suppressed because one or more lines are too long

@ -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>

@ -6,24 +6,22 @@
<h1 class="task-title">{{ page.title }}</h1>
</section>
<TrainingTaskBrief :background="page.background" :goals="page.goals" :requirements="page.requirements" :show-material="false" />
<TrainingTaskBrief :background="page.background" :goals="page.goals" :requirements="page.requirements" :show-toolbar="false" />
<section class="task-card">
<div class="workbench-head workbench-head--actions-only">
<div class="workbench-actions">
<el-button
class="material-download"
:plain="!page.material?.url"
@click="handleMaterialDownload"
>
<el-icon><Download /></el-icon>
{{ page.material?.name || "案例文档" }}
</el-button>
<el-button class="outline-action" @click="exportOutcome">
<el-icon><Download /></el-icon>
导出实训成果
</el-button>
<div class="workbench-head">
<div>
<p class="workbench-eyebrow">COMPREHENSIVE TRAINING · WORKFLOW</p>
<h2>{{ activeStepName || page.title }}</h2>
</div>
<TrainingTaskToolbar
class="comprehensive-training-toolbar"
:material-name="page.material?.name"
:material-url="page.material?.url"
:on-submit="submitTask"
:on-reset="resetTraining"
:on-export="exportOutcome"
/>
</div>
<nav v-if="isComprehensiveTurnNavigation" class="comprehensive-turn-nav" aria-label="实训步骤">
@ -388,17 +386,12 @@
</section>
<div v-if="!processRows.length" class="training-actions">
<el-button class="training-action training-action--save" :loading="saving" @click="saveCurrentProgress">保存当前进度</el-button>
<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>
<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>
<div v-if="processRows.length" class="training-actions">
<el-button class="training-action training-action--save" :loading="saving" @click="saveCurrentProgress">保存当前进度</el-button>
<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>
</main>
@ -414,12 +407,13 @@
</template>
<script setup>
import { Download, Upload } from "@element-plus/icons-vue";
import { Upload } from "@element-plus/icons-vue";
import { getTrainingTaskByKey } from "@/api/trainingTask";
import { getStudentTrainingAnswer, saveStudentTrainingAnswer, uploadStudentTrainingFile } from "@/api/studentTrainingAnswer";
import { getStudentTrainingPage } from "./studentTrainingPages";
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
import TrainingTaskBrief from "@/views/components/TrainingTaskBrief.vue";
import TrainingTaskToolbar from "@/views/components/TrainingTaskToolbar.vue";
import { isStudentDemo } from "@/utils/studentDemo";
const route = useRoute();
@ -1515,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;
}
@ -1532,26 +1528,22 @@ function saveCurrentProgress() {
return saveAnswer("SAVE");
}
function submitTask() {
return saveAnswer("SUBMIT");
function goPreviousStep() {
if (currentStep.value > 1) {
currentStep.value -= 1;
}
}
function handleMaterialDownload() {
const material = page.value.material;
if (!material?.url) {
proxy?.$modal?.msgWarning?.("暂无案例文档");
return;
async function goNextStep() {
if (currentStep.value >= configuredSteps.value.length) return;
const saved = await saveCurrentProgress();
if (saved) {
currentStep.value += 1;
}
const link = document.createElement("a");
link.href = material.url;
link.target = "_blank";
link.rel = "noopener";
if (material.name) {
link.download = material.name;
}
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
function submitTask() {
return saveAnswer("SUBMIT");
}
async function resetTraining() {
@ -1755,6 +1747,7 @@ function exportOutcome() {
padding-bottom: 18px;
border-bottom: 1px solid rgba(0, 180, 255, 0.2);
h2,
h3 {
margin: 4px 0 8px;
color: #ffffff;
@ -1772,6 +1765,21 @@ function exportOutcome() {
}
}
.workbench-eyebrow {
margin: 0 0 6px !important;
color: #59dcff !important;
font-size: 12px !important;
font-weight: 800 !important;
letter-spacing: 0.1em;
line-height: 1.4 !important;
}
.comprehensive-training-toolbar {
flex: 0 0 auto;
max-width: 100%;
justify-content: flex-end;
}
.workbench-actions {
display: flex;
flex: 0 0 auto;
@ -1781,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;
@ -2540,6 +2578,19 @@ function exportOutcome() {
flex-direction: column;
}
.comprehensive-training-toolbar {
width: 100%;
justify-content: flex-start;
}
.step-navigation {
flex-wrap: wrap;
:deep(.el-button) {
flex: 1 1 132px;
}
}
.form-grid {
grid-template-columns: 1fr;
}
@ -2643,13 +2694,6 @@ function exportOutcome() {
}
.workbench-head--actions-only {
justify-content: flex-end;
margin-bottom: 18px;
padding-bottom: 0;
border-bottom: 0;
}
.comprehensive-step-card {
margin-top: 32px;
padding: 22px;

@ -0,0 +1,18 @@
const assert = require("node:assert/strict");
const fs = require("node:fs");
const path = require("node:path");
const test = require("node:test");
const frontendRoot = path.resolve(__dirname, "..");
const page = fs.readFileSync(path.join(frontendRoot, "src/views/test/index.vue"), "utf8");
const brief = fs.readFileSync(path.join(frontendRoot, "src/views/components/TrainingTaskBrief.vue"), "utf8");
test("产品发布渠道评估将任务工具栏放在步骤标题右侧", () => {
assert.match(page, /<TrainingTaskBrief[\s\S]*?:show-toolbar="false"[\s\S]*?\/>/);
assert.match(page, /<header class="workbench-head">[\s\S]*?<TrainingTaskToolbar(?=[^>]*task-key="release-channel-evaluation")[^>]*\/>[\s\S]*?<\/header>/);
});
test("任务说明组件支持按页面隐藏顶部工具栏", () => {
assert.match(brief, /showToolbar:\s*\{[\s\S]*?default:\s*true/);
assert.match(brief, /<TrainingTaskToolbar\s+v-if="showToolbar"/);
});
Loading…
Cancel
Save