zhengkaixin 2 years ago
parent
commit
f959846891
4 changed files with 20 additions and 11 deletions
  1. 2 1
      .env.dev.js
  2. 6 6
      components/Carmap.vue
  3. 11 3
      pages/route/index.js
  4. 1 1
      pages/route/index.vue

+ 2 - 1
.env.dev.js

@@ -1,6 +1,7 @@
 const UNI_APP = {  
+	BASE_URL: 'http://47.98.231.198:9090/ds-commute/' ,
 	
-    BASE_URL: 'http://192.168.77.162:8096/smart-bus-server/' ,
+   // BASE_URL: 'http://192.168.77.162:8096/smart-bus-server/' ,
 	NODE_ENV :"dev",
 	SIMPLE_RUN:true,// 无视权限控制跳转页面   , 用于样式人员快速访问各种功能 ,快速测试等
 	//企业联合会微信appid

+ 6 - 6
components/Carmap.vue

@@ -120,9 +120,14 @@
 			
 			},
 			clickHandler(){
+				this.$emit('clickHandler')
+			},
+			ifCenter(item){
+				console.log("ifCenterifCenter")
+				//this.ifCenterItem=item
 				var _this = this;
 				
-				var item=_this.ifCenterItem
+				//var item=_this.ifCenterItem
 				if(_this.mapbus&&item){
 					var map=_this.mapbus
 					var MapData={
@@ -147,11 +152,6 @@
 				}else{
 					return false
 				}
-			},
-			ifCenter(item){
-				console.log("ifCenterifCenter")
-				this.ifCenterItem=item
-				
 				
 												
 			},

+ 11 - 3
pages/route/index.js

@@ -46,7 +46,8 @@ export default {
 			reverseInit:false,
 			myinterval: '',
 			routeInfo:{},
-			popid:0,
+			popid:0,
+			clickHandlerBl:true,
 			radiolist: [
 					{
 						name: '不提醒',
@@ -215,7 +216,11 @@ export default {
 					this.$refs.amap.setCenter(response.data);
 				}
 				this.carList=[response.data];
-				this.$refs.amap.ifCenter(this.carList[0]);
+				if(this.clickHandlerBl){
+					this.$refs.amap.ifCenter(this.carList[0]);
+				}else{
+					this.clickHandlerBl=true;
+				}
 				
 				if(!this.centerBl&&this.carList.length){
 					this.centerBl=this.$refs.amap.setCenter(this.carList[0]);
@@ -354,6 +359,9 @@ export default {
 				this.$refs.amap.initMap(point, this.stationList,startend);
 			}
 		},
+		clickHandler(){
+			this.clickHandlerBl=false
+		},
 		carShow2(item){
 			console.log(item)
 			if(item.type=="car"){
@@ -538,7 +546,7 @@ export default {
 			var pages = getCurrentPages();
 			var page = (pages[pages.length - 1]).route;
 			if (page == "pages/route/index") {
-				setTimeout(this.getPoint, 10000);
+				setTimeout(this.getPoint, 5000);
 			}
 		},
 		getLocation(){

+ 1 - 1
pages/route/index.vue

@@ -71,7 +71,7 @@
 				<span v-if="mapopen">缩小地图</span>
 			</view>
 		</u-navbar>
-		<carmap ref="amap" @onload="mapdown"  @clickMap="carShow2" ></carmap>
+		<carmap ref="amap" @onload="mapdown"  @clickMap="carShow2"  @clickHandler="clickHandler" ></carmap>
 		
 		<view class="map-info">
 			<view class="map-text" v-if="stationList.length">