Quellcode durchsuchen

11/18 乐团修改提测

11
mo vor 4 Jahren
Ursprung
Commit
86e5793d5f

+ 19 - 48
src/views/teamDetail/componentCourse/gpsLocation.vue

@@ -1,6 +1,5 @@
 <template>
   <div>
-    <p class="title">打卡地相距教学点{{distance}}米</p>
     <!-- <el-amap-search-box class="search-box"
                         value="searchValue"
                         :search-option="searchOption"
@@ -17,11 +16,18 @@
                       :key="index"
                       :position="marker.location"
                       :title="marker.title"></el-amap-marker>
+      <el-amap-text v-for="(marker,index) in markers"
+                    :key="index+'xxx'"
+                    :text="marker.title"
+                    :position="marker.location"
+                    :offset="[40,-10]"></el-amap-text>
       <el-amap-polyline :path="path"
                         strokeColor='#4196fc'></el-amap-polyline>
-      <el-amap-text v-for="text in texts"
+      <el-amap-text v-for="(text,index) in texts"
+                    :key="index+'ooo'"
                     :text="text.text"
-                    :position="text.position"></el-amap-text>
+                    :position="text.position"
+                    :offset="[-50,0]"></el-amap-text>
     </el-amap>
   </div>
 </template> 
@@ -56,10 +62,7 @@ VueAMap.initAMapApiLoader({
 })
 let amapManager = new VueAMap.AMapManager();
 import { getTeacherPersonalAttendance } from '@/api/buildTeam'
-const exampleComponents = {
-  props: ['text'],
-  template: `<div>text from  parent: {{text}}</div>`
-}
+
 export default {
   props: ['activeRow'],
   data () {
@@ -82,6 +85,12 @@ export default {
     }
   },
   watch: {
+    activeRow (val) {
+      if (val) {
+        console.log(val)
+        this.init()
+      }
+    }
   },
   mounted () {
     this.init()
@@ -99,7 +108,6 @@ export default {
         let add = {
           title: '教学点',
           location: this.activeRow.schoolLongitudeLatitude.split(','),
-          contentRender: (h, instance) => h(exampleComponents, { style: { backgroundColor: '#fff' }, props: { text: 'father is here' } }, ['xxxxxxx'])
         }
         this.center = this.activeRow.schoolLongitudeLatitude.split(',');
         this.schoolLongitudeLatitude = this.activeRow.schoolLongitudeLatitude.split(',')
@@ -121,7 +129,7 @@ export default {
           location: this.activeRow.signOutLongitudeLatitude.split(',')
         }
         this.center = this.activeRow.signOutLongitudeLatitude.split(',');
-        this.signInLongitudeLatitude = this.activeRow.signOutLongitudeLatitude.split(',')
+        this.signOutLongitudeLatitude = this.activeRow.signOutLongitudeLatitude.split(',')
         this.markers.push(add)
       }
       // if (this.$refs.map) {
@@ -129,44 +137,7 @@ export default {
       // }
 
       this.getDistance(this.signInLongitudeLatitude, this.schoolLongitudeLatitude)
-
-      return
-      // getTeacherPersonalAttendance({ courseScheduleId: this.courseScheduleId }).then(res => {
-      //   if (res.code == 200) {
-      //     if (res.data && res.data.signInLongitudeLatitude) {
-      //       let add = {
-      //         title: '签到点',
-      //         location: res.data.signInLongitudeLatitude.split(',')
-      //       }
-      //       this.center = res.data.signInLongitudeLatitude.split(',');
-      //       this.signInLongitudeLatitude = res.data.signInLongitudeLatitude.split(',')
-      //       this.markers.push(add)
-      //     }
-      //     if (res.data && res.data.signOutLongitudeLatitude) {
-      //       let add = {
-      //         title: '签退点',
-      //         location: res.data.signOutLongitudeLatitude.split(',')
-      //       }
-      //       this.center = res.data.signOutLongitudeLatitude.split(',');
-      //       this.signOutLongitudeLatitude = res.data.signOutLongitudeLatitude.split(',')
-      //       this.markers.push(add)
-      //     }
-
-      //     if (res.data && res.data.schoolLongitudeLatitude) {
-      //       let add = {
-      //         title: '教学点',
-      //         location: res.data.schoolLongitudeLatitude.split(',')
-      //       }
-      //       this.schoolLongitudeLatitude = res.data.schoolLongitudeLatitude.split(',')
-      //       this.center = res.data.schoolLongitudeLatitude.split(',');
-      //       this.markers.push(add)
-      //     }
-      //     this.getDistance(this.signInLongitudeLatitude, this.schoolLongitudeLatitude)
-      //   }
-      // })
-      //   ;
-      // console.log(this.amapManager.setFitView)
-      // this.getDistance()
+      this.getDistance(this.signOutLongitudeLatitude, this.schoolLongitudeLatitude)
     },
     onSearchResult () { },
     getDistance (sigin, school) {
@@ -202,6 +173,6 @@ export default {
   margin-bottom: 20px;
 }
 .amap-demo {
-  height: 300px;
+  height: 500px;
 }
 </style>

+ 2 - 1
src/views/teamDetail/componentCourse/teacherList.vue

@@ -74,7 +74,8 @@
                title="GPS"
                :visible.sync="gpsVisible"
                append-to-body>
-      <gpsLoction :activeRow='activeRow' />
+      <gpsLoction v-if="gpsVisible"
+                  :activeRow='activeRow' />
     </el-dialog>
   </div>
 </template>