Commit 4cd73381 by zhangxw

冒烟 问题

1 parent 8a708d2a
......@@ -9,7 +9,8 @@
</div>
<div v-show="isUploaded">
<a class="map-cmd-icon location" @click="getLocation">
<span class="icon icon-location"></span>
<span v-if="!isGetLocation" class="icon icon-location"></span>
<van-loading v-else color="#1989fa" />
</a>
<a class="map-cmd-icon refresh-car" @click="refresh">
<span class="icon icon-refresh-car"></span>
......@@ -30,6 +31,7 @@ export default {
const satelActive = ref(null);
const roadActive = ref(null);
const sharePage = ref(false);
const isGetLocation = ref(false);
onMounted(() => {});
const initMap = (id) => {
sharePage.value = JSON.parse(localStorage.getItem("sharePage"));
......@@ -55,6 +57,7 @@ export default {
let currMarker = null;
// 获取定位
const getLocation = () => {
isGetLocation.value = true;
map.plugin("AMap.Geolocation", function () {
var geolocation = new window.AMap.Geolocation({
enableHighAccuracy: true,
......@@ -69,6 +72,7 @@ export default {
if (currMarker) {
currMarker.setMap(null);
}
isGetLocation.value = false;
currMarker = new window.AMap.Marker({
position: data.position,
content: '<span class="curr-marker"></span>',
......@@ -77,7 +81,9 @@ export default {
});
map.setFitView();
});
window.AMap.event.addListener(geolocation, "error", () => {});
window.AMap.event.addListener(geolocation, "error", () => {
isGetLocation.value = false;
});
});
};
// 刷新
......@@ -94,6 +100,7 @@ export default {
refresh,
isUploaded,
sharePage,
isGetLocation,
};
},
};
......
......@@ -96,6 +96,7 @@ export default defineComponent({
const routeQuery = route.query;
const hasRadiusFence = ref(false);
const hasProviceCityFence = ref(false);
const adcodeItemName = ref(null);
let district = null;
onMounted(() => {
AMapLoader.load({
......@@ -112,7 +113,18 @@ export default defineComponent({
});
});
// 地图刷新
const refreshCb = () => {};
const refreshCb = (map) => {
map.clearMap();
getData(map);
if (hasRadiusFence.value) {
createCircle(currLnglat.value, radiusNum.value);
createPoint(currLnglat.value);
}
if (hasProviceCityFence.value && adcodeItemName.value) {
coverArea(adcodeItemName.value, map);
}
map.setFitView();
};
// 切换围栏类型
const changeFenceType = (index) => {
selectedTypeItem.value = index;
......@@ -132,6 +144,7 @@ export default defineComponent({
val["gpsLocation"].elng,
val["gpsLocation"].elat
);
drawMarker(currLnglat.value);
});
} else {
Dialog({ message: "暂无数据" });
......@@ -162,7 +175,6 @@ export default defineComponent({
currentMap = currentMap
? currentMap
: mapContentRefs.value.init("fenceContainer");
drawMarker(currLnglat.value);
currentMap.setFitView();
showSettingDialog.value = false;
hasRadiusFence.value = true;
......@@ -188,6 +200,7 @@ export default defineComponent({
Toast(
`设定${proviceCityType.value === 1 ? "跨省" : "跨市"}围栏成功`
);
adcodeItemName.value = adcodeItem.name;
coverArea(adcodeItem.name, currentMap);
currentMap.setFitView();
hasProviceCityFence.value = true;
......@@ -271,6 +284,7 @@ export default defineComponent({
map: currentMap,
offset: new window.AMap.Pixel(-17, -26),
});
currentMap.setFitView();
};
// 地图添加圆
const createCircle = (lnglat, radius) => {
......@@ -321,6 +335,7 @@ export default defineComponent({
createCircle,
hasRadiusFence,
hasProviceCityFence,
adcodeItemName,
};
},
});
......
......@@ -598,7 +598,7 @@ export default defineComponent({
GET_ALL_CAR_LIST({
pageSize: 10,
pageNumber: pageNumber.value,
term: keyWord.value,
keyWord: keyWord.value,
}).then((res) => {
if (res.code === 200) {
list.value = list.value.concat(res.data.list);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!