zkx 4 tahun lalu
induk
melakukan
475cd50bd1
9 mengubah file dengan 178 tambahan dan 104 penghapusan
  1. 3 3
      .env.test.js
  2. 10 1
      apis/route.js
  3. 1 1
      manifest.json
  4. 2 2
      pages.json
  5. 1 12
      pages/index/index.js
  6. 1 1
      pages/news/index.js
  7. 11 36
      pages/remind/index.vue
  8. 116 13
      pages/route/index.js
  9. 33 35
      pages/route/index.vue

+ 3 - 3
.env.test.js

@@ -1,9 +1,9 @@
 const UNI_APP = {  
-	//BASE_URL: 'http://192.168.33.120:8087/smart-bus-server/' ,
+	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: 'https://ykt-test.xiaoxinda.com/smart-bus-server/' ,
 	NODE_ENV :"test",
-	SIMPLE_RUN:false,
+	SIMPLE_RUN:true,
 	//车信达 appid
 	VUE_APP_WXAPPID:"wx93675268c87a5a46"
 

+ 10 - 1
apis/route.js

@@ -18,4 +18,13 @@ export function routeShiftList(data) {
 		data: data,
 		url: '/mobile/passengerApi/routeShiftList'
 	})
-}
+}
+
+
+export function passengerShiftRemindList(data) {
+	return request({
+		method: 'post',
+		data:data,
+		url: '/mobile/passengerApi/passengerShiftRemindList'
+	})
+}

+ 1 - 1
manifest.json

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

+ 2 - 2
pages.json

@@ -384,8 +384,8 @@
 	        "text": "主页"
 	    }, {
 	        "pagePath": "pages/remind/index",
-	        "iconPath": "static/img/index-news-1.png",
-	        "selectedIconPath": "static/img/index-news-2.png",
+	        "iconPath": "static/img/index-remind-1.png",
+	        "selectedIconPath": "static/img/index-remind-2.png",
 	        "text": "提醒"
 	    },
 		{

+ 1 - 12
pages/index/index.js

@@ -289,18 +289,7 @@ export default {
 			WxJsApi.getWxConfig(['scanQRCode','getLocation','addEventListener']).then(()=>{
 				this.wxinit=true;
 				var _this=this;
-				this.$nextTick(function() {
-					var btn = document.getElementById('subscribe-btn');
-					btn.addEventListener('success', function (e) {            
-					  _this.remindHD()
-					});   
-					var btn = document.getElementById('subscribe-btn');
-					btn.style="width: 120px"
-					btn.addEventListener('error',function (e) {             
-					  //console.log('fail', e.detail);
-					   alert("未打开消息通知")
-					});
-				})
+			 
 			})	
 			//WxJsApi.requestSubscribeMessage(['Ilxy2TX264A3RHqRyDZqL_xUDxi9OuBNeJoDOBfMRHg'])
 			

+ 1 - 1
pages/news/index.js

@@ -38,7 +38,7 @@ export default {
 			
 			uni.navigateTo({
 				//url: "/pages/news/details?id=" + id
-				url: "/pages/buytickets/selectSite?id=" +item.vehicleId
+				url: "/pages/buytickets/selectSite?select=true&id=" +item.vehicleId
 			})
 		},
 		lower() {

+ 11 - 36
pages/remind/index.vue

@@ -4,20 +4,20 @@
 		<view class="remind">
 			<view class="remind-title up">
 				<u-icon name="md-alarm" custom-prefix="custom-icon" color="#69b54a" size="40"></u-icon>
-				<span style="color:#69b54a">上车提</span>
+				<span style="color:#69b54a">上车提</span>
 			</view>
-			<view class="remind-item">
+			<view class="remind-item" v-for="item,i in upList" :key="i">
 				<view class="remind-left">
 					<h3>19路</h3>
 					<p>开往<span>红光路加气站</span>方向,<span>豉湖路转盘</span>上车</p>
 					<view class="remind-radio">
 						<span>到站提醒:</span>
-						<u-radio-group v-model="value" @change="radioGroupChange">
+						<u-radio-group v-model="item.stopInAdvance" @change="radioGroupChange">
 							<u-radio 
 								@change="radioChange" 
 								v-for="(item, index) in list" :key="index" 
-								:name="item.name"
-								:disabled="item.disabled"
+								:name="item.id"
+							
 							>
 								{{item.name}}
 							</u-radio>
@@ -31,9 +31,9 @@
 			</view>
 			<view class="remind-title up">
 				<u-icon name="md-alarm" custom-prefix="custom-icon" color="#fd8032" size="40"></u-icon>
-				<span style="color:#fd8032">上车提现</span>
+				<span style="color:#fd8032">下车提醒</span>
 			</view>
-			<view class="remind-item">
+			<view class="remind-item" v-for="item,i in downList" :key="i">
 				<view class="remind-left">
 					<h3>19路</h3>
 					<p>开往<span>红光路加气站</span>方向,<span>豉湖路转盘</span>上车</p>
@@ -61,34 +61,8 @@
 </template>
 
 <script>
-	export default {
-		data() {
-			return {
-				list: [
-					{
-						name: '提前1站',
-						disabled: false
-					},
-					{
-						name: '提前2站',
-						disabled: false
-					}
-				],
-				// u-radio-group的v-model绑定的值如果设置为某个radio的name,就会被默认选中
-				value: 'orange',
-			}
-		},
-		methods: {
-			// 选中某个单选框时,由radio时触发
-			radioChange(e) {
-				// console.log(e);
-			},
-			// 选中任一radio时,由radio-group触发
-			radioGroupChange(e) {
-				// console.log(e);
-			}
-		}
-	}
+	import api from './index.js'
+	export default   api
 </script>
 <style>
 	page{
@@ -106,7 +80,8 @@
 	}
 	.remind-item{
 		background-color: #fff;
-		display: flex;
+		display: flex;
+		margin-top: 10px;
 	}
 	.remind-left{
 		flex: 1;

+ 116 - 13
pages/route/index.js

@@ -22,9 +22,15 @@ export default {
 			shiftInfo: {
 
 			},
+			remindList:[],
 			list: [{}, {}],
 			 carList:[],
+			caritem:{
+				driverInfo:{}
+			},
+			caritemBl:false,
 			stationList: [],
+			
 			//个人
 			info: {
 				obj: null,
@@ -32,8 +38,23 @@ export default {
 				longitude: '',
 				latitude: '',
 			},
+			reverseInit:false,
 			myinterval: '',
-			routeInfo:{}
+			routeInfo:{},
+			radiolist: [
+					{
+						name: '不提醒',
+						isRemind: "0",
+					},
+					{
+						name: '提前1站',
+						isRemind: "1",
+					},
+					{
+						name: '提前2站',
+						isRemind: "2",
+					}
+				]
 
 		}
 	},
@@ -41,10 +62,37 @@ export default {
 		Carmap
 	},
 
-	methods: {
+	methods: {
+		radioGroupChange(){
+			var item= this.downItem
+			
+			if(item.isRemind==0){
+				if(this.downItem.remindId){
+					this.del(item.remindId,item.isRemind!=0)
+				}
+				return
+			}
+			if(item.remindId){
+				this.del(item.remindId,item.isRemind!=0)
+			}else{
+				this.remindAdd()	
+			}
+			
+		},del(id,bl){
+				API_index.cancelRemind(id).then((res) => {
+					this.downItem.remindId=""
+					if(bl){
+						this.remindAdd()	
+					}else{
+						this.$refs.common.alert( "设置成功");
+					}
+				}).catch(error => {
+						this.$refs.common.alert( error);
+				}) 
+			},
+			 
 		remind(){
-			        var myBtn = document.getElementById("subscribe-btn").tap();
-
+			 var myBtn = document.getElementById("subscribe-btn").tap();
 			 myBtn.tap();
 		},
 		showCar(item){
@@ -86,14 +134,15 @@ export default {
 			this.$refs.amap.setCenter(item);
 			this.downid=item.id;
 			this.downItem=item;
+			this.$forceUpdate()
 		},
 		remindAdd(){
 			if(this.downItem.id){
-				var item= this.remindInfo
+			
 				var obj={
 					startStationId:this.stationList[0].id,
 					remindStationId :this.downItem.id,
-					stopInAdvance:"1",
+					stopInAdvance:this.downItem.isRemind,
 					remindType:"1",
 					vehicleShiftId:this.routeInfo.id,
 					openId:this.carhelp.getOpenId()
@@ -112,22 +161,74 @@ export default {
 				this.$refs.amap.initMap(point, this.stationList,startend);
 			}
 		},
-		reverse(){
-			if(process.car.SIMPLE_RUN){
-				this.remindAdd();
-				return
+		carShow(item){
+			
+			var caritem =null;
+			for(var i in this.carList){
+				var car= this.carList[i]
+				if(car.currentStationId==item.id){
+					var caritem=car;
+					break
+				}
 			}
+			this.caritem=caritem;
+			this.caritemBl=true;
+			
+			
+		},
+		reverse(){
 			
 			this.stationList.reverse();
-			this.getCar()
+			this.getCar()
+			 this.passengerShiftRemindList();
+			
 			this.$refs.amap.setStartend(this.stationList);
+			document.getElementById('map-route-main').scrollLeft = 0
+			this.$nextTick(function() {
+				const query = uni.createSelectorQuery().in(this);
+				query.select('.map-down').boundingClientRect(data => {
+					if(data){
+						document.getElementById('map-route-main').scrollLeft = data.left-20;
+					}
+					this.$refs.common.showLoading(false);
+					//this.downBtn()
+				}).exec();
+			});
 			
 		},
-		 
+		 setRemind(){
+			 for(var i in this.stationList){
+			 	var item=this.stationList[i];
+				item.isRemind=0;
+				item.remindId="";
+			 	for(var j in this.remindList){
+			 			var obj=this.remindList[j];	
+						if(this.stationList[0].id==obj.startStationId&&obj.remindType==1){
+							if(obj.remindStationId==item.id){
+								item.remindId=obj.id;
+								item.isRemind=obj.stopInAdvance;
+							}
+						}
+			 	}
+			 
+			 }
+			 this.$forceUpdate()
+		 },
+		 passengerShiftRemindList(){
+			 	this.$refs.common.showLoading()
+			 API.passengerShiftRemindList({
+			 	shiftId:this.id,
+			 	openId:this.carhelp.getOpenId(),
+			 }).then((response) => {
+			 	this.remindList=response.data;
+			 	this.setRemind();
+					this.$refs.common.showLoading(false)
+			 })
+		 },
 		getPassengerInfo() {
 			
 			this.$refs.common.showLoading()
-
+				
 			API.routeDetail(this.id).then((response) => {
 				 
 				var  list=response.data.stationInfoList;
@@ -140,10 +241,12 @@ export default {
 				}
 				this.stationList=list;
 				for(var i in list){
+					list[i].isRemind=0;
 					if(list[i].id==this.downid){
 						this.downItem=list[i];
 					}			
 				}
+				this.passengerShiftRemindList();
 				
 				this.$refs.common.showLoading(false)
 				

+ 33 - 35
pages/route/index.vue

@@ -1,6 +1,16 @@
 <template>
 	<view>
-		<car-common    ref="common"  ></car-common>
+		<car-common    ref="common"  ></car-common>
+		<u-modal  v-model="caritemBl" v-if="stationList.length" >
+				<view class="slot-content">
+						<h4>{{stationList[0].name}} → {{stationList[stationList.length-1].name}}</h4>
+				</view>
+				<view class="slot-content">
+					{{caritem.licensePlateNumber}}{{caritem.driverInfo.name}}{{caritem.driverInfo.phone}}
+				</view>
+		</u-modal>
+		
+		
 		<u-navbar :title="title"  >
 			<view class="slot-wrap"></view>
 			<view class="navbar-right" @click="mapopenBtn"  >
@@ -25,58 +35,46 @@
 			</view>
 		</view>
 		<view class="map-route">
-			
+			<view class="map-route-head"   >
+				<view  >上车提醒</view>
+				<view  >
+					 <u-radio-group v-model="downItem.isRemind" @change="radioGroupChange" >
+					 	<u-radio 
+					 	 
+					 		v-for="(dio, index) in radiolist" :key="index" 
+					 		:name="dio.isRemind"
+					 		>
+					 		{{dio.name}}
+					 	</u-radio>
+					 </u-radio-group>
+				</view>
+				 
+			</view>
 			 
 			<view class="map-route-main" id="map-route-main">
 				
 				<template v-for="item,i in stationList">
 					<view   class="scroll-view-item" 
 					:class="{'map-route-origin map-geton ':i==0,'map-route-item':i!=0,'map-geton':downid==item.id,'map-down':downid==item.id}"
-					 @click="downBtn(item)">
+					 >
 						
 						<view class="map-route-car" v-if="showCar(item)">
-							<img src="static/img/car.png" alt="">
+							<img src="static/img/car.png" alt=""  @click="carShow(item)">
 						</view>
-						<view class="map-route-circle"  :style="i==0&&downid!=item.id?'border: 3px solid #1e8abd;':''">
+						<view class="map-route-circle"  @click="downBtn(item)" :style="i==0&&downid!=item.id?'border: 3px solid #1e8abd;':''">
 			
 							<img src="static/img/plate.png" style=" width: 12px; margin-top: 3px;" v-if="downid==item.id" alt="">
 						</view>
 						
-						<view class="map-route-line"></view>
-						<view class="map-route-name">
+						<view class="map-route-line" @click="downBtn(item)"></view>
+						<view class="map-route-name" @click="downBtn(item)">
 							{{item.name}}
 						</view>
 					</view>
 				</template> 
 			</view>
-		<view class="map-route-head"  v-if="false" >
-			<view  >
-				 设置提醒
-			</view>
-		</view>
-			<view class="map-route-head" v-if="false" >
-				<!-- #ifdef H5-->
-				<wx-open-subscribe template="Ilxy2TX264A3RHqRyDZqL_xUDxi9OuBNeJoDOBfMRHg" id="subscribe-btn">
-				     <script type="text/wxtag-template" id="demo">
-				          <style>
-				              .subscribe-btn {
-				                  /*对应标签样式*/
-				                  width: 300px;
-				                  height: 50px;
-				                  text-align: center;
-				                  line-height: 50px;
-				               
-								   border: 1px solid #007AFF;
-								    color: #007AFF;
-								   padding: 5px 15px;
-								   border-radius: 30px;
-				              }
-				          </style>
-				          <view class="subscribe-btn">设置提醒</view>
-				      </script>
-				</wx-open-subscribe>
-				<!-- #endif -->
-			</view>
+		
+			
 		</view>
 		
 	</view>