feat: 新增雷达mock

This commit is contained in:
奔跑的面条 2022-09-08 17:01:21 +08:00
parent b618ecfef2
commit 0f30ac9694
3 changed files with 65 additions and 4 deletions

View File

@ -10,6 +10,7 @@ export const textUrl = '/mock/text'
export const imageUrl = '/mock/image'
export const rankListUrl = '/mock/rankList'
export const scrollBoardUrl = '/mock/scrollBoard'
export const radarUrl = '/mock/radarData'
const mockObject: MockMethod[] = [
{
@ -48,7 +49,12 @@ const mockObject: MockMethod[] = [
url: scrollBoardUrl,
method: RequestHttpEnum.GET,
response: () => test.fetchScrollBoard
}
},
{
url: radarUrl,
method: RequestHttpEnum.GET,
response: () => test.fetchRadar
},
]
export default mockObject

View File

@ -79,29 +79,72 @@ export default {
['行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'
}
]
}
}
}

View File

@ -62,7 +62,16 @@ import { selectTypeOptions, selectTimeOptions } from '@/views/chart/ContentConfi
import { RequestHeader } from '../RequestHeader'
import { isDev } from '@/utils'
import { icon } from '@/plugins'
import { chartDataUrl, rankListUrl, scrollBoardUrl, numberFloatUrl, numberIntUrl, textUrl, imageUrl } from '@/api/mock'
import {
chartDataUrl,
rankListUrl,
scrollBoardUrl,
numberFloatUrl,
numberIntUrl,
textUrl,
imageUrl,
radarUrl
} from '@/api/mock'
const { HelpOutlineIcon } = icon.ionicons5
const { targetData, chartEditStore } = useTargetData()
@ -90,6 +99,9 @@ const apiList = [
},
{
value: `【滚动表格】${scrollBoardUrl}`
},
{
value: `【雷达】${radarUrl}`
}
]
</script>