zhengkaixin 4 лет назад
Родитель
Сommit
fbff9dbe2b
12 измененных файлов с 190 добавлено и 42 удалено
  1. 15 3
      .env.js
  2. 1 0
      .env.prod.js
  3. 2 5
      .env.test.js
  4. 13 0
      .env.uat.js
  5. 15 0
      apis/index.js
  6. 1 1
      manifest.json
  7. 6 6
      pages/buytickets/selectSite.vue
  8. 100 9
      pages/index/index.js
  9. 2 2
      pages/index/index.vue
  10. 6 1
      pages/query/index.js
  11. 23 9
      pages/route/index.js
  12. 6 6
      pages/route/index.vue

+ 15 - 3
.env.js

@@ -1,5 +1,5 @@
 (function() {  
-    const NODE_ENV = 'dev'; // dev:开发环境 | test:测试环境  
+    const NODE_ENV = 'test'; // dev:开发环境 | test:测试环境  
     let ENV_VAR = null;  
 	 
     if (process.env.NODE_ENV === "development") {  
@@ -9,9 +9,21 @@
         } else if (NODE_ENV === 'test') {  
 			ENV_VAR = require('.env.test.js'); 
         }  
-
+		
     } else if (process.env.NODE_ENV === "production") {  
-        ENV_VAR = require('.env.prod.js');  
+		
+		
+		var url=window.location.href.split('#')[0];
+		if(url.indexOf("http://xpgj.xiaoxinda.com/jp-car/")==0){
+			ENV_VAR = require('.env.prod.js'); 
+		}else if(url.indexOf("http://xpgj.xiaoxinda.com/jp-car-test/")==0){
+			 ENV_VAR = require('.env.uat.js'); 
+		} else if (NODE_ENV === 'uat') {
+		    ENV_VAR = require('.env.uat.js');  
+		} else  {  
+			ENV_VAR = require('.env.prod.js');  
+		} 
+      
     }  
 
     if (ENV_VAR) {  

+ 1 - 0
.env.prod.js

@@ -1,4 +1,5 @@
 const UNI_APP = {  
+	
 	BASE_URL: 'http://121.37.187.149/smart-bus-server/' ,
 	NODE_ENV :"prod",
 	SIMPLE_RUN:false,

+ 2 - 5
.env.test.js

@@ -1,9 +1,6 @@
 const UNI_APP = {  
-	//BASE_URL: 'http://192.168.33.120:8087/smart-bus-server/' ,
-	//BASE_URL: 'https://xpgjapi.xiaoxinda.com/' ,
-	//BASE_URL: 'https://ykt-test.xiaoxinda.com/smart-bus-server/' ,
-	BASE_URL: 'http://121.37.187.149/smart-bus-server/' ,
-	
+	BASE_URL: 'http://192.168.33.120:8087/smart-bus-server/' ,
+
 	NODE_ENV :"test",
 	SIMPLE_RUN:false,
 	//车信达 appid

+ 13 - 0
.env.uat.js

@@ -0,0 +1,13 @@
+const UNI_APP = {  
+	
+	BASE_URL: 'https://ykt-test.xiaoxinda.com/smart-bus-server/' ,
+	//BASE_URL: 'http://121.37.187.149/smart-bus-server/' ,
+	NODE_ENV :"uat",
+	SIMPLE_RUN:false,
+	//企业联合会微信appid
+	VUE_APP_WXAPPID:"wx93675268c87a5a46"
+	//VUE_APP_WXAPPID:"wxa8954f417fa7c32f"
+	
+}  
+
+module.exports = UNI_APP;

+ 15 - 0
apis/index.js

@@ -72,4 +72,19 @@ export function nearbyStationInfo(data) {
 		data:data,
 		url: '/mobile/passengerApi/nearbyStationInfo'
 	})
+}
+
+export function getRegionList(data) {
+	return request({
+		method: 'post',
+		data:data,
+		url: '/mobile/passengerApi/getRegionList'
+	})
+}
+export function getOwnerRegion(data) {
+	return request({
+		method: 'post',
+		data:data,
+		url: '/mobile/passengerApi/getOwnerRegion'
+	})
 }

+ 1 - 1
manifest.json

@@ -70,7 +70,7 @@
     },
     "h5" : {
         "devServer" : {
-            "port" : 80,
+            "port" : 8080,
             "https" : false,
             "disableHostCheck" : true
         },

+ 6 - 6
pages/buytickets/selectSite.vue

@@ -347,8 +347,8 @@
 				left: -3px;
 			}
 			.map-route-car {
-				height: 30px;
-				width: 30px;
+				height: 40px;
+				width: 40px;
 				position: absolute;
 				right: -10px;
 				top: 2px;
@@ -366,8 +366,8 @@
 		height: 200px;
 		width: 60px;
 		.map-route-car {
-			height: 30px;
-			width: 30px;
+			height: 40px;
+			width: 40px;
 			position: absolute;
 			right: -10px;
 			top: 2px;
@@ -412,8 +412,8 @@
 
 	.map-route-item.map-now {
 		.map-route-car {
-			height: 30px;
-			width: 30px;
+			height: 40px;
+			width: 40px;
 			position: absolute;
 			left: 10px;
 			top: 2px;

+ 100 - 9
pages/index/index.js

@@ -21,14 +21,7 @@ export default {
 				latitude: '',
 				optionsName:'荆州',
 				options1:[
-					{
-											label: '荆州',
-											value: '荆州',
-					},
-					{
-											label: '沙市',
-											value: '沙市',
-					},
+					 
 				],
 				list: [ ],
 				siteList:[
@@ -196,10 +189,104 @@ export default {
 			      }).catch(error => {
 			      	this.$refs.common.alert( error);
 			      })     
+			},
+			getOwnerRegion(){
+				var obj={
+					longitude:this.longitude,
+					latitude:this.latitude
+				}
+				API.getOwnerRegion(obj).then((res) => {
+				 	//this.options1=res.data;
+					 
+				}).catch(error => {
+					this.$refs.common.alert( error);
+				})  
+			},
+			setRegion(){
+				var obj={
+					longitude:this.longitude,
+					latitude:this.latitude
+				}
+				API.getOwnerRegion(obj).then((res) => {
+					
+					var index=0;
+					var regionN = this.carhelp.get("car_region");
+					var region=res.data.id;
+					var obj1={};
+					var obj2={};
+					for(var i in 	this.options1 ){
+						if(this.options1[i].id==region){
+							index=i;
+							obj1=this.options1[i]
+						}
+						if(this.options1[i].id==regionN){
+							this.index=i;	
+							obj2=this.options1[i]
+						}
+					}
+					
+					if(regionN&&regionN!=region){
+						
+						var nowDate =new Date();
+						var curDay=nowDate.getFullYear()*10000+(nowDate.getMonth()+1)*10000+nowDate.getDate()*10000+nowDate.getHours()*100+nowDate.getMinutes();
+						var temp = this.carhelp.get("car_region_cur");
+						var i=30;
+						if(process.car.NODE_ENV!="prod"){
+							i=3
+						}
+						
+						if(temp&&temp+i>curDay){
+							return
+						}
+						this.carhelp.set("car_region_cur",curDay);
+						
+						//是否切换
+						this.$refs.common.setFnc(()=>{
+							 this.index=index;
+							 this.carhelp.set("car_region",region);
+						})
+						this.$refs.common.confirm('定位显示您在“'+obj1.name+'”,是否切换','切换')
+					}else{
+						this.index=index;
+						this.carhelp.set("car_region",region);
+					}
+				
+				}).catch(error => {
+					this.$refs.common.alert( error);
+				})  
+			},
+			getRegion(bl) {
+			      API.getRegionList().then((res) => {
+			       	this.options1=res.data;
+					if(this.options1.length){
+						this.carhelp.set("car_region_temp",	this.options1[0].id);
+					}
+					var region= this.carhelp.get("car_region");
+					if(region){
+						for(var i in 	this.options1 ){
+							if(this.options1[i].id==region){
+								this.index=i;
+								break;
+							}
+						}
+					}
+					 if(bl){	 
+						   this.setRegion();
+					 }
+					
+			      }).catch(error => {
+			      	this.$refs.common.alert( error);
+			      })     
 			},
 			 bindPickerChange: function(e) {
-			           // console.log('picker发送选择改变,携带值为', e.target.value)
+			         
 			            this.index = e.target.value
+						var obj=this.options1[ this.index];
+						var nowDate=new Date();
+						var curDay=nowDate.getFullYear()*10000+(nowDate.getMonth()+1)*10000+nowDate.getDate()*10000+nowDate.getHours()*100+nowDate.getMinutes();
+						this.carhelp.set("car_region_cur",curDay);
+						this.carhelp.set("car_region",obj.id);
+						
 			},
 			gotoQuery(){
 				uni.navigateTo({
@@ -230,6 +317,9 @@ export default {
 			
 					this.latitude = latitude;
 					this.longitude = longitude;
+					
+					 this.getRegion(true);
+					
 					//this.$refs.common.alert("定位中...",);
 					this.passengerNearbyStation()
 					this.getPointBl=true
@@ -311,6 +401,7 @@ export default {
 			this.getNewNum();
 			this.getRemindInfo();
 			this.getBtn();
+			this.getRegion();
 			//清空缓存
 			this.carhelp.set("form",{});
 			this.isReady=true;

+ 2 - 2
pages/index/index.vue

@@ -5,8 +5,8 @@
 		<u-navbar :is-back="false" title="">	
 			<view class="slot-wrap">
 				<view class="navbar-left">
-					  <picker :value="index" @change="bindPickerChange" range-key="label" :range="options1">
-					          <view class="uni-input">{{options1[index].label}}
+					  <picker :value="index" @change="bindPickerChange" range-key="name" :range="options1">
+					          <view class="uni-input" v-if="options1.length">{{options1[index].name}}
 								<u-icon name="arrow-down" color="#999" size="28"></u-icon>			  
 							  </view>					  
 					   </picker>

+ 6 - 1
pages/query/index.js

@@ -71,10 +71,15 @@ import * as API from '@/apis/query.js'
 				}
 				
 				this.setHistory();
+				 var region= this.carhelp.get("car_region");
+				 if(!region){
+					  region= this.carhelp.get("car_region_temp");
+				 }
 				var form={
 					name:this.key,
 					pageIndex:1,
-					pageSize:20
+					pageSize:20,
+					regionId:region
 				}
 				API.routeList(form).then((res) => {
 					this.ing=true;

+ 23 - 9
pages/route/index.js

@@ -85,17 +85,31 @@ export default {
 				startStationId:this.stationList[0].id,
 				currentStationId :this.downItem.id,
 				routeId:this.routeInfo.id,
+			}
+			if(this.stationList[0].id==this.downItem.id&&this.routeInfo.interval){
+				
+				
+				var nowDate =new Date();
+				var curDay=nowDate.getFullYear()+"-"+(nowDate.getMonth()+1)+"-"+nowDate.getDate();
+				var startDate =new Date(curDay+" "+this.routeInfo.startTime+":00");
+				var endDate =new Date(curDay+" "+this.routeInfo.endTime+":00");
+				if(nowDate.getTime()>endDate.getTime()){
+					this.dis=""
+				}else{
+					var d=this.routeInfo.interval - parseInt((nowDate.getTime()-startDate.getTime())/1000/60)%this.routeInfo.interval
+					this.dis="等待发车... 大约"+d+"分钟发车"
+				}
+				
+			}else{
+				this.$refs.common.showLoading();
+				API.vehicleStationDis(obj).then((res) => {
+					this.dis=res.data;
+					this.$refs.common.showLoading(false);
+				}).catch(error => {
+						this.$refs.common.showLoading(false,error);			
+				}) 
 			}
-			this.$refs.common.showLoading();
 			
-			API.vehicleStationDis(obj).then((res) => {
-				this.dis=res.data;
-				this.$refs.common.showLoading(false);
-				
-			}).catch(error => {
-					this.$refs.common.showLoading(false,error);
-					
-			}) 
 		},
 		radioGroupChange(){
 			

+ 6 - 6
pages/route/index.vue

@@ -351,8 +351,8 @@
 					left: -3px;
 				}
 				.map-route-car {
-					height: 30px;
-					width: 30px;
+					height: 40px;
+					width: 40px;
 					position: absolute;
 					right: -10px;
 					top: 2px;
@@ -370,8 +370,8 @@
 			height: 200px;
 			width: 60px;
 			.map-route-car {
-				height: 30px;
-				width: 30px;
+				height: 40px;
+				width: 40px;
 				position: absolute;
 				right: -10px;
 				top: 2px;
@@ -416,8 +416,8 @@
 	
 		.map-route-item.map-now {
 			.map-route-car {
-				height: 30px;
-				width: 30px;
+				height: 40px;
+				width: 40px;
 				position: absolute;
 				left: 10px;
 				top: 2px;