Commit adc71002 by 胡悦

优化交互

1 parent e34ef0d6
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: huyue * @Author: huyue
* @Date: 2022-06-23 15:05:21 * @Date: 2022-06-23 15:05:21
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2022-06-30 18:34:48 * @LastEditTime: 2022-06-30 19:18:15
--> -->
<template> <template>
<div> <div>
...@@ -57,27 +57,27 @@ export default { ...@@ -57,27 +57,27 @@ export default {
{ {
name: '客流', name: '客流',
type: 'enter', type: 'enter',
value: '' value: 100
}, },
{ {
name: '留档', name: '留档',
type: 'stayfile', type: 'stayfile',
value: '' value: 80
}, },
{ {
name: '试驾', name: '试驾',
type: 'test', type: 'test',
value: '' value: 60
}, },
{ {
name: '订单', name: '订单',
type: 'placeorder', type: 'placeorder',
value: '' value: 40
}, },
{ {
name: '成交', name: '成交',
type: 'success', type: 'success',
value: '' value: 20
} }
], ],
option: {}, option: {},
...@@ -115,7 +115,7 @@ export default { ...@@ -115,7 +115,7 @@ export default {
if (res.code === '0') { if (res.code === '0') {
if (res.data.dataList.length) { if (res.data.dataList.length) {
res.data.dataList[0].num.forEach((item, index) => { res.data.dataList[0].num.forEach((item, index) => {
this.funnelData[index].value = item this.funnelData[index].num = item
}) })
this.hasData = res.data.dataList[0].num.every(i => i != 0) this.hasData = res.data.dataList[0].num.every(i => i != 0)
if (this.hasData) this.draw() if (this.hasData) this.draw()
...@@ -130,9 +130,12 @@ export default { ...@@ -130,9 +130,12 @@ export default {
tooltip: { tooltip: {
trigger: 'item', trigger: 'item',
backgroundColor: 'rgba(68,68,68,0.8)', backgroundColor: 'rgba(68,68,68,0.8)',
formatter: '{a} <br/>{b} : {c}', formatter: e => {
return `${e.data.name}: ${e.data.num}`
},
textStyle: { textStyle: {
color: '#fff' color: '#fff',
fontSize: 8
}, },
borderWidth: 0 borderWidth: 0
}, },
...@@ -145,9 +148,7 @@ export default { ...@@ -145,9 +148,7 @@ export default {
top: 8, top: 8,
bottom: 8, bottom: 8,
width: '100%', width: '100%',
min: 0, minSize: '30%',
// max: 10000,
minSize: '25%',
maxSize: '100%', maxSize: '100%',
sort: 'descending', sort: 'descending',
gap: 2, gap: 2,
...@@ -172,12 +173,6 @@ export default { ...@@ -172,12 +173,6 @@ export default {
} }
}, },
data: this.funnelData data: this.funnelData
// data: [
// { value: 20, name: 'Order' },
// { value: 40, name: 'Inquiry' },
// { value: 60, name: 'Visit' },
// { value: 80, name: 'Click' },
// { value: 100, name: 'Show' }
// ] // ]
} }
] ]
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: huyue * @Author: huyue
* @Date: 2022-06-23 15:05:21 * @Date: 2022-06-23 15:05:21
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2022-06-30 18:35:10 * @LastEditTime: 2022-06-30 19:15:13
--> -->
<template> <template>
<div> <div>
...@@ -85,7 +85,39 @@ export default { ...@@ -85,7 +85,39 @@ export default {
show: true, show: true,
borderWidth: 0, borderWidth: 0,
backgroundColor: 'rgba(68,68,68,0.80)', backgroundColor: 'rgba(68,68,68,0.80)',
// position: [20, 20], // position: (point, params, dom, rect, size) => {
// var x = 0 // x坐标位置
// var y = 0 // y坐标位置
// // 当前鼠标位置
// var pointX = point[0]
// var pointY = point[1]
// // 外层div大小
// // var viewWidth = size.viewSize[0];
// // var viewHeight = size.viewSize[1];
// // 提示框大小
// var boxWidth = size.contentSize[0]
// var boxHeight = size.contentSize[1]
// // boxWidth > pointX 说明鼠标左边放不下提示框
// if (boxWidth > pointX) {
// x = 5
// } else {
// // 左边放的下
// x = pointX - boxWidth
// }
// // boxHeight > pointY 说明鼠标上边放不下提示框
// if (boxHeight > pointY) {
// y = 5
// } else {
// // 上边放得下
// y = pointY - boxHeight
// }
// return [x, y]
// },
textStyle: { textStyle: {
color: '#FFFFFF', color: '#FFFFFF',
fontSize: 8 fontSize: 8
...@@ -95,7 +127,7 @@ export default { ...@@ -95,7 +127,7 @@ export default {
var txt = '' var txt = ''
e.forEach(item => { e.forEach(item => {
if (txt) { if (txt) {
txt = txt + '<br>' txt = txt + '<br />'
} }
txt = txt + item.seriesName + ':' + item.value txt = txt + item.seriesName + ':' + item.value
}) })
...@@ -114,12 +146,17 @@ export default { ...@@ -114,12 +146,17 @@ export default {
type: 'category', type: 'category',
axisLabel: { axisLabel: {
color: '#606266', color: '#606266',
fontSize: '0.8em' fontSize: 10
}, },
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] data: []
}, },
yAxis: { yAxis: {
type: 'value' type: 'value',
splitLine: {
lineStyle: {
color: '#606266'
}
}
}, },
series: [ series: [
{ {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!