skcj 3 ヶ月 前
コミット
dacb8ee155
1 ファイル変更14 行追加8 行削除
  1. 14 8
      ruoyi-ui/src/components/AmApN/index.vue

+ 14 - 8
ruoyi-ui/src/components/AmApN/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div  v-show="isShow">
     <div class="myclass" >
-      <div class="flex" >{{title}}<label style="margin-left: 30px;font-size: 18pt">{{title1}}</label><input v-if="gjlx==='gj'" style="margin-left: 400px;width:200px" v-model="rq"  type="date"  name="trip-start"
+      <div class="flex" >{{title}}<input v-if="gjlx==='gj'" style="margin-left: 400px;width:200px" v-model="rq"  type="date"  name="trip-start"
                                          value="2023-09-01" min="2023-09-01" max="2029-12-31"></div>
       <div id="mapTrack">
         <el-card class="box-card" shadow="never" :body-style="{ padding: '0' }">
@@ -232,15 +232,21 @@ export default {
           strokeColor: "#AF5",  //线颜色
           strokeWeight: 6,      //线宽
         });
+        this.map.remove(this.wllabel);
+        this.wllabel = new AMap.Text({
+          text: "Hello World",
+          offset: new AMap.Pixel(-100, -100),
+        });
+        this.wllabel.setPosition( this.lineArr[0]);
+        this.wllabel.setContent("<div style='background-color:beige;width: 200px'>时间:"+ this.lineArrSj[0]+"<br/>"+this.lineArrAdree[0]+"</div>");
+
+        this.wllabel.setMap(this.map);
         this.marker.on('moving',  (e) => {
           this.passedPolyline.setPath(e.passedPath);
           this.map.setCenter(e.target.getPosition(),true);
-          this.title1=this.lineArrSj[e.index];
-          this.marker.setLabel({
-            content:this.lineArrAdree[e.index],
-            direction: 'top',
-            offset: new AMap.Pixel(0, 20)
-          })
+          this.wllabel.setPosition(e.target.getPosition());
+          this.wllabel.setContent("<div style='background-color:beige;width: 200px'>时间:"+ this.lineArrSj[e.index]+"<br/>"+this.lineArrAdree[e.index]+"</div>");
+
         });
         if (this.gjlx=="gj")
         {
@@ -384,7 +390,7 @@ export default {
 },
     markerClick(e) {
       this.map.remove(this.wlMaker);
-      this.map.remove(this.wllabel);
+
       const infoWindow = new AMap.InfoWindow({
         offset: new AMap.Pixel(0, -30),
         content: '<div>这是一个信息窗体</div>'