diff --git a/src/components/map/MapContainer.vue b/src/components/map/MapContainer.vue index ba87110..63138a1 100644 --- a/src/components/map/MapContainer.vue +++ b/src/components/map/MapContainer.vue @@ -11,7 +11,7 @@ let AMap: any = null; let markerList: Array = []; let m_index: Number = 0; let geocoder: any = null; -let marker = null; +let marker: any = null; const emits = defineEmits(["changeMaps"]); @@ -37,6 +37,7 @@ const initMap = async () => { map.value = new AMap.Map("container", { zoom: 13, viewMode: "2D", + center: [105.4423, 28.8717], }); AMap.plugin("AMap.Geocoder", function () { @@ -46,6 +47,21 @@ const initMap = async () => { }); // 经纬度数组 }); + AMap.plugin("AMap.Geolocation", function () { + let geolocation = new AMap.Geolocation({ + enableHighAccuracy: true, // 是否使用高精度定位,默认:true + timeout: 10000, // 超过1秒后停止定位,默认:无穷大 + buttonPosition: "RB", // 定位按钮的停靠位置 + zoomToAccuracy: true, // 定位成功后是否自动调整地图视野到定位点 + }); + + map.value.addControl(geolocation); + + // geolocation.getCurrentPosition(function (status, result) { + // console.log(status, result); + // }); + }); + map.value.setFitView(); map.value.on("click", (e: any) => { diff --git a/src/views/task_template/edit.vue b/src/views/task_template/edit.vue index 51d0326..755d56e 100644 --- a/src/views/task_template/edit.vue +++ b/src/views/task_template/edit.vue @@ -14,11 +14,55 @@ label-width="90px" :rules="formRules" > - - + + + + + + + + + + @@ -90,57 +134,7 @@ - - - - - - - - - - - - + 显示 @@ -316,6 +310,9 @@ const mapRef = shallowRef>(); // 选择任务类型 const changeTaskType = async (e: any) => { + datalist.value.forEach((item: any) => { + if (item.id == e) formData.title = item.name; + }); if (e == 32) { mapShow.value = true; //为三轮车时 // await nextTick();