|
|
@@ -1,2 +1,89 @@
|
|
|
-<template>主页</template>
|
|
|
-<script setup></script>
|
|
|
+<template>
|
|
|
+ <div class="df">
|
|
|
+ <div id="map-container" class="map-container"></div>
|
|
|
+ <div
|
|
|
+ style="width: 200px; height: calc(100vh - 256px); border: 1px solid grey"
|
|
|
+ ></div>
|
|
|
+ </div>
|
|
|
+ <div class="df">
|
|
|
+ <div
|
|
|
+ style="width: calc(100% - 200px); height: 118px; border: 1px solid green"
|
|
|
+ ></div>
|
|
|
+ <div style="width: 200px; height: 118px; border: 1px solid blue"></div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script setup>
|
|
|
+import { ref, reactive, toRefs, computed, onMounted } from "vue";
|
|
|
+import { ElNotification } from "element-plus";
|
|
|
+import store from "../../store";
|
|
|
+import router from "../../router";
|
|
|
+
|
|
|
+import md5 from "md5";
|
|
|
+import api from "../../apis/fetch";
|
|
|
+let map = ref({});
|
|
|
+
|
|
|
+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);
|
|
|
+ return;
|
|
|
+ let markers = [];
|
|
|
+ for (let i of medias.value) {
|
|
|
+ let content = `<div style='width:160px'>
|
|
|
+ ${
|
|
|
+ i.audit == 1
|
|
|
+ ? `<img id='img${i.id}' style='width:160px;height:160px;object-fit:contain;' src='${i.viewUrl}'/>`
|
|
|
+ : ``
|
|
|
+ }
|
|
|
+ <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>`;
|
|
|
+
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+
|
|
|
+ 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);
|
|
|
+ });
|
|
|
+}
|
|
|
+onMounted(() => {
|
|
|
+ initMap();
|
|
|
+});
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+.map-container {
|
|
|
+ width: calc(100% - 200px);
|
|
|
+ height: calc(100vh - 256px);
|
|
|
+}
|
|
|
+</style>
|