Browse Source

feat(records): change

gemercheung 1 year ago
parent
commit
241b7182fe
1 changed files with 16 additions and 39 deletions
  1. 16 39
      src/app/map/App.vue

+ 16 - 39
src/app/map/App.vue

@@ -9,47 +9,24 @@ import { onMounted, ref } from "vue";
 import axios from 'axios';
 import { getFuseCodeLink } from "../../view/case/help";
 
-const mockData = [
-  {
-    id: "1",
-    pos: [113.49950059050184, 22.32067452371977],
-    title: "tttsaaa",
-    icon: "//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png",
-    url: "https://baidu.com"
-  },
-  {
-    id: "2",
-    pos: [113.4705899650537, 22.154966705378126],
-    title: "hello string11",
-    icon: "//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png",
-    url: "https://google.com"
+
+const request = axios.create({
+  baseURL: '',
+  timeout: 1000,
+  headers: {
+    share: 1,
+    'Content-Type': 'application/json'
   },
-  {
-    id: "3",
-    pos: [113.60847140949818, 22.235271980933565],
-    title: "hello string11",
-    icon: "//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png",
-    url: "https://yahoo.com"
-  }
-]
+});
 const mapEl = ref<HTMLDivElement>();
 
 const getDataQuest = () => {
   return new Promise(async (reslove, reject) => {
-    const res = await axios(
-      {
-        url: "https://xj-mix3d.4dkankan.com/fusion-xj/web/fireProject/queryProject",
-        headers: {
-          share: 1,
-          'Content-Type': 'application/json'
-        },
-        method: 'post',
-        data: {
-          pageNum: 1,
-          pageSize: 10000
-        }
-      }
-    )
+
+    const res = await request.post('https://xj-mix3d.4dkankan.com/fusion-xj/web/fireProject/queryProject', {
+      pageNum: 1,
+      pageSize: 10000
+    })
     console.log('res.data', res)
     if (res.status === 200 && res.data.code === 0) {
       reslove(res.data.data.list)
@@ -97,8 +74,8 @@ const loadMap = async () => {
 
 
       console.log('coord', coord, item.id)
-      // const url = getFuseCodeLink(item.id, true)
-      // console.log('url', url)
+      const url = getFuseCodeLink(item.id, true)
+      console.log('url', url)
       const icon = new AMap.Icon({
         image: "//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png",
         size: new AMap.Size(22, 28),  //图标所处区域大小
@@ -110,7 +87,7 @@ const loadMap = async () => {
         position: coord.reverse(),
         title: item.title,
         label: item.title,
-        extData: { url: item.url, id: item.id }
+        extData: { url: url, id: item.id }
         // offset: new AMap.Pixel(-26, -54),
       });