| 
					
				 | 
			
			
				@@ -1,6 +1,6 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 <template> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   <div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    gps 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <p class="title">打卡地相距教学点{{distance}}米</p> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <!-- <el-amap-search-box class="search-box" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         value="searchValue" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         :search-option="searchOption" 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -14,7 +14,8 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       <!--  :events="markerEvents()" --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       <el-amap-marker v-for="(marker, index) in markers" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                       :key="index" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                      :position="marker"></el-amap-marker> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                      :position="marker.location" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                      :title="marker.title"></el-amap-marker> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </el-amap> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 </template>  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -48,7 +49,9 @@ VueAMap.initAMapApiLoader({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   v: '1.4.4' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 let amapManager = new VueAMap.AMapManager(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { getTeacherPersonalAttendance } from '@/api/buildTeam' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  props: ['courseScheduleId'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   data () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       zoom: 20, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -63,37 +66,67 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       //     marker.setMap(o); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       //   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      markers: [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        [114.34361, 30.55949], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        [114.34381, 30.55949], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      ], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      markers: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       plugin: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      distance: '-', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      schoolLongitudeLatitude: null, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      signInLongitudeLatitude: null, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   mounted () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    this.getDistance() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.init() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   activated () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    this.getDistance() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.init() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   methods: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // 地点搜索 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // searchOption () { }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // 重置 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    init () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      getTeacherPersonalAttendance({ courseScheduleId: this.courseScheduleId }).then(res => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (res.code == 200) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          if (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.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) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // this.getDistance() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     onSearchResult () { }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    getDistance () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      let o = amapManager.getMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      let marker1 = new AMap.Marker({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        position: [121.59996, 31.177646] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      let marker2 = new AMap.Marker({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        position: [121.59976, 31.177646] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    getDistance (sigin, school) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (sigin && sigin.length > 0 && school && school.length > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let o = amapManager.getMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let marker1 = new AMap.Marker({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          position: sigin 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let marker2 = new AMap.Marker({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          position: school 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      let p1 = marker1.getPosition(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      let p2 = marker2.getPosition(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      var distance = Math.round(p1.distance(p2)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      console.log(distance) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let p1 = marker1.getPosition(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let p2 = marker2.getPosition(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        var distance = Math.round(p1.distance(p2)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.distance = distance; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -101,6 +134,9 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 </script> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 <style lang="scss" scoped> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+.title { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  margin-bottom: 20px; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 .amap-demo { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   height: 300px; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |