|
@@ -1336,6 +1336,7 @@ import {
|
|
|
import downloadBlobFile from "../../utils/downloadBlobFile";
|
|
import downloadBlobFile from "../../utils/downloadBlobFile";
|
|
|
import url from "../../apis/config";
|
|
import url from "../../apis/config";
|
|
|
import { subTimeStr } from "utils/utils";
|
|
import { subTimeStr } from "utils/utils";
|
|
|
|
|
+import AMapLoader from "@amap/amap-jsapi-loader";
|
|
|
|
|
|
|
|
const route = useRoute();
|
|
const route = useRoute();
|
|
|
let map = ref();
|
|
let map = ref();
|
|
@@ -1540,27 +1541,34 @@ function cancelUpdateDischarge() {
|
|
|
currentUpdateIndex.value = -1;
|
|
currentUpdateIndex.value = -1;
|
|
|
}
|
|
}
|
|
|
function initMap() {
|
|
function initMap() {
|
|
|
- map.value = new AMap.Map("map-container", {
|
|
|
|
|
- zoom: 11, //级别
|
|
|
|
|
- center: [120.563757, 31.891174], //中心点坐标
|
|
|
|
|
- mapStyle: "amap://styles/f48d96805f5fa7f5aada657c5ee37017",
|
|
|
|
|
- zoomEnable: false,
|
|
|
|
|
- dragEnable: false,
|
|
|
|
|
- });
|
|
|
|
|
- let toolBar = new AMap.ToolBar({
|
|
|
|
|
- position: {
|
|
|
|
|
- top: "40px",
|
|
|
|
|
- right: "40px",
|
|
|
|
|
- },
|
|
|
|
|
- });
|
|
|
|
|
- let hawkEye = new AMap.HawkEye({
|
|
|
|
|
- opened: false,
|
|
|
|
|
- });
|
|
|
|
|
- // map.value.addControl(toolBar);
|
|
|
|
|
- map.value.addControl(hawkEye);
|
|
|
|
|
- let markers = [];
|
|
|
|
|
- for (let i of medias.value) {
|
|
|
|
|
- let content = `<div style='width:160px'>
|
|
|
|
|
|
|
+ AMapLoader.load({
|
|
|
|
|
+ key: "0b84075e96d01623f704867a601139bb", // 申请好的Web端开发者Key,首次调用 load 时必填
|
|
|
|
|
+ version: "2.0", // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15需要使用的的插件列表,如比例尺'AMap.Scale',支持添加多个如:['...','...']
|
|
|
|
|
+ }).then((AMap) => {
|
|
|
|
|
+ console.log(1);
|
|
|
|
|
+ map.value = new AMap.Map("map-container", {
|
|
|
|
|
+ zoom: 11, //级别
|
|
|
|
|
+ center: [120.563757, 31.891174], //中心点坐标
|
|
|
|
|
+ mapStyle: "amap://styles/f48d96805f5fa7f5aada657c5ee37017",
|
|
|
|
|
+ zoomEnable: false,
|
|
|
|
|
+ dragEnable: false,
|
|
|
|
|
+ });
|
|
|
|
|
+ map.value.plugin(["AMap.ToolBar", "AMap.HawkEye"], function () {
|
|
|
|
|
+ let ToolBar = new AMap.ToolBar({
|
|
|
|
|
+ position: {
|
|
|
|
|
+ top: "40px",
|
|
|
|
|
+ right: "40px",
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
|
|
+ let HawkEye = new AMap.HawkEye({
|
|
|
|
|
+ opened: false,
|
|
|
|
|
+ });
|
|
|
|
|
+ // map.value.addControl(ToolBar);
|
|
|
|
|
+ map.value.addControl(HawkEye);
|
|
|
|
|
+ });
|
|
|
|
|
+ let markers = [];
|
|
|
|
|
+ for (let i of medias.value) {
|
|
|
|
|
+ let content = `<div style='width:160px'>
|
|
|
${
|
|
${
|
|
|
i.audit == 1
|
|
i.audit == 1
|
|
|
? `<img id='img${i.id}' style='width:160px;height:160px;object-fit:contain;' src='${i.viewUrl}'/>`
|
|
? `<img id='img${i.id}' style='width:160px;height:160px;object-fit:contain;' src='${i.viewUrl}'/>`
|
|
@@ -1569,27 +1577,28 @@ function initMap() {
|
|
|
<img src='https://hhd-pat-1255802371.cos.ap-shanghai.myqcloud.com/frontend/ship-red-icon.png' style='display:block;width:20px;height:20px;margin:6px auto'/
|
|
<img src='https://hhd-pat-1255802371.cos.ap-shanghai.myqcloud.com/frontend/ship-red-icon.png' style='display:block;width:20px;height:20px;margin:6px auto'/
|
|
|
</div>`;
|
|
</div>`;
|
|
|
|
|
|
|
|
- let marker = new AMap.Marker({
|
|
|
|
|
- content,
|
|
|
|
|
- position: new AMap.LngLat(i.longitude, i.latitude),
|
|
|
|
|
- offset: new AMap.Pixel(-75, i.audit == 1 ? -195 : -30),
|
|
|
|
|
- });
|
|
|
|
|
- if (i.audit == 1) {
|
|
|
|
|
- marker.on("click", () => {
|
|
|
|
|
- openMediaModal(i.viewUrl, 1, "航次图片", i);
|
|
|
|
|
|
|
+ let marker = new AMap.Marker({
|
|
|
|
|
+ content,
|
|
|
|
|
+ position: new AMap.LngLat(i.longitude, i.latitude),
|
|
|
|
|
+ offset: new AMap.Pixel(-75, i.audit == 1 ? -195 : -30),
|
|
|
});
|
|
});
|
|
|
- }
|
|
|
|
|
|
|
+ if (i.audit == 1) {
|
|
|
|
|
+ marker.on("click", () => {
|
|
|
|
|
+ openMediaModal(i.viewUrl, 1, "航次图片", i);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- markers.push(marker);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ markers.push(marker);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- let overlayGroups = new AMap.OverlayGroup(markers);
|
|
|
|
|
- map.value.on("complete", function () {
|
|
|
|
|
- let t = setTimeout(() => {
|
|
|
|
|
- map.value.add(overlayGroups);
|
|
|
|
|
- map.value.setFitView(markers, true, [200, 50, 0, 0], 18);
|
|
|
|
|
- clearTimeout(t);
|
|
|
|
|
- }, 2000);
|
|
|
|
|
|
|
+ let overlayGroups = new AMap.OverlayGroup(markers);
|
|
|
|
|
+ map.value.on("complete", function () {
|
|
|
|
|
+ let t = setTimeout(() => {
|
|
|
|
|
+ map.value.add(overlayGroups);
|
|
|
|
|
+ map.value.setFitView(markers, true, [200, 50, 0, 0], 18);
|
|
|
|
|
+ clearTimeout(t);
|
|
|
|
|
+ }, 2000);
|
|
|
|
|
+ });
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|