Commit 393abdee by chenwq

feat(behaviorManage): 新增用户行为路径分析功能及相关页面组件

- 添加行为管理模块的路由配置
- 实现用户行为路径分析的桑基图组件
- 创建路径列表、LTV列表和属性列表页面
- 修改配置获取逻辑以适应新功能需求
- 调整qiankun微前端配置以支持新模块
1 parent bec40147
......@@ -11,14 +11,16 @@
let cfg = require('./conf.js')
import { Http } from 'glsx-common'
let timeout = 30000 //超时时间
export const fetchConfig = function(isEnv = true) {
if (isEnv) {
let { request } = cfg
Object.assign(request, { timeout })
return Promise.resolve(cfg)
}
export const fetchConfig = function(common) {
// if (isEnv) {
// let { request } = cfg
// Object.assign(request, { timeout })
// return Promise.resolve(cfg)
// }
return new Http({ request: { timeout: 3000 } }).get('https://oss-config.glsx.com.cn/mock/616d3b131072f92988f05a01/custom/config2')
let params = { moduleName: 'custom', mockUrl: 'https://oss-config.glsx.com.cn/mock/643e06c7ea3da3a974f54357/custom/config', httpOptions: { Headers: { refererurl: location.href }, request: { timeout: 30000 } } }
return common.utils.getConfig(params)
// return new Http({ request: { timeout: 3000 } }).get('https://oss-config.glsx.com.cn/mock/616d3b131072f92988f05a01/custom/config2')
//开发环境mock
// return new Http({ request: { timeout: 3000 } }).get('http://192.168.3.171:7300/mock/616d3b131072f92988f05a01/custom/config2')
}
......
......@@ -160,6 +160,24 @@ const staticRoutes = Object.freeze([
path: '/leadManage/leadBasicInfo/:id/:type',
component: resolve => require([`@/views/leadManage/leadBasicInfo.vue`], resolve),
meta: {}
},
{
name: 'behaviorManage',
path: '/behaviorManage/pathList',
component: resolve => require([`@/views/behaviorManage/pathList.vue`], resolve),
meta: {}
},
{
name: 'LTVList',
path: '/behaviorManage/LTVList',
component: resolve => require([`@/views/behaviorManage/LTVList.vue`], resolve),
meta: {}
},
{
name: 'behaviorDetail',
path: '/behaviorManage/attributeList',
component: resolve => require([`@/views/behaviorManage/attributeList.vue`], resolve),
meta: {}
}
])
export default staticRoutes
......
......@@ -22,24 +22,24 @@ let router = null
let instance = null
// http:调的是新版标签的接口,http2:调的是客户相关接口;http3:企微授权那边的接口 目前导出接口都测试的:http3
export async function bootstrap({ name, id, history, common, messenger, globalState, routerBase }) {
const { response, request, request2, request3, request4, sign, secret, sign_common, request_common } = await fetchConfig(globalState.configSwitch) //globalState.configSwitch
Vue.prototype.$history = history
Vue.prototype.$messenger = messenger
Vue.prototype.$globalState = globalState
Vue.prototype.$common = common
Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: message.error, headers: { token: globalState.session.token } })
Vue.prototype.$http2 = new common.Http({ response, request: request2, sign, secret, alert: message.error, headers: { token: globalState.session.token } })
Vue.prototype.$http3 = new common.Http({ response, request: request3, sign, secret, alert: message.error, headers: { token: globalState.session.token } })
// Vue.prototype.$http4 = new common.Http({ response, request: request4, sign, secret, alert: message.error, headers: { token: 'scrm-base-e2d4f962-4ca3-4044-83e7-01ba314d8e3d-rop' } })
// Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: message.error, headers: { token: "mini-14eda653-4284-4165-bb85-325bb82a516d-rop" } })
Vue.prototype.$http_common = new common.Http({ response, signWay: 'md5', request: request_common, sign: sign_common, secret, alert: ElementUI.Message.error, headers: { TGT: globalState.session.token } })
// Vue.prototype.$setGlobalState = globalState.actions.setGlobalState
//Vue.use(GLButton, { permissions: globalState.permissions || ['1-1-1-1', '2-1-1-1', '3-1-1-1'] })
const routesData = common.utils.deepClone(globalState.routers)
routes = getRoutes(routesData)
// { name, id, }
subscribe({ messenger })
Vue.use(GLButton, { routes, routerBase })
const { response, request, request2, request3, request4, sign, secret, sign_common, request_common } = await fetchConfig(common) //globalState.configSwitch
Vue.prototype.$history = history
Vue.prototype.$messenger = messenger
Vue.prototype.$globalState = globalState
Vue.prototype.$common = common
Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: message.error, headers: { token: globalState.session.token } })
Vue.prototype.$http2 = new common.Http({ response, request: request2, sign, secret, alert: message.error, headers: { token: globalState.session.token } })
Vue.prototype.$http3 = new common.Http({ response, request: request3, sign, secret, alert: message.error, headers: { token: globalState.session.token } })
// Vue.prototype.$http4 = new common.Http({ response, request: request4, sign, secret, alert: message.error, headers: { token: 'scrm-base-e2d4f962-4ca3-4044-83e7-01ba314d8e3d-rop' } })
// Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: message.error, headers: { token: "mini-14eda653-4284-4165-bb85-325bb82a516d-rop" } })
Vue.prototype.$http_common = new common.Http({ response, signWay: 'md5', request: request_common, sign: sign_common, secret, alert: ElementUI.Message.error, headers: { TGT: globalState.session.token } })
// Vue.prototype.$setGlobalState = globalState.actions.setGlobalState
//Vue.use(GLButton, { permissions: globalState.permissions || ['1-1-1-1', '2-1-1-1', '3-1-1-1'] })
const routesData = common.utils.deepClone(globalState.routers)
routes = getRoutes(routesData)
// { name, id, }
subscribe({ messenger })
Vue.use(GLButton, { routes, routerBase })
}
export async function mount(props) {
const insts = render(props.routerBase, routes)
......
<template>
<div>
<div class="scrm-sub-client-container">
<div class="pageContent">
<GLCombiForm ref="combiForm" :formObj="searchForm" :formData="clientManageFormList" @handleOk="searchTable" @handleRest="resetTable"></GLCombiForm>
</div>
</div>
</div>
</template>
<script>
import { getDictionaryFun } from '@/api/modules/clientManage'
export default {
name: 'LTVList',
data() {
return {
searchForm: {
addWay: ''
},
clientManageFormList: [
{
type: 'input',
inputType: 'text',
name: 'customerName',
label: '客户名称',
placeholder: '请输入客户名称'
},
{
type: 'select',
name: 'addWay',
label: '添加来源',
optionLabel: 'label',
optionId: 'value',
placeholder: '请选择当前来源',
optionList: [] //this.$Constants.SOURCE_OPTION
},
{
type: 'datePicker',
name: 'purchaseCar',
label: '购车时间',
valueFormat: 'yyyy-MM-dd',
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now() || time.getTime() < new Date('2017-12-31').getTime()
}
}
}
],
sourceList: []
}
},
created() {
this.getDictionaryFun()
},
methods: {
getDictionaryFun() {
getDictionaryFun({ dictType: 'add_way' }).then(res => {
if (!res) {
return
}
// addWaySource
const id = this.clientManageFormList.findIndex(item => {
return item.name == 'addWay'
})
let data = res.map(item => {
return {
// ...item,
label: item.dictLabel,
value: item.dictValue
}
})
data.unshift({ label: '全部', value: '' })
this.sourceList = data || []
if (data && data.length > 0) {
window.localStorage.setItem('sourceList', JSON.stringify(data))
}
this.$set(this.clientManageFormList[id], 'optionList', data)
})
},
//搜索表格
searchTable() {
this.$refs.clientManage.refreshTable()
},
//重置表格
resetTable() {
this.searchForm = {}
this.$refs.clientManage.refreshTable()
// 点击之后强制页面刷新
// this.reload()
// this.$forceUpdate() // 没用
// this.$router.go(0)//没有预期效果,会出现一段空白页,用户体验不好
// location.reload() //没有预期效果,会出现一段空白页,用户体验不好
},
},
mounted() {}
}
</script>
<style lang="scss" scoped>
@import '@/styles/variables.scss';
@import '@/styles/resetelement.scss';
// /deep/.el-table .el-table__header tr th{
// line-height: 30px;
// }
.expandImg {
display: flex;
// justify-content: center;
.smallFontSize {
margin-left: 2px;
height: 20px;
font-size: 12px;
letter-spacing: 0;
line-height: 20px;
font-weight: 400;
}
.imgEll {
margin-left: 6.5px;
cursor: pointer;
// margin-bottom:3px;
}
}
.pure-green-text {
color: #61cc43;
}
.pure-yello-text {
color: #fb8f28;
}
.scrm-sub-client-container {
.pageTitle {
margin-bottom: 20px;
position: relative;
height: 20px;
font-size: 20px;
font-weight: 700;
color: #333333;
line-height: 20px;
letter-spacing: 1px;
}
.pageContent {
.leadList {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 8px;
div {
text-align: center;
span:nth-child(1) {
font-weight: 600;
font-size: 16px;
}
}
/deep/ .el-button {
color: #5850ff;
border: 1px solid #5850ff;
}
}
padding: 20px 20px 30px;
background-color: #fff;
.el-button + .el-button {
margin-left: 10px;
}
.searchTop {
// margin-bottom: 20px;
}
.glsx-table {
// /deep/ .el-table__fixed {
// height: 100% !important; //设置高优先,以覆盖内联样式
// }
/deep/ .el-table__fixed,
/deep/ .el-table__fixed-right {
height: 100% !important; //设置高优先,以覆盖内联样式
}
}
.entmicro {
display: flex;
i {
color: #75acff;
margin-right: 3px;
font-size: 14px;
}
// }
}
.el-tag {
// margin-right: 10px;
max-width: 110px;
cursor: pointer;
background-color: #fff !important;
}
}
}
</style>
<template>
<div>
<div class="scrm-sub-client-container">
<div class="pageContent">
<GLCombiForm ref="combiForm" :formObj="searchForm" :formData="clientManageFormList" @handleOk="searchTable" @handleRest="resetTable"></GLCombiForm>
</div>
</div>
</div>
</template>
<script>
import { getDictionaryFun } from '@/api/modules/clientManage'
export default {
name: 'attributeList',
data() {
return {
searchForm: {
addWay: ''
},
clientManageFormList: [
{
type: 'input',
inputType: 'text',
name: 'customerName',
label: '客户名称',
placeholder: '请输入客户名称'
},
{
type: 'select',
name: 'addWay',
label: '添加来源',
optionLabel: 'label',
optionId: 'value',
placeholder: '请选择当前来源',
optionList: [] //this.$Constants.SOURCE_OPTION
},
{
type: 'datePicker',
name: 'purchaseCar',
label: '购车时间',
valueFormat: 'yyyy-MM-dd',
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now() || time.getTime() < new Date('2017-12-31').getTime()
}
}
}
],
sourceList: []
}
},
created() {
this.getDictionaryFun()
},
methods: {
getDictionaryFun() {
getDictionaryFun({ dictType: 'add_way' }).then(res => {
if (!res) {
return
}
// addWaySource
const id = this.clientManageFormList.findIndex(item => {
return item.name == 'addWay'
})
let data = res.map(item => {
return {
// ...item,
label: item.dictLabel,
value: item.dictValue
}
})
data.unshift({ label: '全部', value: '' })
this.sourceList = data || []
if (data && data.length > 0) {
window.localStorage.setItem('sourceList', JSON.stringify(data))
}
this.$set(this.clientManageFormList[id], 'optionList', data)
})
},
//搜索表格
searchTable() {
this.$refs.clientManage.refreshTable()
},
//重置表格
resetTable() {
this.searchForm = {}
this.$refs.clientManage.refreshTable()
// 点击之后强制页面刷新
// this.reload()
// this.$forceUpdate() // 没用
// this.$router.go(0)//没有预期效果,会出现一段空白页,用户体验不好
// location.reload() //没有预期效果,会出现一段空白页,用户体验不好
},
},
mounted() {}
}
</script>
<style lang="scss" scoped>
@import '@/styles/variables.scss';
@import '@/styles/resetelement.scss';
// /deep/.el-table .el-table__header tr th{
// line-height: 30px;
// }
.expandImg {
display: flex;
// justify-content: center;
.smallFontSize {
margin-left: 2px;
height: 20px;
font-size: 12px;
letter-spacing: 0;
line-height: 20px;
font-weight: 400;
}
.imgEll {
margin-left: 6.5px;
cursor: pointer;
// margin-bottom:3px;
}
}
.pure-green-text {
color: #61cc43;
}
.pure-yello-text {
color: #fb8f28;
}
.scrm-sub-client-container {
.pageTitle {
margin-bottom: 20px;
position: relative;
height: 20px;
font-size: 20px;
font-weight: 700;
color: #333333;
line-height: 20px;
letter-spacing: 1px;
}
.pageContent {
.leadList {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 8px;
div {
text-align: center;
span:nth-child(1) {
font-weight: 600;
font-size: 16px;
}
}
/deep/ .el-button {
color: #5850ff;
border: 1px solid #5850ff;
}
}
padding: 20px 20px 30px;
background-color: #fff;
.el-button + .el-button {
margin-left: 10px;
}
.searchTop {
// margin-bottom: 20px;
}
.glsx-table {
// /deep/ .el-table__fixed {
// height: 100% !important; //设置高优先,以覆盖内联样式
// }
/deep/ .el-table__fixed,
/deep/ .el-table__fixed-right {
height: 100% !important; //设置高优先,以覆盖内联样式
}
}
.entmicro {
display: flex;
i {
color: #75acff;
margin-right: 3px;
font-size: 14px;
}
// }
}
.el-tag {
// margin-right: 10px;
max-width: 110px;
cursor: pointer;
background-color: #fff !important;
}
}
}
</style>
<template>
<div class="path-flow-container">
<div ref="chart" class="chart-container"></div>
</div>
</template>
<script>
import * as echarts from 'echarts'
import { nodes, links } from './chartData'
export default {
name: 'PathFlowChart',
data() {
return {
chart: null
}
},
mounted() {
this.$nextTick(() => {
this.initChart()
window.addEventListener('resize', this.resizeChart)
})
},
beforeDestroy() {
window.removeEventListener('resize', this.resizeChart)
if (this.chart) {
this.chart.dispose()
}
},
methods: {
resizeChart() {
if (this.chart) {
this.chart.resize()
}
},
initChart() {
const chartDom = this.$refs.chart
this.chart = echarts.init(chartDom)
const option = {
title: {
text: '用户行为路径分析',
left: 'center',
top: 10
},
tooltip: {
trigger: 'item',
triggerOn: 'mousemove'
},
series: [
{
type: 'sankey',
data: nodes,
links: links,
left: '3%',
right: '3%',
top: '5%',
bottom: '5%',
nodeWidth: 100,
nodeGap: 15,
layoutIterations: 0,
emphasis: {
focus: 'adjacency'
},
itemStyle: {
borderWidth: 1,
borderColor: '#fff'
},
lineStyle: {
color: 'gradient',
curveness: 0.5,
opacity: 0.3
},
label: {
position: 'inside',
formatter: function(params) {
// Hide label for loss nodes if any (though we set show:false in data)
if (params.data.isLoss) return ''
const name = params.name.replace(/\s\(\d+\)$/, '')
return `{name|${name}}\n{value|${params.data.value}}`
},
rich: {
name: {
fontSize: 12,
fontWeight: 'bold',
color: '#fff',
lineHeight: 18
},
value: {
fontSize: 12,
color: '#fff',
lineHeight: 18
}
}
}
}
]
}
this.chart.setOption(option)
}
}
}
</script>
<style scoped>
.path-flow-container {
width: 100%;
background: #fff;
margin-top: 20px;
padding: 20px;
border-radius: 4px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}
.chart-container {
width: 100%;
height: 800px;
}
</style>
<template>
<div>
<div class="scrm-sub-client-container">
<div class="pageContent">
<GLCombiForm ref="combiForm" :formObj="searchForm" :formData="clientManageFormList" @handleOk="searchTable" @handleRest="resetTable"></GLCombiForm>
<PathFlowChart />
</div>
</div>
</div>
</template>
<script>
import PathFlowChart from './components/PathFlowChart'
const EVENT_OPTIONS = [
// App相关
{ label: 'App激活', value: 'App激活' },
{ label: 'App浏览页面', value: 'App浏览页面' },
{ label: 'App元素点击', value: 'App元素点击' },
{ label: 'App推送点击', value: 'App推送点击' },
// Web/小程序/微信
{ label: 'web浏览页面', value: 'web浏览页面' },
{ label: '小程序首次启动', value: '小程序首次启动' },
{ label: '小程序浏览页面', value: '小程序浏览页面' },
{ label: '微信端内活跃', value: '微信端内活跃' },
// 通用行为
{ label: '搜索', value: '搜索' },
{ label: '签到', value: '签到' },
{ label: '所有支付', value: '所有支付' }
]
export default {
name: 'pathList',
components: {
PathFlowChart
},
data() {
return {
searchForm: {
addWay: [],
customerName: '',
purchaseCar: ''
},
clientManageFormList: [
{
type: 'input',
inputType: 'text',
name: 'customerName',
label: '客户名称',
placeholder: '请输入客户名称'
},
{
type: 'select',
name: 'addWay',
label: '事件选择',
multiple: true,
collapseTags: true,
optionLabel: 'label',
optionId: 'value',
placeholder: '请选择事件',
optionList: EVENT_OPTIONS
},
{
type: 'datePicker',
name: 'purchaseCar',
label: '时间选择',
valueFormat: 'yyyy-MM-dd',
dateType: 'week',
attrs: {
format: 'yyyy 第 WW 周'
},
customPickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now() || time.getTime() < new Date('2017-12-31').getTime()
}
}
}
]
}
},
created() {},
methods: {
//搜索表格
searchTable() {
this.$refs.clientManage.refreshTable()
},
//重置表格
resetTable() {
this.searchForm = {}
this.$refs.clientManage.refreshTable()
// 点击之后强制页面刷新
// this.reload()
// this.$forceUpdate() // 没用
// this.$router.go(0)//没有预期效果,会出现一段空白页,用户体验不好
// location.reload() //没有预期效果,会出现一段空白页,用户体验不好
},
},
mounted() {}
}
</script>
<style lang="scss" scoped>
@import '@/styles/variables.scss';
@import '@/styles/resetelement.scss';
// /deep/.el-table .el-table__header tr th{
// line-height: 30px;
// }
.expandImg {
display: flex;
// justify-content: center;
.smallFontSize {
margin-left: 2px;
height: 20px;
font-size: 12px;
letter-spacing: 0;
line-height: 20px;
font-weight: 400;
}
.imgEll {
margin-left: 6.5px;
cursor: pointer;
// margin-bottom:3px;
}
}
.pure-green-text {
color: #61cc43;
}
.pure-yello-text {
color: #fb8f28;
}
.scrm-sub-client-container {
.pageTitle {
margin-bottom: 20px;
position: relative;
height: 20px;
font-size: 20px;
font-weight: 700;
color: #333333;
line-height: 20px;
letter-spacing: 1px;
}
.pageContent {
.leadList {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 8px;
div {
text-align: center;
span:nth-child(1) {
font-weight: 600;
font-size: 16px;
}
}
/deep/ .el-button {
color: #5850ff;
border: 1px solid #5850ff;
}
}
padding: 20px 20px 30px;
background-color: #fff;
.el-button + .el-button {
margin-left: 10px;
}
.searchTop {
// margin-bottom: 20px;
}
.glsx-table {
// /deep/ .el-table__fixed {
// height: 100% !important; //设置高优先,以覆盖内联样式
// }
/deep/ .el-table__fixed,
/deep/ .el-table__fixed-right {
height: 100% !important; //设置高优先,以覆盖内联样式
}
}
.entmicro {
display: flex;
i {
color: #75acff;
margin-right: 3px;
font-size: 14px;
}
// }
}
.el-tag {
// margin-right: 10px;
max-width: 110px;
cursor: pointer;
background-color: #fff !important;
}
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!