Pārlūkot izejas kodu

🐛导航地图问题修复

shaogen1995 2 gadi atpakaļ
vecāks
revīzija
6096df6f9a

+ 23 - 9
yfyc/src/views/Construct/components/HomeList.vue

@@ -13,7 +13,7 @@
       />
     </div>
     <!-- 主体内容 -->
-    <div class="mainBoxNull" v-if="dataShow.length===0">暂无内容</div>
+    <div class="mainBoxNull" v-if="dataShow.length === 0">暂无内容</div>
     <div class="mainBox" v-else>
       <div
         class="row"
@@ -25,7 +25,7 @@
         <div class="name">{{ item.name }}</div>
         <div class="loc">
           <img src="../../../assets/img/home/loc.png" alt="" />
-          {{ item.loction }}
+          <p>{{ item.loction }}</p>
         </div>
       </div>
     </div>
@@ -57,7 +57,11 @@ export default {
         { id: 2, name: "英驻芜领事署旧址", loction: "范罗山" },
         { id: 3, name: "总税务司公所旧址", loction: "范罗山" },
         { id: 4, name: "洋员帮办楼旧址", loction: "范罗山" },
-        { id: 5, name: "英驻芜领事官邸旧址", loction: "吉和南路 26 号雨耕山顶" },
+        {
+          id: 5,
+          name: "英驻芜领事官邸旧址",
+          loction: "吉和南路 26 号雨耕山顶",
+        },
         { id: 6, name: "大教堂", loction: "吉和街28 号" },
         { id: 7, name: "神父楼", loction: "吉和街28 号" },
         { id: 8, name: "天主教主教公署旧址", loction: "狮子山马路39号" },
@@ -112,7 +116,7 @@ export default {
     document.querySelector("#app").style.maxWidth = "500px";
     this.getList();
     if (this.$route.query.autoWatch) {
-      this.handlClick(this.$route.query.autoWatch)
+      this.handlClick(this.$route.query.autoWatch);
     }
   },
   mounted() {},
@@ -176,7 +180,7 @@ export default {
       border-radius: 5px;
     }
   }
-  .mainBoxNull{
+  .mainBoxNull {
     width: 100%;
     height: 300px;
     display: flex;
@@ -210,21 +214,31 @@ export default {
       }
 
       .name {
-        padding: 8px 10px 3px;
+        padding: 10px 0px 3px 6px;
         font-size: 14px;
         font-weight: 700;
+        overflow: hidden;
+        text-overflow: ellipsis;
+        white-space: nowrap;
       }
 
       .loc {
-        padding-left: 10px;
+        width: 100%;
+        padding-left: 6px;
         display: flex;
         align-items: center;
-        margin-top: 3px;
-        font-size: 12px;
+        margin-top: 8px;
         & > img {
           margin-right: 3px;
           width: 14px;
         }
+        & > p {
+          width: calc(100% - 18px);
+          font-size: 12px;
+          overflow: hidden;
+          text-overflow: ellipsis;
+          white-space: nowrap;
+        }
       }
     }
   }

+ 1 - 1
yfyc/src/views/Construct/components/search.vue

@@ -10,7 +10,7 @@
     <!-- 文字介绍 -->
     <div class="searTxt">
       <h3>芜湖市古建一张图</h3>
-      <p>&emsp;&emsp;芜湖是全国文明域市、全国创新型试点域市、全国电子商务示范城市、全国信息消费示范域市、全国双拥模范城、国家园林域市等。</p>
+      <p>&emsp;&emsp;芜湖是全国文明城市、全国创新型试点城市、全国电子商务示范城市、全国信息消费示范城市、全国双拥模范城、国家园林城市等。</p>
       <p>&emsp;&emsp;辖区内有方特旅游度假区、天门山、镜湖公园、鸠兹古镇、丫山风景区、马仁奇峰、松鼠小镇、广济寺、王稼祥纪念园、繁昌窑遗址等景区。</p>
     </div>
     <!-- 底部下拉 -->

+ 1 - 1
yfyc/src/views/Construct/index.vue

@@ -66,7 +66,7 @@ export default {
       vrShow: false,
       searchShow: false,
       data: [
-        { id: 1, name: "老芜湖海关旧址", loction: "滨江公园内" },
+        // { id: 1, name: "老芜湖海关旧址", loction: "滨江公园内" },
         { id: 2, name: "英驻芜领事署旧址", loction: "范罗山" },
         { id: 3, name: "总税务司公所旧址", loction: "范罗山" },
         { id: 4, name: "洋员帮办楼旧址", loction: "范罗山" },

+ 14 - 16
yfyc/src/views/MapNav.vue

@@ -14,8 +14,6 @@ export default {
   data() {
     //这里存放数据
     return {
-      keywords: "",
-      arr: [],
       map: null,
     };
   },
@@ -29,19 +27,19 @@ export default {
       window.onLoad = () => {
         this.map = new AMap.Map("myMap", {
           zoom: 18,
-          center: [this.$route.params.x, this.$route.params.y],
+          center: [this.$route.query.x, this.$route.query.y],
           // viewMode: '3D'
         });
         const marker = new AMap.Marker({
-          position: [this.$route.params.x, this.$route.params.y], // 位置
+          position: [this.$route.query.x, this.$route.query.y], // 位置
           label: {
             offset: new AMap.Pixel(20, 20),
             content: "点击打开高德地图",
           },
         });
-        marker.on("click", function (e) {
+        marker.on("click", (e) => {
           marker.markOnAMAP({
-            name: this.$route.params.name,
+            name: this.$route.query.name,
             position: marker.getPosition(),
           });
         });
@@ -65,20 +63,20 @@ export default {
     },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
-  created() { 
-    window.document.title='景点导航'
+  created() {
+    window.document.title = "景点导航";
   },
   //生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {
     this.initMap();
   },
-  beforeCreate() { }, //生命周期 - 创建之前
-  beforeMount() { }, //生命周期 - 挂载之前
-  beforeUpdate() { }, //生命周期 - 更新之前
-  updated() { }, //生命周期 - 更新之后
-  beforeDestroy() { }, //生命周期 - 销毁之前
-  destroyed() { }, //生命周期 - 销毁完成
-  activated() { }, //如果页面有keep-alive缓存功能,这个函数会触发
+  beforeCreate() {}, //生命周期 - 创建之前
+  beforeMount() {}, //生命周期 - 挂载之前
+  beforeUpdate() {}, //生命周期 - 更新之前
+  updated() {}, //生命周期 - 更新之后
+  beforeDestroy() {}, //生命周期 - 销毁之前
+  destroyed() {}, //生命周期 - 销毁完成
+  activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
 };
 </script>
 <style lang='less' scoped>
@@ -96,7 +94,7 @@ export default {
     width: 100%;
     height: 100%;
   }
-  /deep/.amap-marker-label{
+  /deep/.amap-marker-label {
     // color: red;
   }
 }

+ 1 - 1
yfyc/src/views/Serve/FoodDetail.vue

@@ -119,7 +119,7 @@ export default {
     onClickNav() {
       this.$router.push({
         name: 'MapNav',
-        params: {
+        query: {
           x: this.info.x,
           y: this.info.y,
           name: this.info.name,

+ 1 - 1
yfyc/src/views/Serve/HotelDetail.vue

@@ -160,7 +160,7 @@ export default {
     onClickNav() {
       this.$router.push({
         name: 'MapNav',
-        params: {
+        query: {
           x: this.info.x,
           y: this.info.y,
           name: this.info.name,

+ 1 - 1
yfyc/src/views/Serve/index.vue

@@ -21,7 +21,7 @@
         class="entry"
         :to="{
           name: 'MapNav',
-          params: {
+          query: {
             x: 118.35714,
             y: 31.336011,
             name: '老芜湖海关',