hookehuyr

fix 步行导航功能优化

...@@ -3,8 +3,8 @@ VITE_PORT = 8006 ...@@ -3,8 +3,8 @@ VITE_PORT = 8006
3 3
4 # 反向代理服务器地址 4 # 反向代理服务器地址
5 # VITE_PROXY_TARGET = https://oa-dev.onwall.cn 5 # VITE_PROXY_TARGET = https://oa-dev.onwall.cn
6 -VITE_PROXY_TARGET = https://bm.jiqun.com 6 +# VITE_PROXY_TARGET = https://bm.jiqun.com
7 -# VITE_PROXY_TARGET = https://oa.onwall.cn 7 +VITE_PROXY_TARGET = https://oa.onwall.cn
8 8
9 # API请求前缀 9 # API请求前缀
10 VITE_PROXY_PREFIX = /srv/ 10 VITE_PROXY_PREFIX = /srv/
......
1 { 1 {
2 "globals": { 2 "globals": {
3 "EffectScope": true, 3 "EffectScope": true,
4 + "ElMessage": true,
4 "computed": true, 5 "computed": true,
5 "createApp": true, 6 "createApp": true,
6 "customRef": true, 7 "customRef": true,
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
2 export {} 2 export {}
3 declare global { 3 declare global {
4 const EffectScope: typeof import('vue')['EffectScope'] 4 const EffectScope: typeof import('vue')['EffectScope']
5 + const ElMessage: typeof import('element-plus/es')['ElMessage']
5 const computed: typeof import('vue')['computed'] 6 const computed: typeof import('vue')['computed']
6 const createApp: typeof import('vue')['createApp'] 7 const createApp: typeof import('vue')['createApp']
7 const customRef: typeof import('vue')['customRef'] 8 const customRef: typeof import('vue')['customRef']
......
1 <!-- 1 <!--
2 * @Date: 2024-09-15 22:08:49 2 * @Date: 2024-09-15 22:08:49
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-03-06 09:50:03 4 + * @LastEditTime: 2025-03-06 12:12:52
5 * @FilePath: /map-demo/src/views/by/info.vue 5 * @FilePath: /map-demo/src/views/by/info.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -256,7 +256,7 @@ onMounted(async () => { ...@@ -256,7 +256,7 @@ onMounted(async () => {
256 link: location.origin + location.pathname + location.hash, // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致 256 link: location.origin + location.pathname + location.hash, // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
257 imgUrl: '', // 分享图标 257 imgUrl: '', // 分享图标
258 success: function () { 258 success: function () {
259 - console.warn('设置成功'); 259 + // console.warn('设置成功');
260 } 260 }
261 } 261 }
262 // 分享好友(微信好友或qq好友) 262 // 分享好友(微信好友或qq好友)
...@@ -314,18 +314,6 @@ const goTo = () => { // 打开标记地图显示 ...@@ -314,18 +314,6 @@ const goTo = () => { // 打开标记地图显示
314 } 314 }
315 315
316 const goToWalk = async () => { // 打开步行导航地图显示 316 const goToWalk = async () => { // 打开步行导航地图显示
317 - // 没有关联导航提示
318 - try {
319 - const isLocationEnabled = await checkWxLocation();
320 - if (!isLocationEnabled) {
321 - // 提示用户开启定位
322 - show_toast.value = true;
323 - toast_text.value = '请开启手机定位功能';
324 - return;
325 - }
326 - } catch (err) {
327 - console.error('获取定位状态失败:', err);
328 - }
329 // 317 //
330 if ($router.currentRoute.value.path === '/by/info') { // 详情页 318 if ($router.currentRoute.value.path === '/by/info') { // 详情页
331 $router.push({ 319 $router.push({
...@@ -483,24 +471,6 @@ const onStatusAudioList = (status) => { // 音频列表组件,状态改变 ...@@ -483,24 +471,6 @@ const onStatusAudioList = (status) => { // 音频列表组件,状态改变
483 // show_audio.value = false; 471 // show_audio.value = false;
484 // } 472 // }
485 } 473 }
486 -
487 -const checkWxLocation = () => {
488 - return new Promise((resolve, reject) => {
489 - wx.getLocation({
490 - type: 'gcj02', // 默认为 wgs84 返回 gps 坐标,gcj02 返回可用于 wx.openLocation 的坐标
491 - success: (res) => {
492 - resolve(true); // 已开启定位
493 - },
494 - fail: (err) => {
495 - if (err.errMsg.indexOf('deny') > -1) {
496 - resolve(false); // 未开启定位
497 - } else {
498 - reject(err); // 其他错误
499 - }
500 - }
501 - });
502 - });
503 -}
504 </script> 474 </script>
505 475
506 <style lang="less"> 476 <style lang="less">
......
1 <!-- 1 <!--
2 * @Date: 2023-05-19 14:54:27 2 * @Date: 2023-05-19 14:54:27
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2025-03-06 10:36:30 4 + * @LastEditTime: 2025-03-06 12:14:54
5 * @FilePath: /map-demo/src/views/by/map.vue 5 * @FilePath: /map-demo/src/views/by/map.vue
6 * @Description: 公众地图主体页面 6 * @Description: 公众地图主体页面
7 --> 7 -->
...@@ -322,7 +322,7 @@ export default { ...@@ -322,7 +322,7 @@ export default {
322 link: location.origin + location.pathname + location.hash, // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致 322 link: location.origin + location.pathname + location.hash, // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
323 imgUrl: '', // 分享图标 323 imgUrl: '', // 分享图标
324 success: function () { 324 success: function () {
325 - console.warn('设置成功'); 325 + // console.warn('设置成功');
326 } 326 }
327 } 327 }
328 // 分享好友(微信好友或qq好友) 328 // 分享好友(微信好友或qq好友)
...@@ -335,17 +335,17 @@ export default { ...@@ -335,17 +335,17 @@ export default {
335 this.initMap(); 335 this.initMap();
336 // this.setMapBoundary(); 336 // this.setMapBoundary();
337 // 使用之前获取当前地址,判断当前是否能够获取经纬度 337 // 使用之前获取当前地址,判断当前是否能够获取经纬度
338 - wx.getLocation({ 338 + // wx.getLocation({
339 - type: 'wgs84', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02' 339 + // type: 'wgs84', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
340 - success: (res) => { 340 + // success: (res) => {
341 - var latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90 341 + // var latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90
342 - var longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。 342 + // var longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
343 - var speed = res.speed; // 速度,以米/每秒计 343 + // var speed = res.speed; // 速度,以米/每秒计
344 - var accuracy = res.accuracy; // 位置精度 344 + // var accuracy = res.accuracy; // 位置精度
345 - this.current_lng = GPS.gcj_encrypt(latitude, longitude).lon; 345 + // this.current_lng = GPS.gcj_encrypt(latitude, longitude).lon;
346 - this.current_lat = GPS.gcj_encrypt(latitude, longitude).lat; 346 + // this.current_lat = GPS.gcj_encrypt(latitude, longitude).lat;
347 - }, 347 + // },
348 - }); 348 + // });
349 // 设置贴片地图 349 // 设置贴片地图
350 this.setTitleLayer(); 350 this.setTitleLayer();
351 // 地图标题 351 // 地图标题
...@@ -548,8 +548,23 @@ export default { ...@@ -548,8 +548,23 @@ export default {
548 if (marker_id) { 548 if (marker_id) {
549 this.$nextTick(() => { 549 this.$nextTick(() => {
550 let marker = this.navBarList[0]['list'].filter(item => item.id == marker_id) 550 let marker = this.navBarList[0]['list'].filter(item => item.id == marker_id)
551 - let path = marker[0].path; 551 + // let path = marker[0].path;
552 - this.addSafeRoute({name: '参观路径', path}); 552 + // this.addSafeRoute({name: '参观路径', path});
553 + // TAG: 新增步行导航
554 + let position = marker[0].position;
555 + wx.getLocation({
556 + type: 'wgs84', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
557 + success: (res) => {
558 + var latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90
559 + var longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
560 + var speed = res.speed; // 速度,以米/每秒计
561 + var accuracy = res.accuracy; // 位置精度
562 + this.current_lng = GPS.gcj_encrypt(latitude, longitude).lon;
563 + this.current_lat = GPS.gcj_encrypt(latitude, longitude).lat;
564 + this.onWalkRoute({point: position});
565 + },
566 + });
567 +
553 // 获取当前 URL 的查询参数 568 // 获取当前 URL 的查询参数
554 let query = { ...this.$route.query }; 569 let query = { ...this.$route.query };
555 570
...@@ -971,6 +986,16 @@ export default { ...@@ -971,6 +986,16 @@ export default {
971 // panel: "panel" 986 // panel: "panel"
972 // }); 987 // });
973 988
989 + wx.getLocation({
990 + type: 'wgs84', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
991 + success: (res) => {
992 + var latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90
993 + var longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
994 + var speed = res.speed; // 速度,以米/每秒计
995 + var accuracy = res.accuracy; // 位置精度
996 + this.current_lng = GPS.gcj_encrypt(latitude, longitude).lon;
997 + this.current_lat = GPS.gcj_encrypt(latitude, longitude).lat;
998 +
974 // 确保参数格式正确 999 // 确保参数格式正确
975 const startPoint = [this.current_lng, this.current_lat]; // 起点 1000 const startPoint = [this.current_lng, this.current_lat]; // 起点
976 const endPoint = position.point; // 终点 1001 const endPoint = position.point; // 终点
...@@ -1002,6 +1027,8 @@ export default { ...@@ -1002,6 +1027,8 @@ export default {
1002 } 1027 }
1003 }); 1028 });
1004 }, 1029 },
1030 + });
1031 + },
1005 handleLocation(status) { // 打开/关闭 当前定位 1032 handleLocation(status) { // 打开/关闭 当前定位
1006 if (status) { 1033 if (status) {
1007 this.setLocation() 1034 this.setLocation()
......