goview_vue/src/api/mock/test.mock.ts
2022-09-25 22:06:29 +08:00

250 lines
5.9 KiB
TypeScript

import heatmapJson from './heatMapData.json'
import scatterJson from './scatter.json'
import mapJson from './map.json'
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,
status: 200,
msg: '请求成功',
data: {
dimensions: ['product', 'dataOne', 'dataTwo'],
source: [
{
product: '@name',
'dataOne|100-900': 3,
'dataTwo|100-900': 3
},
{
product: '@name',
'dataOne|100-900': 3,
'dataTwo|100-900': 3
},
{
product: '@name',
'dataOne|100-900': 3,
'dataTwo|100-900': 3
},
{
product: '@name',
'dataOne|100-900': 3,
'dataTwo|100-900': 3
},
{
product: '@name',
'dataOne|100-900': 3,
'dataTwo|100-900': 3
},
{
product: '@name',
'dataOne|100-900': 3,
'dataTwo|100-900': 3
}
]
}
},
// 排名列表
fetchRankList: {
code: 0,
status: 200,
msg: '请求成功',
data: [
{ name: '@name', 'value|100-900': 5 },
{ name: '@name', 'value|100-900': 5 },
{ name: '@name', 'value|100-900': 5 },
{ name: '@name', 'value|100-900': 5 },
{ name: '@name', 'value|100-900': 5 },
{ name: '@name', 'value|100-900': 5 },
{ name: '@name', 'value|100-900': 5 },
{ name: '@name', 'value|100-900': 5 },
{ name: '@name', 'value|100-900': 5 },
{ name: '@name', 'value|100-900': 5 },
{ name: '@name', 'value|100-900': 5 },
{ name: '@name', 'value|100-900': 5 },
{ name: '@name', 'value|100-900': 5 }
]
},
// 轮播表格
fetchScrollBoard: {
code: 0,
status: 200,
msg: '请求成功',
data: [
['行1列1', '行1列2', '1'],
['行2列1', '行2列2', '2'],
['行3列1', '行3列2', '3'],
['行4列1', '行4列2', '4'],
['行5列1', '行5列2', '5'],
['行6列1', '行6列2', '6'],
['行7列1', '行7列2', '行7列3'],
['行8列1', '行8列2', '行8列3'],
['行9列1', '行9列2', '行9列3'],
['行10列1', '行10列2', '行10列3']
]
},
// 获取数字-浮点型
fetchNumberFloat: {
code: 0,
status: 200,
msg: '请求成功',
data: '@float(0, 0.99, 1, 4)'
},
// 获取数字-整型
fetchNumberInt: {
code: 0,
status: 200,
msg: '请求成功',
data: '@integer(0, 100)'
},
// 文字
fetchText: {
code: 0,
status: 200,
msg: '请求成功',
data: '@paragraph(1, 10)'
},
// 图片
fetchImage: (num: number) => ({
code: 0,
status: 200,
msg: '请求成功',
data: `https://robohash.org/${num}`
}),
// 雷达
fetchRadar: {
code: 0,
status: 200,
msg: '请求成功',
data: {
radarIndicator: [
{ name: '@name', max: 10000 },
{ name: '@name', max: 10000 },
{ name: '@name', max: 10000 },
{ name: '@name', max: 10000 },
{ name: '@name', max: 10000 },
{ name: '@name', max: 10000 }
],
seriesData: [
{
value: [
'@integer(0, 10000)',
'@integer(0, 10000)',
'@integer(0, 10000)',
'@integer(0, 10000)',
'@integer(0, 10000)',
'@integer(0, 10000)'
],
name: 'data1'
},
{
value: [
'@integer(0, 10000)',
'@integer(0, 10000)',
'@integer(0, 10000)',
'@integer(0, 10000)',
'@integer(0, 10000)',
'@integer(0, 10000)'
],
name: 'data2'
}
]
}
},
// 热力图
fetchHeatmap: {
code: 0,
status: 200,
msg: '请求成功',
data: heatmapJson
},
// 散点图
fetchScatterBasic: {
code: 0,
status: 200,
msg: '请求成功',
data: scatterJson
},
// 中国地图
fetchMap: {
code: 0,
status: 200,
msg: '请求成功',
data: mapJson
},
// 词云
fetchWordCloud: {
code: 0,
status: 200,
msg: '请求成功',
data: [
{
name: '@name',
value: 8000,
textStyle: {
color: '#78fbb2'
},
emphasis: {
textStyle: {
color: 'red'
}
}
},
{ name: '@name', value: '@integer(10, 8000)' },
{ name: '@name', value: '@integer(10, 8000)' },
{ name: '@name', value: '@integer(10, 8000)' },
{ name: '@name', value: '@integer(10, 8000)' },
{ name: '@name', value: '@integer(10, 8000)' },
{ name: '@name', value: '@integer(10, 8000)' },
{ name: '@name', value: '@integer(10, 8000)' },
{ name: '@name', value: '@integer(10, 8000)' },
{ name: '@name', value: '@integer(10, 8000)' },
{ name: '@name', value: '@integer(10, 8000)' },
{ name: '@name', value: '@integer(10, 8000)' },
{ name: '@name', value: '@integer(10, 8000)' },
{ name: '@name', value: '@integer(10, 8000)' },
{ name: '@name', value: '@integer(10, 8000)' },
{ name: '@name', value: '@integer(10, 8000)' },
{ name: '@name', value: '@integer(10, 8000)' },
{ name: '@name', value: '@integer(10, 8000)' },
{ name: '@name', value: '@integer(10, 8000)' },
{ name: '@name', value: '@integer(10, 8000)' }
]
}
}