Pārlūkot izejas kodu

新样式调整

zhengkaixin 4 gadi atpakaļ
vecāks
revīzija
deda5321e7

+ 4 - 3
.env.test.js

@@ -1,11 +1,12 @@
 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/' ,
-	title:'aaa',
+	BASE_URL: 'https://ykt-test.xiaoxinda.com/smart-bus-server/' ,
 	NODE_ENV :"test",
 	SIMPLE_RUN:false,
 	//车信达 appid
-	VUE_APP_WXAPPID:"wx7e70eb62a8459869"
+	VUE_APP_WXAPPID:"wx93675268c87a5a46"
+	
 	
 }  
 

+ 10 - 2
components/Carmap.vue

@@ -47,6 +47,8 @@
 					latitude:30.309817,
 					name:''
 				}], 
+				start:{},
+				end:{},
 				covers: [
 					{
 						longitude:112.273867,
@@ -62,6 +64,11 @@
 			};
 		},
 		methods:{
+			setStartend(sz){
+				this.start.setPosition( [sz[0].longitude,sz[0].latitude]);
+			this.end.setPosition( [sz[sz.length-1].longitude,sz[sz.length-1].latitude]);
+			
+			},
 			setCenter(item){
 				if(this.mapbus){
 					this.mapbus.setCenter([item.longitude,item.latitude]);
@@ -175,6 +182,7 @@
 				
 			},
 			initMap(point,stationList,startend){
+				
 				var _this = this;
 				this.covers=point;
 				this.startend=startend;
@@ -192,7 +200,7 @@
 					var icon0 = require("@/static/img/map_0.png");
 					var icon1 = require("@/static/img/map_1.png");
 					var icon2 = require("@/static/img/map_2.png");
-					new AMap.Marker({
+					this.start=new AMap.Marker({
 						map: _this.mapbus,
 						position: [_this.startend[0].longitude,_this.startend[0].latitude],
 						content:"<img src='"+icon0+"' style='height: 30px;width: 30px' />",
@@ -200,7 +208,7 @@
 						zIndex:99,
 						autoRotation: true,
 					});
-					new AMap.Marker({
+					this.end=new AMap.Marker({
 						map: _this.mapbus,
 						position: [_this.startend[1].longitude,_this.startend[1].latitude],
 					content:"<img src='"+icon2+"' style='height: 30px;width: 30px' />",

+ 9 - 3
pages/buytickets/confirm.js

@@ -50,13 +50,19 @@ export default {
 			this.$refs.common.showLoading();
 			this.subForm.id = this.id;
 			API.upBusNoTicketList(this.subForm).then((res) => {
-				console.log(res)
+				 
 				var list=res.data.data
 				for(var i in list ){
 					list[i].ck=false;
 				}
-				this.list= list;
-				this.$refs.common.showLoading(false);
+				if(this.list.length!=0){
+					this.$refs.common.showLoading(false,"刷新成功");
+				}else{
+					this.$refs.common.showLoading(false);
+				}
+				this.list= list;
+				
+				
 			}).catch(error => {
 				this.$refs.common.showLoading(false, error);
 

+ 9 - 30
pages/buytickets/confirm.vue

@@ -3,20 +3,7 @@
 		<car-common mytitle="确认身份" ref="common"></car-common>
 		
 		<view class="confirm">
-			<!-- <view class="confirm-img-border2" v-if="list.length">
-				<view class="confirm-img-border">
-					<view class="confirm-img">
-						<img src="static/img/1.jpg" alt="">
-					</view>
-				</view>
-			</view>
-			<view class="confirm-img-border3" v-if="!list.length">
-				<view class="confirm-img-border">
-					<view class="confirm-img">
-						<img src="static/img/discern.png" alt="">
-					</view>
-				</view>
-			</view> -->
+		
 			<h3 v-if="list.length">确认以下哪张是您的照片?</h3>
 			<p>一位乘客仅需选择一张照片</p>
 			<view class="confirm-pic" v-if="list.length">
@@ -24,28 +11,20 @@
 					<view class="confirm-pic-item " :class="item.ck?'active':''" @click="ckBtn(item)" >
 						<img :src="item.imageUrl" alt="">
 					</view>
-					<view class="confirm-pic-item " :class="item.ck?'active':''" @click="ckBtn(item)" >
-						<img :src="item.imageUrl" alt="">
-					</view>
-					<view class="confirm-pic-item " :class="item.ck?'active':''" @click="ckBtn(item)" >
-						<img :src="item.imageUrl" alt="">
-					</view>
 				</template>	 
 			</view>
 		</view>
-		<view class="upload-button" v-show="num">
-			<view class="reset-btn">
-				充值
+		 
+		<view class="upload-button" >
+			<view class="reset-btn" @click="upBusNoTicketList">
+				<u-icon name="shuaxin" custom-prefix="custom-icon" color="#2979ff" size="36"></u-icon>
 			</view>
-			<view class="submit-btn">
+			
+			<view class="submit-btn" v-show="num">
 				<u-button type="primary" shape="circle" @click="submit">确定</u-button>
 			</view>
-		</view>
-		<view class="upload-button" v-show="!num">
-			<view class="reset-btn">
-				<u-icon name="shuaxin" custom-prefix="custom-icon" color="#2979ff" size="36"></u-icon>
-			</view>
-			<view class="submit-btn">
+			
+			<view class="submit-btn" v-show="!num">
 				<u-button class="gray-btn" type="default" shape="circle" >请选择</u-button>
 			</view>
 		</view>

+ 1 - 13
pages/buytickets/selectSite.js

@@ -197,19 +197,7 @@ export default {
 
 			})
 		},
-		getPassengerInfo(){
-			var thisform={
-				id:this.id,
-				openId:this.carhelp.getOpenId()
-			}
-			API.getPassengerInfo(thisform).then((response) => {
-				this.passengerInfo=response.data
-			
-			}).catch(error => {
-				this.$refs.common.showLoading(false, error);
-			
-			})
-		},
+		
 		getPoint() {
 			if (!this.initBl) {
 				this.$refs.common.showLoading();

+ 3 - 1
pages/buytickets/site.js

@@ -16,7 +16,8 @@ import * as API from '@/apis/buytickets.js'
  			down: {
  				name: '请选择',
  				id: ''
- 			},
+ 			},
+			oplist:[],
  			ticket: {
  				price1: 0,
  				price2: 0,
@@ -188,6 +189,7 @@ import * as API from '@/apis/buytickets.js'
  	onLoad(op) {
  		this.id = op.id;
  		var obj = this.carhelp.get("form");
+		this.oplist=obj.oplist;
 		if(obj.op ){
 			this.uid = obj.op.id;
 			this.up.id = obj.op.ticketUpStationId;

+ 11 - 1
pages/buytickets/site.vue

@@ -17,6 +17,11 @@
 					<view class="title">
 						<view class="circle"></view>
 						<span>上车站点</span>
+						
+					</view>
+					<view style="float:right ">
+						<u-avatar size="mini"  v-for="item in oplist" :src="item.imageUrl"></u-avatar>
+						
 					</view>
 					<view class="content">
 						<span>{{up.name}}</span>
@@ -51,7 +56,7 @@
 			<u-button type="primary" shape="circle" @click="clickBtn">保存</u-button>
 		</view>
 		<view class="upload-button" v-show="!down.id">
-			<u-button type="default" shape="circle">保存</u-button>
+			<u-button type="default" class="gray-btn" shape="circle">保存</u-button>
 		</view>
 	</view>
 </template>
@@ -67,6 +72,11 @@
 	page{background-color: #f7f7f7;}
 </style>
 <style scoped lang="scss">
+	.gray-btn{
+		background-color: #bfbfbf;
+		color:#fff;
+		border-color: #bfbfbf;
+	}
 	.slot-wrap {
 		display: flex;
 		align-items: center;

+ 2 - 2
pages/index/index.js

@@ -63,8 +63,8 @@ export default {
 				})
 			},
 			passengerNearbyStation(){
-				this.latitude = '30.284867';
-				this.longitude = '112.291269';
+				// this.latitude = '30.284867';
+				// this.longitude = '112.291269';
 				
 				var form={
 					longitude:this.longitude,

+ 147 - 14
pages/route/index.js

@@ -1,16 +1,149 @@
-
-
-	export default {
-		data() {
-			return {
-			
+ import * as API from '@/apis/route.js'
+ import * as WxJsApi from '@/utils/wxJsApi.js'
+ 
+import Carmap from '@/components/Carmap.vue'
+
+export default {
+	data() {
+		return {
+
+			initBl: false,
+			title: '乘车人',
+			show: false,
+			id: 0, // 使用 marker点击事件 需要填写id
+
+			//地图居中后的位置
+			longitude: 112.276527,
+			latitude: 30.306427,
+			shiftInfo: {
+
+			},
+			list: [{}, {}],
+			 
+			stationList: [],
+			//个人
+			info: {
+				obj: null,
+				init: false,
+				longitude: '',
+				latitude: '',
+			},
+			myinterval: '',
+			routeInfo:{}
+
+		}
+	},
+	components: {
+		Carmap
+	},
+
+	methods: {
+		downBtn(item) {
+			
+				this.$refs.amap.setCenter(item);
+
+		},
+		
+  
+		drawing(point, startend) {
+			if (this.$refs.amap) {
+				this.$refs.amap.initMap(point, this.stationList,startend);
+			}
+		},
+		reverse(){
+			this.stationList.reverse();
+			this.$refs.amap.setStartend(this.stationList);
+		},
+		 
+		getPassengerInfo() {
+			
+			this.$refs.common.showLoading()
+
+			API.routeDetail(this.id).then((response) => {
+				this.stationList=response.data.stationInfoList;
+				this.$refs.common.showLoading(false)
+				
+				var point = [];
+				this.routeInfo=response.data.routeInfo;
+				this.title=this.routeInfo.name;
+				response.data.routeInfo.mapPath.split("|").forEach((item) => {
+					var sz = item.split(",");
+				
+					point.push({
+						longitude: sz[0],
+						latitude: sz[1],
+					})
+				})
+				var startend = [{
+					longitude: this.stationList[0].longitude,
+					latitude: this.stationList[0].latitude,
+					name: this.stationList[0].name
+				}, {
+					longitude: this.stationList[this.stationList.length-1].longitude,
+					latitude: this.stationList[this.stationList.length-1].latitude,
+					name: this.stationList[this.stationList.length-1].name
+				}];
+				
+				this.drawing(point,startend);
+				this.$refs.common.showLoading(false)
+				
+				this.getPoint()
+			}).catch(error => {
+				this.$refs.common.showLoading(false,error)
+			})
+		},
+		getPoint() {
+
+
+			
+		
+			if (!this.info.init) {
+				WxJsApi.getWxConfig(['getLocation']).then(() => {
+					// this.$refs.common.showLoading(false)
+					this.getLocation()
+				});
+			}else{
+					this.getLocation()
 			}
-		},
-		methods: {
+		
+			var pages = getCurrentPages();
+			var page = (pages[pages.length - 1]).route;
+			if (page == "pages/route/index") {
+				setTimeout(this.getPoint, 10000);
+			}
+		},
+		getLocation(){
+			WxJsApi.getLocation().then((res) => {
+				console.log("----getLocation ok-----")
+				var latitude = parseFloat(res.latitude);
+				var longitude = parseFloat(res.longitude);
+			
+				if (!this.info.init) {
+					this.latitude = latitude;
+					this.longitude = longitude;
+				}
+				this.info.init = true
+				this.info.latitude = latitude;
+				this.info.longitude = longitude;
+			
+				this.$refs.amap.setPerson(this.info);
 			
-		},
-		onLoad() {
-			 
-		}
-	}
-
+			}).catch(error => {
+				console.log(error)
+			})
+		}
+
+	},
+	onLoad(op) {
+
+		this.id = op.id
+	},
+	onUnload() {
+		if (this.myinterval) {
+			clearInterval(this.myinterval)
+		}
+	},
+	onReady() {
+		this.getPassengerInfo()
+	}
+}

+ 22 - 83
pages/route/index.vue

@@ -1,105 +1,44 @@
 <template>
 	<view>
-		<map style="width: 100%; height: 240px;" scale="12" ></map>
+		<car-common  :mytitle="title"  ref="common"  ></car-common>
+		
+		<carmap ref="amap"></carmap>
+		
 		<view class="map-info">
-			<view class="map-text">
-				<h4>六中 → 锣场</h4>
-				<p>首班:06:05  末班:18:10</p>
+			<view class="map-text" v-if="stationList.length">
+				<h4>{{stationList[0].name}} → {{stationList[stationList.length-1].name}}</h4>
+				<p>首班:{{routeInfo.startTime}}  末班:{{routeInfo.endTime}}</p>
 			</view>
-			<view class="map-btn">
+			<view class="map-btn" @click="reverse">
 				<u-icon name="swap" custom-prefix="custom-icon"  color="#2979ff"></u-icon>
 				<span>换向</span>
 			</view>
 		</view>
 		<view class="map-route">
-			<view class="map-route-head">
+			<view class="map-route-head" v-if="false">
 				2站3公里
 			</view>
 			<view class="map-route-main">
-				<view class="map-route-origin">
-					<view class="map-route-circle"></view>
-					<view class="map-route-name">
-						1锣场
-					</view>
-				</view>
-				<view class="map-route-item map-after">
-					<view class="map-route-circle"></view>
-					<view class="map-route-line"></view>
-					<view class="map-route-name">
-						2东方大道
-					</view>
-				</view>
-				<view class="map-route-item map-now">
-					<view class="map-route-car">
-						<img src="static/img/car.png" alt="">
-					</view>
-					<view class="map-route-circle"></view>
-					<view class="map-route-line"></view>
-					<view class="map-route-name">
-						3小天鹅
-					</view>
-				</view>
-				<view class="map-route-item">
-					<view class="map-route-circle"></view>
-					<view class="map-route-line"></view>
-					<view class="map-route-name">
-						4宿架转盘
-					</view>
-				</view>
-				<view class="map-route-item">
-					<view class="map-route-circle"></view>
-					<view class="map-route-line"></view>
-					<view class="map-route-name">
-						5荆棉
-					</view>
-				</view>
-				<view class="map-route-item map-geton">
-					<view class="map-geton-mark">
-						<img src="static/img/up.png" alt="">
+				<template v-for="item,i in stationList">
+					<view   class="scroll-view-item" 
+					:class="{'map-route-origin':i==0,'map-route-item':i!=0}"
+					 @click="downBtn(item)">
+						
+						<view class="map-route-circle"></view>
+						<view class="map-route-line"></view>
+						<view class="map-route-name">
+							{{item.name}}
+						</view>
 					</view>
-					<view class="map-route-circle"></view>
-					<view class="map-route-line"></view>
-					<view class="map-route-name">
-						6跃进村
-					</view>
-				</view>
-				<view class="map-route-item">
-					<view class="map-route-circle"></view>
-					<view class="map-route-line"></view>
-					<view class="map-route-name">
-						7变电站
-					</view>
-				</view>
-				<view class="map-route-item">
-					<view class="map-route-circle"></view>
-					<view class="map-route-line"></view>
-					<view class="map-route-name">
-						8跃进村
-					</view>
-				</view>
-				<view class="map-route-item">
-					<view class="map-route-circle"></view>
-					<view class="map-route-line"></view>
-					<view class="map-route-name">
-						9变电站
-					</view>
-				</view>
+				</template> 
 			</view>
 		</view>
 	</view>
 </template>
 
 <script>
-	export default {
-		data() {
-			return {
-				
-			}
-		},
-		methods: {
-			
-		}
-	}
+	import api from './index.js'
+	export default   api
 </script>
 <style scoped lang="scss">
 	.map-route{