|
@@ -7,9 +7,7 @@
|
|
|
import AMapLoader from "@amap/amap-jsapi-loader";
|
|
|
import { onMounted, ref } from "vue";
|
|
|
import axios from 'axios';
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+import { getFuseCodeLink } from "../../view/case/help";
|
|
|
|
|
|
const mockData = [
|
|
|
{
|
|
@@ -36,26 +34,30 @@ const mockData = [
|
|
|
]
|
|
|
const mapEl = ref<HTMLDivElement>();
|
|
|
|
|
|
-const getDataQuest = async () => {
|
|
|
- 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 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
|
|
|
+ }
|
|
|
}
|
|
|
+ )
|
|
|
+ console.log('res.data', res)
|
|
|
+ if (res.status === 200 && res.data.code === 0) {
|
|
|
+ reslove(res.data.data.list)
|
|
|
+ } else {
|
|
|
+ reslove([])
|
|
|
}
|
|
|
- )
|
|
|
- if (res.data && res.data.code === 0) {
|
|
|
- return Promise.resolve(res.data.data.list)
|
|
|
- } else {
|
|
|
- return Promise.resolve([])
|
|
|
- }
|
|
|
+ })
|
|
|
+
|
|
|
|
|
|
|
|
|
}
|
|
@@ -76,7 +78,6 @@ const loadMap = async () => {
|
|
|
resizeEnable: true,
|
|
|
});
|
|
|
|
|
|
-
|
|
|
//添加插件
|
|
|
AMap.plugin(["AMap.ToolBar", "AMap.Scale", "AMap.HawkEye", 'AMap.MapType'], function () {
|
|
|
//异步同时加载多个插件
|
|
@@ -84,21 +85,29 @@ const loadMap = async () => {
|
|
|
map.addControl(new AMap.Scale()); //显示当前地图中心的比例尺
|
|
|
map.addControl(new AMap.MapType()); //显示当前地图中心的比例尺
|
|
|
});
|
|
|
- console.log('map', map)
|
|
|
+ console.log('map', map,)
|
|
|
|
|
|
const initMakers = async () => {
|
|
|
- const data = await getDataQuest();
|
|
|
- // console.log('data', data)
|
|
|
+ const data = await getDataQuest() as any as any[];
|
|
|
+ console.log('data', data)
|
|
|
Array.from(data).forEach((item: any) => {
|
|
|
// console.log(item)
|
|
|
const latlng = item.latlng
|
|
|
const coord = latlng.split(',')
|
|
|
|
|
|
- console.log('coord',coord)
|
|
|
-
|
|
|
+
|
|
|
+ console.log('coord', coord, item.id)
|
|
|
+ // 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), //图标所处区域大小
|
|
|
+ imageSize: new AMap.Size(22, 28) //图标大小
|
|
|
+ });
|
|
|
+
|
|
|
const marker = new AMap.Marker({
|
|
|
- icon: "//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png",
|
|
|
- position: coord,
|
|
|
+ icon: icon,
|
|
|
+ position: coord.reverse(),
|
|
|
title: item.title,
|
|
|
label: item.title,
|
|
|
extData: { url: item.url, id: item.id }
|