瀏覽代碼

feat: 更新铜仁地图数据接口

wll8 5 月之前
父節點
當前提交
a7543ef177
共有 2 個文件被更改,包括 20 次插入5 次删除
  1. 19 2
      mm/mm.config.js
  2. 1 3
      src/views/page1/index.vue

+ 19 - 2
mm/mm.config.js

@@ -18,7 +18,6 @@ module.exports = async (util) => {
       )
     },
   })
-  console.log(`xxx`, util.libObj.mockjs.Random.image2())
   return {
     plugin: [util.plugin.validate, util.plugin.apiDoc],
     guard: false,
@@ -29,7 +28,6 @@ module.exports = async (util) => {
     proxy: {
       '/': `http://www.httpbin.org/`, // 后端接口主域
       '/anything/intercept': [`origin`, `127.0.0.1`], // 修改接口返回的数据
-      '/datav/': `https://geo.datav.aliyun.com/`, // 修改接口返回的数据
     },
     api: {
       // 在其他文件里的 api
@@ -51,6 +49,25 @@ module.exports = async (util) => {
           )
         },
       }),
+      'get /api/mapOfTongren': util.side({
+        tags: [`公用`],
+        summary: `铜仁地图数据`,
+        async action(req, res) {
+          const data = await util.libObj.axios
+            .get(
+              `https://geo.datav.aliyun.com/areas_v3/bound/geojson?code=520600_full`
+            )
+            .then((res) => res.data)
+          console.log(`data`, data)
+          res.json(
+            wrapApiData(
+              util.libObj.mockjs.mock({
+                data,
+              })
+            )
+          )
+        },
+      }),
       'get /api/realTimeStatistics': util.side({
         tags: [`综合总览`],
         summary: `实时统计`,

+ 1 - 3
src/views/page1/index.vue

@@ -287,9 +287,7 @@ export default {
     },
     async getJSON() {
       console.log(`获取JSOn`)
-      this.getJson = await this.$http.get(
-        `/datav/areas_v3/bound/geojson?code=520600_full`
-      )
+      this.getJson = await this.$http.get(`/api/mapOfTongren`)
       console.log(this.getJson)
       this.hasGetJson = true
     },