修改现场返回问题
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -11,6 +11,8 @@ node_modules
|
|||||||
dist
|
dist
|
||||||
|
|
||||||
offline
|
offline
|
||||||
|
# tiles
|
||||||
|
# tiles1
|
||||||
dist-ssr
|
dist-ssr
|
||||||
*.local
|
*.local
|
||||||
# Editor directories and files
|
# Editor directories and files
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import store from "@/store/index";
|
|||||||
|
|
||||||
const service = axios.create({
|
const service = axios.create({
|
||||||
baseURL: "/api",
|
baseURL: "/api",
|
||||||
timeout: 60 * 1000,
|
timeout: 60 * 1000 * 3,
|
||||||
headers: { "Content-Type": "application/json;charset=utf-8" },
|
headers: { "Content-Type": "application/json;charset=utf-8" },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class HttpRequest {
|
|||||||
getInsideConfig() {
|
getInsideConfig() {
|
||||||
const config = {
|
const config = {
|
||||||
baseURL: this.baseUrl, // 所有的请求地址前缀部分(没有后端请求不用写)
|
baseURL: this.baseUrl, // 所有的请求地址前缀部分(没有后端请求不用写)
|
||||||
timeout: 80000, // 请求超时时间(毫秒)
|
timeout: 60 * 1000 * 3, // 请求超时时间(毫秒)
|
||||||
};
|
};
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ const handler = async ({ BMap, map }: any) => {
|
|||||||
const markerClick = (e: any) => {
|
const markerClick = (e: any) => {
|
||||||
zoom.value = 15;
|
zoom.value = 15;
|
||||||
infoWindowPoint.value = e;
|
infoWindowPoint.value = e;
|
||||||
infoWindowPoint.value.show = true;
|
// infoWindowPoint.value.show = true;
|
||||||
center.value.lng = 120.124367;
|
center.value.lng = 120.124367;
|
||||||
center.value.lat = 31.555421;
|
center.value.lat = 31.555421;
|
||||||
|
|
||||||
@@ -167,11 +167,11 @@ const init = () => {
|
|||||||
lineCount: 1,
|
lineCount: 1,
|
||||||
eventCount: 1,
|
eventCount: 1,
|
||||||
lineEventDetails: [
|
lineEventDetails: [
|
||||||
{
|
// {
|
||||||
gdName: "检修分公司",
|
// gdName: "检修分公司",
|
||||||
pictureId: "5debb8bd0ce26527675eedffd74a3198",
|
// pictureId: "5debb8bd0ce26527675eedffd74a3198",
|
||||||
pictureName: "无锡线上",
|
// pictureName: "无锡线上",
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
gdName: "检修分公司",
|
gdName: "检修分公司",
|
||||||
pictureId: "35b1301833e3fdfc872b1a27a17c7245",
|
pictureId: "35b1301833e3fdfc872b1a27a17c7245",
|
||||||
@@ -268,11 +268,11 @@ const checkMapData = () => {
|
|||||||
console.warn("当前区域无离线地图数据,将返回默认位置");
|
console.warn("当前区域无离线地图数据,将返回默认位置");
|
||||||
|
|
||||||
// 使用正确的BMap.Point创建方式
|
// 使用正确的BMap.Point创建方式
|
||||||
const point = new BMapInstance.value.Point(116.404367, 39.915421);
|
const point = new BMapInstance.value.Point(120.124367,31.555421);
|
||||||
|
|
||||||
// 平滑移动并设置合适缩放级别
|
// 平滑移动并设置合适缩放级别
|
||||||
mapInstance.value.panTo(point);
|
mapInstance.value.panTo(point);
|
||||||
mapInstance.value.setZoom(12);
|
mapInstance.value.setZoom(11);
|
||||||
// zoom.value = 12;
|
// zoom.value = 12;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -113,7 +113,7 @@
|
|||||||
v-for="(value, index) in infoWindowPoint.objName.split(
|
v-for="(value, index) in infoWindowPoint.objName.split(
|
||||||
';'
|
';'
|
||||||
)"
|
)"
|
||||||
style="white-space: nowrap"
|
style="white-space: nowrap; font-size: 13px"
|
||||||
>
|
>
|
||||||
{{ value }}
|
{{ value }}
|
||||||
</div>
|
</div>
|
||||||
@@ -198,8 +198,8 @@ const markerClick = (e: any) => {
|
|||||||
zoom.value = 15;
|
zoom.value = 15;
|
||||||
infoWindowPoint.value = e;
|
infoWindowPoint.value = e;
|
||||||
infoWindowPoint.value.show = true;
|
infoWindowPoint.value.show = true;
|
||||||
center.value.lng = 116.404367;
|
center.value.lng = e.lng;
|
||||||
center.value.lat = 39.915421;
|
center.value.lat = e.lat+ 0.01000001;;
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
center.value.lng = e.lng;
|
center.value.lng = e.lng;
|
||||||
@@ -285,41 +285,41 @@ const init = () => {
|
|||||||
const moveenFlag = ref(true);
|
const moveenFlag = ref(true);
|
||||||
|
|
||||||
const checkMapData = () => {
|
const checkMapData = () => {
|
||||||
if (!mapInstance.value || !BMapInstance.value || !moveenFlag.value) return;
|
// if (!mapInstance.value || !BMapInstance.value || !moveenFlag.value) return;
|
||||||
|
|
||||||
// 获取地图容器
|
// // 获取地图容器
|
||||||
const container = mapInstance.value.getContainer();
|
// const container = mapInstance.value.getContainer();
|
||||||
|
|
||||||
setTimeout(() => {
|
// setTimeout(() => {
|
||||||
try {
|
// try {
|
||||||
// 1. 获取所有图片瓦片
|
// // 1. 获取所有图片瓦片
|
||||||
const tiles = Array.from(container.querySelectorAll("img"));
|
// const tiles = Array.from(container.querySelectorAll("img"));
|
||||||
|
|
||||||
// 2. 检查是否有离线地图瓦片
|
// // 2. 检查是否有离线地图瓦片
|
||||||
const hasOfflineTiles = tiles.some((tile: any) => {
|
// const hasOfflineTiles = tiles.some((tile: any) => {
|
||||||
// 确保tile是有效的DOM元素
|
// // 确保tile是有效的DOM元素
|
||||||
if (!tile || !tile.src) return false;
|
// if (!tile || !tile.src) return false;
|
||||||
|
|
||||||
// 检查是否是离线瓦片
|
// // 检查是否是离线瓦片
|
||||||
return tile.src.includes("/plugin/offline/tiles/");
|
// return tile.src.includes("/plugin/offline/tiles/");
|
||||||
});
|
// });
|
||||||
|
|
||||||
// 3. 如果没有离线瓦片,回到默认位置
|
// // 3. 如果没有离线瓦片,回到默认位置
|
||||||
if (!hasOfflineTiles) {
|
// if (!hasOfflineTiles) {
|
||||||
console.warn("当前区域无离线地图数据,将返回默认位置");
|
// console.warn("当前区域无离线地图数据,将返回默认位置");
|
||||||
|
|
||||||
// 使用正确的BMap.Point创建方式
|
// // 使用正确的BMap.Point创建方式
|
||||||
const point = new BMapInstance.value.Point(116.404367, 39.915421);
|
// const point = new BMapInstance.value.Point(116.404367, 39.915421);
|
||||||
|
|
||||||
// 平滑移动并设置合适缩放级别
|
// // 平滑移动并设置合适缩放级别
|
||||||
mapInstance.value.panTo(point);
|
// mapInstance.value.panTo(point);
|
||||||
mapInstance.value.setZoom(12);
|
// mapInstance.value.setZoom(12);
|
||||||
// zoom.value = 12;
|
// // zoom.value = 12;
|
||||||
}
|
// }
|
||||||
} catch (error) {
|
// } catch (error) {/
|
||||||
console.error("地图检测出错:", error);
|
// console.error("地图检测出错:", error);
|
||||||
}
|
// }
|
||||||
}, 1000); // 适当缩短延迟时间
|
// }, 1000); // 适当缩短延迟时间
|
||||||
};
|
};
|
||||||
|
|
||||||
// 处理地图滚轮缩放,修正scale导致的坐标偏移
|
// 处理地图滚轮缩放,修正scale导致的坐标偏移
|
||||||
|
|||||||
Reference in New Issue
Block a user