|
|
|
|
@ -1,720 +1,226 @@
|
|
|
|
|
<template>
|
|
|
|
|
<ProductStandardTrainingPage class="test" task-key="release-channel-evaluation" title="发布渠道评估" badge-text="核心实训 · 产品上线与运营推广" background="电商产品发布渠道评估需要综合用户规模、用户质量、转化率、投资回报率、用户参与度及渠道成本,选择最具价值的投放渠道。" requirement="使用熵值法,根据曝光量、点击量、广告费用、订单金额等数据,评估各投放渠道优劣,为后续重点渠道加大投放提供决策依据。" :goals="taskGoals" @save="saveTask" @submit="submitTask" @reset="resetTask">
|
|
|
|
|
<template #step-content="{ activeStep, hasConfiguredSteps }">
|
|
|
|
|
<section v-show="!hasConfiguredSteps || activeStep === 1" class="release-phase">
|
|
|
|
|
|
|
|
|
|
<p class="release-lead">
|
|
|
|
|
在电商产品投放测试中,熵值法可以用于评估不同投放策略或广告内容的效果。
|
|
|
|
|
<br />
|
|
|
|
|
<br />
|
|
|
|
|
通过收集多个反映投放效果的关键指标数据,如点击率、转化率、订单成交量等,利用熵值法计算各指标的权重,从而确定哪些指标对投放效果的影响更大。这有助于优化投放策略,提高广告效果和投资回报率。
|
|
|
|
|
</p>
|
|
|
|
|
<div class="caseBacktitle">
|
|
|
|
|
<span>实验实训</span>
|
|
|
|
|
</div>
|
|
|
|
|
<p>任务背景:某仿真花店铺计划推出新品花束,因商品特性,计划在淘宝、抖音、拼多多三个渠道进行产品投放,初步投放测试数据如下,请评估上述渠道优劣,为后续重点投放提供决策依据。</p>
|
|
|
|
|
<el-table
|
|
|
|
|
:data="tableData"
|
|
|
|
|
border
|
|
|
|
|
style="width: 60%"
|
|
|
|
|
:span-method="arraySpanMethod"
|
|
|
|
|
>
|
|
|
|
|
<el-table-column prop="channel" label="渠道" align="center" />
|
|
|
|
|
<el-table-column prop="exposure" label="曝光量" align="center" />
|
|
|
|
|
<el-table-column prop="clicks" label="点击量" align="center" />
|
|
|
|
|
<el-table-column prop="cost" label="花费" align="center"></el-table-column>
|
|
|
|
|
<el-table-column prop="orderAmount" label="订单金额" align="center"></el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
</section>
|
|
|
|
|
<section v-show="!hasConfiguredSteps || activeStep === 2" class="release-phase">
|
|
|
|
|
<p>数据标准化:</p>
|
|
|
|
|
<p>
|
|
|
|
|
对于正向指标(点击量、曝光量、订单金额),我们采用极差标准化方法:
|
|
|
|
|
<br />
|
|
|
|
|
标准化公式为:Yij = (Xij - min(Xi)) / (max(Xi) - min(Xi)) 例如,某渠道的点击量极差标准化值=(某渠道点击量-点击量最小值)/(点击量最大值-点击量最小值)
|
|
|
|
|
<br />
|
|
|
|
|
对于负向指标(数值越低越好),标准化公式为:Yij = (max(Xi) - Xij) / (max(Xi) - min(Xi))。 例如,某渠道的广告费用极差标准化值=(广告费最大值-某渠道广告费用)/(广告费用最大值-广告费用最小值)
|
|
|
|
|
</p>
|
|
|
|
|
<p>数据标准化结果如下所示:</p>
|
|
|
|
|
<el-table
|
|
|
|
|
:data="tableData1"
|
|
|
|
|
border
|
|
|
|
|
style="width: 60%"
|
|
|
|
|
:span-method="arraySpanMethod"
|
|
|
|
|
>
|
|
|
|
|
<el-table-column prop="channel" label="渠道" align="center" />
|
|
|
|
|
<el-table-column prop="exposureData" label="曝光量" align="center">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<el-input v-model="row.exposureData" placeholder=""></el-input>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="clickData" label="点击量" align="center">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<el-input v-model="row.clickData" placeholder=""></el-input>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="adCost" label="花费" align="center">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<el-input v-model="row.adCost" placeholder=""></el-input>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="orderAmount" label="订单金额" align="center">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<el-input v-model="row.orderAmount" placeholder=""></el-input>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
<p>计算各指标在各方案下的比值:计算第j项指标在第i个样本中占该指标的比重,即pij = Yij / ΣYij。 例如,某渠道点击量比重=某渠道点击量极差标准化值/各渠道点击量极差标准化值之和</p>
|
|
|
|
|
<p>计算每个指标在每个渠道中的比重:</p>
|
|
|
|
|
<el-table
|
|
|
|
|
:data="tableData2"
|
|
|
|
|
border
|
|
|
|
|
style="width: 60%"
|
|
|
|
|
:span-method="arraySpanMethod"
|
|
|
|
|
>
|
|
|
|
|
<el-table-column prop="channel" label="渠道" align="center" />
|
|
|
|
|
<el-table-column prop="exposureData" label="曝光量" align="center">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<el-input v-model="row.exposureData" placeholder=""></el-input>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="clickData" label="点击量" align="center">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<el-input v-model="row.clickData" placeholder=""></el-input>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="adCost" label="花费" align="center">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<el-input v-model="row.adCost" placeholder=""></el-input>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="orderAmount" label="订单金额" align="center">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<el-input v-model="row.orderAmount" placeholder=""></el-input>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
<template>
|
|
|
|
|
<div class="release-channel-page student-training-shell">
|
|
|
|
|
<main class="training-core">
|
|
|
|
|
<section class="task-header">
|
|
|
|
|
<div class="task-badge"><el-icon><Document /></el-icon> 核心实训 · 产品上线与运营推广</div>
|
|
|
|
|
<h1>{{ taskTitle }}</h1>
|
|
|
|
|
</section>
|
|
|
|
|
<section v-show="!hasConfiguredSteps || activeStep === 3" class="release-phase">
|
|
|
|
|
<p>计算各指标的信息熵:根据信息熵的定义,计算各指标的信息熵Ej。公式为:Ej = -k * Σ(pij * ln(pij)),其中k = 1 / ln(m),m为样本数量。</p>
|
|
|
|
|
<p>例如,我们评估了三种渠道,那么公式中m为3,例如点击量信息熵=-k*(各渠道点击量比重乘以各渠道点击量比重的自然对数之和)</p>
|
|
|
|
|
<p>计算每个指标的信息熵:</p>
|
|
|
|
|
<el-table
|
|
|
|
|
:data="tableData3"
|
|
|
|
|
border
|
|
|
|
|
style="width: 60%"
|
|
|
|
|
:span-method="arraySpanMethod"
|
|
|
|
|
>
|
|
|
|
|
<el-table-column prop="exposureData" label="曝光量" align="center">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<el-input v-model="row.exposureData" placeholder=""></el-input>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="clickData" label="点击量" align="center">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<el-input v-model="row.clickData" placeholder=""></el-input>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="adCost" label="花费" align="center">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<el-input v-model="row.adCost" placeholder=""></el-input>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="orderAmount" label="订单金额" align="center">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<el-input v-model="row.orderAmount" placeholder=""></el-input>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
<p>确定各指标的权重:根据信息熵计算各指标的权重。权重计算公式为:wj = (1 - Ej) / Σ(1 - Ej)。其中Ej源于上一步计算,为各指标信息熵。</p>
|
|
|
|
|
<p>计算每个指标的权重:</p>
|
|
|
|
|
<el-table
|
|
|
|
|
:data="tableData4"
|
|
|
|
|
border
|
|
|
|
|
style="width: 60%"
|
|
|
|
|
:span-method="arraySpanMethod"
|
|
|
|
|
>
|
|
|
|
|
<el-table-column prop="exposureData" label="曝光量" align="center">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<el-input v-model="row.exposureData" placeholder=""></el-input>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="clickData" label="点击量" align="center">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<el-input v-model="row.clickData" placeholder=""></el-input>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="adCost" label="花费" align="center">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<el-input v-model="row.adCost" placeholder=""></el-input>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="orderAmount" label="订单金额" align="center">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<el-input v-model="row.orderAmount" placeholder=""></el-input>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
|
|
<TrainingTaskBrief :background="taskBackground" :goals="taskGoals" :requirements="taskRequirement" :show-material="false" />
|
|
|
|
|
|
|
|
|
|
<section class="task-card">
|
|
|
|
|
<header class="workbench-head">
|
|
|
|
|
<div>
|
|
|
|
|
<p class="section-eyebrow">STEP {{ String(activeStep).padStart(2, "0") }}</p>
|
|
|
|
|
<h2>{{ stepTitle }}</h2>
|
|
|
|
|
</div>
|
|
|
|
|
<TrainingMaterialButton :material-name="taskConfig?.materialName" :material-url="taskConfig?.materialUrl" />
|
|
|
|
|
</header>
|
|
|
|
|
|
|
|
|
|
<nav class="step-tabs" aria-label="产品发布渠道评估步骤">
|
|
|
|
|
<button type="button" :class="{ active: activeStep === 1 }" @click="activeStep = 1">01 权重设置</button>
|
|
|
|
|
<button type="button" :class="{ active: activeStep === 2 }" @click="activeStep = 2">02 渠道数据</button>
|
|
|
|
|
<button type="button" :class="{ active: activeStep === 3 }" @click="openStepThree">03 归一化评分</button>
|
|
|
|
|
<button type="button" :class="{ active: activeStep === 4 }" @click="openStepFour">04 渠道排名</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>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="table-wrap">
|
|
|
|
|
<table class="weight-table">
|
|
|
|
|
<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>
|
|
|
|
|
</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>
|
|
|
|
|
</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>
|
|
|
|
|
</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>
|
|
|
|
|
</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-5)</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="5" :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>
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
<p class="hint">默认显示天猫、京东、抖音、拼多多、唯品会 5 个渠道;可继续新增或删除任意渠道。保存当前进度不拦截,点击下一步时由系统校验全部指标。</p>
|
|
|
|
|
<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>
|
|
|
|
|
</footer>
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
<section v-else-if="activeStep === 3">
|
|
|
|
|
<p class="scoring-guide">通过 Min-Max 归一法将各维度原始数据转换为 0–10 分标准化得分。正向指标(搜索量、点击率、转化率、访客数、匹配度)按“渠道值 − 最小值”计算;逆向指标(供需比、CPC)按“最大值 − 渠道值”计算。请根据前两步数据手工填写得分与加权得分。</p>
|
|
|
|
|
<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 rowspan="2">加权得分</th>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<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 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>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr v-if="!scoreRows.length"><td :colspan="2 + scoringMetrics.length * 2" class="empty-row">请先完成并保存第二步渠道数据。</td></tr>
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
<p class="hint">渠道名称同步第二步,权重同步第一步。每项得分乘以对应权重(按百分比折算)并相加得到加权得分;下一步会按已保存的前两步数据重新计算并校验。</p>
|
|
|
|
|
<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>
|
|
|
|
|
</footer>
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
<section v-else>
|
|
|
|
|
<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>
|
|
|
|
|
<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>
|
|
|
|
|
</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>
|
|
|
|
|
<p class="hint">渠道数量同步第三步,排名自动从 1 往下排列。渠道与加权综合得分需由学生填写,并与第三步数据逐项一致;得分必须按从高到低排序,前两名自动显示为核心渠道。</p>
|
|
|
|
|
<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>
|
|
|
|
|
<section v-show="!hasConfiguredSteps || activeStep >= 4" class="release-phase">
|
|
|
|
|
<p>综合评分:根据权重和指标数据,计算广告效果的综合评分。公式为:Zi = Σ(wj * Yij)。 例如,某渠道综合评分等于渠道各指标权重乘以渠道各指标极差标准值的和。</p>
|
|
|
|
|
<el-table
|
|
|
|
|
:data="tableData5"
|
|
|
|
|
border
|
|
|
|
|
style="width: 60%"
|
|
|
|
|
:span-method="arraySpanMethod"
|
|
|
|
|
>
|
|
|
|
|
<el-table-column prop="channel" label="渠道" align="center"></el-table-column>
|
|
|
|
|
<el-table-column prop="keywords" label="综合评分" align="center">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<el-input v-model="row.keywords" placeholder=""></el-input>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
<p>请根据评分情况分析各渠道优劣,分析熵值法优缺点。</p>
|
|
|
|
|
<el-input :autosize="{ minRows: 11, maxRows: 11 }" type="textarea" v-model="scenePromotion" placeholder="" />
|
|
|
|
|
<p>上述实训也可以用Python代码实现,可点击查看示例代码,在在线Python环境中运行代码,得出结果。</p>
|
|
|
|
|
<el-button @click="runResultShow = true">查看代码</el-button>
|
|
|
|
|
</section>
|
|
|
|
|
</template>
|
|
|
|
|
</ProductStandardTrainingPage>
|
|
|
|
|
<pop-model :showModel="runResultShow" title="设置代码" @closePop="closeCode">
|
|
|
|
|
<template v-slot:content>
|
|
|
|
|
<div>
|
|
|
|
|
<codemirror :code="code"></codemirror>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</pop-model>
|
|
|
|
|
</main>
|
|
|
|
|
<TrainingAiSidebar :study-tip="'先确定可解释的评估权重,再完整汇总各渠道近三个月数据。'" :progress-items="progressItems" />
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script setup>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import ProductStandardTrainingPage from "@/views/product/components/ProductStandardTrainingPage.vue";
|
|
|
|
|
import useUserStore from "@/store/modules/user";
|
|
|
|
|
const userStore = useUserStore();
|
|
|
|
|
import * as analysisAPI from "@/api/market-demand-mining.js";
|
|
|
|
|
import codemirror from "@/components/codemirror/index.vue";
|
|
|
|
|
import popModel from "@/views/components/popModal.vue";
|
|
|
|
|
import { getCurrentInstance, onMounted, ref } from "vue";
|
|
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
|
|
const taskGoals = ["理解熵值法的指标标准化、比重和信息熵计算过程", "能够计算渠道指标权重与综合评分", "基于评价结果形成可执行的发布渠道投放建议"];
|
|
|
|
|
const code = `import numpy as np
|
|
|
|
|
import pandas as pd
|
|
|
|
|
# 数据
|
|
|
|
|
data = {
|
|
|
|
|
'渠道': ['淘宝', '抖音', '拼多多'],
|
|
|
|
|
'点击量': [952, 161, 239],
|
|
|
|
|
'曝光量': [25379, 4719, 24202],
|
|
|
|
|
'花费': [3617, 1213, 425],
|
|
|
|
|
'订单金额': [12293, 5206, 880]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
df = pd.DataFrame(data)
|
|
|
|
|
|
|
|
|
|
df.set_index('渠道', inplace=True)
|
|
|
|
|
|
|
|
|
|
# 数据标准化
|
|
|
|
|
|
|
|
|
|
def normalize_data(df):
|
|
|
|
|
|
|
|
|
|
normalized_df = df.copy()
|
|
|
|
|
|
|
|
|
|
for column in df.columns:
|
|
|
|
|
|
|
|
|
|
max_val = df[column].max()
|
|
|
|
|
|
|
|
|
|
min_val = df[column].min()
|
|
|
|
|
|
|
|
|
|
if max_val == min_val:
|
|
|
|
|
|
|
|
|
|
normalized_df[column] = 0
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
|
|
normalized_df[column] = (df[column] - min_val) / (max_val - min_val)
|
|
|
|
|
|
|
|
|
|
return normalized_df
|
|
|
|
|
|
|
|
|
|
normalized_df = normalize_data(df)
|
|
|
|
|
|
|
|
|
|
# 计算各指标在各方案下的比值
|
|
|
|
|
|
|
|
|
|
def calculate_pij(normalized_df):
|
|
|
|
|
|
|
|
|
|
pij = normalized_df.copy()
|
|
|
|
|
|
|
|
|
|
for column in pij.columns:
|
|
|
|
|
|
|
|
|
|
column_sum = pij[column].sum()
|
|
|
|
|
|
|
|
|
|
pij[column] = pij[column] / column_sum
|
|
|
|
|
|
|
|
|
|
return pij
|
|
|
|
|
|
|
|
|
|
pij = calculate_pij(normalized_df)
|
|
|
|
|
|
|
|
|
|
# 计算各指标的信息熵
|
|
|
|
|
|
|
|
|
|
def calculate_entropy(pij, m):
|
|
|
|
|
|
|
|
|
|
k = 1 / np.log(m)
|
|
|
|
|
|
|
|
|
|
entropy = {}
|
|
|
|
|
|
|
|
|
|
for column in pij.columns:
|
|
|
|
|
|
|
|
|
|
entropy_sum = 0
|
|
|
|
|
|
|
|
|
|
for value in pij[column]:
|
|
|
|
|
|
|
|
|
|
if value > 0:
|
|
|
|
|
|
|
|
|
|
entropy_sum += value * np.log(value)
|
|
|
|
|
|
|
|
|
|
entropy[column] = -k * entropy_sum
|
|
|
|
|
|
|
|
|
|
return entropy
|
|
|
|
|
|
|
|
|
|
m = len(pij)
|
|
|
|
|
|
|
|
|
|
entropy = calculate_entropy(pij, m)
|
|
|
|
|
|
|
|
|
|
# 计算各指标的权重
|
|
|
|
|
|
|
|
|
|
def calculate_weights(entropy):
|
|
|
|
|
weights = {}
|
|
|
|
|
total_entropy = sum(1 - value for value in entropy.values())
|
|
|
|
|
for column, value in entropy.items():
|
|
|
|
|
weights[column] = (1 - value) / total_entropy
|
|
|
|
|
return weights
|
|
|
|
|
weights = calculate_weights(entropy)
|
|
|
|
|
# 计算综合评分
|
|
|
|
|
def calculate_comprehensive_score(normalized_df, weights):
|
|
|
|
|
comprehensive_score = pd.Series(index=normalized_df.index, dtype=float)
|
|
|
|
|
for index, row in normalized_df.iterrows():
|
|
|
|
|
score = 0
|
|
|
|
|
|
|
|
|
|
for column, weight in weights.items():
|
|
|
|
|
|
|
|
|
|
score += weight * row[column]
|
|
|
|
|
|
|
|
|
|
comprehensive_score[index] = score
|
|
|
|
|
|
|
|
|
|
return comprehensive_score
|
|
|
|
|
|
|
|
|
|
comprehensive_score = calculate_comprehensive_score(normalized_df, weights)
|
|
|
|
|
|
|
|
|
|
# 输出结果
|
|
|
|
|
|
|
|
|
|
print("标准化后的数据:")
|
|
|
|
|
|
|
|
|
|
print(normalized_df)
|
|
|
|
|
|
|
|
|
|
print("各指标的信息熵:")
|
|
|
|
|
print(entropy)
|
|
|
|
|
print("各指标的权重:")
|
|
|
|
|
print(weights)
|
|
|
|
|
|
|
|
|
|
print("综合评分:")
|
|
|
|
|
|
|
|
|
|
print(comprehensive_score)`;
|
|
|
|
|
const runResultShow = ref(false);
|
|
|
|
|
const tableData = [
|
|
|
|
|
{
|
|
|
|
|
channel: "淘宝",
|
|
|
|
|
exposure: 25379,
|
|
|
|
|
clicks: 952,
|
|
|
|
|
cost: 3617,
|
|
|
|
|
orderAmount: 12293,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
channel: "抖音",
|
|
|
|
|
exposure: 4719,
|
|
|
|
|
clicks: 161,
|
|
|
|
|
cost: 1213,
|
|
|
|
|
orderAmount: 5206,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
channel: "拼多多",
|
|
|
|
|
exposure: 24202,
|
|
|
|
|
clicks: 459,
|
|
|
|
|
cost: 625,
|
|
|
|
|
orderAmount: 1280,
|
|
|
|
|
},
|
|
|
|
|
<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 TrainingMaterialButton from "@/views/components/TrainingMaterialButton.vue";
|
|
|
|
|
import TrainingTaskBrief from "@/views/components/TrainingTaskBrief.vue";
|
|
|
|
|
import { getTrainingTaskByKey } from "@/api/trainingTask";
|
|
|
|
|
import { getStudentTrainingAnswer, saveStudentTrainingAnswer, validateReleaseChannelEvaluationStepOne, validateReleaseChannelEvaluationStepTwo, validateReleaseChannelEvaluationStepThree, validateReleaseChannelEvaluationStepFour } from "@/api/studentTrainingAnswer";
|
|
|
|
|
import { parseTrainingArray } from "@/views/training/taskKeyMap";
|
|
|
|
|
|
|
|
|
|
const TASK_KEY = "release-channel-evaluation";
|
|
|
|
|
const activeStep = ref(1);
|
|
|
|
|
const taskConfig = ref(null);
|
|
|
|
|
const saving = ref(false);
|
|
|
|
|
const validating = ref(false);
|
|
|
|
|
let nextId = 1;
|
|
|
|
|
const makeRow = (values = {}) => ({ id: nextId++, ...values });
|
|
|
|
|
const defaultWeightRows = () => [
|
|
|
|
|
["市场规模潜力", "对应关键词日均总搜索量,代表渠道用户需求大盘空间", 20, "20~25"], ["竞争激烈程度", "供需比(在线商品数/日均搜索量),数值越低渠道竞争越宽松", 15, "15~20"], ["流量点击效率", "品类平均点击率,代表渠道用户对该品类的点击意愿强弱", 15, "12~18"], ["流量获取成本", "平均CPC,数值越低获取精准用户的推广成本越低", 15, "15~20"], ["流量转化效率", "品类平均转化率,代表渠道用户的最终下单意愿", 15, "12~18"], ["现有用户基础", "店铺现有该品类相关访客数,代表品牌存量用户承接能力", 10, "5~10"], ["匹配度", "渠道属性与产品定位的适配度打分(1-10分)", 10, "5~10"],
|
|
|
|
|
].map(([dimension, description, weight, suggestion]) => makeRow({ dimension, description, weight, 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: "竞争程度得分" },
|
|
|
|
|
{ key: "click", dimension: "流量点击效率", label: "点击效率得分" },
|
|
|
|
|
{ key: "cost", dimension: "流量获取成本", label: "获客成本得分" },
|
|
|
|
|
{ key: "conversion", dimension: "流量转化效率", label: "转化效率得分" },
|
|
|
|
|
{ key: "userBase", dimension: "现有用户基础", label: "用户基础得分" },
|
|
|
|
|
{ key: "match", dimension: "匹配度", label: "匹配度得分" },
|
|
|
|
|
];
|
|
|
|
|
const tableData1 = ref([
|
|
|
|
|
{
|
|
|
|
|
channel: "淘宝",
|
|
|
|
|
exposureData: "",
|
|
|
|
|
clickData: "",
|
|
|
|
|
adCost: "",
|
|
|
|
|
orderAmount: "",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
channel: "抖音",
|
|
|
|
|
exposureData: "",
|
|
|
|
|
clickData: "",
|
|
|
|
|
adCost: "",
|
|
|
|
|
orderAmount: "",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
channel: "拼多多",
|
|
|
|
|
exposureData: "",
|
|
|
|
|
clickData: "",
|
|
|
|
|
adCost: "",
|
|
|
|
|
orderAmount: "",
|
|
|
|
|
},
|
|
|
|
|
]);
|
|
|
|
|
const tableData2 = ref([
|
|
|
|
|
{
|
|
|
|
|
channel: "淘宝",
|
|
|
|
|
exposureData: "",
|
|
|
|
|
clickData: "",
|
|
|
|
|
adCost: "",
|
|
|
|
|
orderAmount: "",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
channel: "抖音",
|
|
|
|
|
exposureData: "",
|
|
|
|
|
clickData: "",
|
|
|
|
|
adCost: "",
|
|
|
|
|
orderAmount: "",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
channel: "拼多多",
|
|
|
|
|
exposureData: "",
|
|
|
|
|
clickData: "",
|
|
|
|
|
adCost: "",
|
|
|
|
|
orderAmount: "",
|
|
|
|
|
},
|
|
|
|
|
]);
|
|
|
|
|
const tableData3 = ref([
|
|
|
|
|
{
|
|
|
|
|
exposureData: "",
|
|
|
|
|
clickData: "",
|
|
|
|
|
adCost: "",
|
|
|
|
|
orderAmount: "",
|
|
|
|
|
},
|
|
|
|
|
]);
|
|
|
|
|
const tableData4 = ref([
|
|
|
|
|
{
|
|
|
|
|
exposureData: "",
|
|
|
|
|
clickData: "",
|
|
|
|
|
adCost: "",
|
|
|
|
|
orderAmount: "",
|
|
|
|
|
},
|
|
|
|
|
]);
|
|
|
|
|
const tableData5 = ref([
|
|
|
|
|
{
|
|
|
|
|
channel: "淘宝",
|
|
|
|
|
keywords: "",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
channel: "抖音",
|
|
|
|
|
keywords: "",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
channel: "拼多多",
|
|
|
|
|
keywords: "",
|
|
|
|
|
},
|
|
|
|
|
]);
|
|
|
|
|
const scenePromotion = ref("");
|
|
|
|
|
function checkEmptyValues(tables) {
|
|
|
|
|
const result = {
|
|
|
|
|
hasEmpty: false,
|
|
|
|
|
emptyItems: [],
|
|
|
|
|
};
|
|
|
|
|
tables.forEach((table, tableIndex) => {
|
|
|
|
|
if (!Array.isArray(table)) return;
|
|
|
|
|
table.forEach((row, rowIndex) => {
|
|
|
|
|
const emptyFields = Object.entries(row)
|
|
|
|
|
.filter(([key, value]) => value === "" || value === null || value === undefined)
|
|
|
|
|
.map(([key]) => key);
|
|
|
|
|
if (emptyFields.length > 0) {
|
|
|
|
|
result.hasEmpty = true;
|
|
|
|
|
result.emptyItems.push({
|
|
|
|
|
tableIndex: tableIndex + 1,
|
|
|
|
|
rowIndex: rowIndex + 1,
|
|
|
|
|
channel: row.channel || "无渠道字段",
|
|
|
|
|
emptyFields,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
const closeCode = () => {
|
|
|
|
|
runResultShow.value = false;
|
|
|
|
|
};
|
|
|
|
|
function mapData(
|
|
|
|
|
sourceArray,
|
|
|
|
|
fieldMapping = {
|
|
|
|
|
exposureData: "exposureData",
|
|
|
|
|
clickData: "clickData",
|
|
|
|
|
adCost: "adCost",
|
|
|
|
|
orderAmount: "orderAmount",
|
|
|
|
|
}
|
|
|
|
|
) {
|
|
|
|
|
return sourceArray.map((item) => {
|
|
|
|
|
const mappedItem = {};
|
|
|
|
|
for (const [targetKey, sourceKey] of Object.entries(fieldMapping)) {
|
|
|
|
|
mappedItem[targetKey] = item[sourceKey];
|
|
|
|
|
}
|
|
|
|
|
return mappedItem;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
const buildTaskParams = () => ({
|
|
|
|
|
userId: userStore.userInfo.userId,
|
|
|
|
|
dataInfoList: mapData(tableData1.value),
|
|
|
|
|
radioInfoList: mapData(tableData2.value),
|
|
|
|
|
messageInfoList: mapData(tableData3.value),
|
|
|
|
|
eventInfoList: mapData(tableData4.value),
|
|
|
|
|
keywords: tableData5.value.map((item) => item.keywords).join(","),
|
|
|
|
|
scenePromotion: scenePromotion.value,
|
|
|
|
|
});
|
|
|
|
|
const saveTask = () => analysisAPI.releaseChannelSubmit(buildTaskParams()).then(() => {
|
|
|
|
|
proxy.$modal.msgSuccess("当前进度已保存");
|
|
|
|
|
});
|
|
|
|
|
const submitTask = () => {
|
|
|
|
|
const tablesToCheck = [tableData1.value, tableData2.value, tableData3.value, tableData4.value, tableData5.value];
|
|
|
|
|
const checkResult = checkEmptyValues(tablesToCheck);
|
|
|
|
|
if (checkResult.hasEmpty) {
|
|
|
|
|
proxy.$modal.msgWarning("请完善数据后提交");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
analysisAPI.releaseChannelSubmit(buildTaskParams()).then(() => {
|
|
|
|
|
proxy.$modal.msgSuccess("提交成功");
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
// 回显数据
|
|
|
|
|
const loadTaskInfo = () => {
|
|
|
|
|
analysisAPI.releaseChannelEcho({ userId: userStore.userInfo.userId }).then((res) => {
|
|
|
|
|
if (!res.data) return;
|
|
|
|
|
res.data?.dataInfoList.forEach((item, index) => {
|
|
|
|
|
tableData1.value[index].exposureData = item.exposureData;
|
|
|
|
|
tableData1.value[index].clickData = item.clickData;
|
|
|
|
|
tableData1.value[index].adCost = item.adCost;
|
|
|
|
|
tableData1.value[index].orderAmount = item.orderAmount;
|
|
|
|
|
});
|
|
|
|
|
res.data?.radioInfoList.forEach((item, index) => {
|
|
|
|
|
tableData2.value[index].exposureData = item.exposureData;
|
|
|
|
|
tableData2.value[index].clickData = item.clickData;
|
|
|
|
|
tableData2.value[index].adCost = item.adCost;
|
|
|
|
|
tableData2.value[index].orderAmount = item.orderAmount;
|
|
|
|
|
});
|
|
|
|
|
tableData3.value = res.data.messageInfoList;
|
|
|
|
|
tableData4.value = res.data.eventInfoList;
|
|
|
|
|
res.data?.keywords.split(",").forEach((item, index) => {
|
|
|
|
|
tableData5.value[index].keywords = item;
|
|
|
|
|
});
|
|
|
|
|
scenePromotion.value = res.data.scenePromotion;
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
// 重新实训
|
|
|
|
|
const resetTask = () => {
|
|
|
|
|
analysisAPI.productReleaseReTrain({ userId: userStore.userInfo.userId, module: "发布渠道评估" }).then((res) => {
|
|
|
|
|
proxy.$modal.msgSuccess("重新实训成功");
|
|
|
|
|
scenePromotion.value = "";
|
|
|
|
|
clearData([tableData1.value, tableData2.value, tableData3.value, tableData4.value, tableData5.value]);
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
// 清空数据函数
|
|
|
|
|
const clearData = (tables) => {
|
|
|
|
|
tables.forEach((table) => {
|
|
|
|
|
table.forEach((row) => {
|
|
|
|
|
Object.keys(row).forEach((key) => {
|
|
|
|
|
if (key !== "channel") {
|
|
|
|
|
row[key] = "";
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
const go = () => {
|
|
|
|
|
window.open("https://jrdsj.sztzjy.com:8000/user/zy84cf311/lab");
|
|
|
|
|
};
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
loadTaskInfo();
|
|
|
|
|
});
|
|
|
|
|
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 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 { await validateReleaseChannelEvaluationStepThree(scorePayload()); await saveAnswer(4, { step3Answer: JSON.stringify(scorePayload()) }); syncRankingRows(); activeStep.value = 4; ElMessage.success("归一化得分与加权得分校验通过,已进入第四步"); } 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; } }
|
|
|
|
|
function exportChannelRows() { const headers = ["渠道", "日均总搜索量", "供需比", "平均点击率(%)", "平均CPC(元)", "平均转化率(%)", "现有相关访客数", "匹配度(1-5)"]; const escape = (value) => `"${String(value ?? "").replaceAll('"', '""')}"`; const lines = [headers, ...channelRows.value.map((row) => [row.channel, row.dailySearchVolume, row.supplyDemandRatio, row.averageClickRate, row.averageCpc, row.averageConversionRate, row.existingVisitorCount, row.matchingScore])].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 = "产品发布渠道评估-渠道数据.csv"; link.click(); URL.revokeObjectURL(url); }
|
|
|
|
|
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 lang="scss" scoped>
|
|
|
|
|
.test {
|
|
|
|
|
--test-panel: rgba(0, 25, 42, 0.64);
|
|
|
|
|
--test-panel-strong: rgba(1, 14, 26, 0.82);
|
|
|
|
|
--test-line: rgba(82, 174, 226, 0.42);
|
|
|
|
|
|
|
|
|
|
min-height: calc(100vh - 76px);
|
|
|
|
|
padding: 24px 24px 32px;
|
|
|
|
|
color: #eef5ff;
|
|
|
|
|
background: #06111d;
|
|
|
|
|
|
|
|
|
|
@media (max-width: 1100px) {
|
|
|
|
|
& {
|
|
|
|
|
grid-template-columns: 1fr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(.el-table) {
|
|
|
|
|
--el-table-border-color: rgba(77, 167, 220, 0.2);
|
|
|
|
|
--el-table-header-bg-color: rgba(8, 55, 82, 0.98);
|
|
|
|
|
--el-table-header-text-color: #eaffff;
|
|
|
|
|
--el-table-row-hover-bg-color: rgba(11, 84, 122, 0.45);
|
|
|
|
|
--el-table-bg-color: rgba(1, 14, 26, 0.72);
|
|
|
|
|
--el-table-tr-bg-color: rgba(1, 14, 26, 0.48);
|
|
|
|
|
--el-table-text-color: #d7f1ff;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
margin: 12px 0 20px;
|
|
|
|
|
border: 1px solid rgba(0, 180, 255, 0.22);
|
|
|
|
|
border-radius: 22px;
|
|
|
|
|
background: var(--test-panel-strong);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(.el-table::before),
|
|
|
|
|
:deep(.el-table__inner-wrapper::before) {
|
|
|
|
|
background-color: transparent;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(.el-table th.el-table__cell) {
|
|
|
|
|
color: #eaffff !important;
|
|
|
|
|
background: rgba(8, 55, 82, 0.98) !important;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
font-weight: 900;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(.el-table tr),
|
|
|
|
|
:deep(.el-table td.el-table__cell) {
|
|
|
|
|
color: #d7f1ff !important;
|
|
|
|
|
background: rgba(1, 14, 26, 0.48) !important;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(.el-table--enable-row-hover .el-table__body tr:hover > td) {
|
|
|
|
|
background: rgba(11, 84, 122, 0.45) !important;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(.el-table .cell) {
|
|
|
|
|
line-height: 1.65;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(.el-input__wrapper),
|
|
|
|
|
:deep(.el-textarea__inner) {
|
|
|
|
|
border: 1px solid rgba(45, 95, 126, 0.95);
|
|
|
|
|
border-radius: 14px;
|
|
|
|
|
color: #eef5ff;
|
|
|
|
|
box-shadow: none !important;
|
|
|
|
|
background: #0f1a24;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(.el-input__wrapper) {
|
|
|
|
|
min-height: 38px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(.el-input__inner),
|
|
|
|
|
:deep(.el-textarea__inner) {
|
|
|
|
|
color: #eef5ff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(.el-input__inner::placeholder),
|
|
|
|
|
:deep(.el-textarea__inner::placeholder) {
|
|
|
|
|
color: #8299aa;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(.el-input__wrapper.is-focus),
|
|
|
|
|
:deep(.el-textarea__inner:focus) {
|
|
|
|
|
border-color: rgba(92, 224, 255, 0.7);
|
|
|
|
|
box-shadow: 0 0 0 3px rgba(0, 174, 255, 0.13) !important;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(.el-textarea) {
|
|
|
|
|
display: block;
|
|
|
|
|
max-width: 960px;
|
|
|
|
|
margin-top: 12px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(.el-textarea__inner) {
|
|
|
|
|
min-height: 110px !important;
|
|
|
|
|
padding: 12px 14px;
|
|
|
|
|
line-height: 1.65;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(.el-button:not(.training-action)) {
|
|
|
|
|
display: inline-flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
min-height: 40px;
|
|
|
|
|
padding: 0 18px;
|
|
|
|
|
border: 1px solid rgba(99, 217, 255, 0.55) !important;
|
|
|
|
|
border-radius: 999px;
|
|
|
|
|
color: #e9fbff !important;
|
|
|
|
|
font-weight: 800;
|
|
|
|
|
background: rgba(17, 126, 178, 0.36) !important;
|
|
|
|
|
transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(.el-button:not(.training-action):hover:not(.is-disabled)) {
|
|
|
|
|
transform: translateY(-1px);
|
|
|
|
|
border-color: rgba(116, 235, 255, 0.85) !important;
|
|
|
|
|
background: rgba(18, 146, 204, 0.5) !important;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.release-phase {
|
|
|
|
|
display: grid;
|
|
|
|
|
gap: 14px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.release-phase > p {
|
|
|
|
|
max-width: 1100px;
|
|
|
|
|
margin: 0;
|
|
|
|
|
color: #d7ecff;
|
|
|
|
|
font-size: 15px;
|
|
|
|
|
line-height: 1.8;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.release-phase .release-lead {
|
|
|
|
|
padding: 16px;
|
|
|
|
|
border: 1px solid rgba(0, 180, 255, 0.22);
|
|
|
|
|
border-radius: 16px;
|
|
|
|
|
background: rgba(1, 14, 26, 0.72);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.release-phase .caseBacktitle {
|
|
|
|
|
display: inline-flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
width: fit-content;
|
|
|
|
|
min-height: 28px;
|
|
|
|
|
padding: 4px 12px;
|
|
|
|
|
border: 1px solid rgba(106, 226, 255, 0.45);
|
|
|
|
|
border-radius: 999px;
|
|
|
|
|
color: #71dfff;
|
|
|
|
|
background: rgba(0, 127, 184, 0.25);
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
font-weight: 800;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.release-phase :deep(.el-table) {
|
|
|
|
|
width: 100% !important;
|
|
|
|
|
max-width: 1100px;
|
|
|
|
|
margin: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.release-phase :deep(.el-input__wrapper) {
|
|
|
|
|
min-height: 42px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.release-phase :deep(.el-button) {
|
|
|
|
|
width: fit-content;
|
|
|
|
|
border-color: rgba(92, 224, 255, 0.7) !important;
|
|
|
|
|
color: #ffffff !important;
|
|
|
|
|
background: linear-gradient(95deg, #0b84bd, #096491) !important;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@media (max-width: 900px) {
|
|
|
|
|
& {
|
|
|
|
|
padding: 14px 14px 18px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.release-phase :deep(.el-button) {
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
.release-channel-page{display:grid;grid-template-columns:minmax(720px,1fr) 340px;gap:24px;min-height:calc(100vh - 76px);padding:24px;color:#eef5ff;background:#06111d}.training-core{min-width:0;padding:28px;border:1px solid rgba(0,180,255,.25);border-radius:30px;background:rgba(8,18,28,.6)}.task-header{margin-bottom:24px}.task-badge{display:inline-flex;gap:8px;align-items:center;padding:5px 14px;border:1px solid rgba(99,217,255,.55);border-radius:999px;color:#dff5ff;background:rgba(17,126,178,.36);font-size:12px;font-weight:700}.task-header h1{margin:12px 0 0;color:#fff;font-size:30px}.task-card{margin-top:28px;padding:24px;border:1px solid rgba(82,174,226,.42);border-radius:24px;background:rgba(0,25,42,.64)}.workbench-head{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;padding-bottom:18px;border-bottom:1px solid rgba(0,180,255,.2)}.section-eyebrow{margin:0;color:#71dfff;font-size:12px;font-weight:800}.workbench-head h2{margin:4px 0 0;color:#fff;font-size:24px}.step-tabs{display:flex;gap:10px;margin:20px 0}.step-tabs button{min-height:36px;padding:0 15px;border:1px solid rgba(99,183,222,.42);border-radius:8px;color:#a8cde0;background:rgba(3,27,43,.56);font:inherit;font-size:13px;font-weight:800;cursor:pointer}.step-tabs button.active{border-color:#48d5ff;color:#fff;background:rgba(9,125,177,.7)}.lead,.scoring-guide{margin:22px 0;color:#e2f3ff;font-size:16px;line-height:1.9}.scoring-guide{padding:16px 18px;border-left:3px solid #48d5ff;border-radius:0 12px 12px 0;background:rgba(16,85,121,.2)}.table-actions{display:flex;justify-content:flex-end;gap:12px;margin:0 0 16px}.table-actions :deep(.el-button){min-width:110px;height:42px;font-weight:800}.table-wrap{overflow-x:auto;border:1px solid rgba(99,183,222,.46);border-radius:14px}.table-wrap table{width:100%;border-collapse:collapse}.weight-table{min-width:900px}.channel-table{min-width:1320px}.scoring-table{min-width:1780px}.ranking-table{min-width:880px}.table-wrap th,.table-wrap td{padding:12px;border-right:1px solid rgba(99,183,222,.35);border-bottom:1px solid rgba(99,183,222,.35);vertical-align:middle}.table-wrap th{white-space:nowrap;color:#effaff;background:#0c9dd6;font-size:14px}.table-wrap td{background:rgba(2,21,34,.58)}.weight-table tbody td:nth-child(1){width:22%}.weight-table tbody td:nth-child(2){width:43%}.weight-table tbody td:nth-child(3){width:23%}.channel-table td{min-width:134px}.channel-table td:first-child{min-width:110px}.scoring-table th:first-child{min-width:108px}.scoring-table td{min-width:108px}.scoring-table thead tr:nth-child(2) th{background:rgba(7,116,161,.94)}.ranking-table td{min-width:170px}.ranking-table td:first-child{min-width:100px}.rank-cell,.core-cell{text-align:center;font-weight:900}.core-cell .core{display:inline-flex;align-items:center;justify-content:center;min-width:30px;height:26px;border:1px solid rgba(99,235,204,.8);border-radius:999px;color:#062f30;background:#68edce}.weight-cell{color:#a8d9eb;text-align:center;font-weight:800}.analysis-field{display:block;margin-top:28px}.analysis-field>span{display:block;margin-bottom:10px;color:#dff5ff;font-size:15px;font-weight:800}.analysis-field :deep(.el-textarea__inner){min-height:180px!important;border:1px solid rgba(111,190,225,.3);border-radius:12px;box-shadow:none;color:#fff;background:#102233;line-height:1.7}.table-wrap :deep(.el-input__wrapper),.table-wrap :deep(.el-input-number){width:100%;background:#102233}.table-wrap :deep(.el-input__wrapper){box-shadow:0 0 0 1px rgba(111,190,225,.3) inset}.table-wrap :deep(.el-input__inner){color:#fff}.table-wrap :deep(.el-input-number .el-input__wrapper){background:#102233}.table-wrap small{display:block;margin-top:7px;color:#8fa8b8;font-size:12px}.operation-column{width:100px;text-align:center}.empty-row{text-align:center;color:#99b5c7}.table-wrap tfoot th,.table-wrap tfoot td{border-bottom:0;background:rgba(7,49,72,.74)}.total-error{color:#ff8c8c;font-weight:900}.hint{margin:18px 0 0;color:#95b2c3;line-height:1.8}.footer-actions{display:flex;justify-content:center;gap:16px;margin-top:30px}.footer-actions :deep(.el-button){min-width:156px;height:44px;font-weight:800}.footer-actions :deep(.el-button .el-icon){margin-left:5px}@media (max-width:1100px){.release-channel-page{grid-template-columns:1fr}}@media (max-width:720px){.release-channel-page{padding:14px}.training-core{padding:18px}.task-card{padding:18px}.workbench-head{flex-direction:column}.table-actions,.footer-actions{align-items:stretch;flex-direction:column}.table-actions :deep(.el-button),.footer-actions :deep(.el-button){width:100%}}
|
|
|
|
|
</style>
|
|
|
|
|
|