hookehuyr

体验优化调整

...@@ -155,7 +155,7 @@ var spotInfo = [ ...@@ -155,7 +155,7 @@ var spotInfo = [
155 url: 'https://mp.weixin.qq.com/s/XzSqtH5RPaRSAihQGZJ8hg', 155 url: 'https://mp.weixin.qq.com/s/XzSqtH5RPaRSAihQGZJ8hg',
156 }, 156 },
157 ], 157 ],
158 - zoom: { 17: 1, 18: 1, 19: 0, 20: 0 }, 158 + zoom: { 17: 1, 18: 1, 19: 1, 20: 0 },
159 }, 159 },
160 { 160 {
161 name: '钟楼', 161 name: '钟楼',
......
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: 2023-06-07 11:26:02 4 + * @LastEditTime: 2023-06-07 15:27:35
5 * @FilePath: /map-demo/src/views/index.vue 5 * @FilePath: /map-demo/src/views/index.vue
6 * @Description: 地图主体页面 6 * @Description: 地图主体页面
7 --> 7 -->
...@@ -186,8 +186,8 @@ export default { ...@@ -186,8 +186,8 @@ export default {
186 publicInfo: [], // 公共设施信息实体 186 publicInfo: [], // 公共设施信息实体
187 show_popup: false, 187 show_popup: false,
188 dialog_show: false, 188 dialog_show: false,
189 - xys_lng: '', 189 + xys_lng: 120.587334,
190 - xys_lat: '', 190 + xys_lat: 31.314823,
191 walk_route: '', 191 walk_route: '',
192 toolBar: '', 192 toolBar: '',
193 isActive: 0, 193 isActive: 0,
...@@ -275,7 +275,7 @@ export default { ...@@ -275,7 +275,7 @@ export default {
275 showIndoorMap: false, 275 showIndoorMap: false,
276 defaultCursor: 'pointer', // 地图默认鼠标样式 276 defaultCursor: 'pointer', // 地图默认鼠标样式
277 showBuildingBlock: false, // 是否展示地图 3D 楼块 277 showBuildingBlock: false, // 是否展示地图 3D 楼块
278 - zooms: [17, 19], // 地图显示的缩放级别范围, 默认为 [2, 20] ,取值范围 [2 ~ 30] 278 + zooms: [17, 20], // 地图显示的缩放级别范围, 默认为 [2, 20] ,取值范围 [2 ~ 30]
279 showLabel: true, // 是否展示地图文字和 POI 信息 279 showLabel: true, // 是否展示地图文字和 POI 信息
280 zoom: 18, // 设置地图显示的缩放级别 280 zoom: 18, // 设置地图显示的缩放级别
281 pitch: 0, // 俯仰角度,默认 0,最大值根据地图当前 zoom 级别不断增大,2D地图下无效 。 281 pitch: 0, // 俯仰角度,默认 0,最大值根据地图当前 zoom 级别不断增大,2D地图下无效 。
...@@ -299,7 +299,7 @@ export default { ...@@ -299,7 +299,7 @@ export default {
299 _.each(coord.spotInfo, (x, i) => { 299 _.each(coord.spotInfo, (x, i) => {
300 var marker = new AMap.ElasticMarker({ 300 var marker = new AMap.ElasticMarker({
301 position: coord.spotInfo[i].position, 301 position: coord.spotInfo[i].position,
302 - zooms: [17, 19], 302 + zooms: [17, 20],
303 styles: [{ 303 styles: [{
304 icon: { 304 icon: {
305 img: coord.spotInfo[i].icon, 305 img: coord.spotInfo[i].icon,
...@@ -339,7 +339,7 @@ export default { ...@@ -339,7 +339,7 @@ export default {
339 _.each(coord.toiletInfo, (x, i) => { 339 _.each(coord.toiletInfo, (x, i) => {
340 var marker = new AMap.ElasticMarker({ 340 var marker = new AMap.ElasticMarker({
341 position: coord.toiletInfo[i].position, 341 position: coord.toiletInfo[i].position,
342 - zooms: [17, 19], 342 + zooms: [17, 20],
343 styles: [{ 343 styles: [{
344 icon: { 344 icon: {
345 img: coord.toiletInfo[i].icon, 345 img: coord.toiletInfo[i].icon,
...@@ -376,7 +376,7 @@ export default { ...@@ -376,7 +376,7 @@ export default {
376 _.each(coord.activityInfo, (x, i) => { 376 _.each(coord.activityInfo, (x, i) => {
377 var marker = new AMap.ElasticMarker({ 377 var marker = new AMap.ElasticMarker({
378 position: coord.activityInfo[i].position, 378 position: coord.activityInfo[i].position,
379 - zooms: [17, 19], 379 + zooms: [17, 20],
380 styles: [{ 380 styles: [{
381 icon: { 381 icon: {
382 img: coord.activityInfo[i].icon, 382 img: coord.activityInfo[i].icon,
...@@ -413,7 +413,7 @@ export default { ...@@ -413,7 +413,7 @@ export default {
413 _.each(coord.publicInfo, (x, i) => { 413 _.each(coord.publicInfo, (x, i) => {
414 var marker = new AMap.ElasticMarker({ 414 var marker = new AMap.ElasticMarker({
415 position: coord.publicInfo[i].position, 415 position: coord.publicInfo[i].position,
416 - zooms: [17, 19], 416 + zooms: [17, 20],
417 styles: [{ 417 styles: [{
418 icon: { 418 icon: {
419 img: coord.publicInfo[i].icon, 419 img: coord.publicInfo[i].icon,
...@@ -480,7 +480,7 @@ export default { ...@@ -480,7 +480,7 @@ export default {
480 } 480 }
481 } 481 }
482 }, 482 },
483 - getLocation() { 483 + getLocation() { // 获取经纬度
484 AMap.plugin(['AMap.Geolocation'], () => { 484 AMap.plugin(['AMap.Geolocation'], () => {
485 this.geolocation = new AMap.Geolocation(this.location_options); 485 this.geolocation = new AMap.Geolocation(this.location_options);
486 this.geolocation.getCurrentPosition((status, result) => { 486 this.geolocation.getCurrentPosition((status, result) => {
...@@ -491,9 +491,6 @@ export default { ...@@ -491,9 +491,6 @@ export default {
491 if (lng && lat) { 491 if (lng && lat) {
492 this.current_lng = GPS.gcj_encrypt(lat, lng).lon; 492 this.current_lng = GPS.gcj_encrypt(lat, lng).lon;
493 this.current_lat = GPS.gcj_encrypt(lat, lng).lat; 493 this.current_lat = GPS.gcj_encrypt(lat, lng).lat;
494 - // 西园寺的经纬度
495 - this.xys_lng = GPS.gcj_encrypt(31.315021, 120.58848).lon;
496 - this.xys_lat = GPS.gcj_encrypt(31.315021, 120.58848).lat;
497 } 494 }
498 } 495 }
499 }) 496 })
...@@ -582,7 +579,7 @@ export default { ...@@ -582,7 +579,7 @@ export default {
582 this.map.remove([this.current_route]); 579 this.map.remove([this.current_route]);
583 this.map.remove(this.safe_route); 580 this.map.remove(this.safe_route);
584 }, 581 },
585 - setTitleLayer() { 582 + setTitleLayer() { // 生成瓦片图
586 var layer = new AMap.TileLayer.Flexible({ 583 var layer = new AMap.TileLayer.Flexible({
587 cacheSize: 50, 584 cacheSize: 50,
588 opacity: 1, 585 opacity: 1,
...@@ -619,7 +616,25 @@ export default { ...@@ -619,7 +616,25 @@ export default {
619 }; 616 };
620 617
621 img.src = `images/tiles/${z}/${x}_${y}.jpg` 618 img.src = `images/tiles/${z}/${x}_${y}.jpg`
622 - } 619 + },
620 + // createTile: function (x, y, z, success, fail) {
621 + // console.warn(z);
622 + // if ((x + y) % 3) {
623 + // fail();
624 + // return;
625 + // }
626 +
627 + // var img = document.createElement('img');
628 + // img.onload = function () {
629 + // success(img)
630 + // };
631 + // img.crossOrigin = "anonymous";// 必须添加,同时图片要有跨域头
632 + // img.onerror = function () {
633 + // fail()
634 + // };
635 +
636 + // img.src = 'https://a.amap.com/jsapi_demos/static/images/amap.png';
637 + // }
623 }); 638 });
624 639
625 this.map.addLayer(layer); 640 this.map.addLayer(layer);
...@@ -770,7 +785,12 @@ export default { ...@@ -770,7 +785,12 @@ export default {
770 this.navName = 'publicInfo' 785 this.navName = 'publicInfo'
771 this.setPublicLayer() 786 this.setPublicLayer()
772 } 787 }
773 - this.closeInfoWindow() 788 + this.closeInfoWindow();
789 + setTimeout(() => {
790 + // 地图zooms调整
791 + this.map.setZoom(18);
792 + this.map.setZoomAndCenter(18, [this.xys_lng, this.xys_lat]);
793 + }, 100);
774 }, 794 },
775 handleSafeRoute(status) { // 打开/关闭逃生路线线 795 handleSafeRoute(status) { // 打开/关闭逃生路线线
776 if (status) { 796 if (status) {
......