Refactor assessment views: Replaced TrainingMaterialButton with TrainingTaskToolbar for improved functionality and layout consistency. Updated CSS for task-action-strip to enhance responsiveness and user experience across various devices.

fix/exam-question-access-material-excel-delete-draft
qinzhenpen 2 months ago
parent dff3ac56f0
commit 0053e509dc

@ -17,8 +17,12 @@
</span>
</p>
</div>
<TrainingTaskToolbar class="diagnosis-toolbar" :task-key="TASK_KEY" :on-submit="submitTask" :on-reset="resetTraining" :on-export="exportTrainingOutcome" />
</section>
<section class="task-action-strip">
<TrainingTaskToolbar :task-key="TASK_KEY" :on-submit="submitTask" :on-reset="resetTraining" :on-export="exportTrainingOutcome" />
</section>
<section class="workbench">
<nav class="step-indicator" aria-label="产品问题诊断步骤"><button type="button" :class="['step-tab', { active: currentStep === 1, complete: currentStep > 1 }]" :aria-current="currentStep === 1 ? 'step' : undefined" @click="currentStep = 1"><span class="step-marker">01</span><span class="step-copy"><b class="step-name">全链路漏斗诊断</b><small class="step-action">{{ currentStep === 1 ? '当前步骤 →' : '点击切换 →' }}</small></span></button><span class="step-connector" aria-hidden="true" /><button type="button" :class="['step-tab', { active: currentStep === 2, complete: currentStep > 2 }]" :aria-current="currentStep === 2 ? 'step' : undefined" @click="currentStep = 2"><span class="step-marker">02</span><span class="step-copy"><b class="step-name">用户评论根因分析</b><small class="step-action">{{ currentStep === 2 ? '当前步骤 →' : '点击切换 →' }}</small></span></button><span class="step-connector" aria-hidden="true" /><button type="button" :class="['step-tab', { active: currentStep === 3 }]" :aria-current="currentStep === 3 ? 'step' : undefined" @click="currentStep = 3"><span class="step-marker">03</span><span class="step-copy"><b class="step-name">AB测试验证</b><small class="step-action">{{ currentStep === 3 ? '当前步骤 →' : '点击切换 →' }}</small></span></button></nav>
@ -82,7 +86,11 @@
<section class="section-block"><div class="section-heading"><span>(3)</span><div><h3>可视化呈现</h3><p>绘制AB测试结果对比图,参考方法及工具如下:</p></div></div><input ref="abChartInput" class="visually-hidden" type="file" accept="image/png,image/jpeg,image/webp" @change="handleAbChartUpload" /><div class="chart-upload-area"><template v-if="abChart.url"><div class="chart-preview"><el-image :src="abChart.url" :preview-src-list="[abChart.url]" fit="cover" preview-teleported /><div><strong>{{ abChart.name || 'AB 测试结果对比图' }}</strong><span>点击缩略图可放大预览</span><button type="button" @click="clearAbChart">移除图片</button></div></div><button type="button" class="secondary-button" :disabled="uploading" @click="abChartInput?.click()">{{ uploading ? '上传中…' : '更换对比图' }}</button></template><template v-else><button type="button" class="upload-button" :disabled="uploading" @click="abChartInput?.click()">{{ uploading ? '上传中…' : '上传AB测试结果对比图' }}</button><p>支持 PNG、JPG、WEBP 格式,图片不超过 5MB;上传后可点击预览。</p></template></div><div class="ab-materials"><div><ol><li>1.使用Excel/WPS绘图功能,自主完成AB测试结果对比图,参考《实训操作说明》。</li><li>2.下载Excel模版,填写关键信息,自动计算AB测试数据,并生成测试结果对比图。</li><li>3.导出数据表上传到通用AI大模型,通过AI大模型辅助完成,参考步骤及提示词如下:请根据表格数据,进行对照组和实验组数据对比,采用组合柱状图生成可视化图形。</li></ol></div><div class="ab-materials__actions"><button type="button" class="secondary-button" @click="downloadAbGuide">下载实训操作说明</button><button type="button" class="secondary-button" @click="downloadAbTemplate">下载Excel模板</button></div></div></section>
<section class="section-block"><div class="section-heading"><span>(4)</span><div><h3>诊断结论与迭代优化建议</h3><p>结合全链路数据漏斗诊断、售后评论分析法及AB测试对照诊断,分析产品存在的问题,并提出具体的迭代优化建议。</p></div></div><el-input v-model="iterationRecommendation" type="textarea" :rows="6" maxlength="1200" show-word-limit placeholder="请填写产品问题诊断结论及具体迭代优化建议" /></section>
</template>
<div class="actions step-navigation"><button v-if="currentStep > 1" type="button" class="secondary-button" :disabled="saving" @click="currentStep -= 1">上一步</button><button type="button" class="submit-button" :disabled="saving || uploading || analyzing" @click="saveCurrentProgress">保存当前进度</button><button v-if="currentStep < 3" type="button" class="submit-button" :disabled="saving || uploading || analyzing" @click="nextStep">下一步</button></div>
<footer class="footer-actions">
<el-button v-if="currentStep > 1" @click="currentStep -= 1">上一步</el-button>
<el-button :loading="saving || uploading || analyzing" @click="saveCurrentProgress">保存当前进度</el-button>
<el-button v-if="currentStep < 3" type="primary" :disabled="saving || uploading || analyzing" @click="nextStep">下一步 <el-icon><ArrowRight /></el-icon></el-button>
</footer>
</section>
</main>
<TrainingAiSidebar :study-tip="currentStep === 1 ? '先从案例资料提取各渠道漏斗数据,计算转化率并与行业均值逐层对比。' : currentStep === 2 ? '先导入案例评论数据生成词云,再点击情感倾向分析,并用高频问题与情感占比解释漏斗异常。' : '基于前两步结论设计随机分流的 AB 测试,用五项指标的组间差异验证改进方案。'" :progress-items="progressItems" />
@ -91,7 +99,7 @@
<script setup>
import { computed, getCurrentInstance, nextTick, onBeforeUnmount, onMounted, ref } from "vue";
import { DataAnalysis } from "@element-plus/icons-vue";
import { ArrowRight, DataAnalysis } from "@element-plus/icons-vue";
import * as echarts from "echarts";
import "echarts-wordcloud";
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
@ -459,11 +467,18 @@ onMounted(async () => { try { taskConfig.value = (await getTrainingTaskByKey(TAS
p { margin: 0; }
}
.diagnosis-toolbar {
flex: 0 0 auto;
/* 操作工具栏横条:内联布局,去掉悬浮和边框 */
.task-action-strip {
margin: 0;
padding: 10px 16px;
:deep(.training-task-toolbar) {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: flex-end;
max-width: 100%;
align-self: center;
gap: 8px;
}
}
/* workbench:透明容器,去掉旧的 border/bg */
@ -764,16 +779,12 @@ button.is-disabled {
}
}
.actions {
/* ===== 底部步骤导航按钮 ===== */
.footer-actions {
display: flex;
justify-content: center;
gap: 12px;
margin-top: 20px;
.secondary-button,
.submit-button {
min-width: 142px;
min-height: 36px;
height: 36px;
}
}
/* ===== 参考资料区 ===== */
@ -1054,18 +1065,20 @@ button.is-disabled {
@media (max-width: 720px) {
.task-header { flex-direction: column; align-items: flex-start; }
.diagnosis-toolbar { width: 100%; justify-content: flex-start; }
.task-action-strip {
:deep(.training-task-toolbar) { justify-content: stretch; }
:deep(.training-task-toolbar > *) { flex: 1 1 auto; }
}
.table-toolbar,
.sentiment-actions {
align-items: stretch;
flex-direction: column;
}
.actions {
.footer-actions {
align-items: stretch;
flex-direction: column;
.secondary-button,
.submit-button { width: 100%; }
}
.footer-actions :deep(.el-button) { width: 100%; }
}
</style>
@ -1264,4 +1277,35 @@ button.is-disabled {
color: #2563eb;
background: #ffffff;
}
/* ===== 底部步骤导航按钮换肤 ===== */
.diagnosis-page .footer-actions .el-button {
border-radius: 8px !important;
font-size: 13px !important;
font-weight: 700 !important;
}
.diagnosis-page .footer-actions .el-button--primary {
border-color: #2563eb !important;
background: #2563eb !important;
color: #ffffff !important;
box-shadow: 0 3px 10px rgba(37, 99, 235, 0.28) !important;
}
.diagnosis-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;
}
.diagnosis-page .footer-actions .el-button:not(.el-button--primary) {
border-color: rgba(37, 99, 235, 0.35) !important;
background: #ffffff !important;
color: #2563eb !important;
}
.diagnosis-page .footer-actions .el-button:not(.el-button--primary):hover {
border-color: #2563eb !important;
background: #eff6ff !important;
}
</style>

@ -19,26 +19,11 @@
</div>
</section>
<section class="task-action-strip">
<TrainingTaskToolbar :task-key="TASK_KEY" :on-submit="submitTask" :on-reset="resetTask" :on-export="exportOutcome" />
</section>
<section class="task-card">
<div class="workbench-head">
<div>
<p class="section-eyebrow">CATEGORY OPERATIONS</p>
<h2>{{ activeStepName }}</h2>
</div>
<div class="workbench-actions">
<TrainingMaterialButton
:material-name="taskConfig?.materialName"
:material-url="taskConfig?.materialUrl"
:training-data-name="taskConfig?.trainingDataName"
:training-data-url="taskConfig?.trainingDataUrl"
:guide-manual-name="taskConfig?.guideManualName"
:guide-manual-url="taskConfig?.guideManualUrl"
:ai-manual-name="taskConfig?.aiManualName"
:ai-manual-url="taskConfig?.aiManualUrl"
/>
<button class="outline-action" type="button" @click="exportOutcome"><el-icon><Download /></el-icon>导出实训成果</button>
</div>
</div>
<nav v-if="hasConfiguredSteps" class="step-indicator" aria-label="品类结构优化步骤">
<template v-for="(step, index) in configuredSteps" :key="`${step}-${index}`">
@ -193,10 +178,6 @@
<button type="button" class="nav-button nav-button--save" :disabled="saving" @click="saveCurrentProgress"><el-icon><CircleCheck /></el-icon>保存当前进度</button>
<button type="button" class="nav-button nav-button--primary" :disabled="activeStep === configuredSteps.length" @click="goNextStep">下一步<el-icon><ArrowRight /></el-icon></button>
</div>
<div class="training-actions">
<el-button class="training-action" :loading="saving" @click="submitTask">提交任务</el-button>
<el-button class="training-action" :loading="saving" @click="resetTask">清空填写</el-button>
</div>
</section>
</main>
<TrainingAiSidebar study-tip="先完成品类营收数据排序和占比校验,再开展后续分析。" :progress-items="progressItems" />
@ -205,12 +186,12 @@
<script setup>
import { computed, defineAsyncComponent, onMounted, ref } from "vue";
import { ArrowLeft, ArrowRight, CircleCheck, Delete, Download, Minus, Plus, TrendCharts, UploadFilled } from "@element-plus/icons-vue";
import { ArrowLeft, ArrowRight, CircleCheck, Delete, Minus, Plus, TrendCharts, UploadFilled } from "@element-plus/icons-vue";
import { ElMessage } from "element-plus";
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
import TrainingMaterialButton from "@/views/components/TrainingMaterialButton.vue";
import TrainingTaskToolbar from "@/views/components/TrainingTaskToolbar.vue";
import { getTrainingTaskByKey } from "@/api/trainingTask";
import { getStudentTrainingAnswer, saveStudentTrainingAnswer, uploadStudentTrainingFile, validateCategoryOptimizationStepOne, validateCategoryOptimizationStepTwo, validateCategoryOptimizationStepThree, validateCategoryOptimizationStepFour, validateCategoryOptimizationStepFive } from "@/api/studentTrainingAnswer";
import { deleteStudentTrainingAnswer, getStudentTrainingAnswer, saveStudentTrainingAnswer, uploadStudentTrainingFile, validateCategoryOptimizationStepOne, validateCategoryOptimizationStepTwo, validateCategoryOptimizationStepThree, validateCategoryOptimizationStepFour, validateCategoryOptimizationStepFive } from "@/api/studentTrainingAnswer";
import { parseTrainingArray } from "@/views/training/taskKeyMap";
import { isStudentDemo } from "@/utils/studentDemo";
@ -381,6 +362,9 @@ async function submitTask() {
}
async function resetTask() {
if (saving.value) return;
saving.value = true;
try {
await deleteStudentTrainingAnswer(TASK_KEY);
categoryRows.value = [];
removeParetoImage();
stepFour.value = createStepFour();
@ -388,8 +372,12 @@ async function resetTask() {
activeStep.value = 1;
activeModule.value = 0;
workspaceKey.value += 1;
saving.value = true;
try { await persistProgress("RESET"); ElMessage.success("填写内容已清空"); } finally { saving.value = false; }
ElMessage.success("已清空全部实训步骤,可以重新开始");
} catch (error) {
ElMessage.error("重新实训失败,请稍后重试");
} finally {
saving.value = false;
}
}
function exportOutcome() {
const blob = new Blob([JSON.stringify(buildProgress(), null, 2)], { type: "application/json;charset=utf-8" });
@ -517,6 +505,19 @@ onMounted(async () => {
p { margin: 0; }
}
/* ===== task-action-strip(操作工具栏) ===== */
.task-action-strip {
margin: 0;
:deep(.training-task-toolbar) {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: flex-end;
gap: 8px;
}
}
/* ===== task-card(透明化) ===== */
.task-card {
overflow: visible;
@ -527,44 +528,6 @@ onMounted(async () => {
gap: 10px;
}
/* ===== workbench-head ===== */
.workbench-head {
display: flex;
justify-content: space-between;
gap: 18px;
padding: 0;
border-bottom: 0;
}
.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;
}
.workbench-actions,
.table-toolbar > div {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 10px;
}
.workbench-actions {
justify-content: flex-end;
}
/* ===== 按钮规范(白底灰边 / 墨黑实底 / 浅灰底) ===== */
.outline-action,
.action-button,
@ -1062,19 +1025,16 @@ button:disabled {
/* ===== 响应式 ===== */
@media (max-width: 720px) {
.task-header { flex-direction: column; align-items: flex-start; }
.workbench-head,
.table-toolbar,
.pareto-materials {
flex-direction: column;
align-items: stretch;
}
.workbench-actions,
.table-toolbar > div,
.step-navigation,
.training-actions {
justify-content: stretch;
}
.workbench-actions > *,
.action-button,
.nav-button,
.training-actions :deep(.training-action) {

@ -394,7 +394,7 @@ function plainText(value) {
top: 64px;
right: 16px;
bottom: 16px;
width: min(390px, calc(100vw - 32px));
width: min(585px, calc(100vw - 32px));
/* 根透明:不铺任何背景色,白底仅限卡片本身 */
background: transparent;
display: flex;

@ -17,17 +17,10 @@
</span>
</p>
</div>
<TrainingMaterialButton
class="release-channel-toolbar"
:material-name="taskConfig?.materialName"
:material-url="taskConfig?.materialUrl"
:training-data-name="taskConfig?.trainingDataName"
:training-data-url="taskConfig?.trainingDataUrl"
:guide-manual-name="taskConfig?.guideManualName"
:guide-manual-url="taskConfig?.guideManualUrl"
:ai-manual-name="taskConfig?.aiManualName"
:ai-manual-url="taskConfig?.aiManualUrl"
/>
</section>
<section class="task-action-strip">
<TrainingTaskToolbar :task-key="TASK_KEY" :on-submit="submitTask" :on-reset="resetTraining" :on-export="exportOutcome" />
</section>
<section class="task-card">
@ -180,7 +173,6 @@
<footer class="footer-actions">
<el-button @click="activeStep = 3">上一步</el-button>
<el-button :loading="saving" @click="saveRankingStep">保存当前进度</el-button>
<el-button type="primary" :loading="validating" @click="validateRankingStep">提交任务</el-button>
</footer>
</section>
</section>
@ -194,9 +186,9 @@ import { computed, onMounted, ref } from "vue";
import { ArrowRight, Document, Download, Minus, Plus } from "@element-plus/icons-vue";
import { ElMessage } from "element-plus";
import TrainingAiSidebar from "@/views/components/TrainingAiSidebar.vue";
import TrainingMaterialButton from "@/views/components/TrainingMaterialButton.vue";
import TrainingTaskToolbar from "@/views/components/TrainingTaskToolbar.vue";
import { getTrainingTaskByKey } from "@/api/trainingTask";
import { getStudentTrainingAnswer, saveStudentTrainingAnswer, validateReleaseChannelEvaluationStepOne, validateReleaseChannelEvaluationStepTwo, validateReleaseChannelEvaluationStepThree, validateReleaseChannelEvaluationStepFour } from "@/api/studentTrainingAnswer";
import { deleteStudentTrainingAnswer, getStudentTrainingAnswer, saveStudentTrainingAnswer, validateReleaseChannelEvaluationStepOne, validateReleaseChannelEvaluationStepTwo, validateReleaseChannelEvaluationStepThree, validateReleaseChannelEvaluationStepFour } from "@/api/studentTrainingAnswer";
import { parseTrainingArray } from "@/views/training/taskKeyMap";
const TASK_KEY = "release-channel-evaluation";
@ -260,6 +252,9 @@ function syncRankingRows(savedRows = []) { const savedByChannel = new Map(savedR
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");
}
@ -391,16 +386,18 @@ onMounted(async () => { try { const result = await getTrainingTaskByKey(TASK_KEY
}
/* ===== 工具栏:一行不换行 ===== */
.task-header :deep(.material-actions) {
flex: 0 0 auto;
display: flex;
flex-wrap: nowrap;
gap: 6px;
}
/* ===== 工具栏:TrainingTaskToolbar 按钮右对齐 ===== */
.task-action-strip {
margin: 0;
padding: 10px 16px;
.task-header :deep(.material-button) {
flex: 0 0 auto;
white-space: nowrap;
:deep(.training-task-toolbar) {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: flex-end;
gap: 8px;
}
}
/* ===== task-card:透明容器 ===== */
@ -667,7 +664,10 @@ onMounted(async () => { try { const result = await getTrainingTaskByKey(TASK_KEY
/* ===== 响应式 ===== */
@media (max-width: 720px) {
.task-header { flex-direction: column; align-items: flex-start; }
.task-header :deep(.material-actions) { width: 100%; }
.task-action-strip {
: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; }
@ -819,36 +819,46 @@ onMounted(async () => { try { const result = await getTrainingTaskByKey(TASK_KEY
}
/* ============================================================
* 共用组件换肤:TrainingMaterialButton 资料按钮 → 教育蓝
* 共用组件换肤:TrainingTaskToolbar 工具栏按钮 → 教育蓝
* ============================================================ */
.release-channel-page .task-header .material-button.el-button {
height: 34px !important;
min-height: 34px !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: 600 !important;
transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease !important;
.release-channel-page .task-action-strip .task-toolbar-button.el-button {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
min-height: 34px;
height: 34px;
padding: 0 14px;
border: 1px solid rgba(37, 99, 235, 0.35);
border-radius: 8px;
color: #2563eb;
background: #ffffff;
font-size: 13px;
font-weight: 600;
transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}
&:hover {
border-color: #2563eb !important;
color: #2563eb !important;
background: #eff6ff !important;
box-shadow: 0 2px 6px rgba(37, 99, 235, 0.12) !important;
}
.release-channel-page .task-action-strip .task-toolbar-button:hover,
.release-channel-page .task-action-strip .task-toolbar-button:focus {
border-color: #2563eb;
color: #1d4ed8;
background: #eff6ff;
box-shadow: 0 2px 6px rgba(37, 99, 235, 0.12);
}
&.is-plain {
border-color: #e5e7eb !important;
color: #9ca3af !important;
&:hover {
border-color: #e5e7eb !important;
color: #9ca3af !important;
background: #ffffff !important;
box-shadow: none !important;
}
}
.release-channel-page .task-action-strip .task-toolbar-button--submit.el-button {
border-color: #2563eb;
color: #ffffff;
background: #2563eb;
box-shadow: 0 1px 2px rgba(37, 99, 235, 0.35), 0 3px 10px rgba(37, 99, 235, 0.22);
}
.release-channel-page .task-action-strip .task-toolbar-button--submit:hover,
.release-channel-page .task-action-strip .task-toolbar-button--submit:focus {
border-color: #1d4ed8;
color: #ffffff;
background: #1d4ed8;
box-shadow: 0 2px 4px rgba(37, 99, 235, 0.4), 0 5px 14px rgba(29, 78, 216, 0.28);
}
/* ===== 表格操作按钮换肤 ===== */

@ -19,16 +19,11 @@
</div>
</section>
<section class="task-card promotion-phase">
<header class="workbench-head">
<div>
<p class="section-eyebrow">STEP {{ String(activeStep).padStart(2, "0") }}</p>
<h2>{{ stepTitle }}</h2>
</div>
<TrainingTaskToolbar class="promotion-toolbar" :task-key="TASK_KEY" />
</header>
<section class="task-action-strip">
<TrainingTaskToolbar :task-key="TASK_KEY" :on-submit="submitTask" :on-reset="resetTraining" :on-export="exportOutcome" />
</section>
<nav class="step-indicator" aria-label="投放效果评估与优化步骤">
<section class="task-workbench"> <nav class="step-indicator" 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"><strong class="step-name">预算分配</strong><span class="step-action">{{ activeStep === 1 ? '当前步骤' : '点击切换' }} →</span></span>
@ -189,7 +184,7 @@ 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 { getStudentTrainingAnswer, saveStudentTrainingAnswer, validatePromotionEffectOptimizationStepOne, validatePromotionEffectOptimizationStepTwo, validatePromotionEffectOptimizationStepThree, validatePromotionEffectOptimizationStepFour } from "@/api/studentTrainingAnswer";
import { deleteStudentTrainingAnswer, getStudentTrainingAnswer, saveStudentTrainingAnswer, validatePromotionEffectOptimizationStepOne, validatePromotionEffectOptimizationStepTwo, validatePromotionEffectOptimizationStepThree, validatePromotionEffectOptimizationStepFour } from "@/api/studentTrainingAnswer";
import { parseTrainingArray } from "@/views/training/taskKeyMap";
const TASK_KEY = "promotion-effect-optimization";
@ -281,6 +276,9 @@ async function validatePerformance() { if (validating.value) return; validating.
function restorePerformance(raw) { try { const saved = typeof raw === "string" ? JSON.parse(raw || "{}") : raw || {}; grossMargin.value = saved.grossMargin; breakEvenRoi.value = saved.breakEvenRoi; syncPerformanceRows(Array.isArray(saved.rows) ? saved.rows : []); } catch (error) { grossMargin.value = undefined; breakEvenRoi.value = undefined; syncPerformanceRows(); } }
async function saveEvaluationDraft() { if (saving.value) return; saving.value = true; try { await saveAnswer(4, { step4Answer: JSON.stringify(evaluationPayload()) }); ElMessage.success("当前进度已保存"); } finally { saving.value = false; } }
async function submitEvaluation() { if (validating.value) return; validating.value = true; try { await validatePromotionEffectOptimizationStepFour(evaluationPayload()); await saveStudentTrainingAnswer(TASK_KEY, { saveAction: "SUBMIT", currentStep: 4, step4Answer: JSON.stringify(evaluationPayload()) }); ElMessage.success("投放效果评估与优化任务已提交"); } catch (error) { ElMessage.error(error?.message || "请检查各渠道达标判断、未达标渠道的诊断与优化动作"); } finally { validating.value = false; } }
async function submitTask() { return submitEvaluation(); }
async function resetTraining() { if (saving.value || validating.value) return; try { await deleteStudentTrainingAnswer(TASK_KEY); restoreBudget(); syncStrategyRows(); restorePerformance(); restoreEvaluation(); ElMessage.success("已清空全部实训步骤,可以重新开始"); } catch (error) { ElMessage.error("重新实训失败,请稍后重试"); } }
function exportOutcome() { ElMessage.info("导出功能正在开发中"); }
function restoreEvaluation(raw) { try { const saved = typeof raw === "string" ? JSON.parse(raw || "{}") : raw || {}; optimizationDecision.value = String(saved.optimizationDecision || ""); syncEvaluationRows(Array.isArray(saved.rows) ? saved.rows : []); } catch (error) { optimizationDecision.value = ""; syncEvaluationRows(); } }
function restoreBudget(raw) { try { const saved = typeof raw === "string" ? JSON.parse(raw || "{}") : raw || {}; totalBudget.value = saved.totalBudget; if (Array.isArray(saved.rows) && saved.rows.length) budgetRows.value = saved.rows.slice(0, 5).map((row) => makeRow({ channel: row?.channel || "", channelPositioning: row?.channelPositioning || "", budgetPercentage: row?.budgetPercentage, coldStartBudget: row?.coldStartBudget, growthBudget: row?.growthBudget, stableBudget: row?.stableBudget })); } catch (error) { budgetRows.value = []; } if (!budgetRows.value.length) budgetRows.value = [makeRow()]; }
function readRows(raw) { try { const saved = typeof raw === "string" ? JSON.parse(raw || "{}") : raw || {}; return Array.isArray(saved.rows) ? saved.rows : []; } catch (error) { return []; } }
@ -401,51 +399,27 @@ onMounted(async () => { try { const result = await getTrainingTaskByKey(TASK_KEY
p { margin: 0; }
}
/* task-card 透明化 */
.task-card.promotion-phase {
padding: 0;
border: 0;
border-radius: 0;
background: transparent;
/* task-workbench 透明容器 */
.task-workbench {
display: grid;
gap: 10px;
margin: 0;
}
.workbench-head {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
padding-bottom: 10px;
border-bottom: 1px solid var(--student-panel-border);
}
.promotion-toolbar {
flex: 0 0 auto;
align-self: center;
justify-content: flex-end;
max-width: 100%;
align-content: start;
}
.section-eyebrow {
/* 操作工具栏横条:内联布局,去掉悬浮和边框 */
.task-action-strip {
margin: 0;
color: var(--student-text-secondary);
font-size: 11px;
font-weight: 700;
letter-spacing: 0.12em;
text-transform: uppercase;
}
padding: 10px 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;
:deep(.training-task-toolbar) {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: flex-end;
gap: 8px;
}
}
/* step-indicator 基础 reset(由非 scoped 块接管完整样式) */
.step-indicator { margin: 0; padding: 0; border: 0; background: transparent; }
.budget-form, .strategy-form, .performance-form, .evaluation-form { padding-top: 4px; }
@ -680,13 +654,19 @@ onMounted(async () => { try { const result = await getTrainingTaskByKey(TASK_KEY
/* ===== 响应式 ===== */
@media (max-width: 900px) {
.task-header { flex-direction: column; align-items: flex-start; }
.promotion-toolbar { width: 100%; justify-content: flex-start; }
.task-action-strip {
:deep(.training-task-toolbar) {
justify-content: stretch;
}
:deep(.training-task-toolbar > *) {
flex: 1 1 auto;
}
}
.promotion-page { padding: 14px; }
.workbench-head, .total-budget-field, .roi-inputs, .table-actions, .footer-actions {
.total-budget-field, .roi-inputs, .table-actions, .footer-actions {
align-items: stretch;
flex-direction: column;
}
.promotion-toolbar { width: 100%; justify-content: flex-start; }
.total-budget-field :deep(.el-input-number),
.roi-inputs :deep(.el-input-number),
.table-actions :deep(.el-button),

@ -23,12 +23,7 @@
</div>
</section>
<section class="task-card">
<div class="workbench-head">
<div>
<p class="workbench-eyebrow">COMPREHENSIVE TRAINING · WORKFLOW</p>
<h2>{{ activeStepName || page.title }}</h2>
</div>
<section class="task-action-strip">
<TrainingTaskToolbar
class="comprehensive-training-toolbar"
:material-name="page.material?.name"
@ -38,6 +33,12 @@
:on-reset="resetTraining"
:on-export="exportOutcome"
/>
</section>
<section class="task-card">
<div class="task-card-head">
<p class="workbench-eyebrow">COMPREHENSIVE TRAINING · WORKFLOW</p>
<h2 class="task-card-title">{{ activeStepName || page.title }}</h2>
</div>
<nav
@ -1875,30 +1876,49 @@ function exportOutcome() {
background: transparent;
}
.workbench-head {
/* ============================================================
* 工具栏操作按钮区:task-action-strip
* ============================================================ */
.task-action-strip {
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 18px;
justify-content: flex-end;
align-items: center;
gap: 12px;
margin: 0;
padding: 12px 20px;
background: #ffffff;
border: 1px solid #e5e7eb;
border-radius: 12px;
.comprehensive-training-toolbar {
flex: 0 0 auto;
max-width: 100%;
}
}
/* ============================================================
* 任务卡片头部信息
* ============================================================ */
.task-card-head {
margin-bottom: 18px;
padding-bottom: 14px;
border-bottom: 1px solid #e5e7eb;
h2,
h3 {
margin: 4px 0 6px;
color: #1f2937;
font-size: var(--student-fs-h1) !important;
.workbench-eyebrow {
margin: 0 0 6px !important;
color: #6b7280 !important;
font-size: var(--student-fs-caption) !important;
font-weight: 700 !important;
line-height: 1.35 !important;
letter-spacing: 0.12em;
line-height: 1.4 !important;
}
p {
.task-card-title {
margin: 0;
color: #6b7280;
font-size: var(--student-fs-body);
font-weight: 400;
line-height: 1.6;
color: #1f2937;
font-size: var(--student-fs-h1) !important;
font-weight: 700 !important;
line-height: 1.35 !important;
}
}
@ -2586,12 +2606,14 @@ function exportOutcome() {
background: #ffffff;
}
.task-card-head h3,
.workbench-head h3 {
font-size: var(--student-fs-h1) !important;
font-weight: 700 !important;
line-height: 1.35 !important;
}
.task-card-head .section-eyebrow,
.workbench-head .section-eyebrow {
color: #6b7280;
font-size: var(--student-fs-caption);
@ -2734,6 +2756,7 @@ function exportOutcome() {
border-radius: 16px;
}
.task-card-head,
.workbench-head,
.workbench-actions,
.step-title-row {
@ -2746,6 +2769,7 @@ function exportOutcome() {
width: 100%;
}
.task-card-head,
.workbench-head {
flex-direction: column;
}

@ -121,3 +121,201 @@ ew-product-survey.vue\ 的标准布局:
- [ ] 确认删除后\"清空填写\"/\"清空本步\"按钮仍然保留
- [ ] 删除重复的\"提交任务\"按钮代码
- [ ] 测试提交功能是否正常工作
---
## 八、产品发布渠道评估 + 产品问题诊断与迭代 调整
### 8.1 diagnosis.vue(产品问题诊断与迭代)
#### 问题描述
`TrainingTaskToolbar` 组件嵌套在 `task-header` 内,导致工具栏随头部一起有边框和背景,不符合标准布局。
#### 调整方案
将 `TrainingTaskToolbar` 从 `task-header` 内移到 `task-header` 同级的独立 `task-action-strip` 区域。
#### 具体修改
**当前代码(第19-20行):**
```html
<section class="task-header">
...
<TrainingTaskToolbar class="diagnosis-toolbar" :task-key="TASK_KEY" :on-submit="submitTask" :on-reset="resetTraining" :on-export="exportTrainingOutcome" />
</section>
```
**修改为:**
```html
<section class="task-header">
...
</section>
<section class="task-action-strip">
<TrainingTaskToolbar :task-key="TASK_KEY" :on-submit="submitTask" :on-reset="resetTraining" :on-export="exportTrainingOutcome" />
</section>
```
#### CSS 调整
**删除旧的 `.diagnosis-toolbar` 样式,替换为:**
```css
/* 操作工具栏横条:内联布局,去掉悬浮和边框 */
.task-action-strip {
margin: 0;
padding: 10px 16px;
:deep(.training-task-toolbar) {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: flex-end;
gap: 8px;
}
}
```
**响应式样式更新(720px断点):**
```css
@media (max-width: 720px) {
.task-action-strip {
:deep(.training-task-toolbar) { justify-content: stretch; }
:deep(.training-task-toolbar > *) { flex: 1 1 auto; }
}
}
```
#### 调整对照表
| 文件 | 修改项 | 操作 |
|------|--------|------|
| diagnosis.vue | 模板结构 | 将 TrainingTaskToolbar 从 task-header 内移到 task-action-strip |
| diagnosis.vue | CSS 样式 | 删除 .diagnosis-toolbar,新增 .task-action-strip |
---
### 8.2 promotion.vue(产品发布渠道评估)
#### 问题描述
`TrainingTaskToolbar` 已有独立的 `task-action-strip` 区域,但缺少回调属性,导致点击"提交任务"按钮时无法正确调用页面内的提交方法。
#### 调整方案
添加 `:on-submit`、`on-reset` 和 `:on-export` 回调属性,并实现对应的方法。
#### 具体修改
**1. 导入 deleteStudentTrainingAnswer**
```javascript
import { deleteStudentTrainingAnswer, getStudentTrainingAnswer, saveStudentTrainingAnswer, ... } from "@/api/studentTrainingAnswer";
```
**2. 添加回调方法**
```javascript
async function submitTask() { return submitEvaluation(); }
async function resetTraining() {
if (saving.value || validating.value) return;
try {
await deleteStudentTrainingAnswer(TASK_KEY);
restoreBudget();
syncStrategyRows();
restorePerformance();
restoreEvaluation();
ElMessage.success("已清空全部实训步骤,可以重新开始");
} catch (error) {
ElMessage.error("重新实训失败,请稍后重试");
}
}
function exportOutcome() { ElMessage.info("导出功能正在开发中"); }
```
**3. 更新 TrainingTaskToolbar 模板**
```html
<TrainingTaskToolbar :task-key="TASK_KEY" :on-submit="submitTask" :on-reset="resetTraining" :on-export="exportOutcome" />
```
#### 调整对照表
| 文件 | 修改项 | 操作 |
|------|--------|------|
| promotion.vue | 导入 | 添加 deleteStudentTrainingAnswer |
| promotion.vue | 方法 | 添加 submitTask、resetTraining、exportOutcome |
| promotion.vue | 模板 | 更新 TrainingTaskToolbar 添加回调属性 |
---
### 8.3 test/index.vue(产品发布渠道评估)
#### 问题描述
该页面原本使用 `TrainingMaterialButton` 组件而非标准的 `TrainingTaskToolbar`,导致缺少"提交任务"、"重新实训"和"导出实训成果"等按钮功能,不符合统一规范。
#### 调整方案
将 `TrainingMaterialButton` 替换为 `TrainingTaskToolbar`,并添加对应的回调方法。
#### 具体修改
**1. 替换导入**
```javascript
// 替换前
import TrainingMaterialButton from "@/views/components/TrainingMaterialButton.vue";
// 替换后
import TrainingTaskToolbar from "@/views/components/TrainingTaskToolbar.vue";
```
**2. 添加导入**
```javascript
import { deleteStudentTrainingAnswer, ... } from "@/api/studentTrainingAnswer";
```
**3. 添加回调方法**
```javascript
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("导出功能正在开发中"); }
```
**4. 更新模板**
```html
<!-- 替换前 -->
<section class="task-action-strip">
<TrainingMaterialButton ... />
</section>
<!-- 替换后 -->
<section class="task-action-strip">
<TrainingTaskToolbar :task-key="TASK_KEY" :on-submit="submitTask" :on-reset="resetTraining" :on-export="exportOutcome" />
</section>
```
**5. CSS 样式更新**
- 移除 `.material-button` 相关样式
- 更新 `.task-action-strip` 为 TrainingTaskToolbar 布局样式
- 添加 `.task-toolbar-button` 和 `.task-toolbar-button--submit` 按钮样式
#### 调整对照表
| 文件 | 修改项 | 操作 |
|------|--------|------|
| test/index.vue | 导入 | 替换 TrainingMaterialButton 为 TrainingTaskToolbar,添加 deleteStudentTrainingAnswer |
| test/index.vue | 方法 | 添加 submitTask、resetTraining、exportOutcome |
| test/index.vue | 模板 | 更新 task-action-strip 使用 TrainingTaskToolbar |
| test/index.vue | CSS | 更新 task-action-strip 和按钮样式 |

Loading…
Cancel
Save