perf: 新增单数据mock接口,优化漏斗图展示

This commit is contained in:
奔跑的面条 2022-09-08 20:23:01 +08:00
parent e2cda9140b
commit c9848e7b01
5 changed files with 51 additions and 7 deletions

View File

@ -4,6 +4,7 @@ import { RequestHttpEnum } from '@/enums/httpEnum'
// 单个X数据
export const chartDataUrl = '/mock/chartData'
export const chartSingleDataUrl = '/mock/chartSingleData'
export const numberFloatUrl = '/mock/number/float'
export const numberIntUrl = '/mock/number/int'
export const textUrl = '/mock/text'
@ -20,6 +21,11 @@ const mockObject: MockMethod[] = [
method: RequestHttpEnum.GET,
response: () => test.fetchMockData
},
{
url: chartSingleDataUrl,
method: RequestHttpEnum.GET,
response: () => test.fetchMockSingleData
},
{
url: numberFloatUrl,
method: RequestHttpEnum.GET,

View File

@ -1,4 +1,39 @@
export default {
// 单图表
fetchMockSingleData: {
code: 0,
status: 200,
msg: '请求成功',
data: {
dimensions: ['product', 'dataOne'],
source: [
{
product: '@name',
'dataOne|0-900': 3,
},
{
product: '@name',
'dataOne|0-900': 3,
},
{
product: '@name',
'dataOne|0-900': 3,
},
{
product: '@name',
'dataOne|0-900': 3,
},
{
product: '@name',
'dataOne|0-900': 3,
},
{
product: '@name',
'dataOne|0-900': 3,
}
]
}
},
// 图表
fetchMockData: {
code: 0,

View File

@ -31,7 +31,6 @@ export const option = {
width: '80%',
bottom: 10,
min: 0,
max: 100,
minSize: '0%',
maxSize: '100%',
sort: 'descending', // descending | ascending

View File

@ -1,10 +1,10 @@
{
"dimensions": ["product", "category"],
"dimensions": ["product", "dataOne"],
"source": [
{ "product": "data1", "category": 20 },
{ "product": "data2", "category": 40 },
{ "product": "data3", "category": 60 },
{ "product": "data4", "category": 80 },
{ "product": "data5", "category": 100 }
{ "product": "data1", "dataOne": 20 },
{ "product": "data2", "dataOne": 40 },
{ "product": "data3", "dataOne": 60 },
{ "product": "data4", "dataOne": 80 },
{ "product": "data5", "dataOne": 100 }
]
}

View File

@ -64,6 +64,7 @@ import { isDev } from '@/utils'
import { icon } from '@/plugins'
import {
chartDataUrl,
chartSingleDataUrl,
rankListUrl,
scrollBoardUrl,
numberFloatUrl,
@ -82,6 +83,9 @@ const apiList = [
{
value: `【图表】${chartDataUrl}`
},
{
value: `【单数据图表】${chartSingleDataUrl}`
},
{
value: `【文本】${textUrl}`
},