goview_vue/src/api/mock/index.ts

121 lines
2.9 KiB
TypeScript
Raw Normal View History

2022-03-21 00:57:23 +08:00
import test from './test.mock'
2022-03-24 09:19:14 +08:00
import { MockMethod } from 'vite-plugin-mock'
import { RequestHttpEnum } from '@/enums/httpEnum'
2022-03-21 00:57:23 +08:00
// 单个X数据
export const chartDataUrl = '/mock/chartData'
export const chartSingleDataUrl = '/mock/chartSingleData'
2022-06-25 15:51:03 +08:00
export const numberFloatUrl = '/mock/number/float'
export const numberIntUrl = '/mock/number/int'
export const textUrl = '/mock/text'
2022-06-26 15:26:57 +08:00
export const imageUrl = '/mock/image'
export const rankListUrl = '/mock/rankList'
export const scrollBoardUrl = '/mock/scrollBoard'
2022-09-08 17:01:21 +08:00
export const radarUrl = '/mock/radarData'
export const heatMapUrl = '/mock/heatMapData'
export const scatterBasicUrl = '/mock/scatterBasic'
2022-09-25 17:48:51 +08:00
export const mapUrl = '/mock/map'
2022-10-27 11:40:53 +08:00
export const capsuleUrl = '/mock/capsule'
export const wordCloudUrl = '/mock/wordCloud'
2022-09-26 21:18:01 +08:00
export const treemapUrl = '/mock/treemap'
2022-10-12 21:08:24 +08:00
export const threeEarth01Url = '/mock/threeEarth01Data'
2023-03-30 13:37:07 +08:00
export const sankeyUrl = '/mock/sankey'
export const graphUrl = '/mock/graphData'
2022-03-21 00:57:23 +08:00
const mockObject: MockMethod[] = [
{
// 正则
// url: /\/mock\/mockData(|\?\S*)$/,
2022-06-25 15:51:03 +08:00
url: chartDataUrl,
method: RequestHttpEnum.GET,
response: () => test.fetchMockData
},
{
url: chartSingleDataUrl,
method: RequestHttpEnum.GET,
response: () => test.fetchMockSingleData
},
{
2022-06-25 15:51:03 +08:00
url: numberFloatUrl,
method: RequestHttpEnum.GET,
response: () => test.fetchNumberFloat
2022-06-25 15:51:03 +08:00
},
{
url: numberIntUrl,
method: RequestHttpEnum.GET,
response: () => test.fetchNumberInt
2022-06-25 15:51:03 +08:00
},
{
url: textUrl,
method: RequestHttpEnum.GET,
response: () => test.fetchText
},
2022-06-26 15:26:57 +08:00
{
url: imageUrl,
method: RequestHttpEnum.GET,
response: () => test.fetchImage(Math.round(Math.random() * 10))
2022-06-26 15:26:57 +08:00
},
{
url: rankListUrl,
method: RequestHttpEnum.GET,
response: () => test.fetchRankList
},
{
url: scrollBoardUrl,
method: RequestHttpEnum.GET,
response: () => test.fetchScrollBoard
2022-09-08 17:01:21 +08:00
},
{
url: radarUrl,
method: RequestHttpEnum.GET,
response: () => test.fetchRadar
},
{
url: heatMapUrl,
method: RequestHttpEnum.GET,
response: () => test.fetchHeatmap
},
{
url: scatterBasicUrl,
method: RequestHttpEnum.GET,
response: () => test.fetchScatterBasic
},
2022-09-25 17:48:51 +08:00
{
url: mapUrl,
method: RequestHttpEnum.GET,
response: () => test.fetchMap
},
2022-10-27 11:40:53 +08:00
{
url: capsuleUrl,
method: RequestHttpEnum.GET,
response: () => test.fetchCapsule
},
2022-09-25 22:10:42 +08:00
{
url: wordCloudUrl,
method: RequestHttpEnum.GET,
response: () => test.fetchWordCloud
2022-09-26 21:18:01 +08:00
},
{
url: treemapUrl,
method: RequestHttpEnum.GET,
response: () => test.fetchTreemap
},
2022-10-12 21:08:24 +08:00
{
url: threeEarth01Url,
method: RequestHttpEnum.GET,
response: () => test.threeEarth01Data
},
2023-03-30 13:37:07 +08:00
{
url: sankeyUrl,
method: RequestHttpEnum.GET,
response: () => test.fetchSankey
},
{
url: graphUrl,
method: RequestHttpEnum.GET,
response: () => test.graphData
},
]
2022-03-24 09:19:14 +08:00
export default mockObject