feat: 重构步骤导航为统一的组件化样式

将多个页面的旧版步骤导航(step-actions)替换为新的统一设计,新增步骤进度显示,优化按钮样式与布局,提升界面一致性与用户体验。
fix/exam-question-access-material-excel-delete-draft
qinzhenpen 2 months ago
parent 1de23486f3
commit c391961159

@ -33,13 +33,6 @@
</section>
<section class="purchase-workbench">
<div class="workbench-head">
<div>
<p class="section-eyebrow">Kraljic Matrix Analysis</p>
<h2>卡拉杰克模型分析</h2>
</div>
</div>
<p class="step-intro">
卡拉杰克模型是由彼得·卡拉杰克于1983年提出的一种采购管理工具,旨在帮助企业更好地管理供应链和采购策略。该模型从供应风险和利润影响两个维度出发,把物品分为四个象限:
</p>
@ -656,32 +649,6 @@ onMounted(() => {
gap: 20px;
}
.workbench-head {
display: flex;
align-items: flex-start;
gap: 16px;
margin: 0;
padding: 0;
border-bottom: 0;
}
.section-eyebrow {
margin: 0;
color: var(--student-accent);
font-size: 11px;
font-weight: 700;
letter-spacing: 0.12em;
text-transform: uppercase;
}
.workbench-head h2 {
margin: 4px 0 0;
color: var(--student-text);
font-size: var(--student-fs-h1);
font-weight: 700;
line-height: 1.35;
}
.step-intro {
margin: 0;
color: var(--student-text-secondary);

@ -245,11 +245,6 @@
</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">
@ -284,11 +279,6 @@
</el-checkbox>
</el-checkbox-group>
</section>
<div class="step-actions"><button class="action-button primary" type="button" :disabled="saving"
@click="saveStepTwo">{{ saving ? '校验并保存中…' : '保存并进入第 3 步' }}<el-icon><ArrowRight /></el-icon></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">
@ -340,9 +330,6 @@
</div>
</template>
</section>
<div class="step-actions"><button class="action-button primary" type="button"
:disabled="saving || uploading" @click="saveStepThree">{{ saving ? '校验并保存中…' : '保存并进入第 4 步'
}}<el-icon><ArrowRight /></el-icon></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"
@ -358,6 +345,26 @@
@click="currentStep = 3">返回第 3
步</button>
</section>
<div class="step-navigation">
<div class="step-nav-left">
<button v-if="currentStep > 1" type="button" class="btn-nav btn-ghost" @click="prevStep">
<el-icon><ArrowLeft /></el-icon>
上一步
</button>
<button type="button" class="btn-nav btn-save" :disabled="saving || uploading" @click="saveCurrentProgress">
<el-icon><CircleCheck /></el-icon>
保存当前进度
</button>
</div>
<div class="step-nav-right">
<span class="step-progress">Step {{ String(currentStep).padStart(2, "0") }} / {{ String(trainingSteps.length).padStart(2, "0") }}</span>
<button v-if="currentStep < trainingSteps.length" type="button" class="btn-nav btn-primary" :disabled="saving || uploading" @click="nextStep">
{{ saving ? "处理中…" : "下一步" }}
<el-icon><ArrowRight /></el-icon>
</button>
</div>
</div>
</section>
</main>
<TrainingAiSidebar study-tip="先从案例资料中提炼可验证的市场、用户与成本依据,再形成一致的商业论证。" reference-title="可行性论证提示"
@ -367,7 +374,7 @@
</template>
<script setup>
import { ArrowRight, Check, CircleCheck, Delete, Document, Download, RefreshLeft, UploadFilled, View } from "@element-plus/icons-vue"
import { ArrowLeft, ArrowRight, Check, CircleCheck, Delete, Document, Download, RefreshLeft, 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"
@ -444,6 +451,9 @@ function downloadReport() { if (!report.value.url) return; const link = document
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 }
function prevStep() { if (currentStep.value > 1) currentStep.value -= 1 }
async function saveCurrentProgress() { if (saving.value) return; saving.value = true; try { const step = currentStep.value; const payload = { currentStep: step, submitted: false, saveAction: "SAVE" }; if (step === 1) payload.step1Answer = JSON.stringify({ form: form.value, calculations: { unitTotalCost: totalCost.value, unitGrossProfit: unitGrossProfit.value, grossMargin: grossMargin.value } }); else if (step === 2) payload.step2Answer = JSON.stringify({ stepTwo: stepTwo.value }); else if (step === 3) payload.step3Answer = JSON.stringify({ report: report.value }); await saveStudentTrainingAnswer(TASK_KEY, payload); proxy?.$modal?.msgSuccess("已保存当前进度") } catch (error) { proxy?.$modal?.msgError?.(error?.message || "保存失败,请稍后重试") } finally { saving.value = false } }
async function nextStep() { if (currentStep.value === 1) return validateAndContinue(); if (currentStep.value === 2) return saveStepTwo(); if (currentStep.value === 3) return saveStepThree() }
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>
@ -926,11 +936,112 @@ td:last-child {
font-size: 13px;
}
.step-actions {
/* ===== 底部导航:工具栏式 ===== */
.step-navigation {
position: relative;
display: flex;
justify-content: center;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
gap: 10px;
margin-top: 24px;
margin-top: 16px;
padding: 12px 16px;
border: 1px solid var(--student-panel-border);
border-radius: 10px;
background: #ffffff;
}
.step-nav-left,
.step-nav-right {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: nowrap;
}
.step-nav-right {
margin-left: auto;
}
.btn-nav {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
min-height: 36px;
height: 36px;
padding: 0 14px;
border-radius: 8px;
font-family: inherit;
font-size: var(--student-fs-button);
font-weight: 600;
cursor: pointer;
transition: all 0.16s ease;
white-space: nowrap;
.el-icon {
font-size: 14px;
}
}
.btn-primary {
border: 1px solid var(--student-accent);
color: #ffffff;
background: var(--student-accent);
box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2), 0 2px 8px rgba(37, 99, 235, 0.15);
&:hover:not(:disabled) {
border-color: var(--student-accent-deep);
background: var(--student-accent-deep);
transform: translateY(-1px);
box-shadow: 0 2px 6px rgba(29, 78, 216, 0.3), 0 4px 12px rgba(29, 78, 216, 0.22);
}
&:active:not(:disabled) {
transform: translateY(0);
}
}
.btn-ghost {
border: 1px solid rgba(37, 99, 235, 0.35);
color: var(--student-accent);
background: #ffffff;
&:hover:not(:disabled) {
border-color: var(--student-accent);
background: var(--student-accent-soft);
transform: translateY(-1px);
box-shadow: 0 2px 6px rgba(37, 99, 235, 0.12);
}
}
.btn-save {
border: 1px solid #e5e7eb;
color: #4b5563;
background: #f9fafb;
&:hover:not(:disabled) {
border-color: #d1d5db;
background: #f3f4f6;
}
}
.btn-primary:disabled,
.btn-ghost:disabled,
.btn-save:disabled,
.btn-nav:disabled {
cursor: not-allowed;
opacity: 0.5;
transform: none;
box-shadow: none;
}
.step-progress {
color: var(--student-text-secondary);
font-size: var(--student-fs-caption);
font-weight: 700;
letter-spacing: 0.05em;
white-space: nowrap;
}
/* placeholder */
@ -1374,7 +1485,7 @@ td:last-child {
display: none;
}
.step-actions {
.step-navigation {
flex-wrap: wrap;
}
}

@ -30,21 +30,18 @@
<div class="step-title-row"><div><p>Step 01</p><h2>{{ trainingSteps[0] }}</h2></div><span>SWOT 分类练习</span></div>
<p class="step-desc">请根据案例文档中信息进行 SWOT 分析,进行各项内容归类,把文档中相应内容填写到以下四类中。</p>
<div class="swot-table-wrap"><table class="swot-table"><thead><tr><th>序号</th><th>SWOT维度</th><th>关键信息要点</th></tr></thead><tbody><tr v-for="(row, index) in swotRows" :key="row.key"><td>{{ index + 1 }}</td><td class="dimension-cell">{{ row.label }}</td><td><el-input v-model.trim="form[row.key]" type="textarea" :autosize="{ minRows: 2 }" :placeholder="row.placeholder" /></td></tr></tbody></table></div>
<div class="task-actions"><button type="button" class="btn btn-primary" :disabled="saving" @click="saveAndGoToStepTwo">保存并进入第 2 步</button><button type="button" class="btn" :disabled="saving" @click="resetTraining"><el-icon><RefreshLeft /></el-icon> 清空填写</button></div>
</template>
<template v-else-if="currentStep === 2">
<div class="step-title-row"><div><p>Step 02</p><h2>{{ trainingSteps[1] }}</h2></div><span>资料补充</span></div>
<div class="research-guide"><p>请自行收集资料,补充完善 SWOT 信息,每个维度至少补充 1 条。信息收集可参考以下方法:</p><ol><li>自行通过互联网平台收集;可在电商平台(京东/天猫)搜索“智能健身镜”,浏览竞品用户评价,从中发现竞品的优劣势和用户未满足的需求。</li><li>使用 AI 大模型智能搜索功能进行信息收集,参考提示词见实训任务案例文档。</li></ol><p>请把补充的 SWOT 信息资讯填入下表:</p></div>
<p v-if="!stepOnePassed" class="step-warning">请先完成并保存第 1 步的 SWOT 信息归类,再填写本步骤。</p>
<div class="swot-table-wrap"><table class="swot-table"><thead><tr><th>序号</th><th>SWOT维度</th><th>补充信息要点</th></tr></thead><tbody><tr v-for="(row, index) in swotRows" :key="row.key"><td>{{ index + 1 }}</td><td class="dimension-cell">{{ row.label }}</td><td><el-input v-model.trim="supplementForm[row.key]" type="textarea" :autosize="{ minRows: 2 }" :disabled="!stepOnePassed" :placeholder="row.placeholder" /></td></tr></tbody></table></div>
<div class="task-actions"><button type="button" class="btn btn-primary" :disabled="saving || !stepOnePassed" @click="saveAndGoToStepThree">保存并进入第 3 步</button><button type="button" class="btn" :disabled="saving || !stepOnePassed" @click="resetStepTwo"><el-icon><RefreshLeft /></el-icon> 清空填写</button></div>
</template>
<template v-else-if="currentStep === 3">
<div class="step-title-row"><div><p>Step 03</p><h2>{{ trainingSteps[2] }}</h2></div><span>SWOT 策略矩阵</span></div>
<p class="step-desc">结合 SWOT 因素矩阵,将内部因素与外部因素交叉组合,分别提出四种策略。每类策略至少提出 1 条。</p>
<p v-if="!stepTwoPassed" class="step-warning">请先完成并保存第 2 步的 SWOT 补充信息,再填写本步骤。</p>
<div class="strategy-table-wrap"><table class="strategy-table"><thead><tr><th>策略类型</th><th>组合逻辑(自动生成)</th><th>具体策略建议</th><th>预期效果</th></tr></thead><tbody><tr v-for="row in strategyDefinitions" :key="row.key"><td class="strategy-type">{{ row.label }}</td><td class="logic-cell"><p v-for="item in getCombinedLogic(row)" :key="item.label"><strong>{{ item.label }}</strong>{{ item.value || '暂无已保存信息' }}</p></td><td><el-input v-model.trim="strategyForm[row.key].recommendation" type="textarea" :autosize="{ minRows: 2 }" :disabled="!stepTwoPassed" placeholder="填写具体策略建议" /></td><td><el-input v-model.trim="strategyForm[row.key].expectedEffect" type="textarea" :autosize="{ minRows: 2 }" :disabled="!stepTwoPassed" placeholder="填写预期效果" /></td></tr></tbody></table></div>
<div class="task-actions"><button type="button" class="btn btn-primary" :disabled="saving || !stepTwoPassed" @click="saveAndGoToStepFour">保存并进入第 4 步</button><button type="button" class="btn" :disabled="saving || !stepTwoPassed" @click="resetStepThree"><el-icon><RefreshLeft /></el-icon> 清空填写</button></div>
</template>
<template v-else-if="currentStep === 4">
<div class="step-title-row"><div><p>Step 04</p><h2>{{ trainingSteps[3] }}</h2></div><span>最终决策</span></div>
@ -56,6 +53,26 @@
</template>
<div v-else class="step-placeholder"><p>第 {{ currentStep }} 步内容待配置</p><span>第 1 步 SWOT 分类已保存,可从上方步骤栏返回查看。</span></div>
</section>
<div class="step-navigation">
<div class="step-nav-left">
<button v-if="currentStep > 1" type="button" class="btn-nav btn-ghost" @click="prevStep">
<el-icon><ArrowLeft /></el-icon>
上一步
</button>
<button type="button" class="btn-nav btn-save" :disabled="saving" @click="saveCurrentProgress">
<el-icon><CircleCheck /></el-icon>
保存当前进度
</button>
</div>
<div class="step-nav-right">
<span class="step-progress">Step {{ String(currentStep).padStart(2, "0") }} / {{ String(trainingSteps.length).padStart(2, "0") }}</span>
<button v-if="currentStep < trainingSteps.length" type="button" class="btn-nav btn-primary" :disabled="saving" @click="nextStep">
{{ saving ? "处理中…" : "下一步" }}
<el-icon><ArrowRight /></el-icon>
</button>
</div>
</div>
</section>
</main>
<TrainingAiSidebar study-tip="先辨别内部条件与外部环境,再归类为优势、劣势、机会和威胁。" reference-title="SWOT 分类提示" reference-text="· 优势:企业或产品已有的资源、能力、渠道与差异化<br />· 劣势:内部能力、成本、体验、资源或覆盖不足<br />· 机会:外部市场增长、政策变化、消费趋势与技术窗口<br />· 威胁:竞争加剧、替代品、成本风险、政策限制与需求变化" :progress-items="progressItems" />
@ -63,7 +80,7 @@
</template>
<script setup>
import { RefreshLeft, TrendCharts } from "@element-plus/icons-vue";
import { ArrowLeft, ArrowRight, CircleCheck, RefreshLeft, TrendCharts } from "@element-plus/icons-vue";
import { checkCompetitiveEnvironmentAnalysisStepOne, checkCompetitiveEnvironmentAnalysisStepTwo, checkCompetitiveEnvironmentAnalysisStepThree, checkCompetitiveEnvironmentAnalysisStepFour, getStudentTrainingAnswer, saveStudentTrainingAnswer } from "@/api/studentTrainingAnswer";
import { getTrainingTaskByKey } from "@/api/trainingTask";
import { parseTrainingArray } from "@/views/training/taskKeyMap";
@ -104,6 +121,9 @@ function restoreFinalOutcome(value) { try { const parsed = typeof value === "str
function getCombinedLogic(row) { return [{ label: `${row.firstLabel}(第1步)· `, value: form.value[row.first] }, { label: `${row.firstLabel}(第2步补充)· `, value: supplementForm.value[row.first] }, { label: `${row.secondLabel}(第1步)· `, value: form.value[row.second] }, { label: `${row.secondLabel}(第2步补充)· `, value: supplementForm.value[row.second] }]; }
function buildStepOneOutcome() { return { title: taskTitle.value, swot: { ...form.value } }; } function buildStepTwoOutcome() { return { title: taskTitle.value, supplements: { ...supplementForm.value } }; } function buildStepThreeOutcome() { return { title: taskTitle.value, strategies: JSON.parse(JSON.stringify(strategyForm.value)) }; } function buildStepFourOutcome() { return { title: taskTitle.value, decision: JSON.parse(JSON.stringify(finalForm.value)) }; } function buildDraft() { return { step1: buildStepOneOutcome(), step2: buildStepTwoOutcome(), step3: buildStepThreeOutcome(), step4: buildStepFourOutcome(), currentStep: currentStep.value }; } function getLocalDraftKey() { const info = userStore.userInfo || {}; return `${TASK_KEY}:draft:${info.userId || info.user_id || info.username || info.userName || "anonymous"}`; } function persistDraft() { if (!draftReady.value) return; try { localStorage.setItem(getLocalDraftKey(), JSON.stringify(buildDraft())); } catch (error) { /* Optional browser draft. */ } } function loadDraft() { try { const raw = localStorage.getItem(getLocalDraftKey()); if (raw) { const draft = JSON.parse(raw); restoreOutcome(draft?.step1 || draft, form); restoreOutcome(draft?.step2, supplementForm, "supplements"); restoreStrategyOutcome(draft?.step3); restoreFinalOutcome(draft?.step4); if (Number(draft?.currentStep) > 0) currentStep.value = Number(draft.currentStep); } } catch (error) { clearDraft(); } } function clearDraft() { try { localStorage.removeItem(getLocalDraftKey()); } catch (error) { /* Ignore storage failures. */ } }
function switchStep(step) { if (step === 2 && !stepOnePassed.value) { proxy?.$modal?.msgWarning("请先完成并保存第 1 步"); return; } if (step === 3 && !stepTwoPassed.value) { proxy?.$modal?.msgWarning("请先完成并保存第 2 步"); return; } if (step === 4 && !stepThreePassed.value) { proxy?.$modal?.msgWarning("请先完成并保存第 3 步"); return; } currentStep.value = step; }
function prevStep() { if (currentStep.value > 1) currentStep.value -= 1; }
async function saveCurrentProgress() { if (saving.value) return; saving.value = true; try { const step = currentStep.value; const payload = { currentStep: step, submitted: false, saveAction: "SAVE" }; if (step === 1) payload.step1Answer = JSON.stringify(buildStepOneOutcome()); else if (step === 2) payload.step2Answer = JSON.stringify(buildStepTwoOutcome()); else if (step === 3) payload.step3Answer = JSON.stringify(buildStepThreeOutcome()); else if (step === 4) payload.step4Answer = JSON.stringify(buildStepFourOutcome()); await saveStudentTrainingAnswer(TASK_KEY, payload); proxy?.$modal?.msgSuccess("已保存当前进度"); } catch (error) { proxy?.$modal?.msgError?.(error?.message || "保存失败,请稍后重试"); } finally { saving.value = false; } }
async function nextStep() { if (currentStep.value === 1) return saveAndGoToStepTwo(); if (currentStep.value === 2) return saveAndGoToStepThree(); if (currentStep.value === 3) return saveAndGoToStepFour(); }
async function saveAndGoToStepTwo() { if (saving.value) return; saving.value = true; try { await checkCompetitiveEnvironmentAnalysisStepOne(form.value); await saveStudentTrainingAnswer(TASK_KEY, { step1Answer: JSON.stringify(buildStepOneOutcome()), currentStep: 2, submitted: false, saveAction: "SAVE" }); stepOnePassed.value = true; clearDraft(); currentStep.value = 2; proxy?.$modal?.msgSuccess("已保存,已进入第 2 步"); } catch (error) { proxy?.$modal?.msgError?.(error?.message || "请完整填写 SWOT 四类信息"); } finally { saving.value = false; } }
async function saveAndGoToStepThree() { if (saving.value || !stepOnePassed.value) return; saving.value = true; try { await checkCompetitiveEnvironmentAnalysisStepTwo(supplementForm.value); await saveStudentTrainingAnswer(TASK_KEY, { step2Answer: JSON.stringify(buildStepTwoOutcome()), currentStep: 3, submitted: false, saveAction: "SAVE" }); stepTwoPassed.value = true; clearDraft(); currentStep.value = 3; proxy?.$modal?.msgSuccess("已保存,已进入第 3 步"); } catch (error) { proxy?.$modal?.msgError?.(error?.message || "请为每个 SWOT 维度至少补充 1 条信息"); } finally { saving.value = false; } }
async function saveAndGoToStepFour() { if (saving.value || !stepTwoPassed.value) return; saving.value = true; try { await checkCompetitiveEnvironmentAnalysisStepThree({ strategies: strategyDefinitions.map((row) => ({ strategyType: row.key, ...strategyForm.value[row.key] })) }); await saveStudentTrainingAnswer(TASK_KEY, { step3Answer: JSON.stringify(buildStepThreeOutcome()), currentStep: 4, submitted: false, saveAction: "SAVE" }); stepThreePassed.value = true; clearDraft(); currentStep.value = 4; proxy?.$modal?.msgSuccess("已保存,已进入第 4 步"); } catch (error) { proxy?.$modal?.msgError?.(error?.message || "请完成四类 SWOT 策略建议和预期效果"); } finally { saving.value = false; } }
@ -573,12 +593,112 @@ function exportOutcome() { const blob = new Blob([JSON.stringify(buildDraft(), n
background: #ffffff;
}
/* ===== 底部按钮 ===== */
.task-actions {
/* ===== 底部导航:工具栏式 ===== */
.step-navigation {
position: relative;
display: flex;
justify-content: center;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
gap: 10px;
margin-top: 18px;
margin-top: 16px;
padding: 12px 16px;
border: 1px solid var(--student-panel-border);
border-radius: 10px;
background: #ffffff;
}
.step-nav-left,
.step-nav-right {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: nowrap;
}
.step-nav-right {
margin-left: auto;
}
.btn-nav {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
min-height: 36px;
height: 36px;
padding: 0 14px;
border-radius: 8px;
font-family: inherit;
font-size: var(--student-fs-button);
font-weight: 600;
cursor: pointer;
transition: all 0.16s ease;
white-space: nowrap;
.el-icon {
font-size: 14px;
}
}
.btn-primary {
border: 1px solid var(--student-accent);
color: #ffffff;
background: var(--student-accent);
box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2), 0 2px 8px rgba(37, 99, 235, 0.15);
&:hover:not(:disabled) {
border-color: var(--student-accent-deep);
background: var(--student-accent-deep);
transform: translateY(-1px);
box-shadow: 0 2px 6px rgba(29, 78, 216, 0.3), 0 4px 12px rgba(29, 78, 216, 0.22);
}
&:active:not(:disabled) {
transform: translateY(0);
}
}
.btn-ghost {
border: 1px solid rgba(37, 99, 235, 0.35);
color: var(--student-accent);
background: #ffffff;
&:hover:not(:disabled) {
border-color: var(--student-accent);
background: var(--student-accent-soft);
transform: translateY(-1px);
box-shadow: 0 2px 6px rgba(37, 99, 235, 0.12);
}
}
.btn-save {
border: 1px solid #e5e7eb;
color: #4b5563;
background: #f9fafb;
&:hover:not(:disabled) {
border-color: #d1d5db;
background: #f3f4f6;
}
}
.btn-primary:disabled,
.btn-ghost:disabled,
.btn-save:disabled,
.btn-nav:disabled {
cursor: not-allowed;
opacity: 0.5;
transform: none;
box-shadow: none;
}
.step-progress {
color: var(--student-text-secondary);
font-size: var(--student-fs-caption);
font-weight: 700;
letter-spacing: 0.05em;
white-space: nowrap;
}
.btn {
@ -908,52 +1028,4 @@ function exportOutcome() { const blob = new Blob([JSON.stringify(buildDraft(), n
box-shadow: 0 2px 6px rgba(37, 99, 235, 0.12) !important;
transform: none !important;
}
/* ============================================================
* 步骤操作按钮:task-actions > button.btn
* ============================================================ */
#app .studentLayout section.app-main:has(.competitive-analysis-page) .task-actions {
gap: 14px !important;
margin-top: 20px !important;
}
#app .studentLayout section.app-main:has(.competitive-analysis-page) .task-actions > button {
display: inline-flex !important;
align-items: center !important;
justify-content: center !important;
gap: 8px !important;
height: 34px !important;
min-height: 34px !important;
padding: 0 14px !important;
border: 1px solid rgba(37, 99, 235, 0.35) !important;
border-radius: 8px !important;
color: #2563eb !important;
background: #ffffff !important;
font-size: 13px !important;
font-weight: 700 !important;
line-height: 1 !important;
transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease !important;
}
#app .studentLayout section.app-main:has(.competitive-analysis-page) .task-actions > button:hover:not(:disabled) {
transform: translateY(-1px) !important;
border-color: #2563eb !important;
color: #2563eb !important;
background: #eff6ff !important;
box-shadow: 0 3px 10px rgba(37, 99, 235, 0.12) !important;
}
#app .studentLayout section.app-main:has(.competitive-analysis-page) .task-actions > button.btn-primary {
border-color: #2563eb !important;
color: #ffffff !important;
background: #2563eb !important;
box-shadow: 0 3px 10px rgba(37, 99, 235, 0.28) !important;
}
#app .studentLayout section.app-main:has(.competitive-analysis-page) .task-actions > button.btn-primary:hover:not(:disabled) {
border-color: #1d4ed8 !important;
color: #ffffff !important;
background: #1d4ed8 !important;
box-shadow: 0 5px 14px rgba(29, 78, 216, 0.32) !important;
}
</style>

@ -244,19 +244,24 @@
</div>
</section>
<div class="step-actions">
<el-button class="nav-action nav-action--previous" :disabled="form.activeStep === 0" @click="goPrev">
<div class="step-navigation">
<div class="step-nav-left">
<button v-if="form.activeStep > 0" type="button" class="btn-nav btn-ghost" :disabled="saving" @click="goPrev">
<el-icon><ArrowLeft /></el-icon>
上一步
</el-button>
<el-button class="nav-action nav-action--save" :loading="saving" @click="saveCurrentProgress">
</button>
<button type="button" class="btn-nav btn-save" :disabled="saving" @click="saveCurrentProgress">
<el-icon><CircleCheck /></el-icon>
保存当前进度
</el-button>
<el-button class="nav-action nav-action--next" :disabled="form.activeStep === flowSteps.length - 1" @click="goNext">
</button>
</div>
<div class="step-nav-right">
<span class="step-progress">Step {{ String(form.activeStep + 1).padStart(2, "0") }} / {{ String(flowSteps.length).padStart(2, "0") }}</span>
<button v-if="form.activeStep < flowSteps.length - 1" type="button" class="btn-nav btn-primary" :disabled="saving" @click="goNext">
下一步
<el-icon><ArrowRight /></el-icon>
</el-button>
</button>
</div>
</div>
<div class="training-actions">
@ -1704,21 +1709,146 @@ function downloadSurveyReportTemplate() {
.file-input { display: none; }
.step-actions {
/* ============ 底部步骤导航 ============ */
.step-navigation {
position: relative;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
gap: 10px;
margin-top: 16px;
padding: 12px 16px;
border: 1px solid var(--student-panel-border);
border-radius: 10px;
background: #ffffff;
}
.step-nav-left,
.step-nav-right {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: nowrap;
}
.step-nav-right {
margin-left: auto;
}
.btn-primary {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 14px;
margin-top: 22px;
gap: 6px;
min-height: 36px;
height: 36px;
padding: 0 14px;
border: 1px solid var(--student-accent);
border-radius: 8px;
color: #ffffff;
background: var(--student-accent);
font-family: inherit;
font-size: var(--student-fs-button);
font-weight: 600;
box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2), 0 2px 8px rgba(37, 99, 235, 0.15);
cursor: pointer;
transition: all 0.16s ease;
white-space: nowrap;
.el-icon {
font-size: 16px;
}
&:hover:not(:disabled) {
border-color: var(--student-accent-deep);
background: var(--student-accent-deep);
transform: translateY(-1px);
box-shadow: 0 2px 6px rgba(29, 78, 216, 0.3), 0 4px 12px rgba(29, 78, 216, 0.22);
}
&:active:not(:disabled) {
transform: translateY(0);
}
}
.btn-ghost {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
min-height: 36px;
height: 36px;
padding: 0 14px;
border: 1px solid rgba(37, 99, 235, 0.35);
border-radius: 8px;
color: var(--student-accent);
background: #ffffff;
font-family: inherit;
font-size: var(--student-fs-button);
font-weight: 600;
cursor: pointer;
transition: all 0.16s ease;
white-space: nowrap;
.el-icon {
font-size: 16px;
}
&:hover:not(:disabled) {
border-color: var(--student-accent);
background: var(--student-accent-soft);
transform: translateY(-1px);
box-shadow: 0 2px 6px rgba(37, 99, 235, 0.12);
}
}
.nav-action {
.btn-save {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
min-height: 36px;
height: 36px;
padding: 0 14px;
border: 1px solid #e5e7eb;
border-radius: 8px;
color: #4b5563;
background: #f9fafb;
font-family: inherit;
font-size: var(--student-fs-button);
font-weight: 600;
cursor: pointer;
transition: all 0.16s ease;
white-space: nowrap;
.el-icon {
font-size: 16px;
}
&:hover:not(:disabled) {
border-color: #d1d5db;
background: #f3f4f6;
}
}
.btn-primary:disabled,
.btn-ghost:disabled,
.btn-save:disabled,
.btn-nav:disabled {
cursor: not-allowed;
opacity: 0.5;
transform: none;
box-shadow: none;
}
.step-progress {
color: var(--student-text-secondary);
font-family: var(--student-font-data);
font-size: var(--student-fs-caption);
font-weight: 700;
letter-spacing: 0.05em;
white-space: nowrap;
}
.training-actions {
@ -1740,12 +1870,18 @@ function downloadSurveyReportTemplate() {
.workbench-actions,
.step-title-row,
.step-actions,
.step-navigation,
.training-actions {
flex-direction: column;
align-items: stretch;
}
.step-nav-left,
.step-nav-right,
.btn-nav {
width: 100%;
}
.hypothesis-head { grid-template-columns: 1fr; }
.training-eight-action {
@ -1973,63 +2109,7 @@ function downloadSurveyReportTemplate() {
box-shadow: 0 5px 14px rgba(29, 78, 216, 0.32) !important;
}
/* === nav-action (step-actions) === */
#app .studentLayout section.app-main:has(.consumer-behavior-page) .step-actions .el-button.nav-action {
min-height: 34px !important;
height: 34px !important;
padding: 0 14px !important;
border: 1px solid rgba(37, 99, 235, 0.35) !important;
border-radius: 8px !important;
color: var(--student-accent) !important;
background: #ffffff !important;
font-size: 13px !important;
font-weight: 700 !important;
box-shadow: none !important;
transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease !important;
}
#app .studentLayout section.app-main:has(.consumer-behavior-page) .step-actions .el-button.nav-action:hover:not(.is-disabled) {
transform: translateY(-1px) !important;
border-color: var(--student-accent) !important;
background: var(--student-accent-soft) !important;
color: var(--student-accent) !important;
box-shadow: 0 3px 10px rgba(37, 99, 235, 0.12) !important;
}
#app .studentLayout section.app-main:has(.consumer-behavior-page) .step-actions .el-button.nav-action:disabled,
#app .studentLayout section.app-main:has(.consumer-behavior-page) .step-actions .el-button.nav-action.is-disabled {
opacity: 0.45 !important;
cursor: not-allowed !important;
transform: none !important;
}
#app .studentLayout section.app-main:has(.consumer-behavior-page) .step-actions .el-button.nav-action--next {
border-color: var(--student-accent) !important;
color: #ffffff !important;
background: var(--student-accent) !important;
box-shadow: 0 3px 10px rgba(37, 99, 235, 0.28) !important;
}
#app .studentLayout section.app-main:has(.consumer-behavior-page) .step-actions .el-button.nav-action--next:hover:not(.is-disabled) {
border-color: var(--student-accent-deep) !important;
background: var(--student-accent-deep) !important;
color: #ffffff !important;
box-shadow: 0 5px 14px rgba(29, 78, 216, 0.32) !important;
}
#app .studentLayout section.app-main:has(.consumer-behavior-page) .step-actions .el-button.nav-action--save {
border-color: #e5e7eb !important;
color: #374151 !important;
background: #f3f4f6 !important;
font-weight: 700 !important;
}
#app .studentLayout section.app-main:has(.consumer-behavior-page) .step-actions .el-button.nav-action--save:hover:not(.is-disabled) {
border-color: #d1d5db !important;
background: #e5e7eb !important;
color: var(--student-accent) !important;
box-shadow: none !important;
}
/* === nav-action (step-navigation):原生 button,样式见 scoped 块 === */
/* ============================================================
* 顶部工具栏:TrainingMaterialButton 资料按钮 → 教育蓝

@ -217,20 +217,25 @@
<p v-if="journeyOptimizationMessage" class="journey-check-message" role="status">{{ journeyOptimizationMessage }}</p>
</section>
<div v-if="hasConfiguredSteps" class="step-actions">
<button type="button" class="nav-action nav-action--previous" :disabled="form.activeStep === 1" @click="goPreviousStep">
<div v-if="hasConfiguredSteps" class="step-navigation">
<div class="step-nav-left">
<button type="button" class="btn-nav btn-ghost" :disabled="form.activeStep === 1" @click="goPreviousStep">
<el-icon><ArrowLeft /></el-icon>
上一步
</button>
<button type="button" class="nav-action nav-action--save" :disabled="saving" @click="saveCurrentProgress">
<button type="button" class="btn-nav btn-save" :disabled="saving" @click="saveCurrentProgress">
<el-icon><CircleCheck /></el-icon>
保存当前进度
</button>
<button type="button" class="nav-action nav-action--next" :disabled="form.activeStep >= trainingSteps.length" @click="goNextStep">
</div>
<div class="step-nav-right">
<span class="step-progress">Step {{ String(form.activeStep).padStart(2, "0") }} / {{ String(trainingSteps.length).padStart(2, "0") }}</span>
<button type="button" class="btn-nav btn-primary" :disabled="form.activeStep >= trainingSteps.length" @click="goNextStep">
下一步
<el-icon><ArrowRight /></el-icon>
</button>
</div>
</div>
<div class="training-actions">
<el-button class="training-action training-action--reset" @click="resetTraining">
@ -1568,64 +1573,184 @@ function exportOutcome() {
}
}
/* ===== 底部按钮 ===== */
.step-actions {
/* ===== 底部步骤导航按钮 ===== */
.step-navigation {
position: relative;
display: flex;
justify-content: center;
gap: 14px;
margin-top: 20px;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
gap: 10px;
margin-top: 16px;
padding: 12px 16px;
border: 1px solid var(--student-panel-border);
border-radius: 10px;
background: #ffffff;
}
.nav-action {
.step-nav-left,
.step-nav-right {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: nowrap;
}
.step-nav-right {
margin-left: auto;
}
.btn-nav {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
min-width: 112px;
min-height: 36px;
padding: 0 18px;
height: 36px;
padding: 0 14px;
border: 1px solid rgba(37, 99, 235, 0.35);
border-radius: 10px;
color: var(--student-text);
border-radius: 8px;
color: var(--student-accent);
background: #ffffff;
font-family: inherit;
font-size: var(--student-fs-button);
font-weight: 600;
cursor: pointer;
text-shadow: none;
transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
transition: all 0.16s ease;
white-space: nowrap;
.el-icon {
font-size: 16px;
}
&:hover:not(:disabled) {
border-color: var(--student-accent);
background: var(--student-accent-soft);
color: var(--student-accent);
transform: translateY(-1px);
box-shadow: 0 3px 10px rgba(37, 99, 235, 0.12);
box-shadow: 0 2px 6px rgba(37, 99, 235, 0.12);
}
&:disabled {
cursor: not-allowed;
opacity: 0.5;
opacity: 0.45;
transform: none;
box-shadow: none;
}
}
.nav-action--next,
.nav-action--save {
border-color: var(--student-accent);
.btn-primary {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
min-height: 36px;
height: 36px;
padding: 0 14px;
border: 1px solid var(--student-accent);
border-radius: 8px;
color: #ffffff;
background: var(--student-accent);
font-weight: 700;
box-shadow: 0 3px 10px rgba(37, 99, 235, 0.28);
font-family: inherit;
font-size: var(--student-fs-button);
font-weight: 600;
box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2), 0 2px 8px rgba(37, 99, 235, 0.15);
cursor: pointer;
transition: all 0.16s ease;
white-space: nowrap;
.el-icon {
font-size: 16px;
}
.nav-action--next:hover:not(:disabled),
.nav-action--save:hover:not(:disabled) {
background: var(--student-accent-deep);
&:hover:not(:disabled) {
border-color: var(--student-accent-deep);
color: #ffffff;
box-shadow: 0 5px 14px rgba(29, 78, 216, 0.32);
background: var(--student-accent-deep);
transform: translateY(-1px);
box-shadow: 0 2px 6px rgba(29, 78, 216, 0.3), 0 4px 12px rgba(29, 78, 216, 0.22);
}
&:active:not(:disabled) {
transform: translateY(0);
}
}
.btn-ghost {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
min-height: 36px;
height: 36px;
padding: 0 14px;
border: 1px solid rgba(37, 99, 235, 0.35);
border-radius: 8px;
color: var(--student-accent);
background: #ffffff;
font-family: inherit;
font-size: var(--student-fs-button);
font-weight: 600;
cursor: pointer;
transition: all 0.16s ease;
white-space: nowrap;
.el-icon {
font-size: 16px;
}
&:hover:not(:disabled) {
border-color: var(--student-accent);
background: var(--student-accent-soft);
transform: translateY(-1px);
box-shadow: 0 2px 6px rgba(37, 99, 235, 0.12);
}
}
.btn-save {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
min-height: 36px;
height: 36px;
padding: 0 14px;
border: 1px solid #e5e7eb;
border-radius: 8px;
color: #4b5563;
background: #f9fafb;
font-family: inherit;
font-size: var(--student-fs-button);
font-weight: 600;
cursor: pointer;
transition: all 0.16s ease;
white-space: nowrap;
.el-icon {
font-size: 16px;
}
&:hover:not(:disabled) {
border-color: #d1d5db;
background: #f3f4f6;
}
}
.btn-primary:disabled,
.btn-ghost:disabled,
.btn-save:disabled,
.btn-nav:disabled {
cursor: not-allowed;
opacity: 0.5;
transform: none;
box-shadow: none;
}
.step-progress {
color: var(--student-text-secondary);
font-family: var(--student-font-data);
font-size: var(--student-fs-caption);
font-weight: 700;
letter-spacing: 0.05em;
white-space: nowrap;
}
/* training-actions 容器:el-button 由全局样式接管 */
@ -1641,12 +1766,28 @@ function exportOutcome() {
@media (max-width: 900px) {
.workbench-head--actions-only,
.step-title-row,
.step-actions,
.training-actions {
flex-direction: column;
align-items: stretch;
}
.step-navigation {
flex-direction: column;
align-items: stretch;
}
.step-nav-left,
.step-nav-right {
justify-content: center;
}
.btn-nav,
.btn-primary,
.btn-ghost,
.btn-save {
width: 100%;
}
.journey-sort-head {
flex-direction: column;
}
@ -1675,10 +1816,6 @@ function exportOutcome() {
.journey-map-helper .el-button {
width: 100%;
}
.nav-action {
width: 100%;
}
}
</style>

@ -188,7 +188,8 @@
</section>
<div v-if="hasConfiguredSteps" class="step-navigation">
<button type="button" class="btn-nav" :disabled="form.activeStep === 1" @click="goPreviousStep">
<div class="step-nav-left">
<button type="button" class="btn-nav btn-ghost" :disabled="form.activeStep === 1" @click="goPreviousStep">
<el-icon><ArrowLeft /></el-icon>
上一步
</button>
@ -196,11 +197,15 @@
<el-icon><CircleCheck /></el-icon>
保存当前进度
</button>
</div>
<div class="step-nav-right">
<span class="step-progress">Step {{ String(form.activeStep).padStart(2, '0') }} / {{ String(flowSteps.length).padStart(2, '0') }}</span>
<button type="button" class="btn-nav btn-primary" :disabled="form.activeStep === flowSteps.length" @click="goNextStep">
下一步
<el-icon><ArrowRight /></el-icon>
</button>
</div>
</div>
<div class="training-actions">
<el-button class="training-action training-action--reset" @click="resetTraining">
@ -1281,67 +1286,168 @@ function exportOutcome() {
/* ===== 底部步骤导航按钮 ===== */
.step-navigation {
position: relative;
display: flex;
justify-content: center;
gap: 14px;
margin-top: 20px;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
gap: 10px;
margin-top: 16px;
padding: 12px 16px;
border: 1px solid var(--student-panel-border);
border-radius: 10px;
background: #ffffff;
}
.step-nav-left,
.step-nav-right {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: nowrap;
}
.step-nav-right {
margin-left: auto;
}
.btn-nav {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 8px;
gap: 6px;
min-height: 36px;
height: 36px;
padding: 0 14px;
border: 1px solid rgba(37, 99, 235, 0.35);
border-radius: 8px;
color: var(--student-text);
color: var(--student-accent);
background: #ffffff;
font-family: inherit;
font-size: var(--student-fs-button);
font-weight: 700;
font-weight: 600;
cursor: pointer;
text-shadow: none;
transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
transition: all 0.16s ease;
white-space: nowrap;
.el-icon {
font-size: 16px;
}
.btn-nav:hover:not(:disabled) {
&:hover:not(:disabled) {
border-color: var(--student-accent);
background: var(--student-accent-soft);
color: var(--student-accent);
transform: translateY(-1px);
box-shadow: 0 3px 10px rgba(37, 99, 235, 0.12);
box-shadow: 0 2px 6px rgba(37, 99, 235, 0.12);
}
.btn-nav.btn-primary {
border-color: var(--student-accent);
&:disabled {
cursor: not-allowed;
opacity: 0.45;
transform: none;
box-shadow: none;
}
}
.btn-primary {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
min-height: 36px;
height: 36px;
padding: 0 14px;
border: 1px solid var(--student-accent);
border-radius: 8px;
color: #ffffff;
background: var(--student-accent);
font-weight: 700;
box-shadow: 0 3px 10px rgba(37, 99, 235, 0.28);
font-family: inherit;
font-size: var(--student-fs-button);
font-weight: 600;
box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2), 0 2px 8px rgba(37, 99, 235, 0.15);
cursor: pointer;
transition: all 0.16s ease;
white-space: nowrap;
.el-icon {
font-size: 16px;
}
.btn-nav.btn-primary:hover:not(:disabled) {
background: var(--student-accent-deep);
&:hover:not(:disabled) {
border-color: var(--student-accent-deep);
box-shadow: 0 5px 14px rgba(29, 78, 216, 0.32);
background: var(--student-accent-deep);
transform: translateY(-1px);
box-shadow: 0 2px 6px rgba(29, 78, 216, 0.3), 0 4px 12px rgba(29, 78, 216, 0.22);
}
.btn-nav.btn-save {
border-color: #e5e7eb;
color: var(--student-accent-light);
background: var(--student-accent-soft);
box-shadow: none;
&:active:not(:disabled) {
transform: translateY(0);
}
}
.btn-nav.btn-save:hover:not(:disabled) {
border-color: var(--student-accent);
background: #e9ecef;
.btn-ghost {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
min-height: 36px;
height: 36px;
padding: 0 14px;
border: 1px solid rgba(37, 99, 235, 0.35);
border-radius: 8px;
color: var(--student-accent);
box-shadow: none;
background: #ffffff;
font-family: inherit;
font-size: var(--student-fs-button);
font-weight: 600;
cursor: pointer;
transition: all 0.16s ease;
white-space: nowrap;
.el-icon {
font-size: 16px;
}
&:hover:not(:disabled) {
border-color: var(--student-accent);
background: var(--student-accent-soft);
transform: translateY(-1px);
box-shadow: 0 2px 6px rgba(37, 99, 235, 0.12);
}
}
.btn-save {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
min-height: 36px;
height: 36px;
padding: 0 14px;
border: 1px solid #e5e7eb;
border-radius: 8px;
color: #4b5563;
background: #f9fafb;
font-family: inherit;
font-size: var(--student-fs-button);
font-weight: 600;
cursor: pointer;
transition: all 0.16s ease;
white-space: nowrap;
.el-icon {
font-size: 16px;
}
&:hover:not(:disabled) {
border-color: #d1d5db;
background: #f3f4f6;
}
}
.btn-primary:disabled,
.btn-ghost:disabled,
.btn-save:disabled,
.btn-nav:disabled {
cursor: not-allowed;
opacity: 0.5;
@ -1349,6 +1455,15 @@ function exportOutcome() {
box-shadow: none;
}
.step-progress {
color: var(--student-text-secondary);
font-family: var(--student-font-data);
font-size: var(--student-fs-caption);
font-weight: 700;
letter-spacing: 0.05em;
white-space: nowrap;
}
/* training-actions 容器:保留,el-button 由全局样式接管 */
.training-actions {
display: flex;
@ -1368,12 +1483,21 @@ function exportOutcome() {
.outline-action,
.step-navigation,
.btn-nav {
.btn-nav,
.btn-primary,
.btn-ghost,
.btn-save {
width: 100%;
}
.step-navigation {
flex-direction: column;
align-items: stretch;
}
.step-nav-left,
.step-nav-right {
justify-content: center;
}
.conversion-intro,

@ -83,9 +83,23 @@
<div v-else class="step-placeholder"><p>第 {{ currentStep }} 步内容待配置</p><span>前序步骤已保存,可从上方步骤栏返回查看。</span></div>
<div class="step-navigation">
<button v-if="currentStep > 1" type="button" class="btn-nav" :disabled="saving" @click="previousStep">上一步</button>
<button type="button" class="btn-nav btn-primary" :disabled="saving" @click="saveCurrentProgress">保存当前进度</button>
<button v-if="currentStep < trainingSteps.length" type="button" class="btn-nav btn-primary" :disabled="saving" @click="nextStep">下一步</button>
<div class="step-nav-left">
<button v-if="currentStep > 1" type="button" class="btn-nav btn-ghost" :disabled="saving" @click="previousStep">
<el-icon><ArrowLeft /></el-icon>
上一步
</button>
<button type="button" class="btn-nav btn-save" :disabled="saving" @click="saveCurrentProgress">
<el-icon><CircleCheck /></el-icon>
保存当前进度
</button>
</div>
<div class="step-nav-right">
<span class="step-progress">Step {{ String(currentStep).padStart(2, "0") }} / {{ String(trainingSteps.length).padStart(2, "0") }}</span>
<button v-if="currentStep < trainingSteps.length" type="button" class="btn-nav btn-primary" :disabled="saving" @click="nextStep">
下一步
<el-icon><ArrowRight /></el-icon>
</button>
</div>
</div>
</section>
</section>
@ -95,7 +109,7 @@
</template>
<script setup>
import { DataAnalysis } from "@element-plus/icons-vue";
import { ArrowLeft, ArrowRight, CircleCheck, DataAnalysis } from "@element-plus/icons-vue";
import { checkIndustryDemandAnalysisStepOne, checkIndustryDemandAnalysisStepTwo, checkIndustryDemandAnalysisStepThree, checkIndustryDemandAnalysisStepFour, deleteStudentTrainingAnswer, getStudentTrainingAnswer, saveStudentTrainingAnswer } from "@/api/studentTrainingAnswer";
import { getTrainingTaskByKey } from "@/api/trainingTask";
import { parseTrainingArray } from "@/views/training/taskKeyMap";
@ -605,13 +619,68 @@ function exportOutcome() { const blob = new Blob([JSON.stringify(buildDraft(), n
/* ===== 底部步骤导航按钮(scoped 基础) ===== */
.step-navigation {
position: relative;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
gap: 10px;
margin-top: 16px;
padding: 12px 16px;
border: 1px solid var(--student-panel-border);
border-radius: 10px;
background: #ffffff;
}
.step-nav-left,
.step-nav-right {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: nowrap;
}
.step-nav-right {
margin-left: auto;
}
.btn-primary {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 14px;
margin-top: 20px;
gap: 6px;
min-height: 36px;
height: 36px;
padding: 0 14px;
border: 1px solid var(--student-accent);
border-radius: 8px;
color: #ffffff;
background: var(--student-accent);
font-family: inherit;
font-size: var(--student-fs-button);
font-weight: 600;
box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2), 0 2px 8px rgba(37, 99, 235, 0.15);
cursor: pointer;
transition: all 0.16s ease;
white-space: nowrap;
.el-icon {
font-size: 16px;
}
.step-navigation .btn-nav {
&:hover:not(:disabled) {
border-color: var(--student-accent-deep);
background: var(--student-accent-deep);
transform: translateY(-1px);
box-shadow: 0 2px 6px rgba(29, 78, 216, 0.3), 0 4px 12px rgba(29, 78, 216, 0.22);
}
&:active:not(:disabled) {
transform: translateY(0);
}
}
.btn-ghost {
display: inline-flex;
align-items: center;
justify-content: center;
@ -621,44 +690,75 @@ function exportOutcome() { const blob = new Blob([JSON.stringify(buildDraft(), n
padding: 0 14px;
border: 1px solid rgba(37, 99, 235, 0.35);
border-radius: 8px;
color: var(--student-text);
color: var(--student-accent);
background: #ffffff;
font-family: inherit;
font-size: var(--student-fs-button);
font-weight: 600;
cursor: pointer;
text-shadow: none;
transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
transition: all 0.16s ease;
white-space: nowrap;
.el-icon {
font-size: 16px;
}
.step-navigation .btn-nav:hover {
&:hover:not(:disabled) {
border-color: var(--student-accent);
background: var(--student-accent-soft);
color: var(--student-accent);
transform: translateY(-1px);
box-shadow: 0 3px 10px rgba(37, 99, 235, 0.12);
box-shadow: 0 2px 6px rgba(37, 99, 235, 0.12);
}
}
.step-navigation .btn-nav.btn-primary {
border-color: var(--student-accent);
color: #ffffff;
background: var(--student-accent);
font-weight: 700;
box-shadow: 0 3px 10px rgba(37, 99, 235, 0.28);
.btn-save {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
min-height: 36px;
height: 36px;
padding: 0 14px;
border: 1px solid #e5e7eb;
border-radius: 8px;
color: #4b5563;
background: #f9fafb;
font-family: inherit;
font-size: var(--student-fs-button);
font-weight: 600;
cursor: pointer;
transition: all 0.16s ease;
white-space: nowrap;
.el-icon {
font-size: 16px;
}
.step-navigation .btn-nav.btn-primary:hover {
background: var(--student-accent-deep);
border-color: var(--student-accent-deep);
box-shadow: 0 5px 14px rgba(29, 78, 216, 0.32);
&:hover:not(:disabled) {
border-color: #d1d5db;
background: #f3f4f6;
}
}
.step-navigation .btn-nav:disabled {
.btn-primary:disabled,
.btn-ghost:disabled,
.btn-save:disabled,
.btn-nav:disabled {
cursor: not-allowed;
opacity: 0.5;
transform: none;
box-shadow: none;
}
.step-progress {
color: var(--student-text-secondary);
font-family: var(--student-font-data);
font-size: var(--student-fs-caption);
font-weight: 700;
letter-spacing: 0.05em;
white-space: nowrap;
}
.step-placeholder {
padding: 60px 20px;
text-align: center;
@ -679,8 +779,10 @@ function exportOutcome() { const blob = new Blob([JSON.stringify(buildDraft(), n
@media (max-width: 720px) {
.task-header { flex-direction: column; align-items: flex-start; }
.step-chip { display: none; }
.step-navigation { flex-direction: column; }
.step-navigation .btn-nav { width: 100%; }
.step-navigation { flex-direction: column; align-items: stretch; }
.step-nav-left,
.step-nav-right { width: 100%; }
.btn-nav { width: 100%; }
}
</style>

@ -315,27 +315,33 @@
</div>
</section>
<div v-if="steps.length" class="step-actions">
<el-button class="step-action step-action--previous" :disabled="currentStep <= 1"
<div v-if="steps.length" class="step-navigation">
<div class="step-nav-left">
<button v-if="currentStep > 1" type="button" class="btn-nav btn-ghost" :disabled="saving"
@click="currentStep -= 1">
<el-icon>
<ArrowLeft />
</el-icon>
上一步
</el-button>
<el-button class="step-action step-action--save" :loading="saving" @click="saveCurrentProgress">
</button>
<button type="button" class="btn-nav btn-save" :disabled="saving" @click="saveCurrentProgress">
<el-icon>
<CircleCheck />
</el-icon>
保存当前进度
</el-button>
<el-button class="step-action step-action--next" :disabled="currentStep >= steps.length"
@click="goNext">
</button>
</div>
<div class="step-nav-right">
<span class="step-progress">Step {{ String(currentStep).padStart(2, "0") }} / {{
String(steps.length).padStart(2, "0") }}</span>
<button v-if="currentStep < steps.length" type="button" class="btn-nav btn-primary"
:disabled="saving" @click="goNext">
下一步
<el-icon>
<ArrowRight />
</el-icon>
</el-button>
</button>
</div>
</div>
<div class="training-actions">
@ -1934,53 +1940,145 @@ function exportOutcome() {
}
/* ============ 底部步骤导航 ============ */
.step-actions {
.step-navigation {
position: relative;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
gap: 10px;
margin-top: 16px;
padding: 12px 16px;
border: 1px solid var(--student-panel-border);
border-radius: 10px;
background: #ffffff;
}
.step-nav-left,
.step-nav-right {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: nowrap;
}
.step-nav-right {
margin-left: auto;
}
.btn-primary {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 12px;
margin-top: 18px;
gap: 6px;
min-height: 36px;
height: 36px;
padding: 0 14px;
border: 1px solid var(--student-accent);
border-radius: 8px;
color: #ffffff;
background: var(--student-accent);
font-family: inherit;
font-size: var(--student-fs-button);
font-weight: 600;
box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2), 0 2px 8px rgba(37, 99, 235, 0.15);
cursor: pointer;
transition: all 0.16s ease;
white-space: nowrap;
.el-icon {
font-size: 16px;
}
.step-actions :deep(.step-action) {
min-height: 40px;
padding: 0 18px;
&:hover:not(:disabled) {
border-color: var(--student-accent-deep);
background: var(--student-accent-deep);
transform: translateY(-1px);
box-shadow: 0 2px 6px rgba(29, 78, 216, 0.3), 0 4px 12px rgba(29, 78, 216, 0.22);
}
&:active:not(:disabled) {
transform: translateY(0);
}
}
.btn-ghost {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
min-height: 36px;
height: 36px;
padding: 0 14px;
border: 1px solid rgba(37, 99, 235, 0.35);
border-radius: 10px;
border-radius: 8px;
color: var(--student-accent);
background: #ffffff;
font-size: 13px;
font-weight: 700;
transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
font-family: inherit;
font-size: var(--student-fs-button);
font-weight: 600;
cursor: pointer;
transition: all 0.16s ease;
white-space: nowrap;
&:hover:not(.is-disabled) {
transform: translateY(-1px);
.el-icon {
font-size: 16px;
}
&:hover:not(:disabled) {
border-color: var(--student-accent);
background: var(--student-accent-soft);
color: var(--student-accent);
box-shadow: 0 3px 10px rgba(37, 99, 235, 0.12);
transform: translateY(-1px);
box-shadow: 0 2px 6px rgba(37, 99, 235, 0.12);
}
}
.step-actions :deep(.step-action--save),
.step-actions :deep(.step-action--next) {
border-color: var(--student-accent);
color: #ffffff;
background: var(--student-accent);
box-shadow: 0 3px 10px rgba(37, 99, 235, 0.28);
.btn-save {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
min-height: 36px;
height: 36px;
padding: 0 14px;
border: 1px solid #e5e7eb;
border-radius: 8px;
color: #4b5563;
background: #f9fafb;
font-family: inherit;
font-size: var(--student-fs-button);
font-weight: 600;
cursor: pointer;
transition: all 0.16s ease;
white-space: nowrap;
&:hover:not(.is-disabled) {
transform: translateY(-1px);
background: var(--student-accent-deep);
border-color: var(--student-accent-deep);
box-shadow: 0 5px 14px rgba(29, 78, 216, 0.32);
color: #ffffff;
.el-icon {
font-size: 16px;
}
&:hover:not(:disabled) {
border-color: #d1d5db;
background: #f3f4f6;
}
}
.step-actions :deep(.step-action.is-disabled) {
opacity: 0.5;
.btn-primary:disabled,
.btn-ghost:disabled,
.btn-save:disabled,
.btn-nav:disabled {
cursor: not-allowed;
opacity: 0.5;
transform: none;
box-shadow: none;
}
.step-progress {
color: var(--student-text-secondary);
font-family: var(--student-font-data);
font-size: var(--student-fs-caption);
font-weight: 700;
letter-spacing: 0.05em;
white-space: nowrap;
}
/* ============ 底部提交/重新实训 ============ */
@ -2052,7 +2150,7 @@ function exportOutcome() {
.workbench-actions,
.upload-panel,
.step-title-row,
.step-actions,
.step-navigation,
.training-actions {
flex-direction: column;
align-items: stretch;
@ -2062,7 +2160,9 @@ function exportOutcome() {
.workbench-actions .outline-action,
.upload-action,
.preview-action,
.step-actions :deep(.step-action),
.step-nav-left,
.step-nav-right,
.btn-nav,
.training-actions :deep(.training-action) {
width: 100%;
}
@ -2365,52 +2465,8 @@ function exportOutcome() {
}
/* ============================================================
* 底部步骤按钮:step-action
* 底部步骤按钮:step-navigation(原生 button,样式见 scoped 块)
* ============================================================ */
#app .studentLayout section.app-main:has(.target-profile-page) .step-actions .el-button.step-action {
height: 34px !important;
min-height: 34px !important;
padding: 0 14px !important;
border: 1px solid rgba(37, 99, 235, 0.35) !important;
border-radius: 8px !important;
color: #2563eb !important;
background: #ffffff !important;
box-shadow: none !important;
&:hover:not(.is-disabled) {
border-color: #2563eb !important;
color: #2563eb !important;
background: #eff6ff !important;
box-shadow: 0 3px 10px rgba(37, 99, 235, 0.12) !important;
}
}
#app .studentLayout section.app-main:has(.target-profile-page) .step-actions .el-button.step-action--save {
border-color: #e5e7eb !important;
color: #374151 !important;
background: #f3f4f6 !important;
&:hover:not(.is-disabled) {
border-color: #d1d5db !important;
color: #2563eb !important;
background: #e5e7eb !important;
box-shadow: none !important;
}
}
#app .studentLayout section.app-main:has(.target-profile-page) .step-actions .el-button.step-action--next {
border-color: #2563eb !important;
color: #ffffff !important;
background: #2563eb !important;
box-shadow: 0 3px 10px rgba(37, 99, 235, 0.28) !important;
&:hover:not(.is-disabled) {
border-color: #1d4ed8 !important;
color: #ffffff !important;
background: #1d4ed8 !important;
box-shadow: 0 5px 14px rgba(29, 78, 216, 0.32) !important;
}
}
/* ============================================================
* 底部提交/清空:training-actions

File diff suppressed because it is too large Load Diff

@ -1,4 +1,4 @@
<template>
<template>
<div class="product-factors student-training-shell">
<main class="factors-core">
<section class="task-header">
@ -97,17 +97,6 @@
</tbody>
</table>
</div>
<div class="task-actions">
<button type="button" class="btn-nav btn-submit" :disabled="saving" @click="saveAndGoToStepTwo">
保存并进入第 2 步
<el-icon><ArrowRight /></el-icon>
</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">
@ -115,7 +104,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 步<el-icon><ArrowRight /></el-icon></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">
@ -123,7 +111,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 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 步<el-icon><ArrowRight /></el-icon></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">
@ -136,6 +123,26 @@
<span>已保存的分析可从上方步骤栏返回查看。</span>
</div>
</section>
<div class="step-navigation">
<div class="step-nav-left">
<button v-if="currentStep > 0" type="button" class="btn-nav btn-ghost" @click="prevStep">
<el-icon><ArrowLeft /></el-icon>
上一步
</button>
<button type="button" class="btn-nav btn-save" :disabled="saving" @click="saveCurrentProgress">
<el-icon><CircleCheck /></el-icon>
保存当前进度
</button>
</div>
<div class="step-nav-right">
<span class="step-progress">Step {{ String(currentStep + 1).padStart(2, '0') }} / {{ String(trainingSteps.length).padStart(2, '0') }}</span>
<button v-if="currentStep < trainingSteps.length - 1" type="button" class="btn-nav btn-primary" :disabled="saving" @click="nextStep">
{{ saving ? '处理中…' : '下一步' }}
<el-icon><ArrowRight /></el-icon>
</button>
</div>
</div>
</section>
</main>
@ -150,7 +157,7 @@
</template>
<script setup>
import { ArrowRight, CircleCheck, Operation, RefreshLeft } from "@element-plus/icons-vue";
import { ArrowLeft, ArrowRight, CircleCheck, Operation, RefreshLeft } 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";
@ -483,6 +490,49 @@ function exportOutcome() {
URL.revokeObjectURL(url);
proxy?.$modal?.msgSuccess("导出成功");
}
function prevStep() {
if (currentStep.value > 0) {
currentStep.value -= 1;
}
}
async function saveCurrentProgress() {
if (saving.value) return;
saving.value = true;
try {
let payload;
const persistedStep = currentStep.value + 1;
if (currentStep.value === 0) {
payload = buildStepOneAnswerPayload("SAVE", persistedStep);
} else if (currentStep.value === 1) {
payload = buildStepTwoAnswerPayload("SAVE", persistedStep);
} else if (currentStep.value === 2) {
payload = buildStepThreeAnswerPayload("SAVE", persistedStep);
} else {
payload = buildStepFourAnswerPayload("SAVE", persistedStep);
payload.submitted = false;
}
await saveStudentTrainingAnswer(TASK_KEY, payload);
clearDraft();
proxy?.$modal?.msgSuccess("保存成功");
} catch (error) {
proxy?.$modal?.msgError?.(error?.message || "保存失败,请稍后重试");
} finally {
saving.value = false;
}
}
async function nextStep() {
if (saving.value) return;
if (currentStep.value === 0) {
await saveAndGoToStepTwo();
} else if (currentStep.value === 1) {
await saveAndGoToStepThree();
} else if (currentStep.value === 2) {
await saveAndGoToStepFour();
}
}
</script>
<style lang="scss" scoped>
@ -910,6 +960,155 @@ function exportOutcome() {
}
}
/* ============================================================
* 底部步骤导航:上一步 / 保存当前进度 / 下一步
* ============================================================ */
.step-navigation {
position: relative;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
gap: 10px;
margin-top: 16px;
padding: 12px 16px;
border: 1px solid var(--student-panel-border);
border-radius: 10px;
background: #ffffff;
}
.step-nav-left,
.step-nav-right {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: nowrap;
}
.step-nav-right {
margin-left: auto;
}
.btn-primary {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
min-height: 36px;
height: 36px;
padding: 0 14px;
border: 1px solid var(--student-accent);
border-radius: 8px;
color: #ffffff;
background: var(--student-accent);
font-family: inherit;
font-size: 13px;
font-weight: 600;
box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2), 0 2px 8px rgba(37, 99, 235, 0.15);
cursor: pointer;
transition: all 0.16s ease;
white-space: nowrap;
.el-icon {
font-size: 14px;
}
&:hover:not(:disabled) {
border-color: var(--student-accent-deep);
background: var(--student-accent-deep);
transform: translateY(-1px);
box-shadow: 0 2px 6px rgba(29, 78, 216, 0.3), 0 4px 12px rgba(29, 78, 216, 0.22);
}
&:active:not(:disabled) {
transform: translateY(0);
}
}
.btn-ghost {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
min-height: 36px;
height: 36px;
padding: 0 14px;
border: 1px solid rgba(37, 99, 235, 0.35);
border-radius: 8px;
color: var(--student-accent);
background: #ffffff;
font-family: inherit;
font-size: 13px;
font-weight: 600;
cursor: pointer;
transition: all 0.16s ease;
white-space: nowrap;
.el-icon {
font-size: 14px;
}
&:hover:not(:disabled) {
border-color: var(--student-accent);
background: var(--student-accent-soft);
transform: translateY(-1px);
box-shadow: 0 2px 6px rgba(37, 99, 235, 0.12);
}
}
.btn-save {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
min-height: 36px;
height: 36px;
padding: 0 14px;
border: 1px solid #e5e7eb;
border-radius: 8px;
color: #4b5563;
background: #f9fafb;
font-family: inherit;
font-size: 13px;
font-weight: 600;
cursor: pointer;
transition: all 0.16s ease;
white-space: nowrap;
.el-icon {
font-size: 14px;
}
&:hover:not(:disabled) {
border-color: #d1d5db;
background: #f3f4f6;
}
}
.btn-primary:disabled,
.btn-ghost:disabled,
.btn-save:disabled {
cursor: not-allowed;
opacity: 0.5;
transform: none;
box-shadow: none;
}
.step-progress {
color: var(--student-text-secondary);
font-family: var(--student-font-data);
font-size: 11px;
font-weight: 700;
letter-spacing: 0.05em;
white-space: nowrap;
}
@media (max-width: 1100px) {
.step-nav-right {
margin-left: 0;
}
}
@media (max-width: 900px) {
/* 窄屏全宽规则的强制覆盖见非 scoped 块(scoped 打不赢全局 !important) */

@ -1,4 +1,4 @@
<template>
<template>
<div class="product-process student-training-shell">
<main class="process-core">
<section class="task-header">
@ -81,10 +81,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">
@ -112,10 +108,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">
@ -144,10 +136,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 步<el-icon><ArrowRight /></el-icon></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">
@ -169,6 +157,26 @@
</template>
<div v-else class="step-placeholder"><p>第 {{ currentStep }} 步内容待配置</p><span>第 1 步答案已保存,可从上方步骤栏返回查看。</span></div>
</section>
<div class="step-navigation">
<div class="step-nav-left">
<button v-if="currentStep > 1" type="button" class="btn-nav btn-ghost" @click="prevStep">
<el-icon><ArrowLeft /></el-icon>
上一步
</button>
<button type="button" class="btn-nav btn-save" :disabled="saving || uploadingGantt" @click="saveCurrentProgress">
<el-icon><CircleCheck /></el-icon>
保存当前进度
</button>
</div>
<div class="step-nav-right">
<span class="step-progress">Step {{ String(currentStep).padStart(2, '0') }} / {{ String(trainingSteps.length).padStart(2, '0') }}</span>
<button v-if="currentStep < trainingSteps.length" type="button" class="btn-nav btn-primary" :disabled="checking || saving || uploadingGantt" @click="nextStep">
{{ checking ? '判题中…' : '下一步' }}
<el-icon><ArrowRight /></el-icon>
</button>
</div>
</div>
</section>
</main>
@ -182,7 +190,7 @@
</template>
<script setup>
import { ArrowRight, CircleCheck, Operation, RefreshLeft, Upload } from "@element-plus/icons-vue";
import { ArrowLeft, ArrowRight, CircleCheck, Operation, RefreshLeft, Upload } from "@element-plus/icons-vue";
import * as XLSX from "xlsx";
import { checkProductDevelopmentProcessStepOne, checkProductDevelopmentProcessStepTwo, checkProductDevelopmentProcessStepThree, checkProductDevelopmentProcessStepFour, getStudentTrainingAnswer, saveStudentTrainingAnswer, uploadStudentTrainingFile } from "@/api/studentTrainingAnswer";
import { getTrainingTaskByKey } from "@/api/trainingTask";
@ -220,6 +228,7 @@ const processRows = ref(createProcessRows());
const currentStep = ref(1);
const briefOpen = ref(false);
const checking = ref(false);
const saving = ref(false);
const draftReady = ref(false);
const checkResult = ref(null);
const stepOnePassed = ref(false);
@ -618,6 +627,47 @@ function exportOutcome() {
URL.revokeObjectURL(url);
proxy?.$modal?.msgSuccess("导出成功");
}
function prevStep() {
if (currentStep.value > 1) {
currentStep.value -= 1;
}
}
async function saveCurrentProgress() {
if (saving.value || uploadingGantt.value) return;
saving.value = true;
try {
let payload;
if (currentStep.value === 1) {
payload = { step1Answer: JSON.stringify(buildOutcome()), currentStep: 1, submitted: false, saveAction: "SAVE" };
} else if (currentStep.value === 2) {
payload = { step2Answer: JSON.stringify(buildStepTwoOutcome()), currentStep: 2, submitted: false, saveAction: "SAVE" };
} else if (currentStep.value === 3) {
payload = { step3Answer: JSON.stringify(buildStepThreeOutcome()), currentStep: 3, submitted: false, saveAction: "SAVE" };
} else {
payload = { step4Answer: JSON.stringify(buildStepFourOutcome()), currentStep: 4, submitted: false, saveAction: "SAVE" };
}
await saveStudentTrainingAnswer(TASK_KEY, payload);
clearDraft();
proxy?.$modal?.msgSuccess("保存成功");
} catch (error) {
proxy?.$modal?.msgError?.(error?.message || "保存失败,请稍后重试");
} finally {
saving.value = false;
}
}
async function nextStep() {
if (checking.value || saving.value) return;
if (currentStep.value === 1) {
await saveAndGoToStepTwo();
} else if (currentStep.value === 2) {
await saveAndGoToStepThree();
} else if (currentStep.value === 3) {
await saveAndGoToStepFour();
}
}
</script>
<style lang="scss" scoped>
@ -1052,6 +1102,173 @@ tr.is-incorrect .classification-feedback {
box-shadow: none;
}
/* ============================================================
* 底部步骤导航:上一步 / 保存当前进度 / 下一步
* ============================================================ */
.step-navigation {
position: relative;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
gap: 10px;
margin-top: 16px;
padding: 12px 16px;
border: 1px solid var(--student-panel-border);
border-radius: 10px;
background: #ffffff;
}
.step-nav-left,
.step-nav-right {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: nowrap;
}
.step-nav-right {
margin-left: auto;
}
.btn-primary {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
min-height: 36px;
height: 36px;
padding: 0 14px;
border: 1px solid var(--student-accent);
border-radius: 8px;
color: #ffffff;
background: var(--student-accent);
font-family: inherit;
font-size: 13px;
font-weight: 600;
box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2), 0 2px 8px rgba(37, 99, 235, 0.15);
cursor: pointer;
transition: all 0.16s ease;
white-space: nowrap;
.el-icon {
font-size: 14px;
}
&:hover:not(:disabled) {
border-color: var(--student-accent-deep);
background: var(--student-accent-deep);
transform: translateY(-1px);
box-shadow: 0 2px 6px rgba(29, 78, 216, 0.3), 0 4px 12px rgba(29, 78, 216, 0.22);
}
&:active:not(:disabled) {
transform: translateY(0);
}
}
.btn-ghost {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
min-height: 36px;
height: 36px;
padding: 0 14px;
border: 1px solid rgba(37, 99, 235, 0.35);
border-radius: 8px;
color: var(--student-accent);
background: #ffffff;
font-family: inherit;
font-size: 13px;
font-weight: 600;
cursor: pointer;
transition: all 0.16s ease;
white-space: nowrap;
.el-icon {
font-size: 14px;
}
&:hover:not(:disabled) {
border-color: var(--student-accent);
background: var(--student-accent-soft);
transform: translateY(-1px);
box-shadow: 0 2px 6px rgba(37, 99, 235, 0.12);
}
}
.btn-save {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
min-height: 36px;
height: 36px;
padding: 0 14px;
border: 1px solid #e5e7eb;
border-radius: 8px;
color: #4b5563;
background: #f9fafb;
font-family: inherit;
font-size: 13px;
font-weight: 600;
cursor: pointer;
transition: all 0.16s ease;
white-space: nowrap;
.el-icon {
font-size: 14px;
}
&:hover:not(:disabled) {
border-color: #d1d5db;
background: #f3f4f6;
}
}
.btn-primary:disabled,
.btn-ghost:disabled,
.btn-save:disabled {
cursor: not-allowed;
opacity: 0.5;
transform: none;
box-shadow: none;
}
.step-progress {
color: var(--student-text-secondary);
font-family: var(--student-font-data);
font-size: 11px;
font-weight: 700;
letter-spacing: 0.05em;
white-space: nowrap;
}
@media (max-width: 1100px) {
.step-nav-right {
margin-left: 0;
}
}
@media (max-width: 900px) {
.step-navigation {
flex-direction: column;
align-items: stretch;
}
.step-nav-left,
.step-nav-right {
justify-content: center;
}
.btn-primary,
.btn-ghost,
.btn-save {
width: 100%;
}
}
/* 空步骤占位 */
.step-placeholder {
display: grid;

@ -24,13 +24,6 @@
</section>
<section class="after-sales-workbench">
<div class="workbench-head">
<div>
<p class="section-eyebrow">After-sales diagnostic routing</p>
<h2>售后故障类型分类</h2>
</div>
</div>
<nav class="step-indicator" aria-label="售后服务流程设计步骤">
<template v-for="(step, index) in trainingSteps" :key="`${step}-${index}`">
<button type="button" :class="['step-tab', { active: currentStep === index + 1, complete: currentStep > index + 1 }]" @click="switchStep(index + 1)">
@ -613,15 +606,6 @@ function exportOutcome() { const blob = new Blob([JSON.stringify({ currentStep:
box-shadow: none;
}
.workbench-head {
display: flex;
align-items: flex-start;
gap: 16px;
margin: 0;
padding: 0;
border-bottom: 0;
}
.section-eyebrow {
margin: 0;
color: var(--student-accent);
@ -631,14 +615,6 @@ function exportOutcome() { const blob = new Blob([JSON.stringify({ currentStep:
text-transform: uppercase;
}
.workbench-head h2 {
margin: 4px 0 0;
color: var(--student-text);
font-size: var(--student-fs-h1);
font-weight: 700;
line-height: 1.35;
}
/* ===== step-card:透明化 ===== */
.step-card {
padding: 0;

@ -24,13 +24,6 @@
</section>
<section class="hardware-workbench">
<div class="workbench-head hardware-workbench-head">
<div>
<p class="section-eyebrow">BOM cost workspace</p>
<h2>智能硬件成本估算</h2>
</div>
</div>
<nav class="step-indicator" aria-label="智能硬件成本估算步骤">
<button type="button" :class="['step-tab', { active: currentStep === 1, complete: currentStep > 1 }]" aria-label="切换至第 1 步:BOM 物料选型" :aria-current="currentStep === 1 ? 'step' : undefined" @click="currentStep = 1">
<span class="step-marker" aria-hidden="true">01</span>
@ -54,13 +47,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>
@ -112,11 +98,7 @@
</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-title-actions">
<button type="button" class="btn-nav" :disabled="exporting || !costRows.length" @click="exportStepTwo">{{ exporting ? "导出中…" : "导出成本核算表" }}</button>
</div>
<section class="cost-brief">
@ -175,11 +157,7 @@
</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-title-actions">
<button type="button" class="btn-nav" :disabled="exportingStepThree" @click="exportStepThree">
{{ exportingStepThree ? "导出中…" : "导出单件总成本表" }}
</button>
@ -234,11 +212,7 @@
</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-title-actions">
<span class="step-chip">以第 2、3 步核算结果为依据</span>
</div>
@ -952,7 +926,7 @@ onMounted(async () => {
gap: 14px;
}
.workbench-head,
.step-title-actions,
.step-title-row,
.bom-toolbar,
.task-actions {
@ -962,14 +936,7 @@ onMounted(async () => {
gap: 14px;
}
.workbench-head { margin-bottom: 4px; }
.workbench-head h2 {
margin: 4px 0 0;
color: var(--student-text);
font-size: var(--student-fs-h1);
font-weight: 700;
line-height: 1.35;
}
.step-title-actions { justify-content: flex-end; margin-bottom: 4px; }
.step-card {
padding: 0;

@ -24,13 +24,6 @@
</section>
<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>
<nav class="step-indicator" aria-label="产品需求文档撰写步骤">
<template v-for="(step, index) in trainingSteps" :key="`${step}-${index}`">
<button
@ -683,21 +676,6 @@ function exportOutcome() { if (currentStep.value === 2) { exportStepTwoTable();
gap: 10px;
}
.workbench-head {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 16px;
}
.workbench-head h2 {
margin: 4px 0 0;
color: var(--student-text);
font-size: var(--student-fs-h1);
font-weight: 700;
line-height: 1.35;
}
.section-eyebrow {
margin: 0;
color: var(--student-accent);
@ -1380,7 +1358,6 @@ function exportOutcome() { if (currentStep.value === 2) { exportStepTwoTable();
.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) {

@ -1,6 +1,13 @@
<template>
<div v-loading="loading" class="student-home app-container">
<el-alert v-if="loadError" class="load-error" type="error" :title="loadError" :closable="false" show-icon />
<el-alert
v-if="loadError"
class="load-error"
type="error"
:title="loadError"
:closable="false"
show-icon
/>
<el-card class="dashboard-card score-card">
<template #header>
@ -19,6 +26,11 @@
<strong>{{ formatScore(aiScore) }}</strong>
<span class="summary-unit">分</span>
</div>
<div class="score-metric score-metric--teacher">
<span class="summary-label">老师评分</span>
<strong>{{ formatTeacherScore(teacherScore) }}</strong>
<span v-if="hasTeacherScore(teacherScore)" class="summary-unit">分</span>
</div>
</div>
</section>
@ -71,62 +83,62 @@
</template>
<script setup>
import * as echarts from "echarts"
import useUserStore from "@/store/modules/user"
import * as indexApi from "@/api/index"
import { getCurrentProjectStudyTime } from "@/api/projectStudyTime"
const userStore = useUserStore()
const scoreChartRef = ref(null)
const studyTimeChartRef = ref(null)
const progressChartRef = ref(null)
const report = ref({ totalScore: 0, modules: [] })
const projectStudyTimes = ref([])
const loading = ref(true)
const loadError = ref("")
const MODULE_COLORS = ["#1d4ed8", "#2563eb", "#3b82f6", "#60a5fa", "#93c5fd", "#bfdbfe"]
let scoreChart
let studyTimeChart
let progressChart
const displayModules = computed(() => report.value.modules || [])
const aiScore = computed(() => report.value.aiAssessmentScore ?? report.value.aiScore ?? report.value.totalScore)
const teacherScore = computed(() => report.value.teacherScore)
import * as echarts from "echarts";
import useUserStore from "@/store/modules/user";
import * as indexApi from "@/api/index";
import { getCurrentProjectStudyTime } from "@/api/projectStudyTime";
const userStore = useUserStore();
const scoreChartRef = ref(null);
const studyTimeChartRef = ref(null);
const progressChartRef = ref(null);
const report = ref({ totalScore: 0, modules: [] });
const projectStudyTimes = ref([]);
const loading = ref(true);
const loadError = ref("");
const MODULE_COLORS = ["#1d4ed8", "#2563eb", "#3b82f6", "#60a5fa", "#93c5fd", "#bfdbfe"];
let scoreChart;
let studyTimeChart;
let progressChart;
const displayModules = computed(() => report.value.modules || []);
const aiScore = computed(() => report.value.aiAssessmentScore ?? report.value.aiScore ?? report.value.totalScore);
const teacherScore = computed(() => report.value.teacherScore);
const studySecondsByProject = computed(() => Object.fromEntries(
projectStudyTimes.value.map((item) => [item.projectName, Number(item.studySeconds) || 0])
))
));
const displayStudyProjects = computed(() => {
const knownProjects = displayModules.value.map((module) => module.moduleName)
const extraProjects = projectStudyTimes.value.map((item) => item.projectName).filter((name) => !knownProjects.includes(name))
const knownProjects = displayModules.value.map((module) => module.moduleName);
const extraProjects = projectStudyTimes.value.map((item) => item.projectName).filter((name) => !knownProjects.includes(name));
return [...knownProjects, ...extraProjects].map((projectName) => ({
projectName,
studySeconds: studySecondsByProject.value[projectName] || 0,
}))
})
}));
});
const totalStudyMinutes = computed(() => Math.round(
displayStudyProjects.value.reduce((total, item) => total + item.studySeconds, 0) / 60
))
));
const studyHours = computed(() => (totalStudyMinutes.value / 60).toFixed(1))
const studyHours = computed(() => (totalStudyMinutes.value / 60).toFixed(1));
const formatScore = (value) => Number(value || 0).toFixed(2).replace(/\.00$/, "")
const hasTeacherScore = (value) => value !== null && value !== undefined && value !== ""
const formatTeacherScore = (value) => hasTeacherScore(value) ? formatScore(value) : "待评阅"
const formatWeight = (weight) => `${(Number(weight || 0) * 100).toFixed(0)}%`
const moduleColor = (index) => MODULE_COLORS[index % MODULE_COLORS.length]
const formatScore = (value) => Number(value || 0).toFixed(2).replace(/\.00$/, "");
const hasTeacherScore = (value) => value !== null && value !== undefined && value !== "";
const formatTeacherScore = (value) => hasTeacherScore(value) ? formatScore(value) : "待评阅";
const formatWeight = (weight) => `${(Number(weight || 0) * 100).toFixed(0)}%`;
const moduleColor = (index) => MODULE_COLORS[index % MODULE_COLORS.length];
const progressPercent = (module) => {
const total = Number(module.totalTaskCount) || 0
const completed = Number(module.completedTaskCount) || 0
return total > 0 ? Math.min(100, Math.round((completed / total) * 100)) : 0
}
const progressText = (module) => `${Number(module.completedTaskCount) || 0}/${Number(module.totalTaskCount) || 0}`
const total = Number(module.totalTaskCount) || 0;
const completed = Number(module.completedTaskCount) || 0;
return total > 0 ? Math.min(100, Math.round((completed / total) * 100)) : 0;
};
const progressText = (module) => `${Number(module.completedTaskCount) || 0}/${Number(module.totalTaskCount) || 0}`;
const renderScoreChart = () => {
if (!scoreChartRef.value) return
scoreChart = scoreChart || echarts.init(scoreChartRef.value)
if (!scoreChartRef.value) return;
scoreChart = scoreChart || echarts.init(scoreChartRef.value);
scoreChart.setOption({
tooltip: { trigger: "item", valueFormatter: (value) => `${formatScore(value)} 分` },
legend: { orient: "vertical", right: 8, top: "middle", itemWidth: 12, itemHeight: 12 },
@ -144,13 +156,13 @@ const renderScoreChart = () => {
itemStyle: { color: moduleColor(index) }
}))
}]
}, true)
}
}, true);
};
const renderProgressChart = () => {
if (!progressChartRef.value) return
progressChart = progressChart || echarts.init(progressChartRef.value)
const modules = displayModules.value
if (!progressChartRef.value) return;
progressChart = progressChart || echarts.init(progressChartRef.value);
const modules = displayModules.value;
progressChart.setOption({
tooltip: { trigger: "axis", axisPointer: { type: "shadow" } },
legend: { top: 0, data: ["已完成", "待完成"] },
@ -180,13 +192,13 @@ const renderProgressChart = () => {
data: modules.map((module) => Math.max(0, (Number(module.totalTaskCount) || 0) - (Number(module.completedTaskCount) || 0)))
}
]
}, true)
}
}, true);
};
const renderStudyTimeChart = () => {
if (!studyTimeChartRef.value) return
studyTimeChart = studyTimeChart || echarts.init(studyTimeChartRef.value)
const projects = displayStudyProjects.value
if (!studyTimeChartRef.value) return;
studyTimeChart = studyTimeChart || echarts.init(studyTimeChartRef.value);
const projects = displayStudyProjects.value;
studyTimeChart.setOption({
tooltip: {
trigger: "axis",
@ -208,55 +220,55 @@ const renderStudyTimeChart = () => {
itemStyle: { color: "#3b82f6", borderRadius: [0, 9, 9, 0] },
data: projects.map((item) => Number((item.studySeconds / 60).toFixed(1))),
}],
}, true)
}
}, true);
};
const renderCharts = () => {
renderScoreChart()
renderStudyTimeChart()
renderProgressChart()
}
renderScoreChart();
renderStudyTimeChart();
renderProgressChart();
};
const resizeCharts = () => {
scoreChart?.resize()
studyTimeChart?.resize()
progressChart?.resize()
}
scoreChart?.resize();
studyTimeChart?.resize();
progressChart?.resize();
};
const loadDashboard = async () => {
loading.value = true
loadError.value = ""
loading.value = true;
loadError.value = "";
const [reportResult, projectStudyTimeResult] = await Promise.allSettled([
indexApi.getCurrentExperimentReport(),
getCurrentProjectStudyTime(),
])
]);
if (reportResult.status !== "fulfilled") {
loadError.value = "新版实训报告加载失败,请刷新页面后重试。"
loading.value = false
return
loadError.value = "新版实训报告加载失败,请刷新页面后重试。";
loading.value = false;
return;
}
report.value = reportResult.value?.data || { totalScore: 0, modules: [] }
report.value = reportResult.value?.data || { totalScore: 0, modules: [] };
projectStudyTimes.value = projectStudyTimeResult.status === "fulfilled" && Array.isArray(projectStudyTimeResult.value?.data)
? projectStudyTimeResult.value.data
: []
loading.value = false
await nextTick()
renderCharts()
}
: [];
loading.value = false;
await nextTick();
renderCharts();
};
onMounted(() => {
window.addEventListener("resize", resizeCharts)
loadDashboard()
})
window.addEventListener("resize", resizeCharts);
loadDashboard();
});
onBeforeUnmount(() => {
window.removeEventListener("resize", resizeCharts)
scoreChart?.dispose()
studyTimeChart?.dispose()
progressChart?.dispose()
})
window.removeEventListener("resize", resizeCharts);
scoreChart?.dispose();
studyTimeChart?.dispose();
progressChart?.dispose();
});
</script>
<style lang="scss" scoped>
@ -266,19 +278,14 @@ onBeforeUnmount(() => {
padding: 0;
}
.load-error {
margin-bottom: 12px;
}
.load-error { margin-bottom: 12px; }
.dashboard-card {
margin-bottom: 14px;
border: 1px solid #e5e7eb;
box-shadow: 0 2px 10px rgba(17, 24, 39, 0.05);
:deep(.el-card__header) {
padding: 13px 16px;
border-bottom: 1px solid #e5e7eb;
}
:deep(.el-card__header) { padding: 13px 16px; border-bottom: 1px solid #e5e7eb; }
}
.card-header {
@ -287,23 +294,11 @@ onBeforeUnmount(() => {
justify-content: space-between;
gap: 12px;
span {
color: #1f2937;
font-size: 15px;
font-weight: 700;
}
small {
color: #9ca3af;
font-size: 12px;
}
span { color: #1f2937; font-size: 15px; font-weight: 700; }
small { color: #9ca3af; font-size: 12px; }
}
.score-layout {
display: grid;
grid-template-columns: minmax(520px, 0.95fr) minmax(760px, 1.35fr);
min-height: 330px;
}
.score-layout { display: grid; grid-template-columns: minmax(520px, 0.95fr) minmax(760px, 1.35fr); min-height: 330px; }
.score-visual {
position: relative;
@ -312,69 +307,34 @@ onBeforeUnmount(() => {
border-right: 1px dashed #e5e7eb;
}
.score-chart {
width: 100%;
min-height: 330px;
}
.score-chart { width: 100%; min-height: 330px; }
/* 评分摘要竖排居中于环形图圆心(34%, 50%),避免覆盖圆环图形 */
.score-summary {
position: absolute;
left: 34%;
top: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-direction: column;
align-items: center;
gap: 18px;
flex-wrap: nowrap;
gap: 6px;
white-space: nowrap;
text-align: center;
color: #72809a;
pointer-events: none;
strong {
font-size: 26px;
line-height: 1;
}
.summary-unit {
font-weight: 600;
}
}
.score-metric {
display: inline-flex;
align-items: baseline;
gap: 4px;
}
.score-metric--ai {
color: #1d4ed8;
}
.score-metric--teacher {
color: #6b7280;
}
.summary-label {
font-size: 12px;
font-weight: 600;
}
.score-table-wrap {
display: flex;
align-items: center;
min-width: 0;
overflow-x: auto;
padding: 8px 0 8px 24px;
}
.score-table {
width: 100%;
min-width: 760px;
strong { font-size: 26px; line-height: 1; }
.summary-unit { font-weight: 600; }
}
.score-table :deep(.el-table__cell) {
white-space: nowrap;
}
.score-metric { display: inline-flex; align-items: baseline; gap: 4px; }
.score-metric--ai { color: #1d4ed8; }
.score-metric--teacher { color: #6b7280; }
.score-metric--teacher strong { font-size: 20px; }
.summary-label { font-size: 12px; font-weight: 600; }
.score-table-wrap { display: flex; align-items: center; min-width: 0; overflow-x: auto; padding: 8px 0 8px 24px; }
.score-table { width: 100%; min-width: 760px; }
.score-table :deep(.el-table__cell) { white-space: nowrap; }
/* 成绩表:纯白底 + 中性灰边框,无蓝色/斑马重色 */
.score-table :deep(th.el-table__cell) {
@ -399,12 +359,7 @@ onBeforeUnmount(() => {
background: #f3f4f6;
}
.progress-layout {
display: grid;
grid-template-columns: 190px minmax(370px, 1fr) minmax(370px, 1fr);
gap: 24px;
align-items: stretch;
}
.progress-layout { display: grid; grid-template-columns: 190px minmax(370px, 1fr) minmax(370px, 1fr); gap: 24px; align-items: stretch; }
.learning-time {
display: flex;
@ -417,17 +372,8 @@ onBeforeUnmount(() => {
border-radius: 14px;
background: #fafbfc;
strong {
margin-top: 16px;
font-size: 14px;
font-weight: 800;
}
span {
margin-top: 6px;
font-size: 12px;
color: #6b7280;
}
strong { margin-top: 16px; font-size: 14px; font-weight: 800; }
span { margin-top: 6px; font-size: 12px; color: #6b7280; }
}
.time-orbit {
@ -441,29 +387,10 @@ onBeforeUnmount(() => {
box-shadow: inset 0 0 0 7px #eff6ff;
}
.time-value {
font-size: 25px;
font-weight: 800;
line-height: 1;
}
.time-unit {
margin-top: 5px;
font-size: 12px;
letter-spacing: 0.08em;
color: #6b7280;
}
.study-time-chart-wrap,
.progress-chart-wrap {
min-width: 0;
}
.study-time-chart,
.progress-chart {
min-height: 270px;
width: 100%;
}
.time-value { font-size: 25px; font-weight: 800; line-height: 1; }
.time-unit { margin-top: 5px; font-size: 12px; letter-spacing: 0.08em; color: #6b7280; }
.study-time-chart-wrap, .progress-chart-wrap { min-width: 0; }
.study-time-chart, .progress-chart { min-height: 270px; width: 100%; }
.module-progress-list {
display: flex;
@ -474,91 +401,29 @@ onBeforeUnmount(() => {
padding: 8px 4px;
}
.module-progress-item {
min-width: 0;
}
.module-progress-head {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 7px;
color: #6f7b91;
font-size: 13px;
}
.module-progress-head strong {
flex: 1;
overflow: hidden;
color: #273858;
font-size: 14px;
text-overflow: ellipsis;
white-space: nowrap;
}
.module-color {
flex: 0 0 auto;
width: 8px;
height: 8px;
border-radius: 50%;
}
.module-progress-item { min-width: 0; }
.module-progress-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; color: #6f7b91; font-size: 13px; }
.module-progress-head strong { flex: 1; overflow: hidden; color: #273858; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.module-color { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; }
@media (max-width: 1320px) {
.score-layout {
grid-template-columns: 1fr;
}
.score-visual {
border-bottom: 1px dashed #e5e7eb;
}
.score-table-wrap {
padding: 20px 0 0;
}
.progress-layout {
grid-template-columns: 180px 1fr;
}
.progress-chart-wrap {
grid-column: 1 / -1;
}
.score-layout { grid-template-columns: 1fr; }
.score-visual { border-bottom: 1px dashed #e5e7eb; }
.score-table-wrap { padding: 20px 0 0; }
.progress-layout { grid-template-columns: 180px 1fr; }
.progress-chart-wrap { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
.student-home {
padding: 12px;
}
.card-header {
align-items: flex-start;
flex-direction: column;
}
.score-visual {
min-height: 290px;
}
.score-chart {
min-height: 290px;
}
.score-summary {
left: 18px;
top: 18px;
}
.progress-layout {
grid-template-columns: 1fr;
}
.learning-time {
min-height: 210px;
}
.progress-chart-wrap {
grid-column: auto;
}
.student-home { padding: 12px; }
.card-header { align-items: flex-start; flex-direction: column; }
.score-visual { min-height: 290px; }
.score-chart { min-height: 290px; }
.score-summary { gap: 4px; strong { font-size: 22px; } }
.score-metric--teacher strong { font-size: 16px; }
.progress-layout { grid-template-columns: 1fr; }
.learning-time { min-height: 210px; }
.progress-chart-wrap { grid-column: auto; }
}
</style>

@ -11,7 +11,9 @@
</button>
<span v-if="briefOpen" class="task-brief-more">
<b>实训目标</b>
<ul><li v-for="goal in taskGoals" :key="goal">{{ goal }}</li></ul>
<ul>
<li v-for="goal in taskGoals" :key="goal">{{ goal }}</li>
</ul>
<b>实训要求</b>
<p>{{ taskRequirement }}</p>
</span>
@ -20,86 +22,140 @@
</section>
<section class="task-action-strip">
<TrainingTaskToolbar :task-key="TASK_KEY" :on-submit="submitTask" :on-reset="resetTraining" :on-export="exportOutcome" />
<TrainingTaskToolbar :task-key="TASK_KEY" :on-submit="submitTask" :on-reset="resetTraining"
:on-export="exportOutcome" />
</section>
<section class="task-card">
<header class="workbench-head">
<div>
<p class="section-eyebrow">STEP {{ String(activeStep).padStart(2, "0") }}</p>
<h2>{{ stepTitle }}</h2>
</div>
</header>
<nav class="step-tabs" aria-label="产品发布渠道评估步骤">
<button type="button" :class="['step-tab', { active: activeStep === 1, complete: activeStep > 1 }]" :aria-current="activeStep === 1 ? 'step' : undefined" @click="activeStep = 1">
<span class="step-marker">01</span><span class="step-copy"><b>权重设置</b><small>{{ activeStep === 1 ? '当前步骤 →' : '点击切换 →' }}</small></span>
<button type="button" :class="['step-tab', { active: activeStep === 1, complete: activeStep > 1 }]"
:aria-current="activeStep === 1 ? 'step' : undefined" @click="activeStep = 1">
<span class="step-marker">01</span><span class="step-copy"><b>权重设置</b><small>{{ activeStep === 1
? '当前步骤 →' : '点击切换 →' }}</small></span>
</button>
<span class="step-connector" aria-hidden="true" />
<button type="button" :class="['step-tab', { active: activeStep === 2, complete: activeStep > 2 }]" :aria-current="activeStep === 2 ? 'step' : undefined" @click="activeStep = 2">
<span class="step-marker">02</span><span class="step-copy"><b>渠道数据</b><small>{{ activeStep === 2 ? '当前步骤 →' : '点击切换 →' }}</small></span>
<button type="button" :class="['step-tab', { active: activeStep === 2, complete: activeStep > 2 }]"
:aria-current="activeStep === 2 ? 'step' : undefined" @click="activeStep = 2">
<span class="step-marker">02</span><span class="step-copy"><b>渠道数据</b><small>{{ activeStep === 2
? '当前步骤 →' : '点击切换 →' }}</small></span>
</button>
<span class="step-connector" aria-hidden="true" />
<button type="button" :class="['step-tab', { active: activeStep === 3, complete: activeStep > 3 }]" :aria-current="activeStep === 3 ? 'step' : undefined" @click="openStepThree">
<span class="step-marker">03</span><span class="step-copy"><b>归一化评分</b><small>{{ activeStep === 3 ? '当前步骤 →' : '点击切换 →' }}</small></span>
<button type="button" :class="['step-tab', { active: activeStep === 3, complete: activeStep > 3 }]"
:aria-current="activeStep === 3 ? 'step' : undefined" @click="openStepThree">
<span class="step-marker">03</span><span class="step-copy"><b>归一化评分</b><small>{{ activeStep ===
3 ? '当前步骤 →' : '点击切换 →' }}</small></span>
</button>
<span class="step-connector" aria-hidden="true" />
<button type="button" :class="['step-tab', { active: activeStep === 4 }]" :aria-current="activeStep === 4 ? 'step' : undefined" @click="openStepFour">
<span class="step-marker">04</span><span class="step-copy"><b>渠道排名</b><small>{{ activeStep === 4 ? '当前步骤 →' : '点击切换 →' }}</small></span>
<button type="button" :class="['step-tab', { active: activeStep === 4 }]"
:aria-current="activeStep === 4 ? 'step' : undefined" @click="openStepFour">
<span class="step-marker">04</span><span class="step-copy"><b>渠道排名</b><small>{{ activeStep === 4
? '当前步骤 →' : '点击切换 →' }}</small></span>
</button>
</nav>
<section v-if="activeStep === 1">
<p class="lead">不同维度对新品渠道效果的影响不一样,请给以下核心评估维度设置权重,按照重要性分配权重,总权重合计 100%。</p>
<div class="table-actions">
<el-button type="primary" @click="addWeightRow"><el-icon><Plus /></el-icon>增加一行</el-button>
<el-button @click="weightRows.pop()" :disabled="!weightRows.length"><el-icon><Minus /></el-icon>删除一行</el-button>
<el-button type="primary" @click="addWeightRow"><el-icon>
<Plus />
</el-icon>增加一行</el-button>
<el-button @click="weightRows.pop()" :disabled="!weightRows.length"><el-icon>
<Minus />
</el-icon>删除一行</el-button>
</div>
<div class="table-wrap">
<table class="weight-table">
<thead><tr><th>评估维度</th><th>维度说明</th><th>权重占比(%)</th><th class="operation-column">操作</th></tr></thead>
<thead>
<tr>
<th>评估维度</th>
<th>维度说明</th>
<th>权重占比(%)</th>
<th class="operation-column">操作</th>
</tr>
</thead>
<tbody>
<tr v-for="(row, index) in weightRows" :key="row.id">
<td><el-input v-model="row.dimension" maxlength="50" placeholder="填写评估维度" /></td>
<td><el-input v-model="row.description" maxlength="200" placeholder="填写维度说明" /></td>
<td><el-input-number v-model="row.weight" :min="0" :max="100" :precision="2" :step="1" controls-position="right" /><small v-if="row.suggestion">建议权重:{{ row.suggestion }}</small></td>
<td class="operation-column"><el-button link type="danger" @click="weightRows.splice(index, 1)">删除本行</el-button></td>
<td><el-input-number v-model="row.weight" :min="0" :max="100" :precision="2"
:step="1" controls-position="right" /><small v-if="row.suggestion">建议权重:{{
row.suggestion }}</small></td>
<td class="operation-column"><el-button link type="danger"
@click="weightRows.splice(index, 1)">删除本行</el-button></td>
</tr>
<tr v-if="!weightRows.length">
<td colspan="4" class="empty-row">暂无评估维度,请增加一行后填写。</td>
</tr>
<tr v-if="!weightRows.length"><td colspan="4" class="empty-row">暂无评估维度,请增加一行后填写。</td></tr>
</tbody>
<tfoot><tr><th colspan="2">当前权重合计</th><td :class="{ 'total-error': weightTotal !== 100 }">{{ displayWeightTotal }}%</td><td></td></tr></tfoot>
<tfoot>
<tr>
<th colspan="2">当前权重合计</th>
<td :class="{ 'total-error': weightTotal !== 100 }">{{ displayWeightTotal }}%</td>
<td></td>
</tr>
</tfoot>
</table>
</div>
<p class="hint">默认展示建议的评估维度和建议权重范围,具体权重需由学生自行填写。可修改任意单元格,也可逐行新增、删除;点击下一步时系统校验所有权重之和必须等于 100%。</p>
<footer class="footer-actions">
<el-button :loading="saving" @click="saveWeightStep">保存当前进度</el-button>
<el-button type="primary" :loading="validating" @click="goStepTwo">下一步<el-icon><ArrowRight /></el-icon></el-button>
<el-button type="primary" :loading="validating" @click="goStepTwo">下一步<el-icon>
<ArrowRight />
</el-icon></el-button>
</footer>
</section>
<section v-else-if="activeStep === 2">
<p class="lead">根据案例资料提供的 5 大渠道近 3 个月数据,汇总填写下表。</p>
<div class="table-actions">
<el-button type="primary" @click="addChannelRow"><el-icon><Plus /></el-icon>增加一行</el-button>
<el-button @click="channelRows.pop()" :disabled="!channelRows.length"><el-icon><Minus /></el-icon>删除一行</el-button>
<el-button type="primary" plain @click="exportChannelRows"><el-icon><Download /></el-icon>导出</el-button>
<el-button type="primary" @click="addChannelRow"><el-icon>
<Plus />
</el-icon>增加一行</el-button>
<el-button @click="channelRows.pop()" :disabled="!channelRows.length"><el-icon>
<Minus />
</el-icon>删除一行</el-button>
<el-button type="primary" plain @click="exportChannelRows"><el-icon>
<Download />
</el-icon>导出</el-button>
</div>
<div class="table-wrap">
<table class="channel-table">
<thead><tr><th>渠道</th><th>日均总搜索量</th><th>供需比</th><th>平均点击率(%)</th><th>平均CPC(元)</th><th>平均转化率(%)</th><th>现有相关访客数</th><th>匹配度(1-100)</th><th class="operation-column">操作</th></tr></thead>
<thead>
<tr>
<th>渠道</th>
<th>日均总搜索量</th>
<th>供需比</th>
<th>平均点击率(%)</th>
<th>平均CPC(元)</th>
<th>平均转化率(%)</th>
<th>现有相关访客数</th>
<th>匹配度(1-100)</th>
<th class="operation-column">操作</th>
</tr>
</thead>
<tbody>
<tr v-for="(row, index) in channelRows" :key="row.id">
<td><el-input v-model="row.channel" maxlength="30" placeholder="填写渠道" /></td>
<td><el-input-number v-model="row.dailySearchVolume" :min="0" :precision="0" controls-position="right" /></td>
<td><el-input-number v-model="row.supplyDemandRatio" :min="0" :precision="4" :step="0.1" controls-position="right" /></td>
<td><el-input-number v-model="row.averageClickRate" :min="0" :max="100" :precision="2" controls-position="right" /></td>
<td><el-input-number v-model="row.averageCpc" :min="0" :precision="2" controls-position="right" /></td>
<td><el-input-number v-model="row.averageConversionRate" :min="0" :max="100" :precision="2" controls-position="right" /></td>
<td><el-input-number v-model="row.existingVisitorCount" :min="0" :precision="0" controls-position="right" /></td>
<td><el-input-number v-model="row.matchingScore" :min="1" :max="100" :precision="0" controls-position="right" /></td>
<td class="operation-column"><el-button link type="danger" @click="channelRows.splice(index, 1)">删除本行</el-button></td>
<td><el-input-number v-model="row.dailySearchVolume" :min="0" :precision="0"
controls-position="right" /></td>
<td><el-input-number v-model="row.supplyDemandRatio" :min="0" :precision="4"
:step="0.1" controls-position="right" /></td>
<td><el-input-number v-model="row.averageClickRate" :min="0" :max="100"
:precision="2" controls-position="right" /></td>
<td><el-input-number v-model="row.averageCpc" :min="0" :precision="2"
controls-position="right" /></td>
<td><el-input-number v-model="row.averageConversionRate" :min="0" :max="100"
:precision="2" controls-position="right" /></td>
<td><el-input-number v-model="row.existingVisitorCount" :min="0" :precision="0"
controls-position="right" /></td>
<td><el-input-number v-model="row.matchingScore" :min="1" :max="100" :precision="0"
controls-position="right" /></td>
<td class="operation-column"><el-button link type="danger"
@click="channelRows.splice(index, 1)">删除本行</el-button></td>
</tr>
<tr v-if="!channelRows.length">
<td colspan="9" class="empty-row">暂无渠道数据,请增加一行后填写。</td>
</tr>
<tr v-if="!channelRows.length"><td colspan="9" class="empty-row">暂无渠道数据,请增加一行后填写。</td></tr>
</tbody>
</table>
</div>
@ -107,48 +163,67 @@
<footer class="footer-actions">
<el-button @click="activeStep = 1">上一步</el-button>
<el-button :loading="saving" @click="saveChannelStep">保存当前进度</el-button>
<el-button type="primary" :loading="validating" @click="validateChannelStep">下一步<el-icon><ArrowRight /></el-icon></el-button>
<el-button type="primary" :loading="validating" @click="validateChannelStep">下一步<el-icon>
<ArrowRight />
</el-icon></el-button>
</footer>
</section>
<section v-else-if="activeStep === 3">
<p class="scoring-guide">通过 Min-Max 归一法将各维度原始数据转换为 0–10 分标准化得分。正向指标(搜索量、点击率、转化率、访客数、匹配度)按“渠道值 − 最小值”计算;逆向指标(供需比、CPC)按“最大值 − 渠道值”计算。请根据前两步数据手工填写得分与加权得分。</p>
<div class="table-actions"><el-button type="primary" plain @click="exportScoreRows"><el-icon><Download /></el-icon>导出</el-button></div>
<p class="scoring-guide">通过 Min-Max 归一法将各维度原始数据转换为 0–10 分标准化得分。正向指标(搜索量、点击率、转化率、访客数、匹配度)按“渠道值 −
最小值”计算;逆向指标(供需比、CPC)按“最大值 − 渠道值”计算。请根据前两步数据手工填写得分与加权得分。</p>
<div class="table-actions"><el-button type="primary" plain @click="exportScoreRows"><el-icon>
<Download />
</el-icon>导出</el-button></div>
<div class="table-wrap scoring-table-wrap">
<table class="scoring-table">
<thead>
<tr>
<th rowspan="2">渠道</th>
<th v-for="metric in scoringMetrics" :key="metric.key" colspan="2">{{ metric.label }}</th>
<th v-for="metric in scoringMetrics" :key="metric.key" colspan="2">{{ metric.label
}}</th>
<th rowspan="2">加权得分</th>
</tr>
<tr>
<template v-for="metric in scoringMetrics" :key="`${metric.key}-sub`"><th>得分</th><th>权重</th></template>
<template v-for="metric in scoringMetrics" :key="`${metric.key}-sub`">
<th>得分</th>
<th>权重</th>
</template>
</tr>
</thead>
<tbody>
<tr v-for="row in scoreRows" :key="row.id">
<th scope="row">{{ row.channel }}</th>
<template v-for="metric in row.dimensions" :key="metric.key">
<td><el-input-number v-model="metric.score" :min="0" :max="10" :precision="1" :step="0.1" controls-position="right" /></td>
<td><el-input-number v-model="metric.score" :min="0" :max="10" :precision="1"
:step="0.1" controls-position="right" /></td>
<td class="weight-cell">{{ metric.weight ?? "—" }}%</td>
</template>
<td><el-input-number v-model="row.weightedScore" :min="0" :precision="2" :step="0.01" controls-position="right" /></td>
<td><el-input-number v-model="row.weightedScore" :min="0" :precision="2"
:step="0.01" controls-position="right" /></td>
</tr>
<tr v-if="!scoreRows.length">
<td :colspan="2 + scoringMetrics.length * 2" class="empty-row">请先完成并保存第二步渠道数据。</td>
</tr>
<tr v-if="!scoreRows.length"><td :colspan="2 + scoringMetrics.length * 2" class="empty-row">请先完成并保存第二步渠道数据。</td></tr>
</tbody>
</table>
</div>
<p class="hint">渠道名称同步第二步,权重同步第一步。每项得分乘以对应权重(按百分比折算)并相加得到加权得分;系统会依据已保存的前两步数据检测计算结果。</p>
<p class="step-three-notice">说明:渠道来自第二步,权重来自第一步;每个维度得分乘以权重后相加即为加权得分。计算结果不一致时仍可进入下一步,系统会记录检测结果,供 AI 助评扣分参考。</p>
<p class="step-three-notice">说明:渠道来自第二步,权重来自第一步;每个维度得分乘以权重后相加即为加权得分。计算结果不一致时仍可进入下一步,系统会记录检测结果,供 AI
助评扣分参考。</p>
<section class="step-three-materials" aria-label="归一化评分参考资料">
<p>参考方法及工具如下:下载案例数据表,使用 Excel 按 Min-Max 公式计算各渠道归一化得分,可参考《实训操作说明》完成。</p>
<el-button type="primary" class="step-three-materials__button" @click="downloadPracticeGuide"><el-icon><Download /></el-icon>下载实训操作说明</el-button>
<el-button type="primary" class="step-three-materials__button"
@click="downloadPracticeGuide"><el-icon>
<Download />
</el-icon>下载实训操作说明</el-button>
</section>
<footer class="footer-actions">
<el-button @click="activeStep = 2">上一步</el-button>
<el-button :loading="saving" @click="saveScoreStep">保存当前进度</el-button>
<el-button type="primary" :loading="validating" @click="validateScoreStep">下一步<el-icon><ArrowRight /></el-icon></el-button>
<el-button type="primary" :loading="validating" @click="validateScoreStep">下一步<el-icon>
<ArrowRight />
</el-icon></el-button>
</footer>
</section>
@ -156,19 +231,33 @@
<p class="lead">根据步骤一设置的权重和步骤三的归一化得分,填写各渠道加权综合得分并排序,明确前两位核心渠道。</p>
<div class="table-wrap ranking-table-wrap">
<table class="ranking-table">
<thead><tr><th>排名</th><th>渠道</th><th>加权综合得分</th><th>是否选为核心渠道</th></tr></thead>
<thead>
<tr>
<th>排名</th>
<th>渠道</th>
<th>加权综合得分</th>
<th>是否选为核心渠道</th>
</tr>
</thead>
<tbody>
<tr v-for="(row, index) in rankingRows" :key="row.id">
<td class="rank-cell">{{ index + 1 }}</td>
<td><el-input v-model="row.channel" maxlength="30" placeholder="填写渠道" /></td>
<td><el-input-number v-model="row.weightedScore" :min="0" :precision="2" :step="0.01" controls-position="right" /></td>
<td class="core-cell"><span :class="{ core: index < 2 }">{{ index < 2 ? "是" : "否" }}</span></td>
<td><el-input-number v-model="row.weightedScore" :min="0" :precision="2"
:step="0.01" controls-position="right" /></td>
<td class="core-cell"><span :class="{ core: index < 2 }">{{ index < 2 ? "是" : "否"
}}</span>
</td>
</tr>
<tr v-if="!rankingRows.length">
<td colspan="4" class="empty-row">请先完成并保存第三步归一化评分。</td>
</tr>
<tr v-if="!rankingRows.length"><td colspan="4" class="empty-row">请先完成并保存第三步归一化评分。</td></tr>
</tbody>
</table>
</div>
<label class="analysis-field"><span>请根据以上计算结果,结合案例文档内容,分析所选核心渠道的优势及运营建议:</span><el-input v-model="coreChannelAnalysis" type="textarea" :autosize="{ minRows: 7, maxRows: 14 }" placeholder="填写核心渠道优势、资源投入重点和运营建议" /></label>
<label class="analysis-field"><span>请根据以上计算结果,结合案例文档内容,分析所选核心渠道的优势及运营建议:</span><el-input
v-model="coreChannelAnalysis" type="textarea" :autosize="{ minRows: 7, maxRows: 14 }"
placeholder="填写核心渠道优势、资源投入重点和运营建议" /></label>
<p class="hint">渠道数量同步第三步,排名自动从 1 往下排列。渠道与加权综合得分需由学生填写,并与第三步数据逐项一致;得分必须按从高到低排序,前两名自动显示为核心渠道。</p>
<footer class="footer-actions">
<el-button @click="activeStep = 3">上一步</el-button>
@ -182,34 +271,34 @@
</template>
<script setup>
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 TrainingTaskToolbar from "@/views/components/TrainingTaskToolbar.vue";
import { getTrainingTaskByKey } from "@/api/trainingTask";
import { deleteStudentTrainingAnswer, getStudentTrainingAnswer, saveStudentTrainingAnswer, validateReleaseChannelEvaluationStepOne, validateReleaseChannelEvaluationStepTwo, validateReleaseChannelEvaluationStepThree, validateReleaseChannelEvaluationStepFour } from "@/api/studentTrainingAnswer";
import { parseTrainingArray } from "@/views/training/taskKeyMap";
const TASK_KEY = "release-channel-evaluation";
const RELEASE_CHANNEL_GUIDE_URL = "/file/training-materials/release-channel-evaluation/21.实训操作说明.docx";
const activeStep = ref(1);
const briefOpen = ref(false);
const taskConfig = ref(null);
const saving = ref(false);
const validating = ref(false);
let nextId = 1;
const makeRow = (values = {}) => ({ id: nextId++, ...values });
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 TrainingTaskToolbar from "@/views/components/TrainingTaskToolbar.vue"
import { getTrainingTaskByKey } from "@/api/trainingTask"
import { deleteStudentTrainingAnswer, getStudentTrainingAnswer, saveStudentTrainingAnswer, validateReleaseChannelEvaluationStepOne, validateReleaseChannelEvaluationStepTwo, validateReleaseChannelEvaluationStepThree, validateReleaseChannelEvaluationStepFour } from "@/api/studentTrainingAnswer"
import { parseTrainingArray } from "@/views/training/taskKeyMap"
const TASK_KEY = "release-channel-evaluation"
const RELEASE_CHANNEL_GUIDE_URL = "/file/training-materials/release-channel-evaluation/21.实训操作说明.docx"
const activeStep = ref(1)
const briefOpen = ref(false)
const taskConfig = ref(null)
const saving = ref(false)
const validating = ref(false)
let nextId = 1
const makeRow = (values = {}) => ({ id: nextId++, ...values })
const defaultWeightRows = () => [
["市场规模潜力", "对应关键词日均总搜索量,代表渠道用户需求大盘空间", "20~25"], ["竞争激烈程度", "供需比(在线商品数/日均搜索量),数值越低渠道竞争越宽松", "15~20"], ["流量点击效率", "品类平均点击率,代表渠道用户对该品类的点击意愿强弱", "12~18"], ["流量获取成本", "平均CPC,数值越低获取精准用户的推广成本越低", "15~20"], ["流量转化效率", "品类平均转化率,代表渠道用户的最终下单意愿", "12~18"], ["现有用户基础", "店铺现有该品类相关访客数,代表品牌存量用户承接能力", "5~10"], ["匹配度", "渠道属性与产品定位的适配度打分(1-10分)", "5~10"],
].map(([dimension, description, suggestion]) => makeRow({ dimension, description, weight: undefined, suggestion }));
const defaultChannelRows = () => ["天猫", "京东", "抖音", "拼多多", "唯品会"].map((channel) => makeRow({ channel }));
const weightSuggestions = Object.fromEntries(defaultWeightRows().map((row) => [row.dimension, row.suggestion]));
const weightRows = ref(defaultWeightRows());
const channelRows = ref(defaultChannelRows());
const scoreRows = ref([]);
const rankingRows = ref([]);
const coreChannelAnalysis = ref("");
].map(([dimension, description, suggestion]) => makeRow({ dimension, description, weight: undefined, suggestion }))
const defaultChannelRows = () => ["天猫", "京东", "抖音", "拼多多", "唯品会"].map((channel) => makeRow({ channel }))
const weightSuggestions = Object.fromEntries(defaultWeightRows().map((row) => [row.dimension, row.suggestion]))
const weightRows = ref(defaultWeightRows())
const channelRows = ref(defaultChannelRows())
const scoreRows = ref([])
const rankingRows = ref([])
const coreChannelAnalysis = ref("")
const scoringMetrics = [
{ key: "marketScale", dimension: "市场规模潜力", label: "市场规模得分" },
{ key: "competition", dimension: "竞争激烈程度", label: "竞争程度得分" },
@ -218,60 +307,61 @@ const scoringMetrics = [
{ key: "conversion", dimension: "流量转化效率", label: "转化效率得分" },
{ key: "userBase", dimension: "现有用户基础", label: "用户基础得分" },
{ key: "match", dimension: "匹配度", label: "匹配度得分" },
];
const taskTitle = computed(() => taskConfig.value?.taskName || "产品发布渠道评估");
const stepTitle = computed(() => ["评估维度与权重设置", "渠道基础数据汇总", "Min-Max 归一化与加权评分", "渠道综合排名与核心渠道选择"][activeStep.value - 1] || "产品发布渠道评估");
const taskBackground = computed(() => taskConfig.value?.background || "结合新品定位与渠道特征,为产品发布选择更合适的投放渠道。");
const taskRequirement = computed(() => taskConfig.value?.requirements || "设置渠道评估维度与权重,并汇总渠道基础数据。");
const taskGoals = computed(() => parseTrainingArray(taskConfig.value?.objectives, ["理解渠道评估的核心维度", "能够按重要性配置评估权重", "汇总渠道数据并完成评估基础"]));
const weightTotal = computed(() => Number(weightRows.value.reduce((sum, row) => sum + (Number(row.weight) || 0), 0).toFixed(6)));
const displayWeightTotal = computed(() => Number.isInteger(weightTotal.value) ? String(weightTotal.value) : weightTotal.value.toFixed(2));
const progressItems = computed(() => parseTrainingArray(taskConfig.value?.steps).map((text, index) => ({ text, status: index + 1 < activeStep.value ? "done" : index + 1 === activeStep.value ? "doing" : "" })));
const weightPayload = () => ({ rows: weightRows.value.map(({ dimension, description, weight }) => ({ dimension, description, weight })) });
const channelPayload = () => ({ rows: channelRows.value.map(({ channel, dailySearchVolume, supplyDemandRatio, averageClickRate, averageCpc, averageConversionRate, existingVisitorCount, matchingScore }) => ({ channel, dailySearchVolume, supplyDemandRatio, averageClickRate, averageCpc, averageConversionRate, existingVisitorCount, matchingScore })) });
const scorePayload = () => ({ rows: scoreRows.value.map((row) => ({ channel: row.channel, weightedScore: row.weightedScore, dimensions: row.dimensions.map(({ dimension, score, weight }) => ({ dimension, score, weight })) })) });
const scoreAnswerPayload = (calculationCheck = {}) => ({ ...scorePayload(), calculationCheck: {
]
const taskTitle = computed(() => taskConfig.value?.taskName || "产品发布渠道评估")
const taskBackground = computed(() => taskConfig.value?.background || "结合新品定位与渠道特征,为产品发布选择更合适的投放渠道。")
const taskRequirement = computed(() => taskConfig.value?.requirements || "设置渠道评估维度与权重,并汇总渠道基础数据。")
const taskGoals = computed(() => parseTrainingArray(taskConfig.value?.objectives, ["理解渠道评估的核心维度", "能够按重要性配置评估权重", "汇总渠道数据并完成评估基础"]))
const weightTotal = computed(() => Number(weightRows.value.reduce((sum, row) => sum + (Number(row.weight) || 0), 0).toFixed(6)))
const displayWeightTotal = computed(() => Number.isInteger(weightTotal.value) ? String(weightTotal.value) : weightTotal.value.toFixed(2))
const progressItems = computed(() => parseTrainingArray(taskConfig.value?.steps).map((text, index) => ({ text, status: index + 1 < activeStep.value ? "done" : index + 1 === activeStep.value ? "doing" : "" })))
const weightPayload = () => ({ rows: weightRows.value.map(({ dimension, description, weight }) => ({ dimension, description, weight })) })
const channelPayload = () => ({ rows: channelRows.value.map(({ channel, dailySearchVolume, supplyDemandRatio, averageClickRate, averageCpc, averageConversionRate, existingVisitorCount, matchingScore }) => ({ channel, dailySearchVolume, supplyDemandRatio, averageClickRate, averageCpc, averageConversionRate, existingVisitorCount, matchingScore })) })
const scorePayload = () => ({ rows: scoreRows.value.map((row) => ({ channel: row.channel, weightedScore: row.weightedScore, dimensions: row.dimensions.map(({ dimension, score, weight }) => ({ dimension, score, weight })) })) })
const scoreAnswerPayload = (calculationCheck = {}) => ({
...scorePayload(), calculationCheck: {
calculationCorrect: calculationCheck.calculationCorrect === true,
totalItemCount: Number(calculationCheck.totalItemCount) || 0,
incorrectItemCount: Number(calculationCheck.incorrectItemCount) || 0,
incorrectItems: Array.isArray(calculationCheck.incorrectItems) ? calculationCheck.incorrectItems : [],
} });
const rankingPayload = () => ({ rows: rankingRows.value.map(({ channel, weightedScore }) => ({ channel, weightedScore })), coreChannelAnalysis: coreChannelAnalysis.value });
function addWeightRow() { weightRows.value.push(makeRow({ dimension: "", description: "", weight: undefined, suggestion: "" })); }
function addChannelRow() { channelRows.value.push(makeRow({ channel: "" })); }
async function saveAnswer(currentStep, fields) { await saveStudentTrainingAnswer(TASK_KEY, { saveAction: "SAVE", currentStep, ...fields }); }
async function saveWeightStep() { if (saving.value) return; saving.value = true; try { await saveAnswer(1, { step1Answer: JSON.stringify(weightPayload()) }); ElMessage.success("当前进度已保存"); } finally { saving.value = false; } }
async function goStepTwo() { if (validating.value) return; validating.value = true; try { await validateReleaseChannelEvaluationStepOne(weightPayload()); await saveAnswer(2, { step1Answer: JSON.stringify(weightPayload()) }); activeStep.value = 2; ElMessage.success("权重校验通过,已进入第二步"); } catch (error) { ElMessage.error(error?.message || "请检查评估维度和权重设置"); } finally { validating.value = false; } }
async function saveChannelStep() { if (saving.value) return; saving.value = true; try { await saveAnswer(2, { step2Answer: JSON.stringify(channelPayload()) }); ElMessage.success("当前进度已保存"); } finally { saving.value = false; } }
async function validateChannelStep() { if (validating.value) return; validating.value = true; try { await validateReleaseChannelEvaluationStepTwo(channelPayload()); await saveAnswer(3, { step2Answer: JSON.stringify(channelPayload()) }); syncScoreRows(); activeStep.value = 3; ElMessage.success("渠道数据校验通过,已进入第三步"); } catch (error) { ElMessage.error(error?.message || "请检查渠道数据填写情况"); } finally { validating.value = false; } }
function syncScoreRows(savedRows = []) { const savedByChannel = new Map(savedRows.map((row) => [row?.channel, row])); const weights = Object.fromEntries(weightRows.value.map((row) => [row.dimension, row.weight])); scoreRows.value = channelRows.value.map((channelRow) => { const saved = savedByChannel.get(channelRow.channel); const savedScores = new Map((saved?.dimensions || []).map((dimension) => [dimension?.dimension, dimension])); return makeRow({ channel: channelRow.channel, weightedScore: saved?.weightedScore, dimensions: scoringMetrics.map((metric) => makeRow({ key: metric.key, dimension: metric.dimension, weight: weights[metric.dimension], score: savedScores.get(metric.dimension)?.score })) }); }); }
function openStepThree() { syncScoreRows(scoreRows.value); activeStep.value = 3; }
async function saveScoreStep() { if (saving.value) return; saving.value = true; try { await saveAnswer(3, { step3Answer: JSON.stringify(scorePayload()) }); ElMessage.success("当前进度已保存"); } finally { saving.value = false; } }
async function validateScoreStep() { if (validating.value) return; validating.value = true; try { const result = await validateReleaseChannelEvaluationStepThree(scorePayload()); const calculationCheck = result?.data || {}; await saveAnswer(4, { step3Answer: JSON.stringify(scoreAnswerPayload(calculationCheck)) }); syncRankingRows(); activeStep.value = 4; ElMessage[calculationCheck.calculationCorrect ? "success" : "warning"](calculationCheck.message || "已保存并进入第四步"); } catch (error) { ElMessage.error(error?.message || "请完整填写归一化得分表"); } finally { validating.value = false; } }
function syncRankingRows(savedRows = []) { const savedByChannel = new Map(savedRows.map((row) => [row?.channel, row])); rankingRows.value = scoreRows.value.map((scoreRow) => { const saved = savedByChannel.get(scoreRow.channel); return makeRow({ channel: saved?.channel ?? "", weightedScore: saved?.weightedScore }); }); }
function openStepFour() { syncRankingRows(rankingRows.value); activeStep.value = 4; }
async function saveRankingStep() { if (saving.value) return; saving.value = true; try { await saveAnswer(4, { step4Answer: JSON.stringify(rankingPayload()) }); ElMessage.success("当前进度已保存"); } finally { saving.value = false; } }
async function validateRankingStep() { if (validating.value) return; validating.value = true; try { await validateReleaseChannelEvaluationStepFour(rankingPayload()); await saveStudentTrainingAnswer(TASK_KEY, { saveAction: "SUBMIT", currentStep: 4, step4Answer: JSON.stringify(rankingPayload()) }); ElMessage.success("渠道排名校验通过,任务已提交"); } catch (error) { ElMessage.error(error?.message || "请检查渠道排名和核心渠道运营建议"); } finally { validating.value = false; } }
async function submitTask() { return validateRankingStep(); }
async function resetTraining() { if (saving.value || validating.value) return; try { await deleteStudentTrainingAnswer(TASK_KEY); weightRows.value = defaultWeightRows(); channelRows.value = defaultChannelRows(); scoreRows.value = []; rankingRows.value = []; coreChannelAnalysis.value = ""; activeStep.value = 1; ElMessage.success("已清空全部实训步骤,可以重新开始"); } catch (error) { ElMessage.error("重新实训失败,请稍后重试"); } }
function exportOutcome() { ElMessage.info("导出功能正在开发中"); }
}
})
const rankingPayload = () => ({ rows: rankingRows.value.map(({ channel, weightedScore }) => ({ channel, weightedScore })), coreChannelAnalysis: coreChannelAnalysis.value })
function addWeightRow() { weightRows.value.push(makeRow({ dimension: "", description: "", weight: undefined, suggestion: "" })) }
function addChannelRow() { channelRows.value.push(makeRow({ channel: "" })) }
async function saveAnswer(currentStep, fields) { await saveStudentTrainingAnswer(TASK_KEY, { saveAction: "SAVE", currentStep, ...fields }) }
async function saveWeightStep() { if (saving.value) return; saving.value = true; try { await saveAnswer(1, { step1Answer: JSON.stringify(weightPayload()) }); ElMessage.success("当前进度已保存") } finally { saving.value = false } }
async function goStepTwo() { if (validating.value) return; validating.value = true; try { await validateReleaseChannelEvaluationStepOne(weightPayload()); await saveAnswer(2, { step1Answer: JSON.stringify(weightPayload()) }); activeStep.value = 2; ElMessage.success("权重校验通过,已进入第二步") } catch (error) { ElMessage.error(error?.message || "请检查评估维度和权重设置") } finally { validating.value = false } }
async function saveChannelStep() { if (saving.value) return; saving.value = true; try { await saveAnswer(2, { step2Answer: JSON.stringify(channelPayload()) }); ElMessage.success("当前进度已保存") } finally { saving.value = false } }
async function validateChannelStep() { if (validating.value) return; validating.value = true; try { await validateReleaseChannelEvaluationStepTwo(channelPayload()); await saveAnswer(3, { step2Answer: JSON.stringify(channelPayload()) }); syncScoreRows(); activeStep.value = 3; ElMessage.success("渠道数据校验通过,已进入第三步") } catch (error) { ElMessage.error(error?.message || "请检查渠道数据填写情况") } finally { validating.value = false } }
function syncScoreRows(savedRows = []) { const savedByChannel = new Map(savedRows.map((row) => [row?.channel, row])); const weights = Object.fromEntries(weightRows.value.map((row) => [row.dimension, row.weight])); scoreRows.value = channelRows.value.map((channelRow) => { const saved = savedByChannel.get(channelRow.channel); const savedScores = new Map((saved?.dimensions || []).map((dimension) => [dimension?.dimension, dimension])); return makeRow({ channel: channelRow.channel, weightedScore: saved?.weightedScore, dimensions: scoringMetrics.map((metric) => makeRow({ key: metric.key, dimension: metric.dimension, weight: weights[metric.dimension], score: savedScores.get(metric.dimension)?.score })) }) }) }
function openStepThree() { syncScoreRows(scoreRows.value); activeStep.value = 3 }
async function saveScoreStep() { if (saving.value) return; saving.value = true; try { await saveAnswer(3, { step3Answer: JSON.stringify(scorePayload()) }); ElMessage.success("当前进度已保存") } finally { saving.value = false } }
async function validateScoreStep() { if (validating.value) return; validating.value = true; try { const result = await validateReleaseChannelEvaluationStepThree(scorePayload()); const calculationCheck = result?.data || {}; await saveAnswer(4, { step3Answer: JSON.stringify(scoreAnswerPayload(calculationCheck)) }); syncRankingRows(); activeStep.value = 4; ElMessage[calculationCheck.calculationCorrect ? "success" : "warning"](calculationCheck.message || "已保存并进入第四步") } catch (error) { ElMessage.error(error?.message || "请完整填写归一化得分表") } finally { validating.value = false } }
function syncRankingRows(savedRows = []) { const savedByChannel = new Map(savedRows.map((row) => [row?.channel, row])); rankingRows.value = scoreRows.value.map((scoreRow) => { const saved = savedByChannel.get(scoreRow.channel); return makeRow({ channel: saved?.channel ?? "", weightedScore: saved?.weightedScore }) }) }
function openStepFour() { syncRankingRows(rankingRows.value); activeStep.value = 4 }
async function saveRankingStep() { if (saving.value) return; saving.value = true; try { await saveAnswer(4, { step4Answer: JSON.stringify(rankingPayload()) }); ElMessage.success("当前进度已保存") } finally { saving.value = false } }
async function validateRankingStep() { if (validating.value) return; validating.value = true; try { await validateReleaseChannelEvaluationStepFour(rankingPayload()); await saveStudentTrainingAnswer(TASK_KEY, { saveAction: "SUBMIT", currentStep: 4, step4Answer: JSON.stringify(rankingPayload()) }); ElMessage.success("渠道排名校验通过,任务已提交") } catch (error) { ElMessage.error(error?.message || "请检查渠道排名和核心渠道运营建议") } finally { validating.value = false } }
async function submitTask() { return validateRankingStep() }
async function resetTraining() { if (saving.value || validating.value) return; try { await deleteStudentTrainingAnswer(TASK_KEY); weightRows.value = defaultWeightRows(); channelRows.value = defaultChannelRows(); scoreRows.value = []; rankingRows.value = []; coreChannelAnalysis.value = ""; activeStep.value = 1; ElMessage.success("已清空全部实训步骤,可以重新开始") } catch (error) { ElMessage.error("重新实训失败,请稍后重试") } }
function exportOutcome() { ElMessage.info("导出功能正在开发中") }
function downloadPracticeGuide() {
downloadBuiltInFile(RELEASE_CHANNEL_GUIDE_URL, "21.实训操作说明.docx");
downloadBuiltInFile(RELEASE_CHANNEL_GUIDE_URL, "21.实训操作说明.docx")
}
function downloadBuiltInFile(url, fileName) {
const link = document.createElement("a");
link.href = url;
link.download = fileName;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
function downloadCsv(headers, rows, fileName) { const escape = (value) => `"${String(value ?? "").replaceAll('"', '""')}"`; const lines = [headers, ...rows].map((row) => row.map(escape).join(",")); const url = URL.createObjectURL(new Blob([`\uFEFF${lines.join("\n")}`], { type: "text/csv;charset=utf-8" })); const link = document.createElement("a"); link.href = url; link.download = fileName; link.click(); URL.revokeObjectURL(url); }
function exportChannelRows() { downloadCsv(["渠道", "日均总搜索量", "供需比", "平均点击率(%)", "平均CPC(元)", "平均转化率(%)", "现有相关访客数", "匹配度(1-100)"], channelRows.value.map((row) => [row.channel, row.dailySearchVolume, row.supplyDemandRatio, row.averageClickRate, row.averageCpc, row.averageConversionRate, row.existingVisitorCount, row.matchingScore]), "产品发布渠道评估-渠道数据.csv"); }
function exportScoreRows() { const headers = ["渠道", ...scoringMetrics.flatMap((metric) => [`${metric.dimension}得分`, `${metric.dimension}权重(%)`]), "加权得分"]; const rows = scoreRows.value.map((row) => [row.channel, ...row.dimensions.flatMap((dimension) => [dimension.score, dimension.weight]), row.weightedScore]); downloadCsv(headers, rows, "产品发布渠道评估-归一化评分.csv"); }
function restoreRows(raw, target, defaults, fields) { try { const saved = typeof raw === "string" ? JSON.parse(raw || "{}") : raw; if (!Array.isArray(saved?.rows)) return; target.value = saved.rows.map((row) => { const value = Object.fromEntries(fields.map((field) => [field, row?.[field]])); return makeRow(target === weightRows ? { ...value, suggestion: weightSuggestions[value.dimension] || "" } : value); }); } catch (error) { target.value = defaults(); } }
async function loadProgress() { try { const result = await getStudentTrainingAnswer(TASK_KEY); const answer = result?.data; restoreRows(answer?.step1Answer, weightRows, defaultWeightRows, ["dimension", "description", "weight"]); restoreRows(answer?.step2Answer, channelRows, defaultChannelRows, ["channel", "dailySearchVolume", "supplyDemandRatio", "averageClickRate", "averageCpc", "averageConversionRate", "existingVisitorCount", "matchingScore"]); let savedScores = []; try { const saved = typeof answer?.step3Answer === "string" ? JSON.parse(answer.step3Answer || "{}") : answer?.step3Answer; savedScores = Array.isArray(saved?.rows) ? saved.rows : []; } catch (error) { savedScores = []; } syncScoreRows(savedScores); let savedRanking = []; try { const saved = typeof answer?.step4Answer === "string" ? JSON.parse(answer.step4Answer || "{}") : answer?.step4Answer; savedRanking = Array.isArray(saved?.rows) ? saved.rows : []; coreChannelAnalysis.value = String(saved?.coreChannelAnalysis || ""); } catch (error) { savedRanking = []; coreChannelAnalysis.value = ""; } syncRankingRows(savedRanking); activeStep.value = Math.min(Math.max(Number(answer?.currentStep) || 1, 1), 4); } catch (error) { syncScoreRows(); syncRankingRows(); } }
onMounted(async () => { try { const result = await getTrainingTaskByKey(TASK_KEY); taskConfig.value = result?.data || null; } catch (error) { taskConfig.value = null; } await loadProgress(); });
const link = document.createElement("a")
link.href = url
link.download = fileName
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
}
function downloadCsv(headers, rows, fileName) { const escape = (value) => `"${String(value ?? "").replaceAll('"', '""')}"`; const lines = [headers, ...rows].map((row) => row.map(escape).join(",")); const url = URL.createObjectURL(new Blob([`\uFEFF${lines.join("\n")}`], { type: "text/csv;charset=utf-8" })); const link = document.createElement("a"); link.href = url; link.download = fileName; link.click(); URL.revokeObjectURL(url) }
function exportChannelRows() { downloadCsv(["渠道", "日均总搜索量", "供需比", "平均点击率(%)", "平均CPC(元)", "平均转化率(%)", "现有相关访客数", "匹配度(1-100)"], channelRows.value.map((row) => [row.channel, row.dailySearchVolume, row.supplyDemandRatio, row.averageClickRate, row.averageCpc, row.averageConversionRate, row.existingVisitorCount, row.matchingScore]), "产品发布渠道评估-渠道数据.csv") }
function exportScoreRows() { const headers = ["渠道", ...scoringMetrics.flatMap((metric) => [`${metric.dimension}得分`, `${metric.dimension}权重(%)`]), "加权得分"]; const rows = scoreRows.value.map((row) => [row.channel, ...row.dimensions.flatMap((dimension) => [dimension.score, dimension.weight]), row.weightedScore]); downloadCsv(headers, rows, "产品发布渠道评估-归一化评分.csv") }
function restoreRows(raw, target, defaults, fields) { try { const saved = typeof raw === "string" ? JSON.parse(raw || "{}") : raw; if (!Array.isArray(saved?.rows)) return; target.value = saved.rows.map((row) => { const value = Object.fromEntries(fields.map((field) => [field, row?.[field]])); return makeRow(target === weightRows ? { ...value, suggestion: weightSuggestions[value.dimension] || "" } : value) }) } catch (error) { target.value = defaults() } }
async function loadProgress() { try { const result = await getStudentTrainingAnswer(TASK_KEY); const answer = result?.data; restoreRows(answer?.step1Answer, weightRows, defaultWeightRows, ["dimension", "description", "weight"]); restoreRows(answer?.step2Answer, channelRows, defaultChannelRows, ["channel", "dailySearchVolume", "supplyDemandRatio", "averageClickRate", "averageCpc", "averageConversionRate", "existingVisitorCount", "matchingScore"]); let savedScores = []; try { const saved = typeof answer?.step3Answer === "string" ? JSON.parse(answer.step3Answer || "{}") : answer?.step3Answer; savedScores = Array.isArray(saved?.rows) ? saved.rows : [] } catch (error) { savedScores = [] } syncScoreRows(savedScores); let savedRanking = []; try { const saved = typeof answer?.step4Answer === "string" ? JSON.parse(answer.step4Answer || "{}") : answer?.step4Answer; savedRanking = Array.isArray(saved?.rows) ? saved.rows : []; coreChannelAnalysis.value = String(saved?.coreChannelAnalysis || "") } catch (error) { savedRanking = []; coreChannelAnalysis.value = "" } syncRankingRows(savedRanking); activeStep.value = Math.min(Math.max(Number(answer?.currentStep) || 1, 1), 4) } catch (error) { syncScoreRows(); syncRankingRows() } }
onMounted(async () => { try { const result = await getTrainingTaskByKey(TASK_KEY); taskConfig.value = result?.data || null } catch (error) { taskConfig.value = null } await loadProgress() })
</script>
<style scoped lang="scss">
@ -371,7 +461,10 @@ onMounted(async () => { try { const result = await getTrainingTaskByKey(TASK_KEY
font: inherit;
font-weight: 700;
cursor: pointer;
&:hover { text-decoration: underline; }
&:hover {
text-decoration: underline;
}
}
.task-brief-more {
@ -380,9 +473,22 @@ onMounted(async () => { try { const result = await getTrainingTaskByKey(TASK_KEY
margin-top: 8px;
padding-top: 8px;
border-top: 1px solid var(--student-panel-border);
b { color: var(--student-text); font-size: 12px; }
ul { display: grid; gap: 4px; margin: 0; padding-left: 18px; }
p { margin: 0; }
b {
color: var(--student-text);
font-size: 12px;
}
ul {
display: grid;
gap: 4px;
margin: 0;
padding-left: 18px;
}
p {
margin: 0;
}
}
/* ===== 工具栏:一行不换行 ===== */
@ -417,33 +523,6 @@ onMounted(async () => { try { const result = await getTrainingTaskByKey(TASK_KEY
min-width: 0;
}
.workbench-head {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
padding: 0 0 10px;
border: 0;
border-bottom: 1px solid var(--student-panel-border);
}
.section-eyebrow {
margin: 0;
color: var(--student-text-secondary);
font-size: 11px;
font-weight: 700;
letter-spacing: 0.12em;
text-transform: uppercase;
}
.workbench-head h2 {
margin: 4px 0 0;
color: var(--student-text);
font-size: var(--student-fs-h1);
font-weight: 700;
line-height: 1.35;
}
/* ===== 步骤条:容器样式 ===== */
.step-tabs {
display: flex;
@ -491,7 +570,10 @@ onMounted(async () => { try { const result = await getTrainingTaskByKey(TASK_KEY
font-size: var(--student-fs-body);
line-height: 1.6;
}
.step-three-materials p { margin: 0; }
.step-three-materials p {
margin: 0;
}
.step-three-notice {
margin: 20px 0 0;
@ -524,10 +606,21 @@ onMounted(async () => { try { const result = await getTrainingTaskByKey(TASK_KEY
border-collapse: collapse;
}
.weight-table { min-width: 900px; }
.channel-table { min-width: 1320px; }
.scoring-table { min-width: 1780px; }
.ranking-table { min-width: 880px; }
.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 {
@ -546,19 +639,40 @@ onMounted(async () => { try { const result = await getTrainingTaskByKey(TASK_KEY
text-align: left;
}
.table-wrap td { background: #ffffff; }
.table-wrap td {
background: #ffffff;
}
.scoring-table thead tr:nth-child(2) th { background: #fafbfc; }
.scoring-table thead tr:nth-child(2) th {
background: #fafbfc;
}
.channel-table td,
.scoring-table td { min-width: 108px; }
.channel-table td:first-child { min-width: 110px; }
.scoring-table th:first-child { min-width: 108px; }
.ranking-table td { min-width: 170px; }
.ranking-table td:first-child { min-width: 100px; }
.scoring-table td {
min-width: 108px;
}
.channel-table td:first-child {
min-width: 110px;
}
.scoring-table th:first-child {
min-width: 108px;
}
.ranking-table td {
min-width: 170px;
}
.ranking-table td:first-child {
min-width: 100px;
}
.rank-cell,
.core-cell { text-align: center; font-weight: 800; }
.core-cell {
text-align: center;
font-weight: 800;
}
.core-cell .core {
display: inline-flex;
@ -587,8 +701,15 @@ onMounted(async () => { try { const result = await getTrainingTaskByKey(TASK_KEY
font-size: var(--student-fs-caption);
}
.operation-column { width: 100px; text-align: center; }
.empty-row { text-align: center; color: var(--student-text-secondary); }
.operation-column {
width: 100px;
text-align: center;
}
.empty-row {
text-align: center;
color: var(--student-text-secondary);
}
.table-wrap tfoot th,
.table-wrap tfoot td {
@ -596,13 +717,17 @@ onMounted(async () => { try { const result = await getTrainingTaskByKey(TASK_KEY
background: var(--student-panel-bg);
}
.total-error { color: var(--student-danger); font-weight: 700; }
.total-error {
color: var(--student-danger);
font-weight: 700;
}
/* ===== 表单输入 ===== */
.analysis-field {
display: block;
margin-top: 14px;
}
.analysis-field>span {
display: block;
margin-bottom: 8px;
@ -618,9 +743,11 @@ onMounted(async () => { try { const result = await getTrainingTaskByKey(TASK_KEY
background: transparent;
box-shadow: none;
}
.table-wrap :deep(.el-input__inner) {
color: var(--student-text);
}
.table-wrap :deep(.el-textarea__inner) {
border: 1px solid transparent;
background: transparent;
@ -629,6 +756,7 @@ onMounted(async () => { try { const result = await getTrainingTaskByKey(TASK_KEY
font-size: var(--student-fs-body);
line-height: 1.55;
}
.analysis-field :deep(.el-textarea__inner) {
min-height: 180px !important;
border: 1px solid var(--student-panel-border);
@ -638,6 +766,7 @@ onMounted(async () => { try { const result = await getTrainingTaskByKey(TASK_KEY
color: var(--student-text);
line-height: 1.55;
}
.table-wrap :deep(.el-textarea__inner:focus),
.analysis-field :deep(.el-textarea__inner:focus),
.table-wrap :deep(.el-input__wrapper.is-focus) {
@ -663,16 +792,31 @@ onMounted(async () => { try { const result = await getTrainingTaskByKey(TASK_KEY
/* ===== 响应式 ===== */
@media (max-width: 720px) {
.task-header { flex-direction: column; align-items: flex-start; }
.task-header {
flex-direction: column;
align-items: flex-start;
}
.task-action-strip {
:deep(.training-task-toolbar) { justify-content: stretch; }
:deep(.training-task-toolbar > *) { flex: 1 1 auto; }
:deep(.training-task-toolbar) {
justify-content: stretch;
}
:deep(.training-task-toolbar > *) {
flex: 1 1 auto;
}
}
.workbench-head { flex-direction: column; }
.table-actions,
.footer-actions { align-items: stretch; flex-direction: column; }
.footer-actions {
align-items: stretch;
flex-direction: column;
}
.table-actions :deep(.el-button),
.footer-actions :deep(.el-button) { width: 100%; }
.footer-actions :deep(.el-button) {
width: 100%;
}
}
</style>
@ -692,7 +836,9 @@ onMounted(async () => { try { const result = await getTrainingTaskByKey(TASK_KEY
background: transparent !important;
box-shadow: none !important;
.step-connector { display: none !important; }
.step-connector {
display: none !important;
}
.step-tab {
flex: 1 1 0 !important;
@ -725,6 +871,7 @@ onMounted(async () => { try { const result = await getTrainingTaskByKey(TASK_KEY
&:first-child {
border-radius: 8px 0 0 8px !important;
}
&:last-child {
border-radius: 0 8px 8px 0 !important;
border-right: 1px solid #e5e7eb !important;
@ -768,25 +915,40 @@ onMounted(async () => { try { const result = await getTrainingTaskByKey(TASK_KEY
font-weight: 600 !important;
}
.step-copy small { display: none !important; }
.step-copy small {
display: none !important;
}
&:hover:not(.active):not(.complete) {
border-color: #2563eb !important;
background: #eff6ff !important;
color: #2563eb !important;
z-index: 1 !important;
.step-marker { background: #2563eb !important; color: #ffffff !important; }
.step-marker {
background: #2563eb !important;
color: #ffffff !important;
}
}
&.complete:not(.active) {
border-color: #e5e7eb !important;
color: #374151 !important;
.step-marker { background: rgba(43, 164, 113, 0.12) !important; color: #16915f !important; }
.step-marker {
background: rgba(43, 164, 113, 0.12) !important;
color: #16915f !important;
}
&:hover {
border-color: #2ba471 !important;
background: #f0fdf6 !important;
z-index: 1 !important;
.step-marker { background: #2ba471 !important; color: #ffffff !important; }
.step-marker {
background: #2ba471 !important;
color: #ffffff !important;
}
}
}
@ -797,7 +959,12 @@ onMounted(async () => { try { const result = await getTrainingTaskByKey(TASK_KEY
font-weight: 700 !important;
box-shadow: none !important;
z-index: 2 !important;
.step-marker { background: #ffffff !important; color: #2563eb !important; }
.step-marker {
background: #ffffff !important;
color: #2563eb !important;
}
&:hover {
background: #1d4ed8 !important;
border-color: #1d4ed8 !important;
@ -812,6 +979,7 @@ onMounted(async () => { try { const result = await getTrainingTaskByKey(TASK_KEY
justify-content: flex-start !important;
overflow-x: auto !important;
}
#app .studentLayout section.app-main:has(.release-channel-page) .step-tabs .step-tab {
flex: 0 0 140px !important;
max-width: none !important;
@ -868,6 +1036,7 @@ onMounted(async () => { try { const result = await getTrainingTaskByKey(TASK_KEY
font-size: 13px !important;
font-weight: 700 !important;
}
.release-channel-page .table-actions .el-button--primary,
.release-channel-page .footer-actions .el-button--primary {
border-color: #2563eb !important;
@ -875,17 +1044,20 @@ onMounted(async () => { try { const result = await getTrainingTaskByKey(TASK_KEY
color: #ffffff !important;
box-shadow: 0 3px 10px rgba(37, 99, 235, 0.28) !important;
}
.release-channel-page .table-actions .el-button--primary:hover,
.release-channel-page .footer-actions .el-button--primary:hover {
border-color: #1d4ed8 !important;
background: #1d4ed8 !important;
box-shadow: 0 5px 14px rgba(29, 78, 216, 0.32) !important;
}
.release-channel-page .footer-actions .el-button:not(.el-button--primary) {
border-color: rgba(37, 99, 235, 0.35) !important;
background: #ffffff !important;
color: #2563eb !important;
}
.release-channel-page .footer-actions .el-button:not(.el-button--primary):hover {
border-color: #2563eb !important;
background: #eff6ff !important;

Loading…
Cancel
Save