复购分析、留存分析、用户粘性分析

fix/non-blocking-route-navigation
HeHaonan 2 years ago
parent 3c9304b7a8
commit 8418d9eac9

@ -35,8 +35,32 @@ export function downloadDataByBoston(data) {
} }
//数据下载-漏斗分析 //数据下载-漏斗分析
export function downloadDataByFunnel(data) { export function downloadDataByFunnel(data) {
return request({
url: "/api/downDataByUserPortrait/analysisByFunnelModel",
method: "get",
params: data,
});
}
//数据下载-购物篮分析
export function downloadDataByBasket(data) {
return request({
url: "/api/downDataByUserPortrait/analysisByShopBasket",
method: "get",
params: data,
});
}
//数据下载-复购分析
export function downloadDataByRepurchase(data) {
return request({
url: "/api/downDataByUserPortrait/analysisByRepurchase",
method: "get",
params: data,
});
}
//数据下载-留存分析
export function downloadDataByRetain(data) {
return request({ return request({
url: "/api/downDataByUserPortrait/analysisByFunnelModel", url: "/api/downDataByUserPortrait/analysisByRetention",
method: "get", method: "get",
params: data, params: data,
}); });
@ -75,9 +99,9 @@ export function retrain(data) {
} }
//实训任务提交 //实训任务提交
export function submit(data) { export function submit(data) {
return request({ return request({
url: "/api/userBehavior/practicalTrainingSubmission", url: "/api/userBehavior/practicalTrainingSubmission",
method: "post", method: "post",
params: data, params: data,
}); });
} }

@ -35,7 +35,7 @@
<el-table-column label="商品3" align="center" prop="goods3"> <el-table-column label="商品3" align="center" prop="goods3">
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class="download">下载数据</div> <div class="download" @click="downloadData">下载数据</div>
</div> </div>
<p style="line-height: 25px; font-size: 14px"> <p style="line-height: 25px; font-size: 14px">
计算公式如下:<br /> 计算公式如下:<br />
@ -825,6 +825,16 @@ const getData = () => {
}) })
.catch((error) => {}); .catch((error) => {});
}; };
const downloadData = () => {
portraitModel
.downloadDataByBasket({})
.then((res) => {
// console.log(res,'--');
const blob = new Blob([res], { type: "application/vnd.ms-excel" });
downBlobFile(`案例数据-购物篮分析`, blob);
})
.catch((error) => {});
};
const submitData = () => { const submitData = () => {
// console.log("asdasdasdsdsds"); // console.log("asdasdasdsdsds");
if ( if (

@ -66,7 +66,7 @@
<el-table-column label="订单日期" align="center" prop="date"> <el-table-column label="订单日期" align="center" prop="date">
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class="download">下载数据</div> <div class="download" @click="downloadData">下载数据</div>
</div> </div>
</div> </div>
<div class="line"></div> <div class="line"></div>
@ -171,10 +171,11 @@
> >
</el-input </el-input
><span v-if="scope.$index == 2">%</span> ><span v-if="scope.$index == 2">%</span>
<span v-else>个</span>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class="submit">提交</div> <div class="submit" @click="step2Submit">提交</div>
</div> </div>
</div> </div>
<div class="line"></div> <div class="line"></div>
@ -288,7 +289,7 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class="submit">提交</div> <div class="submit" @click="step4Submit">提交</div>
</div> </div>
<div style="display: flex; align-items: center"> <div style="display: flex; align-items: center">
<p style="line-height: 25px; font-size: 14px"> <p style="line-height: 25px; font-size: 14px">
@ -442,7 +443,7 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
<div class="submit">提交</div> <div class="submit" @click="step5Submit">提交</div>
</div> </div>
<!-- <div class="customerType" style="width: 887px"> <!-- <div class="customerType" style="width: 887px">
<img src="@/assets/images/促销.png" alt="" /> <img src="@/assets/images/促销.png" alt="" />
@ -543,14 +544,23 @@
</template> </template>
<script setup> <script setup>
import * as portraitModel from "@/api/portraitModel";
import { downBlobFile } from "@/utils/index.js";
import * as echarts from "echarts"; import * as echarts from "echarts";
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const knowledgeHtml = ref( const knowledgeHtml = ref(
`<p style="text-align: left;">复购率分析是评估消费者对某一品牌或产品忠诚度的重要指标,它反映了消费者满意度和重复购买的行为。通过复购率分析,企业可以更好地了解消费者的购买行为和需求,从而制定更精准的营销策略和产品优化方向。</p><p style="text-align: left;">复购率的计算有两种主要方法:</p><p style="text-align: left;">按客户计算:一定时间内再次购买的客户的人数除以购买的总人数。这种方法不考虑客户购买的次数,只关注是否有重复购买行为。</p><p style="text-align: left;">按订单计算:一定时间内再次购买的客户的订单数除以购买的总订单数。这种方法会统计多次购买的客户订单,区分每次购买的订单。</p><p style="text-align: left;">推荐企业采取按客户计算的复购率算法,因为它更能反映消费者的忠诚度。然而,按订单计算的复购率可能会因为多次购买的客户产生的订单数较多而显得更高。</p><p style="text-align: left;">复购率分析的重要性体现在以下几个方面:</p><p style="text-align: left;">反映客户忠诚度:高复购率意味着消费者对产品的认可度高,愿意再次购买,从而反映出较高的客户忠诚度。</p><p style="text-align: left;">预测销售趋势:通过分析复购率的变化趋势,企业可以预测产品的未来表现,做出更明智的选品决策。</p><p style="text-align: left;">指导选品策略:结合其他指标如销售额、转化率等,对复购率进行综合分析,可以帮助企业筛选出具有潜力的爆款产品。</p><p style="text-align: left;">为了进行复购率分析,企业可以采用以下步骤:</p><p style="text-align: left;">1.收集数据:收集包括订单ID、订单日期、客户名称等指标的数据。</p><p style="text-align: left;">2.计算复购率:根据收集的数据计算一个月内每个用户的购买次数、统计一个月内的购买人数、统计每个月内多次购买的人数并计算月复购率。</p><p style="text-align: left;">3.可视化展示:通过可视化图表的形式展示复购率数据,发现数据规律和问题,如复购时间间隔分析、商品复购分析等。</p><p style="text-align: left;">4.结论分析:根据复购率和用户总数的变化趋势,分析用户黏性的健康度,制定相应的运营策略。</p><p style="text-align: left;">通过复购率分析,企业不仅可以评估现有客户的忠诚度和满意度,还可以预测未来的销售趋势,为产品优化和营销策略提供有力支持。</p>` `<p style="text-align: left;">复购率分析是评估消费者对某一品牌或产品忠诚度的重要指标,它反映了消费者满意度和重复购买的行为。通过复购率分析,企业可以更好地了解消费者的购买行为和需求,从而制定更精准的营销策略和产品优化方向。</p><p style="text-align: left;">复购率的计算有两种主要方法:</p><p style="text-align: left;">按客户计算:一定时间内再次购买的客户的人数除以购买的总人数。这种方法不考虑客户购买的次数,只关注是否有重复购买行为。</p><p style="text-align: left;">按订单计算:一定时间内再次购买的客户的订单数除以购买的总订单数。这种方法会统计多次购买的客户订单,区分每次购买的订单。</p><p style="text-align: left;">推荐企业采取按客户计算的复购率算法,因为它更能反映消费者的忠诚度。然而,按订单计算的复购率可能会因为多次购买的客户产生的订单数较多而显得更高。</p><p style="text-align: left;">复购率分析的重要性体现在以下几个方面:</p><p style="text-align: left;">反映客户忠诚度:高复购率意味着消费者对产品的认可度高,愿意再次购买,从而反映出较高的客户忠诚度。</p><p style="text-align: left;">预测销售趋势:通过分析复购率的变化趋势,企业可以预测产品的未来表现,做出更明智的选品决策。</p><p style="text-align: left;">指导选品策略:结合其他指标如销售额、转化率等,对复购率进行综合分析,可以帮助企业筛选出具有潜力的爆款产品。</p><p style="text-align: left;">为了进行复购率分析,企业可以采用以下步骤:</p><p style="text-align: left;">1.收集数据:收集包括订单ID、订单日期、客户名称等指标的数据。</p><p style="text-align: left;">2.计算复购率:根据收集的数据计算一个月内每个用户的购买次数、统计一个月内的购买人数、统计每个月内多次购买的人数并计算月复购率。</p><p style="text-align: left;">3.可视化展示:通过可视化图表的形式展示复购率数据,发现数据规律和问题,如复购时间间隔分析、商品复购分析等。</p><p style="text-align: left;">4.结论分析:根据复购率和用户总数的变化趋势,分析用户黏性的健康度,制定相应的运营策略。</p><p style="text-align: left;">通过复购率分析,企业不仅可以评估现有客户的忠诚度和满意度,还可以预测未来的销售趋势,为产品优化和营销策略提供有力支持。</p>`
); );
const list = ref(["-"]); const list = ref(["-"]);
const errorNum = ref(0);
const step1Error = ref(0); const step1Error = ref(0);
const step2Error = ref(0); const step2Error = ref(0);
const step4Error = ref(0);
const step5Error = ref(0);
const step1AnswerFlag = ref(false);
const step2AnswerFlag = ref(false);
const step4AnswerFlag = ref(false);
const step5AnswerFlag = ref(false);
const combinationValue1 = ref(""); const combinationValue1 = ref("");
const combinationValue2 = ref(""); const combinationValue2 = ref("");
const knowledgeFlag = ref(false); const knowledgeFlag = ref(false);
@ -1479,8 +1489,286 @@ const step1Submit = () => {
return; return;
} }
} }
console.log(1); if (step1Data.value[0].params && step1Data.value[0].params != "1") {
step1Error.value++;
}
if (step1Data.value[1].params && step1Data.value[1].params != "2") {
step1Error.value++;
}
if (step1Data.value[2].params && step1Data.value[2].params != "1") {
step1Error.value++;
}
if (step1Data.value[3].params && step1Data.value[3].params != "2") {
step1Error.value++;
}
if (step1Data.value[4].params && step1Data.value[4].params != "3") {
step1Error.value++;
}
if (step1Data.value[5].params && step1Data.value[5].params != "1") {
step1Error.value++;
}
if (step1Data.value[6].params && step1Data.value[6].params != "2") {
step1Error.value++;
}
if (step1Data.value[7].params && step1Data.value[7].params != "3") {
step1Error.value++;
}
if (step1Data.value[8].params && step1Data.value[8].params != "4") {
step1Error.value++;
}
if (step1Data.value[9].params && step1Data.value[9].params != "1") {
step1Error.value++;
}
if (step1Data.value[10].params && step1Data.value[10].params != "2") {
step1Error.value++;
}
if (step1Data.value[11].params && step1Data.value[11].params != "2") {
step1Error.value++;
}
if (step1Data.value[12].params && step1Data.value[12].params != "3") {
step1Error.value++;
}
if (step1Data.value[13].params && step1Data.value[13].params != "4") {
step1Error.value++;
}
if (step1Data.value[14].params && step1Data.value[14].params != "1") {
step1Error.value++;
}
if (step1Data.value[15].params && step1Data.value[15].params != "1") {
step1Error.value++;
}
if (step1Data.value[16].params && step1Data.value[16].params != "1") {
step1Error.value++;
}
if (step1Data.value[17].params && step1Data.value[17].params != "1") {
step1Error.value++;
}
if (step1Data.value[18].params && step1Data.value[18].params != "1") {
step1Error.value++;
}
if (step1Data.value[19].params && step1Data.value[19].params != "1") {
step1Error.value++;
}
console.log(step1Error.value, "错误数");
proxy.$modal.msgSuccess("提交成功");
step1AnswerFlag.value = true;
step4Data.value[0].data6 = step1Data.value[0].params;
step4Data.value[1].data6 = step1Data.value[1].params;
step4Data.value[2].data6 = step1Data.value[3].params;
step4Data.value[3].data6 = step1Data.value[4].params;
step4Data.value[4].data6 = step1Data.value[7].params;
step4Data.value[5].data6 = step1Data.value[8].params;
step4Data.value[6].data6 = step1Data.value[9].params;
step4Data.value[7].data6 = step1Data.value[10].params;
};
const step2Submit = () => {
step2Error.value = 0;
for (let i in step2Data.value) {
// console.log(fileTable1.value[i]);
if (!step2Data.value[i].params) {
proxy.$modal.msgError("请先完成所有填空");
return;
}
}
if (step2Data.value[0].params && step2Data.value[0].params != "10") {
step2Error.value++;
}
if (step2Data.value[1].params && step2Data.value[1].params != "4") {
step2Error.value++;
}
if (step2Data.value[2].params && step2Data.value[2].params != "40") {
step2Error.value++;
}
console.log(step2Error.value, "错误数");
proxy.$modal.msgSuccess("提交成功");
step2AnswerFlag.value = true;
};
const step4Submit = () => {
// console.log(9);
step4Error.value = 0;
if (!step4Data.value[0].params1 || !step4Data.value[0].params2) {
proxy.$modal.msgError("请先完成所有填空");
return;
}
if (!step4Data.value[2].params1 || !step4Data.value[2].params2) {
proxy.$modal.msgError("请先完成所有填空");
return;
}
if (!step4Data.value[4].params1 || !step4Data.value[4].params2) {
proxy.$modal.msgError("请先完成所有填空");
return;
}
if (!step4Data.value[6].params1 || !step4Data.value[6].params2) {
proxy.$modal.msgError("请先完成所有填空");
return;
}
if (step4Data.value[0].params1 && step4Data.value[0].params1 != "22") {
step4Error.value++;
}
if (step4Data.value[0].params2 && step4Data.value[0].params2 != "30天内") {
step4Error.value++;
}
if (step4Data.value[2].params1 && step4Data.value[2].params1 != "10") {
step4Error.value++;
}
if (step4Data.value[2].params2 && step4Data.value[2].params2 != "15天内") {
step4Error.value++;
}
if (step4Data.value[4].params1 && step4Data.value[4].params1 != "4") {
step4Error.value++;
}
if (step4Data.value[4].params2 && step4Data.value[4].params2 != "7天内") {
step4Error.value++;
}
if (step4Data.value[6].params1 && step4Data.value[6].params1 != "2") {
step4Error.value++;
}
if (step4Data.value[6].params2 && step4Data.value[6].params2 != "7天内") {
step4Error.value++;
}
console.log(step4Error.value, "错误数");
proxy.$modal.msgSuccess("提交成功");
step4AnswerFlag.value = true;
};
const step5Submit = () => {
// console.log(1313);
step5Error.value = 0;
if (!step5DataTable2.value[0].params) {
proxy.$modal.msgError("请先完成所有填空");
return;
}
if (!step5DataTable2.value[1].params) {
proxy.$modal.msgError("请先完成所有填空");
return;
}
for (let i in step5DataTable3.value) {
// console.log(fileTable1.value[i]);
if (
!step5DataTable3.value[i].params1 ||
!step5DataTable3.value[i].params2
) {
proxy.$modal.msgError("请先完成所有填空");
return;
}
}
if (
step5DataTable2.value[0].params &&
step5DataTable2.value[0].params != "裤子" &&
step5DataTable2.value[0].params != "外套"
) {
step5Error.value++;
}
if (
step5DataTable2.value[1].params &&
step5DataTable2.value[1].params != "衬衫" &&
step5DataTable2.value[1].params != "短袖" &&
step5DataTable2.value[1].params != "睡衣"
) {
step5Error.value++;
}
if (
step5DataTable3.value[0].params1 &&
step5DataTable3.value[0].params1 != "无"
) {
step5Error.value++;
}
if (
step5DataTable3.value[0].params2 &&
step5DataTable3.value[0].params2 != "0"
) {
step5Error.value++;
}
if (
step5DataTable3.value[1].params1 &&
step5DataTable3.value[1].params1 != "无"
) {
step5Error.value++;
}
if (
step5DataTable3.value[1].params2 &&
step5DataTable3.value[1].params2 != "0"
) {
step5Error.value++;
}
if (
step5DataTable3.value[2].params1 &&
step5DataTable3.value[2].params1 != "无"
) {
step5Error.value++;
}
if (
step5DataTable3.value[2].params2 &&
step5DataTable3.value[2].params2 != "0"
) {
step5Error.value++;
}
if (
step5DataTable3.value[3].params1 &&
step5DataTable3.value[3].params1 != "C"
) {
step5Error.value++;
}
if (
step5DataTable3.value[3].params2 &&
step5DataTable3.value[3].params2 != "1"
) {
step5Error.value++;
}
if (
step5DataTable3.value[4].params1 &&
step5DataTable3.value[4].params1 != "D"
) {
step5Error.value++;
}
if (
step5DataTable3.value[4].params2 &&
step5DataTable3.value[4].params2 != "2"
) {
step5Error.value++;
}
console.log(step5Error.value, "错误数");
proxy.$modal.msgSuccess("提交成功");
step5AnswerFlag.value = true;
};
const downloadData = () => {
portraitModel
.downloadDataByRepurchase({})
.then((res) => {
// console.log(res,'--');
const blob = new Blob([res], { type: "application/vnd.ms-excel" });
downBlobFile(`案例数据-复购分析`, blob);
})
.catch((error) => {});
};
const submitData = () => {
if (
!step1AnswerFlag.value ||
!step2AnswerFlag.value ||
!step4AnswerFlag.value ||
!step5AnswerFlag.value
) {
proxy.$modal.msgError("请先完成所有步骤!");
return;
}
errorNum.value =
step1Error.value + step2Error.value + step4Error.value + step5Error.value;
console.log(errorNum.value, "总错误次数");
portraitModel
.submit({
userId: 492,
taskName: "复购分析",
numberOfErrors: errorNum.value,
})
.then((res) => {
proxy.$modal.msgSuccess("提交成功");
})
.catch((error) => {});
// console.log(666);
}; };
defineExpose({
submitData,
// practicalTraining,
});
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

@ -64,7 +64,7 @@
<el-table-column label="14日" align="center" prop="day14"> <el-table-column label="14日" align="center" prop="day14">
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class="download">下载数据</div> <div class="download" @click="downloadData">下载数据</div>
</div> </div>
<span style="line-height: 25px; font-size: 14px"> <span style="line-height: 25px; font-size: 14px">
表格列指标释义:<br /> 表格列指标释义:<br />
@ -103,147 +103,160 @@
<template #default="scope"> <template #default="scope">
<el-input <el-input
v-model="scope.row.params" v-model="scope.row.params"
placeholder="请输入" placeholder="输入"
style="width: 70px" style="width: 50px"
v-if="scope.$index == 12" v-if="scope.$index == 12"
> >
</el-input> </el-input
><span v-if="scope.$index == 12">%</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="3日" align="center" prop="day3"> <el-table-column label="3日" align="center" prop="day3">
<template #default="scope"> <template #default="scope">
<el-input <el-input
v-model="scope.row.params" v-model="scope.row.params"
placeholder="请输入" placeholder="输入"
style="width: 70px" style="width: 50px"
v-if="scope.$index == 11" v-if="scope.$index == 11"
> >
</el-input> </el-input
><span v-if="scope.$index == 11">%</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="4日" align="center" prop="day4"> <el-table-column label="4日" align="center" prop="day4">
<template #default="scope"> <template #default="scope">
<el-input <el-input
v-model="scope.row.params" v-model="scope.row.params"
placeholder="请输入" placeholder="输入"
style="width: 70px" style="width: 50px"
v-if="scope.$index == 10" v-if="scope.$index == 10"
> >
</el-input> </el-input
><span v-if="scope.$index == 10">%</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="5日" align="center" prop="day5"> <el-table-column label="5日" align="center" prop="day5">
<template #default="scope"> <template #default="scope">
<el-input <el-input
v-model="scope.row.params" v-model="scope.row.params"
placeholder="请输入" placeholder="输入"
style="width: 70px" style="width: 50px"
v-if="scope.$index == 9" v-if="scope.$index == 9"
> >
</el-input> </el-input
><span v-if="scope.$index == 9">%</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="6日" align="center" prop="day6"> <el-table-column label="6日" align="center" prop="day6">
<template #default="scope"> <template #default="scope">
<el-input <el-input
v-model="scope.row.params" v-model="scope.row.params"
placeholder="请输入" placeholder="输入"
style="width: 70px" style="width: 50px"
v-if="scope.$index == 8" v-if="scope.$index == 8"
> >
</el-input> </el-input
><span v-if="scope.$index == 8">%</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="7日" align="center" prop="day7"> <el-table-column label="7日" align="center" prop="day7">
<template #default="scope"> <template #default="scope">
<el-input <el-input
v-model="scope.row.params" v-model="scope.row.params"
placeholder="请输入" placeholder="输入"
style="width: 70px" style="width: 50px"
v-if="scope.$index == 7" v-if="scope.$index == 7"
> >
</el-input> </el-input
><span v-if="scope.$index == 7">%</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="8日" align="center" prop="day8"> <el-table-column label="8日" align="center" prop="day8">
<template #default="scope"> <template #default="scope">
<el-input <el-input
v-model="scope.row.params" v-model="scope.row.params"
placeholder="请输入" placeholder="输入"
style="width: 70px" style="width: 50px"
v-if="scope.$index == 6" v-if="scope.$index == 6"
> >
</el-input> </el-input
><span v-if="scope.$index == 6">%</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="9日" align="center" prop="day9"> <el-table-column label="9日" align="center" prop="day9">
<template #default="scope"> <template #default="scope">
<el-input <el-input
v-model="scope.row.params" v-model="scope.row.params"
placeholder="请输入" placeholder="输入"
style="width: 70px" style="width: 50px"
v-if="scope.$index == 5" v-if="scope.$index == 5"
> >
</el-input> </el-input
><span v-if="scope.$index == 5">%</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="10日" align="center" prop="day10"> <el-table-column label="10日" align="center" prop="day10">
<template #default="scope"> <template #default="scope">
<el-input <el-input
v-model="scope.row.params" v-model="scope.row.params"
placeholder="请输入" placeholder="输入"
style="width: 70px" style="width: 50px"
v-if="scope.$index == 4" v-if="scope.$index == 4"
> >
</el-input> </el-input
><span v-if="scope.$index == 4">%</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="11日" align="center" prop="day11"> <el-table-column label="11日" align="center" prop="day11">
<template #default="scope"> <template #default="scope">
<el-input <el-input
v-model="scope.row.params" v-model="scope.row.params"
placeholder="请输入" placeholder="输入"
style="width: 70px" style="width: 50px"
v-if="scope.$index == 3" v-if="scope.$index == 3"
> >
</el-input> </el-input
><span v-if="scope.$index == 3">%</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="12日" align="center" prop="day12"> <el-table-column label="12日" align="center" prop="day12">
<template #default="scope"> <template #default="scope">
<el-input <el-input
v-model="scope.row.params" v-model="scope.row.params"
placeholder="请输入" placeholder="输入"
style="width: 70px" style="width: 50px"
v-if="scope.$index == 2" v-if="scope.$index == 2"
> >
</el-input> </el-input
><span v-if="scope.$index == 2">%</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="13日" align="center" prop="day13"> <el-table-column label="13日" align="center" prop="day13">
<template #default="scope"> <template #default="scope">
<el-input <el-input
v-model="scope.row.params" v-model="scope.row.params"
placeholder="请输入" placeholder="输入"
style="width: 70px" style="width: 50px"
v-if="scope.$index == 1" v-if="scope.$index == 1"
> >
</el-input> </el-input
><span v-if="scope.$index == 1">%</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="14日" align="center" prop="day14"> <el-table-column label="14日" align="center" prop="day14">
<template #default="scope"> <template #default="scope">
<el-input <el-input
v-model="scope.row.params" v-model="scope.row.params"
placeholder="请输入" placeholder="输入"
style="width: 70px" style="width: 50px"
v-if="scope.$index == 0" v-if="scope.$index == 0"
> >
</el-input> </el-input
><span v-if="scope.$index == 0">%</span>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class="submit">提交</div> <div class="submit" @click="step1Submit">提交</div>
</div> </div>
</div> </div>
<div class="line"></div> <div class="line"></div>
@ -277,7 +290,8 @@
placeholder="请输入" placeholder="请输入"
style="width: 70px" style="width: 70px"
> >
</el-input> </el-input
><span>%</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="3日" align="center" prop="description"> <el-table-column label="3日" align="center" prop="description">
@ -287,7 +301,8 @@
placeholder="请输入" placeholder="请输入"
style="width: 70px" style="width: 70px"
> >
</el-input> </el-input
><span>%</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="7日" align="center" prop="description"> <el-table-column label="7日" align="center" prop="description">
@ -297,7 +312,8 @@
placeholder="请输入" placeholder="请输入"
style="width: 70px" style="width: 70px"
> >
</el-input> </el-input
><span>%</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="14日" align="center" prop="amount"> <el-table-column label="14日" align="center" prop="amount">
@ -307,11 +323,12 @@
placeholder="请输入" placeholder="请输入"
style="width: 70px" style="width: 70px"
> >
</el-input> </el-input
><span>%</span>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class="submit">提交</div> <div class="submit" @click="step2Submit">提交</div>
</div> </div>
</div> </div>
<div class="line"></div> <div class="line"></div>
@ -350,6 +367,13 @@
3、14日的留存率,每天一直下降,需要找出原因。 3、14日的留存率,每天一直下降,需要找出原因。
</span> </span>
</div> </div>
<div
class="submit"
@click="step3Submit"
style="margin-top: 20px; margin-left: 0px"
>
提交
</div>
</div> </div>
</div> </div>
</div> </div>
@ -426,6 +450,8 @@
</template> </template>
<script setup> <script setup>
import * as portraitModel from "@/api/portraitModel";
import { downBlobFile } from "@/utils/index.js";
import * as echarts from "echarts"; import * as echarts from "echarts";
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const knowledgeHtml = ref( const knowledgeHtml = ref(
@ -435,6 +461,13 @@ const list = ref(["-"]);
const dayValue = ref(""); const dayValue = ref("");
const combinationValue1 = ref(""); const combinationValue1 = ref("");
const combinationValue2 = ref(""); const combinationValue2 = ref("");
const errorNum = ref(0);
const step1Error = ref(0);
const step2Error = ref(0);
const step3Error = ref(0);
const step1AnswerFlag = ref(false);
const step2AnswerFlag = ref(false);
const step3AnswerFlag = ref(false);
const knowledgeFlag = ref(false); const knowledgeFlag = ref(false);
//时间间隔分组数-7天内 //时间间隔分组数-7天内
const sevenNum = ref(0); const sevenNum = ref(0);
@ -1273,6 +1306,21 @@ const dayOptions = ref([
label: "14日", label: "14日",
}, },
]); ]);
const step1RightAnswer = ref([
"4",
"5",
"6",
"7",
"9",
"14",
"18",
"19",
"30",
"41",
"57",
"72",
"79",
]);
const moveUp = (index, row) => { const moveUp = (index, row) => {
console.log("上移", index, row); console.log("上移", index, row);
if (index > 0) { if (index > 0) {
@ -1399,6 +1447,106 @@ const draw = () => {
option && myChart.setOption(option); option && myChart.setOption(option);
}; };
const downloadData = () => {
portraitModel
.downloadDataByRetain({})
.then((res) => {
// console.log(res,'--');
const blob = new Blob([res], { type: "application/vnd.ms-excel" });
downBlobFile(`案例数据-留存分析`, blob);
})
.catch((error) => {});
};
const step1Submit = () => {
// console.log(65);
step1Error.value = 0;
for (let i in step1Data.value.slice(0, step1Data.value.length - 1)) {
// console.log(fileTable1.value[i]);
if (!step1Data.value[i].params) {
proxy.$modal.msgError("请先完成所有填空");
return;
}
}
for (let i in step1Data.value.slice(0, step1Data.value.length - 1)) {
if (step1Data.value[i].params != step1RightAnswer.value[i]) {
step1Error.value++;
}
}
console.log(step1Error.value, "错误数");
proxy.$modal.msgSuccess("提交成功");
step1AnswerFlag.value = true;
};
const step2Submit = () => {
step2Error.value = 0;
if (
!step2Data.value[0].params1 ||
!step2Data.value[0].params2 ||
!step2Data.value[0].params3 ||
!step2Data.value[0].params4
) {
proxy.$modal.msgError("请先完成所有填空");
return;
}
if (step2Data.value[0].params1 && step2Data.value[0].params1 != "85") {
step2Error.value++;
}
if (step2Data.value[0].params2 && step2Data.value[0].params2 != "73") {
step2Error.value++;
}
if (step2Data.value[0].params3 && step2Data.value[0].params3 != "27") {
step2Error.value++;
}
if (step2Data.value[0].params4 && step2Data.value[0].params4 != "4") {
step2Error.value++;
}
console.log(step2Error.value, "错误数");
proxy.$modal.msgSuccess("提交成功");
step2AnswerFlag.value = true;
step4Data.value[0].data1 = step2Data.value[0].params1 + "%";
step4Data.value[0].data2 = step2Data.value[0].params2 + "%";
step4Data.value[0].data3 = step2Data.value[0].params3 + "%";
step4Data.value[0].data4 = step2Data.value[0].params4 + "%";
};
const step3Submit = () => {
// console.log(1132);
step3Error.value = 0;
if (dayValue.value == "") {
proxy.$modal.msgError("请先完成选择");
return;
}
if (dayValue.value != "10日") {
step3Error.value++;
}
console.log(step3Error.value, "错误数");
proxy.$modal.msgSuccess("提交成功");
step3AnswerFlag.value = true;
};
const submitData = () => {
if (
!step1AnswerFlag.value ||
!step2AnswerFlag.value ||
!step3AnswerFlag.value
) {
proxy.$modal.msgError("请先完成所有步骤!");
return;
}
errorNum.value = step1Error.value + step2Error.value + step3Error.value;
console.log(errorNum.value, "总错误次数");
portraitModel
.submit({
userId: 492,
taskName: "留存分析",
numberOfErrors: errorNum.value,
})
.then((res) => {
proxy.$modal.msgSuccess("提交成功");
})
.catch((error) => {});
};
defineExpose({
submitData,
// practicalTraining,
});
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

@ -37,7 +37,7 @@ https://blog.csdn.net/kevin1993best/article/details/106329573"
<div style="margin-top: 10px; display: flex"> <div style="margin-top: 10px; display: flex">
<el-table <el-table
:data="fileTable1" :data="fileTable1"
style="width: 650px" style="width: 1000px"
border border
:header-cell-style="{ :header-cell-style="{
color: '#fff', color: '#fff',
@ -45,14 +45,24 @@ https://blog.csdn.net/kevin1993best/article/details/106329573"
backgroundColor: '#6A7DE9!important', backgroundColor: '#6A7DE9!important',
}" }"
> >
<el-table-column label="用户ID" align="center" prop="date"> <el-table-column label="用户ID" align="center" prop="id1">
</el-table-column> </el-table-column>
<el-table-column label="登录时间" align="center" prop="addNum"> <el-table-column label="登录时间" align="center" prop="time1">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="登录时长(分钟)" label="登录时长(分钟)"
align="center" align="center"
prop="day2" prop="duration1"
>
</el-table-column>
<el-table-column label="用户ID" align="center" prop="id2">
</el-table-column>
<el-table-column label="登录时间" align="center" prop="time2">
</el-table-column>
<el-table-column
label="登录时长(分钟)"
align="center"
prop="duration2"
> >
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -144,7 +154,7 @@ https://blog.csdn.net/kevin1993best/article/details/106329573"
type="textarea" type="textarea"
placeholder="请输入" placeholder="请输入"
/> />
<div class="submit">提交</div> <div class="submit" @click="step1Submit">提交</div>
</div> </div>
</div> </div>
</div> </div>
@ -390,6 +400,11 @@ const dayValue = ref("");
const combinationValue1 = ref(""); const combinationValue1 = ref("");
const combinationValue2 = ref(""); const combinationValue2 = ref("");
const analysisConclusion = ref(""); const analysisConclusion = ref("");
const errorNum = ref(0);
const step1Error = ref(0);
const step2Error = ref(0);
const step3Error = ref(0);
const step4Error = ref(0);
const knowledgeFlag = ref(false); const knowledgeFlag = ref(false);
//时间间隔分组数-7天内 //时间间隔分组数-7天内
const sevenNum = ref(0); const sevenNum = ref(0);
@ -493,225 +508,245 @@ const step1Data = ref([
]); ]);
const fileTable1 = ref([ const fileTable1 = ref([
{ {
date: "2021/8/1", id1: "A",
addNum: "1668", time1: "2024-03-01",
day2: "1472", duration1: "35",
day3: "1214", id2: "F",
day4: "1002", time2: "2024-03-11",
day5: "901", duration2: "11",
day6: "631", },
day7: "556", {
day8: "417", id1: "E",
day9: "295", time1: "2024-03-01",
day10: "205", duration1: "22",
day11: "172", id2: "C",
day12: "145", time2: "2024-03-12",
day13: "108", duration2: "33",
day14: "68", },
}, {
{ id1: "B",
date: "2021/8/2", time1: "2024-03-01",
addNum: "1692", duration1: "11",
day2: "1435", id2: "D",
day3: "1165", time2: "2024-03-12",
day4: "946", duration2: "22",
day5: "607", },
day6: "534",
day7: "346", {
day8: "300", id1: "H",
day9: "214", time1: "2024-03-01",
day10: "165", duration1: "27",
day11: "143", id2: "H",
day12: "126", time2: "2024-03-13",
day13: "91", duration2: "25",
day14: "", },
}, {
{ id1: "F",
date: "2021/8/3", time1: "2024-03-02",
addNum: "1669", duration1: "35",
day2: "1402", id2: "D",
day3: "1232", time2: "2024-03-14",
day4: "1083", duration2: "19",
day5: "897", },
day6: "756", {
day7: "518", id1: "C",
day8: "382", time1: "2024-03-02",
day9: "258", duration1: "16",
day10: "199", id2: "B",
day11: "121", time2: "2024-03-15",
day12: "106", duration2: "38",
day13: "", },
day14: "", {
}, id1: "D",
{ time1: "2024-03-03",
date: "2021/8/4", duration1: "16",
addNum: "1301", id2: "D",
day2: "1077", time2: "2024-03-17",
day3: "883", duration2: "35",
day4: "724", },
day5: "651", {
day6: "494", id1: "B",
day7: "299", time1: "2024-03-03",
day8: "230", duration1: "25",
day9: "155", id2: "C",
day10: "133", time2: "2024-03-17",
day11: "91", duration2: "43",
day12: "", },
day13: "", {
day14: "", id1: "G",
}, time1: "2024-03-03",
{ duration1: "30",
date: "2021/8/5", id2: "C",
addNum: "2049", time2: "2024-03-18",
day2: "1748", duration2: "36",
day3: "1515", },
day4: "1314", {
day5: "1046", id1: "D",
day6: "831", time1: "2024-03-03",
day7: "658", duration1: "43",
day8: "498", id2: "K",
day9: "442", time2: "2024-03-19",
day10: "189", duration2: "31",
day11: "", },
day12: "", {
day13: "", id1: "C",
day14: "", time1: "2024-03-04",
}, duration1: "32",
{ id2: "A",
date: "2021/8/6", time2: "2024-03-20",
addNum: "2670", duration2: "5",
day2: "2312", },
day3: "2039", {
day4: "1799", id1: "D",
day5: "1290", time1: "2024-03-04",
day6: "922", duration1: "43",
day7: "828", id2: "D",
day8: "543", time2: "2024-03-20",
day9: "373", duration2: "8",
day10: "", },
day11: "", {
day12: "", id1: "B",
day13: "", time1: "2024-03-05",
day14: "", duration1: "8",
}, id2: "C",
{ time2: "2024-03-21",
date: "2021/8/7", duration2: "29",
addNum: "1999", },
day2: "1765", {
day3: "1573", id1: "D",
day4: "1401", time1: "2024-03-06",
day5: "988", duration1: "4",
day6: "783", id2: "D",
day7: "514", time2: "2024-03-22",
day8: "356", duration2: "35",
day9: "", },
day10: "", {
day11: "", id1: "C",
day12: "", time1: "2024-03-06",
day13: "", duration1: "25",
day14: "", id2: "C",
}, time2: "2024-03-23",
{ duration2: "35",
date: "2021/8/8", },
addNum: "2099", {
day2: "1874", id1: "K",
day3: "1515", time1: "2024-03-06",
day4: "1224", duration1: "36",
day5: "765", id2: "K",
day6: "578", time2: "2024-03-23",
day7: "402", duration2: "40",
day8: "", },
day9: "", {
day10: "", id1: "A",
day11: "", time1: "2024-03-06",
day12: "", duration1: "12",
day13: "", id2: "A",
day14: "", time2: "2024-03-24",
}, duration2: "27",
{ },
date: "2021/8/9", {
addNum: "2509", id1: "D",
day2: "2050", time1: "2024-03-07",
day3: "1808", duration1: "38",
day4: "1595", id2: "D",
day5: "1370", time2: "2024-03-25",
day6: "752", duration2: "4",
day7: "", },
day8: "", {
day9: "", id1: "C",
day10: "", time1: "2024-03-07",
day11: "", duration1: "35",
day12: "", id2: "B",
day13: "", time2: "2024-03-25",
day14: "", duration2: "16",
}, },
{ {
date: "2021/8/10", id1: "J",
addNum: "1011", time1: "2024-03-07",
day2: "839", duration1: "6",
day3: "740", id2: "G",
day4: "653", time2: "2024-03-25",
day5: "410", duration2: "16",
day6: "", },
day7: "", {
day8: "", id1: "B",
day9: "", time1: "2024-03-08",
day10: "", duration1: "39",
day11: "", id2: "B",
day12: "", time2: "2024-03-25",
day13: "", duration2: "29",
day14: "", },
}, {
{ id1: "A",
date: "2021/8/11", time1: "2024-03-08",
addNum: "2128", duration1: "4",
day2: "1894", id2: "D",
day3: "1566", time2: "2024-03-26",
day4: "1214", duration2: "17",
day5: "", },
day6: "", {
day7: "", id1: "E",
day8: "", time1: "2024-03-08",
day9: "", duration1: "3",
day10: "", id2: "C",
day11: "", time2: "2024-03-27",
day12: "", duration2: "32",
day13: "", },
day14: "", {
}, id1: "B",
{ time1: "2024-03-08",
date: "2021/8/12", duration1: "10",
addNum: "1366", id2: "K",
day2: "1145", time2: "2024-03-28",
day3: "983", duration2: "8",
day4: "", },
day5: "", {
day6: "", id1: "H",
day7: "", time1: "2024-03-08",
day8: "", duration1: "18",
day9: "", id2: "H",
day10: "", time2: "2024-03-29",
day11: "", duration2: "20",
day12: "", },
day13: "", {
day14: "", id1: "F",
}, time1: "2024-03-09",
{ duration1: "20",
date: "2021/8/13", id2: "B",
addNum: "2971", time2: "2024-03-29",
day2: "2335", duration2: "20",
day3: "", },
day4: "", {
day5: "", id1: "F",
day6: "", time1: "2024-03-09",
day7: "", duration1: "24",
day8: "", id2: "G",
day9: "", time2: "2024-03-29",
day10: "", duration2: "40",
day11: "", },
day12: "", {
day13: "", id1: "B",
day14: "", time1: "2024-03-10",
duration1: "21",
id2: "D",
time2: "2024-03-29",
duration2: "29",
},
{
id1: "H",
time1: "2024-03-11",
duration1: "10",
id2: "A",
time2: "2024-03-30",
duration2: "4",
},
{
id1: "F",
time1: "2024-03-11",
duration1: "34",
id2: "C",
time2: "2024-03-30",
duration2: "45",
}, },
]); ]);
const step2Data = ref([ const step2Data = ref([
@ -1086,6 +1121,158 @@ const dayOptions = ref([
label: "14日", label: "14日",
}, },
]); ]);
const step1RightAnswer = ref([
{
activeNum: "4",
activeRate: "40",
activeTime: "23.75",
},
{
activeNum: "2",
activeRate: "20",
activeTime: "25.50",
},
{
activeNum: "4",
activeRate: "40",
activeTime: "28.50",
},
{
activeNum: "2",
activeRate: "20",
activeTime: "37.50",
},
{
activeNum: "1",
activeRate: "10",
activeTime: "8.00",
},
{
activeNum: "4",
activeRate: "40",
activeTime: "19.25",
},
{
activeNum: "3",
activeRate: "30",
activeTime: "26.33",
},
{
activeNum: "5",
activeRate: "50",
activeTime: "14.80",
},
{
activeNum: "2",
activeRate: "20",
activeTime: "22.00",
},
{
activeNum: "1",
activeRate: "10",
activeTime: "21.00",
},
{
activeNum: "3",
activeRate: "30",
activeTime: "18.33",
},
{
activeNum: "2",
activeRate: "20",
activeTime: "27.50",
},
{
activeNum: "1",
activeRate: "10",
activeTime: "25.00",
},
{
activeNum: "1",
activeRate: "10",
activeTime: "19.00",
},
{
activeNum: "1",
activeRate: "10",
activeTime: "38.00",
},
{
activeNum: "0",
activeRate: "0",
activeTime: "0.00",
},
{
activeNum: "2",
activeRate: "20",
activeTime: "39.00",
},
{
activeNum: "1",
activeRate: "10",
activeTime: "36.00",
},
{
activeNum: "1",
activeRate: "10",
activeTime: "31.00",
},
{
activeNum: "2",
activeRate: "20",
activeTime: "6.50",
},
{
activeNum: "1",
activeRate: "10",
activeTime: "29.00",
},
{
activeNum: "1",
activeRate: "10",
activeTime: "35.00",
},
{
activeNum: "2",
activeRate: "20",
activeTime: "37.50",
},
{
activeNum: "1",
activeRate: "10",
activeTime: "27.00",
},
{
activeNum: "4",
activeRate: "40",
activeTime: "16.25",
},
{
activeNum: "1",
activeRate: "10",
activeTime: "17.00",
},
{
activeNum: "1",
activeRate: "10",
activeTime: "32.00",
},
{
activeNum: "1",
activeRate: "10",
activeTime: "8.00",
},
{
activeNum: "4",
activeRate: "40",
activeTime: "27.25",
},
{
activeNum: "2",
activeRate: "20",
activeTime: "24.50",
},
]);
const moveUp = (index, row) => { const moveUp = (index, row) => {
console.log("上移", index, row); console.log("上移", index, row);
if (index > 0) { if (index > 0) {
@ -1326,6 +1513,33 @@ const drawEcharts = () => {
option && myChart.setOption(option); option && myChart.setOption(option);
}; };
const step1Submit = () => {
step1Error.value++;
for (let i in step1Data.value) {
// console.log(fileTable1.value[i]);
if (
!step1Data.value[i].params1 ||
!step1Data.value[i].params2 ||
!step1Data.value[i].params3
) {
proxy.$modal.msgError("请先完成所有填空");
return;
}
}
for (let i in step1Data.value) {
if (step1Data.value[i].params1 != step1RightAnswer.value[i].activeNum) {
step1Error.value++;
}
if (step1Data.value[i].params2 != step1RightAnswer.value[i].activeRate) {
step1Error.value++;
}
if (step1Data.value[i].params3 != step1RightAnswer.value[i].activeTime) {
step1Error.value++;
}
}
console.log(step1Error.value, "错误数");
proxy.$modal.msgSuccess("提交成功");
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

Loading…
Cancel
Save