| 
														
															@@ -1,4 +1,6 @@ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 // nova-werun/pages/home/sport/sport-home/index.js 
														 | 
														
														 | 
														
															 // nova-werun/pages/home/sport/sport-home/index.js 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+const Parse = getApp().Parse; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+const company = getApp().globalData.company; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 Page({ 
														 | 
														
														 | 
														
															 Page({ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     /** 
														 | 
														
														 | 
														
															     /** 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -19,6 +21,8 @@ Page({ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         longitude: 0, 
														 | 
														
														 | 
														
															         longitude: 0, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         latitude: 0, 
														 | 
														
														 | 
														
															         latitude: 0, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         markers: [], 
														 | 
														
														 | 
														
															         markers: [], 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        // 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        distance:0 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     }, 
														 | 
														
														 | 
														
															     }, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     /** 
														 | 
														
														 | 
														
															     /** 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -50,6 +54,7 @@ Page({ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         //地图 
														 | 
														
														 | 
														
															         //地图 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         this.Getlocation() 
														 | 
														
														 | 
														
															         this.Getlocation() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        this.getwalk(0) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     }, 
														 | 
														
														 | 
														
															     }, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     /** 
														 | 
														
														 | 
														
															     /** 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -181,11 +186,36 @@ Page({ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     }, 
														 | 
														
														 | 
														
															     }, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    //切换 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     switchTab (e) { 
														 | 
														
														 | 
														
															     switchTab (e) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         const index = e.currentTarget.dataset.index; 
														 | 
														
														 | 
														
															         const index = e.currentTarget.dataset.index; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         this.setData({ 
														 | 
														
														 | 
														
															         this.setData({ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															           currentTab: index 
														 | 
														
														 | 
														
															           currentTab: index 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         }); 
														 | 
														
														 | 
														
															         }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        this.getwalk(index) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         console.log(this.data.currentTab); 
														 | 
														
														 | 
														
															         console.log(this.data.currentTab); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       }, 
														 | 
														
														 | 
														
															       }, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      //获取行走公里 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     async getwalk(index){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        const currentUser = Parse.User.current(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        let ActivityDataquery = new Parse.Query('ActivityData'); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        ActivityDataquery.equalTo('user', currentUser.id); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        ActivityDataquery.equalTo('company', company); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        if(index==0){ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            ActivityDataquery.equalTo('type', 'walk'); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        }else{ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            ActivityDataquery.equalTo('type', 'run'); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        ActivityDataquery.notEqualTo('isDeleted', true); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        let r = await ActivityDataquery.find(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        let List = r.map(item => item.toJSON()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        let distance = 0 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        List.forEach(item=>{ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            distance =  Number(item.distance)+distance 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        }) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        this.setData({ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            distance, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        }) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        console.log('距离',this.data.distance); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 }) 
														 | 
														
														 | 
														
															 }) 
														 |