hookehuyr

fix: 更新AMap安全密钥并添加地图定位范围配置

更新多个视图文件中的AMap安全密钥为最新值
为地图组件添加point_range配置以支持动态设置定位范围
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: 2024-01-08 17:26:45 4 + * @LastEditTime: 2025-08-08 11:46:19
5 * @FilePath: /map-demo/src/views/activity.vue 5 * @FilePath: /map-demo/src/views/activity.vue
6 * @Description: 内部地图主体页面 6 * @Description: 内部地图主体页面
7 --> 7 -->
...@@ -235,7 +235,7 @@ const GPS = { ...@@ -235,7 +235,7 @@ const GPS = {
235 }; 235 };
236 // 关键安全配置 236 // 关键安全配置
237 window._AMapSecurityConfig = { 237 window._AMapSecurityConfig = {
238 - securityJsCode: '8602057c4c8dae5bed9a240c0582c46f', // 替换为你的密钥 238 + securityJsCode: 'ac1a3a5858d74b7d6c50b6858100aa12', // 替换为你的密钥
239 } 239 }
240 export default { 240 export default {
241 components: { InfoWindow, InfoWindowLite, InfoWindowWarn, InfoWindowYard, Floor }, 241 components: { InfoWindow, InfoWindowLite, InfoWindowWarn, InfoWindowYard, Floor },
...@@ -329,7 +329,7 @@ export default { ...@@ -329,7 +329,7 @@ export default {
329 }, 329 },
330 async mounted() { 330 async mounted() {
331 const AMap = await AMapLoader.load({ 331 const AMap = await AMapLoader.load({
332 - key: '381c6763e1fefd810fbab697f470149c', // 控制台获取 332 + key: '17b8fc386104b89db88b60b049a6dbce', // 控制台获取
333 version: '2.0', // 指定API版本 333 version: '2.0', // 指定API版本
334 plugins: ['AMap.ElasticMarker','AMap.ImageLayer','AMap.ToolBar','AMap.IndoorMap','AMap.Walking','AMap.Geolocation'] // 必须加载步行导航插件 334 plugins: ['AMap.ElasticMarker','AMap.ImageLayer','AMap.ToolBar','AMap.IndoorMap','AMap.Walking','AMap.Geolocation'] // 必须加载步行导航插件
335 }) 335 })
...@@ -341,6 +341,7 @@ export default { ...@@ -341,6 +341,7 @@ export default {
341 this.mapTiles = data.level; // 获取图层 341 this.mapTiles = data.level; // 获取图层
342 this.navKey = data.list[0]['id']; // 默认选中 第一个 id 342 this.navKey = data.list[0]['id']; // 默认选中 第一个 id
343 this.navList = data.list.filter(item => item.id === this.navKey)[0]['list']; // 返回默认选中项的实体信息 343 this.navList = data.list.filter(item => item.id === this.navKey)[0]['list']; // 返回默认选中项的实体信息
344 + this.point_range = data.map.map_range ? data.map.point_range : []; // 地图定位范围
344 // 初始化地图 345 // 初始化地图
345 this.initMap(); 346 this.initMap();
346 // this.setMapBoundary(); 347 // this.setMapBoundary();
......
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:28:52 4 + * @LastEditTime: 2025-08-08 14:44:51
5 * @FilePath: /map-demo/src/views/bieyuan/map.vue 5 * @FilePath: /map-demo/src/views/bieyuan/map.vue
6 * @Description: 公众地图主体页面 6 * @Description: 公众地图主体页面
7 --> 7 -->
...@@ -155,7 +155,7 @@ const GPS = { ...@@ -155,7 +155,7 @@ const GPS = {
155 }; 155 };
156 // 关键安全配置 156 // 关键安全配置
157 window._AMapSecurityConfig = { 157 window._AMapSecurityConfig = {
158 - securityJsCode: '8602057c4c8dae5bed9a240c0582c46f', // 替换为你的密钥 158 + securityJsCode: 'ac1a3a5858d74b7d6c50b6858100aa12', // 替换为你的密钥
159 } 159 }
160 export default { 160 export default {
161 components: { pageInfo, audioBackground1 }, 161 components: { pageInfo, audioBackground1 },
...@@ -269,11 +269,14 @@ export default { ...@@ -269,11 +269,14 @@ export default {
269 open_current_location: true, 269 open_current_location: true,
270 show_toast: false, 270 show_toast: false,
271 toast_text: '', 271 toast_text: '',
272 + point_range: [ // 左下角是开始, 顺时针转动, 四个角
273 + [117.044223,26.835105], [117.044227,26.842448], [117.0552,26.842452], [117.055195,26.8351]
274 + ],
272 } 275 }
273 }, 276 },
274 async mounted() { 277 async mounted() {
275 const AMap = await AMapLoader.load({ 278 const AMap = await AMapLoader.load({
276 - key: '381c6763e1fefd810fbab697f470149c', // 控制台获取 279 + key: '17b8fc386104b89db88b60b049a6dbce', // 控制台获取
277 version: '2.0', // 指定API版本 280 version: '2.0', // 指定API版本
278 plugins: ['AMap.ElasticMarker','AMap.ImageLayer','AMap.ToolBar','AMap.IndoorMap','AMap.Walking','AMap.Geolocation'] // 必须加载步行导航插件 281 plugins: ['AMap.ElasticMarker','AMap.ImageLayer','AMap.ToolBar','AMap.IndoorMap','AMap.Walking','AMap.Geolocation'] // 必须加载步行导航插件
279 }) 282 })
...@@ -288,6 +291,7 @@ export default { ...@@ -288,6 +291,7 @@ export default {
288 this.data_rotation = data.map.rotation; // 地图旋转角度 291 this.data_rotation = data.map.rotation; // 地图旋转角度
289 this.data_zooms = data.map.zooms.map(item => Number(item)); // 地图默认缩放范围 292 this.data_zooms = data.map.zooms.map(item => Number(item)); // 地图默认缩放范围
290 this.data_paths = data.map.path ? data.map.path : {}; // 地图默认导航路径 293 this.data_paths = data.map.path ? data.map.path : {}; // 地图默认导航路径
294 + this.point_range = data.map.map_range ? data.map.point_range : []; // 地图定位范围
291 if (data.map.path) { 295 if (data.map.path) {
292 for (const key in data.map.path) { 296 for (const key in data.map.path) {
293 const element = data.map.path[key]; 297 const element = data.map.path[key];
...@@ -548,9 +552,7 @@ export default { ...@@ -548,9 +552,7 @@ export default {
548 // }, 1000); 552 // }, 1000);
549 }, 553 },
550 isPointInRing() { // 是否在景区范围 554 isPointInRing() { // 是否在景区范围
551 - let isPointInRing = AMap.GeometryUtil.isPointInRing([this.current_lng, this.current_lat], [ 555 + let isPointInRing = AMap.GeometryUtil.isPointInRing([this.current_lng, this.current_lat], this.point_range);
552 - [117.044223,26.835105], [117.044227,26.842448], [117.0552,26.842452], [117.055195,26.8351]
553 - ]);
554 return isPointInRing 556 return isPointInRing
555 }, 557 },
556 setLocation() { // 开启定位服务 558 setLocation() { // 开启定位服务
......
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-22 21:23:42 4 + * @LastEditTime: 2025-08-07 16:13:40
5 * @FilePath: /map-demo/src/views/by/map.vue 5 * @FilePath: /map-demo/src/views/by/map.vue
6 * @Description: 公众地图主体页面 6 * @Description: 公众地图主体页面
7 --> 7 -->
...@@ -165,7 +165,7 @@ const GPS = { ...@@ -165,7 +165,7 @@ const GPS = {
165 165
166 // 关键安全配置 166 // 关键安全配置
167 window._AMapSecurityConfig = { 167 window._AMapSecurityConfig = {
168 - securityJsCode: '8602057c4c8dae5bed9a240c0582c46f', // 替换为你的密钥 168 + securityJsCode: 'ac1a3a5858d74b7d6c50b6858100aa12', // 替换为你的密钥
169 } 169 }
170 170
171 export default { 171 export default {
...@@ -282,12 +282,15 @@ export default { ...@@ -282,12 +282,15 @@ export default {
282 toast_text: '', 282 toast_text: '',
283 data_logo: '', 283 data_logo: '',
284 data_layers: [], 284 data_layers: [],
285 + point_range: [
286 + [117.044223,26.835105], [117.044227,26.842448], [117.0552,26.842452], [117.055195,26.8351]
287 + ],
285 walking: '', 288 walking: '',
286 } 289 }
287 }, 290 },
288 async mounted() { 291 async mounted() {
289 const AMap = await AMapLoader.load({ 292 const AMap = await AMapLoader.load({
290 - key: '381c6763e1fefd810fbab697f470149c', // 控制台获取 293 + key: '17b8fc386104b89db88b60b049a6dbce', // 控制台获取
291 version: '2.0', // 指定API版本 294 version: '2.0', // 指定API版本
292 plugins: ['AMap.ElasticMarker','AMap.ImageLayer','AMap.ToolBar','AMap.IndoorMap','AMap.Walking','AMap.Geolocation'] // 必须加载步行导航插件 295 plugins: ['AMap.ElasticMarker','AMap.ImageLayer','AMap.ToolBar','AMap.IndoorMap','AMap.Walking','AMap.Geolocation'] // 必须加载步行导航插件
293 }) 296 })
...@@ -303,6 +306,7 @@ export default { ...@@ -303,6 +306,7 @@ export default {
303 this.data_zooms = data.map.zooms.map(item => Number(item)); // 地图默认缩放范围 306 this.data_zooms = data.map.zooms.map(item => Number(item)); // 地图默认缩放范围
304 this.data_paths = data.map.path ? data.map.path : {}; // 地图默认导航路径 307 this.data_paths = data.map.path ? data.map.path : {}; // 地图默认导航路径
305 this.data_logo = data.map.map_logo ? data.map.map_logo : ''; // 地图logo 308 this.data_logo = data.map.map_logo ? data.map.map_logo : ''; // 地图logo
309 + this.point_range = data.map.map_range ? data.map.point_range : []; // 地图定位范围
306 if (data.map.map_layers) { // 地图默认图层 310 if (data.map.map_layers) { // 地图默认图层
307 if (data.map.map_layers === 'satellite') { // 卫星和路网 311 if (data.map.map_layers === 'satellite') { // 卫星和路网
308 this.data_layers = [new AMap.TileLayer.Satellite(), new AMap.TileLayer.RoadNet()] 312 this.data_layers = [new AMap.TileLayer.Satellite(), new AMap.TileLayer.RoadNet()]
...@@ -608,9 +612,7 @@ export default { ...@@ -608,9 +612,7 @@ export default {
608 // }, 1000); 612 // }, 1000);
609 }, 613 },
610 isPointInRing() { // 是否在景区范围 614 isPointInRing() { // 是否在景区范围
611 - let isPointInRing = AMap.GeometryUtil.isPointInRing([this.current_lng, this.current_lat], [ 615 + let isPointInRing = AMap.GeometryUtil.isPointInRing([this.current_lng, this.current_lat], this.point_range);
612 - [117.044223,26.835105], [117.044227,26.842448], [117.0552,26.842452], [117.055195,26.8351]
613 - ]);
614 return isPointInRing 616 return isPointInRing
615 }, 617 },
616 setLocation() { // 开启定位服务 618 setLocation() { // 开启定位服务
......
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 15:46:30 4 + * @LastEditTime: 2025-08-07 16:14:55
5 * @FilePath: /map-demo/src/views/index.vue 5 * @FilePath: /map-demo/src/views/index.vue
6 * @Description: 公众地图主体页面 6 * @Description: 公众地图主体页面
7 --> 7 -->
...@@ -183,7 +183,7 @@ const GPS = { ...@@ -183,7 +183,7 @@ const GPS = {
183 }; 183 };
184 // 关键安全配置 184 // 关键安全配置
185 window._AMapSecurityConfig = { 185 window._AMapSecurityConfig = {
186 - securityJsCode: '8602057c4c8dae5bed9a240c0582c46f', // 替换为你的密钥 186 + securityJsCode: 'ac1a3a5858d74b7d6c50b6858100aa12', // 替换为你的密钥
187 } 187 }
188 export default { 188 export default {
189 components: { InfoWindow, InfoWindowLite, InfoWindowWarn, audioBackground, InfoPopup, InfoPopupLite, InfoPopupWarn }, 189 components: { InfoWindow, InfoWindowLite, InfoWindowWarn, audioBackground, InfoPopup, InfoPopupLite, InfoPopupWarn },
...@@ -265,11 +265,14 @@ export default { ...@@ -265,11 +265,14 @@ export default {
265 showInfoPopup: false, 265 showInfoPopup: false,
266 showInfoLitePopup: false, 266 showInfoLitePopup: false,
267 showInfoWarnPopup: false, 267 showInfoWarnPopup: false,
268 + point_range: [
269 + [120.585111, 31.316084], [120.585111, 31.316084], [120.589488, 31.313197], [120.585422, 31.313005]
270 + ], // 接口获取-地图范围
268 } 271 }
269 }, 272 },
270 async mounted() { 273 async mounted() {
271 const AMap = await AMapLoader.load({ 274 const AMap = await AMapLoader.load({
272 - key: '381c6763e1fefd810fbab697f470149c', // 控制台获取 275 + key: '17b8fc386104b89db88b60b049a6dbce', // 控制台获取
273 version: '2.0', // 指定API版本 276 version: '2.0', // 指定API版本
274 plugins: ['AMap.ElasticMarker','AMap.ImageLayer','AMap.ToolBar','AMap.IndoorMap','AMap.Walking','AMap.Geolocation'] // 必须加载步行导航插件 277 plugins: ['AMap.ElasticMarker','AMap.ImageLayer','AMap.ToolBar','AMap.IndoorMap','AMap.Walking','AMap.Geolocation'] // 必须加载步行导航插件
275 }) 278 })
...@@ -286,6 +289,7 @@ export default { ...@@ -286,6 +289,7 @@ export default {
286 this.data_rotation = data.map.rotation; // 地图旋转角度 289 this.data_rotation = data.map.rotation; // 地图旋转角度
287 this.data_zooms = data.map.zooms.map(item => Number(item)); // 地图默认缩放范围 290 this.data_zooms = data.map.zooms.map(item => Number(item)); // 地图默认缩放范围
288 this.data_paths = data.map.path ? data.map.path : {}; // 地图默认导航路径 291 this.data_paths = data.map.path ? data.map.path : {}; // 地图默认导航路径
292 + this.point_range = data.map.map_range ? data.map.point_range : []; // 地图定位范围
289 if (data.map.path) { 293 if (data.map.path) {
290 for (const key in data.map.path) { 294 for (const key in data.map.path) {
291 const element = data.map.path[key]; 295 const element = data.map.path[key];
...@@ -564,9 +568,7 @@ export default { ...@@ -564,9 +568,7 @@ export default {
564 // }); 568 // });
565 // }, 569 // },
566 isPointInRing() { // 是否在景区范围 570 isPointInRing() { // 是否在景区范围
567 - let isPointInRing = AMap.GeometryUtil.isPointInRing([this.current_lng, this.current_lat], [ 571 + let isPointInRing = AMap.GeometryUtil.isPointInRing([this.current_lng, this.current_lat], this.point_range);
568 - [120.585111, 31.316084], [120.585111, 31.316084], [120.589488, 31.313197], [120.585422, 31.313005]
569 - ]);
570 return isPointInRing 572 return isPointInRing
571 }, 573 },
572 setLocation() { // 开启定位服务 574 setLocation() { // 开启定位服务
......
...@@ -202,7 +202,7 @@ const GPS = { ...@@ -202,7 +202,7 @@ const GPS = {
202 }; 202 };
203 // 关键安全配置 203 // 关键安全配置
204 window._AMapSecurityConfig = { 204 window._AMapSecurityConfig = {
205 - securityJsCode: '8602057c4c8dae5bed9a240c0582c46f', // 替换为你的密钥 205 + securityJsCode: 'ac1a3a5858d74b7d6c50b6858100aa12', // 替换为你的密钥
206 } 206 }
207 export default { 207 export default {
208 components: { InfoWindow, InfoWindowLite, InfoWindowWarn, InfoWindowYard, Floor }, 208 components: { InfoWindow, InfoWindowLite, InfoWindowWarn, InfoWindowYard, Floor },
...@@ -286,7 +286,7 @@ export default { ...@@ -286,7 +286,7 @@ export default {
286 }, 286 },
287 async mounted() { 287 async mounted() {
288 const AMap = await AMapLoader.load({ 288 const AMap = await AMapLoader.load({
289 - key: '381c6763e1fefd810fbab697f470149c', // 控制台获取 289 + key: '17b8fc386104b89db88b60b049a6dbce', // 控制台获取
290 version: '2.0', // 指定API版本 290 version: '2.0', // 指定API版本
291 plugins: ['AMap.ElasticMarker','AMap.ImageLayer','AMap.ToolBar','AMap.IndoorMap','AMap.Walking','AMap.Geolocation'] // 必须加载步行导航插件 291 plugins: ['AMap.ElasticMarker','AMap.ImageLayer','AMap.ToolBar','AMap.IndoorMap','AMap.Walking','AMap.Geolocation'] // 必须加载步行导航插件
292 }) 292 })
...@@ -298,6 +298,7 @@ export default { ...@@ -298,6 +298,7 @@ export default {
298 this.mapTiles = data.level; // 获取图层 298 this.mapTiles = data.level; // 获取图层
299 this.navKey = data.list[0]['id']; // 默认选中 第一个 id 299 this.navKey = data.list[0]['id']; // 默认选中 第一个 id
300 this.navList = data.list.filter(item => item.id === this.navKey)[0]['list']; // 返回默认选中项的实体信息 300 this.navList = data.list.filter(item => item.id === this.navKey)[0]['list']; // 返回默认选中项的实体信息
301 + this.point_range = data.map.map_range ? data.map.point_range : []; // 地图定位范围
301 // 初始化地图 302 // 初始化地图
302 this.initMap(); 303 this.initMap();
303 // this.setMapBoundary(); 304 // this.setMapBoundary();
......
...@@ -210,12 +210,12 @@ const handleKeydown = (e) => { // 键盘控制 ...@@ -210,12 +210,12 @@ const handleKeydown = (e) => { // 键盘控制
210 210
211 // 关键安全配置 211 // 关键安全配置
212 window._AMapSecurityConfig = { 212 window._AMapSecurityConfig = {
213 - securityJsCode: '8602057c4c8dae5bed9a240c0582c46f', // 替换为你的密钥 213 + securityJsCode: 'ac1a3a5858d74b7d6c50b6858100aa12', // 替换为你的密钥
214 } 214 }
215 215
216 onMounted(async () => { 216 onMounted(async () => {
217 const AMap = await AMapLoader.load({ 217 const AMap = await AMapLoader.load({
218 - key: '381c6763e1fefd810fbab697f470149c', // 控制台获取 218 + key: '17b8fc386104b89db88b60b049a6dbce', // 控制台获取
219 version: '2.0', // 指定API版本 219 version: '2.0', // 指定API版本
220 plugins: ['AMap.ElasticMarker','AMap.ImageLayer','AMap.ToolBar','AMap.IndoorMap','AMap.Walking','AMap.Geolocation'] // 必须加载步行导航插件 220 plugins: ['AMap.ElasticMarker','AMap.ImageLayer','AMap.ToolBar','AMap.IndoorMap','AMap.Walking','AMap.Geolocation'] // 必须加载步行导航插件
221 }) 221 })
......
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 15:51:20 4 + * @LastEditTime: 2025-08-07 16:14:37
5 * @FilePath: /map-demo/src/views/tools.vue 5 * @FilePath: /map-demo/src/views/tools.vue
6 * @Description: 公众地图主体页面 6 * @Description: 公众地图主体页面
7 --> 7 -->
...@@ -185,7 +185,7 @@ const GPS = { ...@@ -185,7 +185,7 @@ const GPS = {
185 }; 185 };
186 // 关键安全配置 186 // 关键安全配置
187 window._AMapSecurityConfig = { 187 window._AMapSecurityConfig = {
188 - securityJsCode: '8602057c4c8dae5bed9a240c0582c46f', // 替换为你的密钥 188 + securityJsCode: 'ac1a3a5858d74b7d6c50b6858100aa12', // 替换为你的密钥
189 } 189 }
190 export default { 190 export default {
191 components: { InfoWindow, InfoWindowLite, InfoWindowWarn, audioBackground }, 191 components: { InfoWindow, InfoWindowLite, InfoWindowWarn, audioBackground },
...@@ -265,12 +265,15 @@ export default { ...@@ -265,12 +265,15 @@ export default {
265 data_zooms: '', // 接口获取-地图默认缩放范围 265 data_zooms: '', // 接口获取-地图默认缩放范围
266 data_rotation: 0, // 接口获取-地图旋转角度 266 data_rotation: 0, // 接口获取-地图旋转角度
267 log_lnglat: '', // 获取当前地址经纬度 267 log_lnglat: '', // 获取当前地址经纬度
268 - temp_rotation: 0 268 + temp_rotation: 0,
269 + point_range: [
270 + [120.585111, 31.316084], [120.585111, 31.316084], [120.589488, 31.313197], [120.585422, 31.313005]
271 + ], // 接口获取-地图范围
269 } 272 }
270 }, 273 },
271 async mounted() { 274 async mounted() {
272 const AMap = await AMapLoader.load({ 275 const AMap = await AMapLoader.load({
273 - key: '381c6763e1fefd810fbab697f470149c', // 控制台获取 276 + key: '17b8fc386104b89db88b60b049a6dbce', // 控制台获取
274 version: '2.0', // 指定API版本 277 version: '2.0', // 指定API版本
275 plugins: ['AMap.ElasticMarker','AMap.ImageLayer','AMap.ToolBar','AMap.IndoorMap','AMap.Walking','AMap.Geolocation'] // 必须加载步行导航插件 278 plugins: ['AMap.ElasticMarker','AMap.ImageLayer','AMap.ToolBar','AMap.IndoorMap','AMap.Walking','AMap.Geolocation'] // 必须加载步行导航插件
276 }) 279 })
...@@ -290,6 +293,7 @@ export default { ...@@ -290,6 +293,7 @@ export default {
290 this.data_zoom = data.map.zoom; // 地图默认缩放 293 this.data_zoom = data.map.zoom; // 地图默认缩放
291 this.data_rotation = data.map.rotation; // 地图旋转角度 294 this.data_rotation = data.map.rotation; // 地图旋转角度
292 this.data_zooms = data.map.zooms.map(item => Number(item)); // 地图默认缩放范围 295 this.data_zooms = data.map.zooms.map(item => Number(item)); // 地图默认缩放范围
296 + this.point_range = data.map.map_range ? data.map.point_range : []; // 地图定位范围
293 // 初始化地图 297 // 初始化地图
294 this.initMap(); 298 this.initMap();
295 // this.setMapBoundary(); 299 // this.setMapBoundary();
...@@ -521,9 +525,7 @@ export default { ...@@ -521,9 +525,7 @@ export default {
521 // }); 525 // });
522 // }, 526 // },
523 isPointInRing() { // 是否在景区范围 527 isPointInRing() { // 是否在景区范围
524 - let isPointInRing = AMap.GeometryUtil.isPointInRing([this.current_lng, this.current_lat], [ 528 + let isPointInRing = AMap.GeometryUtil.isPointInRing([this.current_lng, this.current_lat], this.point_range);
525 - [120.585111, 31.316084], [120.585111, 31.316084], [120.589488, 31.313197], [120.585422, 31.313005]
526 - ]);
527 return isPointInRing 529 return isPointInRing
528 }, 530 },
529 setLocation() { // 开启定位服务 531 setLocation() { // 开启定位服务
......
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 15:52:47 4 + * @LastEditTime: 2025-08-07 16:13:08
5 * @FilePath: /map-demo/src/views/xys/index.vue 5 * @FilePath: /map-demo/src/views/xys/index.vue
6 * @Description: 公众地图主体页面 6 * @Description: 公众地图主体页面
7 --> 7 -->
...@@ -183,7 +183,7 @@ const GPS = { ...@@ -183,7 +183,7 @@ const GPS = {
183 }; 183 };
184 // 关键安全配置 184 // 关键安全配置
185 window._AMapSecurityConfig = { 185 window._AMapSecurityConfig = {
186 - securityJsCode: '8602057c4c8dae5bed9a240c0582c46f', // 替换为你的密钥 186 + securityJsCode: 'ac1a3a5858d74b7d6c50b6858100aa12', // 替换为你的密钥
187 } 187 }
188 export default { 188 export default {
189 components: { InfoWindow, InfoWindowLite, InfoWindowWarn, audioBackground, InfoPopup, InfoPopupLite, InfoPopupWarn }, 189 components: { InfoWindow, InfoWindowLite, InfoWindowWarn, audioBackground, InfoPopup, InfoPopupLite, InfoPopupWarn },
...@@ -266,11 +266,14 @@ export default { ...@@ -266,11 +266,14 @@ export default {
266 showInfoLitePopup: false, 266 showInfoLitePopup: false,
267 showInfoWarnPopup: false, 267 showInfoWarnPopup: false,
268 data_layers: [], 268 data_layers: [],
269 + point_range: [
270 + [120.585111, 31.316084], [120.585111, 31.316084], [120.589488, 31.313197], [120.585422, 31.313005]
271 + ]
269 } 272 }
270 }, 273 },
271 async mounted() { 274 async mounted() {
272 const AMap = await AMapLoader.load({ 275 const AMap = await AMapLoader.load({
273 - key: '381c6763e1fefd810fbab697f470149c', // 控制台获取 276 + key: '17b8fc386104b89db88b60b049a6dbce', // 控制台获取
274 version: '2.0', // 指定API版本 277 version: '2.0', // 指定API版本
275 plugins: ['AMap.ElasticMarker','AMap.ImageLayer','AMap.ToolBar','AMap.IndoorMap','AMap.Walking','AMap.Geolocation'] // 必须加载步行导航插件 278 plugins: ['AMap.ElasticMarker','AMap.ImageLayer','AMap.ToolBar','AMap.IndoorMap','AMap.Walking','AMap.Geolocation'] // 必须加载步行导航插件
276 }) 279 })
...@@ -287,6 +290,7 @@ export default { ...@@ -287,6 +290,7 @@ export default {
287 this.data_rotation = data.map.rotation; // 地图旋转角度 290 this.data_rotation = data.map.rotation; // 地图旋转角度
288 this.data_zooms = data.map.zooms.map(item => Number(item)); // 地图默认缩放范围 291 this.data_zooms = data.map.zooms.map(item => Number(item)); // 地图默认缩放范围
289 this.data_paths = data.map.path ? data.map.path : {}; // 地图默认导航路径 292 this.data_paths = data.map.path ? data.map.path : {}; // 地图默认导航路径
293 + this.point_range = data.map.map_range ? data.map.point_range : []; // 地图定位范围
290 if (data.map.map_layers) { // 地图默认图层 294 if (data.map.map_layers) { // 地图默认图层
291 if (data.map.map_layers === 'satellite') { // 卫星和路网 295 if (data.map.map_layers === 'satellite') { // 卫星和路网
292 this.data_layers = [new AMap.TileLayer.Satellite(), new AMap.TileLayer.RoadNet()] 296 this.data_layers = [new AMap.TileLayer.Satellite(), new AMap.TileLayer.RoadNet()]
...@@ -570,9 +574,7 @@ export default { ...@@ -570,9 +574,7 @@ export default {
570 // }); 574 // });
571 // }, 575 // },
572 isPointInRing() { // 是否在景区范围 576 isPointInRing() { // 是否在景区范围
573 - let isPointInRing = AMap.GeometryUtil.isPointInRing([this.current_lng, this.current_lat], [ 577 + let isPointInRing = AMap.GeometryUtil.isPointInRing([this.current_lng, this.current_lat], this.point_range);
574 - [120.585111, 31.316084], [120.585111, 31.316084], [120.589488, 31.313197], [120.585422, 31.313005]
575 - ]);
576 return isPointInRing 578 return isPointInRing
577 }, 579 },
578 setLocation() { // 开启定位服务 580 setLocation() { // 开启定位服务
......