diff --git a/backend/src/main/java/io/dataease/config/WebMvcConfig.java b/backend/src/main/java/io/dataease/config/WebMvcConfig.java new file mode 100644 index 0000000000..5653245ee1 --- /dev/null +++ b/backend/src/main/java/io/dataease/config/WebMvcConfig.java @@ -0,0 +1,20 @@ +package io.dataease.config; + + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@Configuration +public class WebMvcConfig implements WebMvcConfigurer { + + @Value("${geo.rootpath:file:/opt/dataease/data/feature/full/}") + private String geoPath; + + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + + registry.addResourceHandler("/geo/**").addResourceLocations(geoPath); + } +} diff --git a/frontend/src/api/map/map.js b/frontend/src/api/map/map.js index 73463c11b9..cdd49c376b 100644 --- a/frontend/src/api/map/map.js +++ b/frontend/src/api/map/map.js @@ -8,9 +8,17 @@ export const areaMapping = () => { }) } +// export function geoJson(areaCode) { +// return request({ +// url: '/api/map/resourceFull/' + areaCode, +// method: 'get', +// loading: true +// }) +// } + export function geoJson(areaCode) { return request({ - url: '/api/map/resourceFull/' + areaCode, + url: '/geo/' + areaCode + '_full.json', method: 'get', loading: true }) diff --git a/frontend/src/views/chart/components/ChartComponent.vue b/frontend/src/views/chart/components/ChartComponent.vue index 7a0e986a46..6127982ef3 100644 --- a/frontend/src/views/chart/components/ChartComponent.vue +++ b/frontend/src/views/chart/components/ChartComponent.vue @@ -113,13 +113,16 @@ export default { } geoJson(customAttr.areaCode).then(res => { - this.initMapChart(res.data, chart) + // this.initMapChart(res.data, chart) + this.initMapChart(res, chart) this.$store.dispatch('map/setGeo', { key: customAttr.areaCode, - value: res.data + value: res + // value: res.data }) - this.currentGeoJson = res.data + // this.currentGeoJson = res.data + this.currentGeoJson = res }) return }