提交 5070f21b 编写于 作者: huangwensu's avatar huangwensu

漏斗接口联调

上级 fc396ea6
......@@ -19,6 +19,7 @@ export const getAddress = () => {
let ipAddress = "https://" + window.location.host;
// let ipAddress = "http://localhost:8099";
let env = getTestEnv(ipAddress);
let versionUrl = "";
let preViewUrl = ""
let qiniuImgUrl = "";
let qiniuFileUrl = '';
......@@ -41,6 +42,7 @@ export const getAddress = () => {
//本地
if (ipAddress.indexOf("localhost") > -1 || ipAddress.indexOf("10.177.10.118") > -1 || ipAddress.indexOf("test-kf") > -1) {
ipAddress = "http://localhost:7070";
versionUrl = 'https://dev-dev.yunqueyi.com';
preViewUrl = "http://localhost:9090/#/template";
qiniuImgUrl = "https://test1-file.yunqueyi.com";
resource_url = "https://test-file.yunqueyi.com";
......@@ -64,6 +66,7 @@ export const getAddress = () => {
qiniuFileUrl = "http://dev-sc.yunqueyi.com/contents/admin/qiniu/token1";
qiniuResourceUrl = "https://test1-videos.yunqueyi.com";
} else if (isNotEmptyUtils(env)) {//测试test1 test2 uat
versionUrl = 'https://' + env + '-dev.yunqueyi.com';
preViewUrl = "https://" + env + "-phome.yunqueyi.com" + "/template/#/template"
qiniuFileUrl = "https://" + env + "-sc.yunqueyi.com" + "/contents/admin/qiniu/token1";
qiniuImgUrl = "https://test1-file.yunqueyi.com";
......@@ -97,6 +100,7 @@ export const getAddress = () => {
lectureUrl = "https://" + env + "-sc.yunqueyi.com"
}
} else {//生产环境
versionUrl = 'https://dev.yunqueyi.com';
preViewUrl = "https://phome.yunqueyi.com" + "/template/#/template"
qiniuFileUrl = "https://sc.yunqueyi.com" + "/contents/admin/qiniu/token1";
qiniuImgUrl = "https://files.yunqueyi.com";//qiniu存储域名
......@@ -116,6 +120,7 @@ export const getAddress = () => {
qiniuResourceUrl = "https://video.yunqueyi.com";//qiniu存储域名
exam_url = "https://sc.yunqueyi.com/exams";
}
localStorage.setItem("versionUrl",versionUrl);
localStorage.setItem("preViewUrl",preViewUrl);
localStorage.setItem("qiniuFileUrl", qiniuFileUrl);
localStorage.setItem("qiniuImgUrl", qiniuImgUrl);
......
......@@ -10,7 +10,7 @@
<el-form ref="form" :model="searchParam" label-suffix=":" style="width:100%;">
<el-col :span="21">
<el-form-item label="漏斗名称">
<el-input v-model="searchParam.name" maxlength="20" placeholder="请输入漏斗名称" style="width:288px;"></el-input>
<el-input v-model="searchParam.name" maxlength="30" placeholder="请输入漏斗名称" style="width:288px;"></el-input>
</el-form-item>
</el-col>
<el-col :span="3" style="padding:0;text-align:right;padding-right:15px;">
......@@ -21,7 +21,7 @@
<div class="add-step">
<p>请以用户逐步触发的事件为依据,构造漏斗、系统会自动计算整个过程的转化率。如果事件之间不连续,转化率为0!</p>
</div>
<div class="step-content" v-for="(item,index) in stepArray" :key="index">
<div class="step-content" v-for="(item,index) in searchParam.actionModelList" :key="index">
<span>步骤{{index + 1}}</span>
<el-form
ref="form"
......@@ -31,17 +31,17 @@
style="width:100%;">
<el-col :span="11">
<el-form-item label="步骤名称">
<el-input v-model="item.name" maxlength="20" placeholder="请输入步骤名称" style="width:200px;"></el-input>
<el-input v-model="item.actionName" maxlength="30" placeholder="请输入步骤名称" style="width:200px;"></el-input>
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="触发事件">
<el-select v-model="item.event" placeholder="请选择用户触发事件" style="width:200px">
<el-select v-model="item.eventId" filterable placeholder="请选择用户触发事件" style="width:200px">
<el-option
v-for="(eItem,eIndex) in eventSelect"
:key="eIndex"
:label="eItem.label"
:value="eItem.value">
:label="eItem.eventName"
:value="eItem.eventId">
</el-option>
</el-select>
</el-form-item>
......@@ -56,35 +56,100 @@
</div>
</template>
<script>
import { openLoading, closeLoading } from "../../common/utils";
export default {
data() {
return {
funnelId: '',
searchParam: {
name: ''
},
stepArray: [
name: '',
actionModelList: [
{
name: '',
event: ''
}
],
actionName: '',
eventId: ''
}]
},
eventSelect: []
}
},
created() {
this.funnelId = this.$route.query.id;
},
mounted() {
this.getEventList();
if(this.funnelId) this.getFunnelDetail();
},
methods: {
// 封装一下请求通用的方法
getData(type, url, req, callback) {
openLoading(this);
this.$axios[type](localStorage.getItem("lectureUrl") + url, req)
.then(res => {
closeLoading(this);
let data = res.data;
if (data.code == "000000") {
if (callback) callback(data);
} else {
this.$message.error(data.message);
}
})
},
// 获取触发事件列表
getEventList() {
let req = this.searchParam.name;
this.getData(
"get", `/session/funnel/eventList?searchName=${req}`, {},
res => {
this.eventSelect = res.data;
}
);
},
// 编辑获取漏斗详情
getFunnelDetail() {
this.getData(
"get", `/session/funnel/detail/${this.funnelId}`, {},
res => {
if(res.code == '000000') {
this.searchParam = res.data;
}
}
);
},
// 保存
saveAddAndEdit() {
if(!this.searchParam.name) {
this.$message.error('请输入漏斗名称');
return;
}
for(let i = 0; i < this.searchParam.actionModelList.length; i++) {
if(!this.searchParam.actionModelList[i].eventId) {
this.$message.error('触发事件不能为空');
return;
}
}
let req = this.searchParam;
this.getData(
"post", `/session/funnel/save`, req,
res => {
if(res.code == '000000') {
this.$message.success('转化漏斗创建成功');
this.$router.push({ path: 'user-path' });
}else {
this.$message.error(res.message);
}
}
);
},
// 删除步骤
deleteSteps(i) {
this.stepArray.splice(i,1);
this.$message.success('删除成功');
this.searchParam.actionModelList.splice(i,1);
},
// 增加步骤
addSteps() {
this.stepArray.push({
name: '',
event: ''
this.searchParam.actionModelList.push({
actionName: '',
eventId: ''
});
}
}
......
......@@ -11,11 +11,23 @@
<el-col :span="10">
<el-form-item label="时间">
<el-date-picker
v-model="searchParam.time"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期">
type="date"
placeholder="开始时间"
v-model="searchParam.startDate"
style="width: 200px;"
:picker-options="endDateOpt"
value-format="yyyy-MM-dd 00:00:00"
>
</el-date-picker>
<span>-</span>
<el-date-picker
type="date"
placeholder="结束时间"
v-model="searchParam.endDate"
style="width: 200px;"
:picker-options="endDateOpt1"
value-format="yyyy-MM-dd 23:59:59"
>
</el-date-picker>
</el-form-item>
</el-col>
......@@ -41,19 +53,19 @@
<div class="data-num">
<div class="num-text first-num">
<span>总人数</span>
<p>543233<span></span></p>
<p>{{funnelData.userCountTotal}}<span></span></p>
</div>
<div class="num-text">
<span>总转化率</span>
<p>20.47%</p>
<p>{{funnelData.inversionRateTotal}}%</p>
</div>
<div class="num-text">
<span>达成目标人数</span>
<p>234<span></span></p>
<p>{{funnelData.userCountLast}}<span></span></p>
</div>
<div class="num-text num">
<span>转化率最低步骤</span>
<p>点击【相关推荐内容】</p>
<p>{{funnelData.funnelNameLast}}</p>
</div>
</div>
<div class="data-analysis">
......@@ -61,13 +73,13 @@
<div ref="chart" class="echart"></div>
<el-table
class="data-table"
:data="tableData"
:data="funnelData.funnelReportModels"
style="width: 100%">
<el-table-column prop="step" label="步骤" min-width="140" align="center"></el-table-column>
<el-table-column prop="name" label="步骤名称" min-width="140" align="center"></el-table-column>
<el-table-column prop="userNum" label="用户数" min-width="150" align="center"></el-table-column>
<el-table-column prop="pre" label="较上一步转化率" min-width="150" align="center"></el-table-column>
<el-table-column prop="all" label="总转化率" min-width="150" align="center"></el-table-column>
<el-table-column prop="funnel" label="步骤" min-width="140" align="center"></el-table-column>
<el-table-column prop="funnelName" label="步骤名称" min-width="140" align="center"></el-table-column>
<el-table-column prop="userCount" label="用户数" min-width="150" align="center"></el-table-column>
<el-table-column prop="inversionRate" label="较上一步转化率" min-width="150" align="center"></el-table-column>
<el-table-column prop="inversionRateTotal" label="总转化率" min-width="150" align="center"></el-table-column>
</el-table>
</div>
</div>
......@@ -76,72 +88,85 @@
</template>
<script>
let url = 'image://data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAARCAMAAACLgl7OAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAaVBMVEUAAADBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcEAAAD45xibAAAAInRSTlMAmT6WJYwSfBMGZAFHmEgtkBeCCW0KAlI1k5QeiA10A1tc7ah1owAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAB7SURBVCjPtZDZDoAgDAQXvA+8bwX1/3/SGKIBEd+cx07TdgtIiAF0/mygDvnAoYDr2b3nnjP8wOaDUG6J4ncfR9cdScpMzbJECZEXT1/kesyy0n1VPv6AulF908Kg6+9DWN/hjWGUfhpgYV5Ov8ywwgUhguODddtXvXIAjuUEs/70/t4AAAAldEVYdGRhdGU6Y3JlYXRlADIwMTktMTItMTZUMTU6MzM6MDkrMDg6MDCzL2BEAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE5LTEyLTE2VDE1OjMzOjA5KzA4OjAwwnLY+AAAAABJRU5ErkJggg==';
import { openLoading, closeLoading } from "../../common/utils";
export default {
data() {
return {
name: '测试',
funnelId: '',
name: '',
searchParam: {
time: '',
endDate: '2020-11-23',
startDate: '2020-11-20',
version: ''
},
versionSelect: [], // 版本下拉数据
tableData: [{
step: '步骤1',
name: '点击【微专业】',
userNum: 54343,
pre: 98.00,
all: 67.34
},{
step: '步骤2',
name: '点击【课程】',
userNum: 54343,
pre: 98.00,
all: 67.34
}]
funnelData: {},
endDateOpt: {
disabledData: (time) => {
if ( this.searchParam.endDate != "" && this.searchParam.endDate != null) {
return (
time.getTime() > new Date(this.searchParam.endDate).getTime()
);
}
}
},
endDateOpt1: {
disabledDate: time => {
return (
time.getTime() < new Date(this.searchParam.startDate).getTime()
);
}
}
}
},
created() {
this.funnelId = this.$route.query.id;
this.name = this.$route.query.name;
},
mounted() {
this.initCharts();
this.getAnalysisData();
this.getVersionData();
},
methods: {
// 封装一下请求通用的方法
getData(type, url, req, callback) {
openLoading(this);
this.$axios[type](localStorage.getItem("lectureUrl") + url, req)
.then(res => {
closeLoading(this);
let data = res.data;
if (data.code == "000000") {
if (callback) callback(data);
} else {
this.$message.error(data.message);
}
})
},
// 获取版本号数据
getVersionData() {
openLoading(this);
this.$axios.get(localStorage.getItem("versionUrl") + '/api/PICAVersionServiceImpl/getVersionList', {})
.then(res => {
closeLoading(this);
})
},
// 获取漏斗分析数据
getAnalysisData() {
let req = this.searchParam;
this.getData(
"get", `/session/funnel/report?endDate=${req.endDate}&funnelId=${this.funnelId}&startDate=${req.endDate}&version=${req.version}`, {},
res => {
if(res.code == '000000') {
this.funnelData = res.data;
this.initCharts();
}
}
);
},
// 初始化图标
initCharts() {
let lineargroup = [{
value: 200,
oriname: "点击【微专业】",
number: 98756,
color: ["rgba(29,211,137,0.8)", "rgba(29,211,137,0)"]
},
{
value: 150,
oriname: "点击【课程】",
number: 88756,
pointValue: 69.23,
color: ["rgba(102,142,255,0.7)", "rgba(102,142,255,0)"]
},
{
value: 100,
oriname: "点击【相关推荐内容】",
number: 78756,
pointValue: 35.21,
color: ["rgba(255,198,82,0.6)", "rgba(255,198,82,0)"]
},
{
value: 60,
oriname: "点击【健康漫画】",
number: 456,
pointValue: 15.21,
color: ["rgba(255,198,82,0.6)", "rgba(255,198,82,0)"]
},
{
value:30,
oriname: "点击【更多】",
number: 56,
pointValue: 5.21,
color: ["rgba(255,198,82,0.6)", "rgba(255,198,82,0)"]
},
];
let lineargroup = this.funnelData.funnelReportModels;
let len = lineargroup.length;
let colorObj = {
type: 'linear',
......@@ -161,28 +186,28 @@ export default {
let data1 = [], dataArr = [], valueArr = [], lineArr = [], linksArr = [];
for (let i = 0; i < lineargroup.length; i++) {
let obj1 = {
value: lineargroup[i].value,
num: lineargroup[i].number,
name: lineargroup[i].oriname
value: 200 - i * 40,
num: lineargroup[i].userCount,
name: lineargroup[i].funnelName
};
data1.push(obj1);
if(i != (lineargroup.length - 1)) {
dataArr.push('转化率');
valueArr.push({value: '100'}); // 步骤箭头
linksArr.push({ // 转化率线
source: lineargroup[i].oriname,
target: lineargroup[i + 1].oriname,
value: lineargroup[i + 1].pointValue,
source: lineargroup[i].funnelName,
target: lineargroup[i + 1].funnelName,
value: lineargroup[i + 1].inversionRate,
lineStyle: {
normal: {
curveness: parseInt(len - i) + 1,
curveness: parseInt(len - i) + 4,
color: colorObj
}
}
})
}
lineArr.push({
name: lineargroup[i].oriname,
name: lineargroup[i].funnelName,
x: 400,
y: 0 + i*15
});
......@@ -190,10 +215,10 @@ export default {
let option = {
backgroundColor: '#ffffff',
grid: {
top: 110 - len * 5, // 箭头距离顶部高度
top: 115 - len * 4, // 箭头距离顶部高度 3-115 4-
left: "-34%",
right: 20,
height: 115 + len * 15, // 箭头之间的距离
height: 50 + len * 30, // 箭头之间的距离 3-145 4-
bottom: '0'
},
xAxis: {
......@@ -244,7 +269,7 @@ export default {
z: 1,
top: 20,
left: 500,
height: 286,
height: 306,
type: 'graph',
layout: 'none',
symbolSize: 0,
......
......@@ -114,12 +114,12 @@ export default {
this.$router.push({ path: 'add-funnel' });
},
// 查看数据
visitData() {
this.$router.push({ path: 'path-data' });
visitData(row) {
this.$router.push({ path: 'path-data',query: {id: row.id, name: row.name} });
},
// 编辑
editColumn(row) {
this.$router.push({ path: 'add-funnel' ,query: {id: row.id}});
this.$router.push({ path: 'add-funnel',query: {id: row.id}});
},
// 删除确认框
deleteConfirm(row) {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册