From 3ae9aac2d93e0e877d47d86dcc3aa0b665d181cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Sun, 22 Dec 2024 12:51:02 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E6=95=B0=E6=8D=AEmoc?= =?UTF-8?q?k=EF=BC=8C=E6=95=B0=E6=8D=AE=E5=AD=97=E6=AE=B5=E6=98=A0?= =?UTF-8?q?=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/mock/index.ts | 8 ++ src/api/mock/vchart.mock.ts | 10 ++ src/api/mock/vchart/bar.json | 16 ++++ src/components/GoVChart/index.vue | 27 +----- .../VChart/Bars/VChartBarCommon/config.ts | 2 +- .../VChart/Bars/VChartBarCommon/data.json | 1 + .../VChart/Bars/VChartBarStack/config.ts | 6 +- .../VChart/Bars/VChartBarStack/data.json | 87 +++-------------- .../ChartDataMatchingAndShow/index.vue | 94 ++++++++++++++++++- .../components/RequestTargetConfig/index.vue | 8 +- tsconfig.json | 2 +- 11 files changed, 153 insertions(+), 108 deletions(-) create mode 100644 src/api/mock/vchart.mock.ts create mode 100644 src/api/mock/vchart/bar.json diff --git a/src/api/mock/index.ts b/src/api/mock/index.ts index 9f639513..d8952c47 100644 --- a/src/api/mock/index.ts +++ b/src/api/mock/index.ts @@ -1,4 +1,5 @@ import test from './test.mock' +import vchart from './vchart.mock' import { MockMethod } from 'vite-plugin-mock' import { RequestHttpEnum } from '@/enums/httpEnum' @@ -22,6 +23,8 @@ export const threeEarth01Url = '/mock/threeEarth01Data' export const sankeyUrl = '/mock/sankey' export const graphUrl = '/mock/graphData' +export const vchartBarDataUrl = '/mock/vchart/barDataUrl' + const mockObject: MockMethod[] = [ { // 正则 @@ -115,6 +118,11 @@ const mockObject: MockMethod[] = [ method: RequestHttpEnum.GET, response: () => test.graphData }, + { + url: vchartBarDataUrl, + method: RequestHttpEnum.GET, + response: () => vchart.bar + } ] export default mockObject diff --git a/src/api/mock/vchart.mock.ts b/src/api/mock/vchart.mock.ts new file mode 100644 index 00000000..4e1d70c0 --- /dev/null +++ b/src/api/mock/vchart.mock.ts @@ -0,0 +1,10 @@ +import bar from './vchart/bar.json' + +export default { + bar: { + code: 0, + status: 200, + msg: '请求成功', + data: bar + } +} diff --git a/src/api/mock/vchart/bar.json b/src/api/mock/vchart/bar.json new file mode 100644 index 00000000..3372ec56 --- /dev/null +++ b/src/api/mock/vchart/bar.json @@ -0,0 +1,16 @@ +{ + "values": [ + { "type": "Nail polish", "year": "Africa", "value|100-900": 3 }, + { "type": "Nail polish", "year": "EU", "value|100-900": 3 }, + { "type": "Nail polish", "year": "China", "value|100-900": 3 }, + { "type": "Nail polish", "year": "USA", "value|100-900": 3 }, + { "type": "Eyebrow pencil", "year": "Africa", "value|100-900": 3 }, + { "type": "Eyebrow pencil", "year": "EU", "value|100-900": 3 }, + { "type": "Eyebrow pencil", "year": "China", "value|100-900": 3 }, + { "type": "Eyebrow pencil", "year": "USA", "value|100-900": 3 }, + { "type": "Rouge", "year": "Africa", "value|100-900": 3 }, + { "type": "Rouge", "year": "EU", "value|100-900": 3 }, + { "type": "Rouge", "year": "China", "value|100-900": 3 }, + { "type": "Rouge", "year": "USA", "value|100-900": 3 } + ] +} diff --git a/src/components/GoVChart/index.vue b/src/components/GoVChart/index.vue index 9f6e7471..3f99e3a0 100644 --- a/src/components/GoVChart/index.vue +++ b/src/components/GoVChart/index.vue @@ -2,13 +2,13 @@
diff --git a/tsconfig.json b/tsconfig.json index 07a4c65b..8880f8e4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -20,6 +20,6 @@ // "strictNullChecks": true, //不允许使用null "noImplicitThis": true //不允许往this上面挂属性 }, - "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue", "types/**/*"], + "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue", "types/**/*", "src/api/mock/vchart/bar.js"], "exclude": ["node_modules", "dist", "**/*.js"] }