소스 검색

版本更新

zhengkaixin 4 년 전
부모
커밋
bc37a5e318

+ 1 - 1
.env.dev.js

@@ -4,7 +4,7 @@ const UNI_APP = {
 	NODE_ENV :"dev",
 	SIMPLE_RUN:true,//是否能 无视权限控制跳转页面
 	//企业联合会微信appid
-	VUE_APP_WXAPPID:"wx7e70eb62a8459869"
+	VUE_APP_WXAPPID:"wx93675268c87a5a46"
 }  
 
 module.exports = UNI_APP;

+ 1 - 1
.env.prod.js

@@ -5,7 +5,7 @@ const UNI_APP = {
 	NODE_ENV :"prod",
 	SIMPLE_RUN:false,
 	//企业联合会微信appid
-	VUE_APP_WXAPPID:"wx7e70eb62a8459869"
+	VUE_APP_WXAPPID:"wx93675268c87a5a46"
 }  
 
 module.exports = UNI_APP;

+ 5 - 4
.env.test.js

@@ -1,11 +1,12 @@
 const UNI_APP = {  
-	BASE_URL: 'https://xpgjapi.xiaoxinda.com/' ,
-	
-	
+	BASE_URL: 'http://192.168.33.120:8087/smart-bus-server/' ,
+	//BASE_URL: 'https://xpgjapi.xiaoxinda.com/' ,
+	title:'aaa',
 	NODE_ENV :"test",
 	SIMPLE_RUN:false,
-	//企业联合会微信appid
+	//车信达 appid
 	VUE_APP_WXAPPID:"wx7e70eb62a8459869"
+	
 }  
 
 module.exports = UNI_APP;

+ 4 - 5
App.vue

@@ -8,11 +8,10 @@
 		},
 		onShow: function() {
 			
-			if(this.caruitl.get("personInfo")){
-				
-			}else{
-				console.log("onShow111")
-			}
+		
+		},
+		onReady: function() {
+			
 		},
 		onHide: function() {
 			

+ 59 - 0
apis/buytickets.js

@@ -1,4 +1,5 @@
 import request from '../utils/request.js';
+import Qs from 'qs';
 
 export function test(data) {
 	return request({
@@ -7,3 +8,61 @@ export function test(data) {
 		url: '/test/post'
 	})
 }
+
+//查询班次
+export function getShiftInfo(data) {
+	return request({
+		url: '/mobile/passengerApi/getShiftInfo',
+		data: {
+			id:data
+		},
+		method: 'post',
+	})
+}
+
+//查询站点
+export function getVehicleStationInfo(data) {
+	return request({
+		url: '/mobile/passengerApi/getVehicleStationInfo',
+		data: {
+			id:data
+		},
+		method: 'post',
+	})
+}
+//查询车辆
+export function getVehicleInfo(data) {
+	return request({
+		url: '/mobile/passengerApi/getVehicleInfo',
+		data: {
+			id:data
+		},
+		method: 'post',
+	})
+}
+//车牌号查询
+export function passengerApi(data) {
+	return request({
+		url: '/mobile/passengerApi/',
+		data: Qs.stringify(data),
+		method: 'post',
+	})
+}
+
+//匹配照片
+export function matchFaceImage(data) {
+	return request({
+		url: '/mobile/passengerApi/matchFaceImage',
+		data: Qs.stringify(data),
+		method: 'post',
+	})
+}
+
+//查询车辆
+export function getPassengerInfo(data) {
+	return request({
+		url: '/mobile/passengerApi/getPassengerInfo',
+		data: Qs.stringify(data),
+		method: 'post',
+	})
+}

+ 10 - 0
apis/common.js

@@ -1,6 +1,16 @@
 import request from '@/utils/request'
 import Qs from 'qs';
 
+//上传图片
+export function upload(formData) {
+	return request({
+		url: '/mobile/passengerApi/upload',
+		data: formData,
+		method: 'post',
+		
+	})
+}
+
 //上传图片
 export function uploadBase64(formData) {
 	return request({

+ 81 - 0
apis/user.js

@@ -0,0 +1,81 @@
+import request from '@/utils/request'
+import Qs from 'qs';
+
+//帐号密码登录
+export function loginUserName(data) {
+	return request({
+		url: '/mobile/personInfoApi/loginByPassword',
+		data: Qs.stringify(data),
+		method: 'post',
+	})
+}
+
+//退出登录
+export function loginOut() {
+	return request({
+		url: '/mobile/personInfoApi/logOut',
+		data: {},
+		method: 'post',
+	})
+}
+
+//获取短信验证码
+export function getVerifyCode(data) {
+	return request({
+		url: '/mobile/passengerApi/getVerifyCode',
+		data: Qs.stringify(data),
+		method: 'post',
+	})
+}
+
+//验证短信验证码
+export function validateCode(data) {
+	return request({
+		url: '/mobile/passengerApi/validateCode',
+		data: Qs.stringify(data),
+		method: 'post',
+	})
+}
+
+//重置密码
+export function resetPassword(data) {
+	return request({
+		url: '/mobile/personInfoApi/resetPassword',
+		data: Qs.stringify(data),
+		method: 'post',
+	})
+}
+
+//获取基础信息
+export function getBasicInformation() {
+	return request({
+		url: '/mobile/personInfoApi/basicInformation',
+		method: 'post',
+	})
+}
+
+//提交基础信息
+export function submitBasicInformation(data) {
+	return request({
+		url: '/mobile/personInfoApi/updateBasicInformation',
+		data: Qs.stringify(data),
+		method: 'post',
+	})
+}
+
+//关于企联
+export function getAboutInfo() {
+	return request({
+		url: '/mobile/enterpriseInfoApi/enterpriseInfo',
+		method: 'post',
+	})
+}
+
+//变更手机号
+export function changePhone(data) {
+	return request({
+		url: '/mobile/personInfoApi/validateCodeAndUpdatePhone',
+		data: Qs.stringify(data),
+		method: 'post',
+	})
+}

+ 110 - 48
bobo-router/index.js

@@ -1,50 +1,112 @@
-import Vue from 'vue'
-import uniCrazyRouter from "uni-crazy-router";
-Vue.use(uniCrazyRouter)
-//** 有bug, 第一次直接敲链接访问, 是访问bobo-router 前置守卫
-//**  后续操作,访问的是 uniCrazyRouter的前置守卫
-
-
-uniCrazyRouter.beforeEach(async (to, from ,next)=>{
-	
-    // 逻辑代码
-console.log("beforeEach")
-   routerBeforeEach(to, from, next);
-})
-
-uniCrazyRouter.afterEach((to, from)=>{
-    // 逻辑代码
+import {
+	getUrlParam,
+	getWeixinRedirectURI,
+	isWeiXin
+} from '@/utils'
+import * as API_WeiXin from '@/apis/weixin.js'
+import  carhelp from '@/utils/mixin.js'
+
+import Vue from 'vue'
+import uniCrazyRouter from "uni-crazy-router";
+Vue.use(uniCrazyRouter)
+//** 有bug, 第一次直接敲链接访问, 是访问bobo-router 前置守卫
+//**  后续操作,访问的是 uniCrazyRouter的前置守卫
+
+
+uniCrazyRouter.beforeEach(async (to, from, next) => {
+
+	// 逻辑代码
+	console.log("beforeEach")
+	routerBeforeEach(to, from, next);
+})
+
+uniCrazyRouter.afterEach((to, from) => {
+	// 逻辑代码
 	console.log("afterEach")
-})
-
-uniCrazyRouter['on'+'Error']((to, from)=>{
-    // 逻辑代码
-	console.log("Error")
-})
-
-import Router from './bobo-router'
-
-Vue.use(Router)
-
-// 路由配置 页面中全部使用this.$Router来操作路由,以实现路由的全局管理
-const router = new Router()
-
-// 路由全局拦截器 在这里处理登录、授权等相关操作
+	if(process.car.NODE_ENV=='dev'||process.car.NODE_ENV=='test'){
+		    uni.setNavigationBarTitle({
+		       		title:'车信达('+process.car.NODE_ENV+')',
+		    						
+		    }) 
+		}
+	
+})
+
+uniCrazyRouter['on' + 'Error']((to, from) => {
+	// 逻辑代码
+	console.log("Error")
+})
+
+import Router from './bobo-router'
+
+Vue.use(Router)
+
+// 路由配置 页面中全部使用this.$Router来操作路由,以实现路由的全局管理
+const router = new Router()
+
+// 路由全局拦截器 在这里处理登录、授权等相关操作
 router.beforeEach(function(to, from, next) {
-	console.log('前置守卫')
-	routerBeforeEach(to, from, next);
-})
-function routerBeforeEach(to, from, next) {
-	next();
-}
-// 路由后置拦截器
-router.afterEach(function (to, from) {
-	console.log('后置守卫')
-})
-
-// 路由跳转出错处理
-router.onError(function(e) {
-	console.log('错误:', e.message || '路由跳转失败')
-})
-
-export default router
+	
+	console.log('前置守卫')
+	if (process.car.SIMPLE_RUN) {
+		routerBeforeEach(to, from, next);
+	} else {
+		
+		if (!carhelp.getOpenId()) {
+			if (isWeiXin()) {
+				getOpenId();
+			}
+		} else {
+			const code = getUrlParam('code');
+			
+			if(code){
+				var linkUrl = document.URL.replace(/\?code=(.*?)&state=STATE/g, '');
+				window.location = linkUrl; //隐藏参数
+			}
+			routerBeforeEach(to, from, next);
+		}
+
+	}
+
+
+
+})
+
+function getOpenId() {
+	const code = getUrlParam('code');
+	
+	if (!code) {
+		var url = document.URL;
+		
+		window.location.href = getWeixinRedirectURI(process.car.VUE_APP_WXAPPID, url);
+	} else {
+ 
+		 
+		API_WeiXin.getDataByCode(code).then(response => {
+			
+			carhelp.setOpenId(response.data.openid)
+			var linkUrl = document.URL.replace(/\?code=(.*?)&state=STATE/g, '');
+			window.location = linkUrl; //隐藏参数
+			//return Promise.resolve(response.openid);
+		}).catch(error => {
+			console.log(error);
+		});
+
+	}
+
+}
+
+function routerBeforeEach(to, from, next) {
+	next();
+}
+// 路由后置拦截器
+router.afterEach(function(to, from) {
+	console.log('后置守卫')
+})
+
+// 路由跳转出错处理
+router.onError(function(e) {
+	console.log('错误:', e.message || '路由跳转失败')
+})
+
+export default router

+ 169 - 0
components/Carmap.vue

@@ -0,0 +1,169 @@
+<template>
+	<view>
+		<view id="container" style="width: 100%; height: 240px;"></view>
+		
+	</view>
+</template>
+
+<script>
+		import MapLoader from '@/utils/AMap'
+	export default {
+		name:"Carmap",
+		data() {
+			return {
+				longitude: 112.276527,
+				latitude: 30.306427,
+				//车的位置
+				car: {
+					obj:null,
+					longitude: '',
+					latitude: '',
+				},
+				//个人
+				info: {
+					obj:null,
+					init: false,
+					longitude: '',
+					latitude: '',
+				},
+				mapbus:null,
+				startend: [{
+					longitude:112.279274,
+					latitude:30.303273,
+					name:''
+				}, {
+					longitude:112.273867,
+					latitude:30.309817,
+					name:''
+				}], 
+				covers: [
+					{
+						longitude:112.273867,
+						latitude:30.309817,
+					},{
+						longitude:112.280261,
+						latitude:30.3041,
+					},{
+						longitude:112.279274,
+						latitude:30.303273,
+					}
+				]
+			};
+		},
+		methods:{
+			setCar(ob){
+				this.car.longitude=ob.longitude
+				this.car.latitude=ob.latitude
+				if(!this.car.ob){
+					
+					
+					var icon0 = require("@/static/img/icon-busPosition.png");
+					
+					
+					this.car.ob= new AMap.Marker({
+						map: this.mapbus,
+						position: [this.car.longitude,this.car.latitude],
+						offset: new AMap.Pixel(-5, 15),
+						content:"<img src='"+icon0+"' style='height: 30px;width: 30px' />",
+						
+						zIndex:999,
+						autoRotation: true,
+					});
+					
+				}else{
+					this.car.ob.setPosition( [this.car.longitude,this.car.latitude]);
+				}
+			},
+			setPerson(ob){
+				this.info.longitude=ob.longitude
+				this.info.latitude=ob.latitude
+				if(!this.info.ob){
+					
+					var icon0 = require("@/static/img/icon-userPosition.png");
+					
+					
+					this.info.ob= new AMap.Marker({
+						map: this.mapbus,
+						position: [this.info.longitude,this.info.latitude],
+						offset: new AMap.Pixel(-5, -5),
+						content:"<img src='"+icon0+"' style='height: 30px;width: 30px' />",
+						
+						zIndex:999,
+						autoRotation: true,
+					});
+					
+				}else{
+					this.info.ob.setPosition( [this.info.longitude,this.info.latitude]);
+				}
+			},
+			initMap(point,stationList,startend){
+				var _this = this;
+				this.covers=point;
+				this.startend=startend;
+				MapLoader().then(AMap => {
+					
+					_this.mapbus && _this.mapbus.destroy();
+				
+					_this.mapbus=new AMap.Map("container", {
+						resizeEnable: true,
+						center: [this.longitude, this.latitude],
+						zoom: 10
+					});
+					var lineArr=[]
+					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({
+						map: _this.mapbus,
+						position: [_this.startend[0].longitude,_this.startend[0].latitude],
+						content:"<img src='"+icon0+"' style='height: 30px;width: 30px' />",
+						offset: new AMap.Pixel(-15, -30),
+						zIndex:999,
+						autoRotation: true,
+					});
+					new AMap.Marker({
+						map: _this.mapbus,
+						position: [_this.startend[1].longitude,_this.startend[1].latitude],
+					content:"<img src='"+icon2+"' style='height: 30px;width: 30px' />",
+					offset: new AMap.Pixel(-15, -30),
+					zIndex:999,
+						autoRotation: true,
+					});
+					for(var i in _this.covers){
+						var point=_this.covers[i]
+						lineArr.push([point.longitude,point.latitude])
+						
+					}
+					for(var i in stationList){
+						var point=stationList[i]
+						new AMap.Marker({
+							map: _this.mapbus,
+							position: [point.longitude,point.latitude],
+							offset: new AMap.Pixel(-5, -5),
+							content:"<img src='"+icon1+"' style='height: 10px;width: 10px' />",
+							zIndex:999,
+							autoRotation: true,
+						});
+					}
+					var polyline = new AMap.Polyline({
+						map: _this.mapbus,
+						path: lineArr,
+						showDir: true,
+						strokeColor: "#28F", //线颜色
+						// strokeOpacity: 1,     //线透明度
+						strokeWeight: 3, //线宽
+						//strokeStyle: "solid"  //线样式
+					});
+					
+				}, e => {
+					//_this.mui.toast('地图加载失败');
+					console.log('地图加载失败', e)
+				})
+			},
+		}
+	}
+</script>
+
+<style>
+
+</style>

+ 81 - 11
components/Common.vue

@@ -1,6 +1,12 @@
 <template >
 	<view>
-		aaaaaa
+		<u-toast ref="uToast"  />
+		<u-loading :show="false"></u-loading>
+		<u-modal v-model="show" :content="content" :confirm-text="confirmtext?confirmtext:'确定'" @confirm="confirmBtn" :title="title?title:'提示'"></u-modal>
+		<u-navbar v-if="mytitle" :title="mytitle">
+			<view class="slot-wrap"></view>		
+		</u-navbar>
+		<view v-show="false"  :login="islogin()" ></view>	
 	</view>
 </template>
 
@@ -12,22 +18,86 @@
 				require: false,
 				default: false,
 			},
+			mytitle: {
+				require: false,
+				default: false,
+			},
 		},
 		data() {
 			return {
-				
+				isloginBl:true,
+				show:false,
+				fnc:null,
+				fncBl:false,
+				content:null,
+				confirmtext:null,
+				title:null,
 			};
-		},
-		onShow() {
-			
-			console.log("mounted")
-			
-			
-		},
-		created() {
-			
 			
+		},methods:{
+			islogin(){
+				if(this.login){
+					if (!this.carhelp.getPersonInfo()) {
+						var route_path = window.location.href.split("#")[1];
+						this.carhelp.set("back_url",route_path);
+						uni.reLaunch({
+							url: '/pages/car/login?back=true'
+						})
+					}
+				}
+			},
+			goError(message){
+				this.setFnc(function(){
+					uni.switchTab({
+					    url: '/pages/index/index'
+					});
+				})
+				this.alert2(message?message:'访问链接异常','前往首页')
+				
+			},
+			setFnc(fnc){
+				
+				this.fnc=fnc;
+				this.fncBl=true
+			},
+			alert2(content,confirmtext,title){
+				this.show=true;
+				this.content=content;
+				this.confirmtext=confirmtext;
+				this.title=title;
+				 uni.hideLoading();
+			},
+			confirmBtn(){
+				
+				if(this.fncBl){
+					this.fnc()
+					this.fncBl=false;	
+				}
+			},
+			showLoading(bl,message){
+				if(bl==null ||bl){
+					// request  要改同步改
+					uni.showLoading({
+						mask:true,title:'加载中...'
+					})
+				}else{
+					  uni.hideLoading();
+					  if(message){
+						  this.alert(message)
+					  }
+				}
+				
+			},
+			alert(message,fnc){
+				this.$refs.uToast.show({
+					title: message,
+					type:'default',
+					position:'bottom',
+					callback:fnc
+				})
+			}
 		}
+		
 	}
 </script>
 

+ 7 - 2
main.js

@@ -1,9 +1,10 @@
 import Vue from 'vue'
 import App from './App'
+import CarCommon from '@/components/Common.vue'
 
 import  mixin from './utils/mixin.js'
 
-Vue.prototype.caruitl=mixin
+Vue.prototype.carhelp=mixin
 
 import Vconsole from 'vconsole'
  //import './router' // 引入路由
@@ -21,13 +22,17 @@ const app = new Vue({
 
     ...App
 })
+Vue.component('car-common',CarCommon)
 Vue.use(mixin)
 Vue.mixin({ 
     onLoad( option){  
         if (option.test == 'test') {
         	let vConsole = new Vconsole()
         }
-    } 
+		
+    } ,onReady(){
+	
+	}
 })
 
 

+ 1 - 0
package.json

@@ -13,6 +13,7 @@
   "uview-ui": "^1.8.4",
   "vconsole": "^3.4.0",
   "vue-cli": "^2.9.6",
+  "vue-cropper": "^0.5.6",
   "vuex": "^3.6.2",
   "weixin-js-sdk": "^1.6.0"
  },

+ 26 - 27
pages.json

@@ -8,7 +8,7 @@
 			"name":"IndexIndex",
 			"path": "pages/index/index",
 			"style": {
-				"navigationBarTitleText": "首页",
+	
 				"navigationStyle": "custom" // 隐藏系统导航栏
 			}
 		}
@@ -19,7 +19,7 @@
             "path" : "pages/car/login",
             "style" :                                                                                    
             {
-                "navigationBarTitleText": "登录",
+               // "navigationBarTitleText": "登录",
                 "enablePullDownRefresh": false
             }
             
@@ -29,7 +29,7 @@
             "path" : "pages/route/index",
             "style" :                                                                                    
             {
-                "navigationBarTitleText": "路线详情",
+               // "navigationBarTitleText": "路线详情",
                 "enablePullDownRefresh": false
             }
             
@@ -41,7 +41,7 @@
 			
             "style" :                                                                                    
             {
-                "navigationBarTitleText": "添加乘车人",
+               // "navigationBarTitleText": "添加乘车人",
                 "enablePullDownRefresh": false
             }
             
@@ -51,7 +51,7 @@
             "path" : "pages/buytickets/selectSite",
             "style" :                                                                                    
             {
-                "navigationBarTitleText": "选择站点",
+               // "navigationBarTitleText": "选择站点",
                 "enablePullDownRefresh": false
             }
             
@@ -61,7 +61,7 @@
 		    "path" : "pages/buytickets/upload",
 		    "style" :                                                                                    
 		    {
-		        "navigationBarTitleText": "上传图片",
+		       // "navigationBarTitleText": "上传图片",
 		        "enablePullDownRefresh": false
 		    }
 		    
@@ -71,7 +71,7 @@
             "path" : "pages/buytickets/adjust",
             "style" :                                                                                    
             {
-                "navigationBarTitleText": "调整图片",
+               // "navigationBarTitleText": "调整图片",
                 "enablePullDownRefresh": false
             }
             
@@ -81,7 +81,7 @@
             "path" : "pages/buytickets/confirm",
             "style" :                                                                                    
             {
-                "navigationBarTitleText": "确认身份",
+               // "navigationBarTitleText": "确认身份",
                 "enablePullDownRefresh": false
             }
             
@@ -91,7 +91,7 @@
             "path" : "pages/buytickets/site",
             "style" :                                                                                    
             {
-                "navigationBarTitleText": "选择站点",
+               // "navigationBarTitleText": "选择站点",
                 "enablePullDownRefresh": false,
 				"navigationStyle": "custom" // 隐藏系统导航栏
             }
@@ -102,7 +102,7 @@
             "path" : "pages/buytickets/success",
             "style" :                                                                                    
             {
-                "navigationBarTitleText": "购买成功",
+               // "navigationBarTitleText": "购买成功",
                 "enablePullDownRefresh": false
             }
             
@@ -112,7 +112,7 @@
             "path" : "pages/query/index",
             "style" :                                                                                    
             {
-                "navigationBarTitleText": "搜索",
+               // "navigationBarTitleText": "搜索",
                 "enablePullDownRefresh": false,
 				"navigationStyle": "custom" // 隐藏系统导航栏
             }
@@ -123,7 +123,7 @@
             "path" : "pages/query/record",
             "style" :                                                                                    
             {
-                "navigationBarTitleText": "搜索结果",
+               // "navigationBarTitleText": "搜索结果",
                 "enablePullDownRefresh": false,
 				"navigationStyle": "custom" // 隐藏系统导航栏
             }
@@ -134,7 +134,7 @@
             "path" : "pages/news/index",
             "style" :                                                                                    
             {
-                "navigationBarTitleText": "消息",
+               // "navigationBarTitleText": "消息",
                 "enablePullDownRefresh": false
             }
             
@@ -144,7 +144,7 @@
 		    "path" : "pages/my/index",
 		    "style" :                                                                                    
 		    {
-		        "navigationBarTitleText": "我的",
+		       // "navigationBarTitleText": "我的",
 		        "enablePullDownRefresh": false
 		    }
 		    
@@ -154,7 +154,7 @@
             "path" : "pages/my/user/updateUser",
             "style" :                                                                                    
             {
-                "navigationBarTitleText": "",
+               // "navigationBarTitleText": "",
                 "enablePullDownRefresh": false
             }
             
@@ -164,7 +164,7 @@
             "path" : "pages/my/user/bybusList",
             "style" :                                                                                    
             {
-                "navigationBarTitleText": "",
+               // "navigationBarTitleText": "",
                 "enablePullDownRefresh": false
             }
             
@@ -174,7 +174,7 @@
             "path" : "pages/my/platform/opinion",
             "style" :                                                                                    
             {
-                "navigationBarTitleText": "",
+               // "navigationBarTitleText": "",
                 "enablePullDownRefresh": false
             }
             
@@ -184,7 +184,7 @@
             "path" : "pages/my/platform/about",
             "style" :                                                                                    
             {
-                "navigationBarTitleText": "",
+               // "navigationBarTitleText": "",
                 "enablePullDownRefresh": false
             }
             
@@ -195,7 +195,7 @@
             "path" : "pages/my/user/resetpassword/verification",
             "style" :                                                                                    
             {
-                "navigationBarTitleText": "",
+               // "navigationBarTitleText": "",
                 "enablePullDownRefresh": false
             }
             
@@ -205,7 +205,7 @@
 		    "path" : "pages/my/user/resetpassword/change",
 		    "style" :                                                                                    
 		    {
-		        "navigationBarTitleText": "",
+		       // "navigationBarTitleText": "",
 		        "enablePullDownRefresh": false
 		    }
 		    
@@ -215,7 +215,7 @@
 		    "path" : "pages/my/user/updatephone/index",
 		    "style" :                                                                                    
 		    {
-		        "navigationBarTitleText": "",
+		       // "navigationBarTitleText": "",
 		        "enablePullDownRefresh": false
 		    }
 		    
@@ -225,7 +225,7 @@
             "path" : "pages/my/user/updatephone/verification",
             "style" :                                                                                    
             {
-                "navigationBarTitleText": "",
+               // "navigationBarTitleText": "",
                 "enablePullDownRefresh": false
             }
             
@@ -236,7 +236,7 @@
             "path" : "pages/my/user/updatephone/change",
             "style" :                                                                                    
             {
-                "navigationBarTitleText": "",
+               // "navigationBarTitleText": "",
                 "enablePullDownRefresh": false
             }
 			
@@ -256,10 +256,9 @@
 	        }]
 	    },
 	"globalStyle": {
-		"navigationBarTextStyle": "black",
-		"navigationBarTitleText": "uni-app",
-		"navigationBarBackgroundColor": "#F8F8F8",
-		"backgroundColor": "#F8F8F8"
+			"navigationStyle": "custom" // 隐藏系统导航栏
+			,"navigationBarTitleText": "车信达"
+			
 	},
 	"tabBar": {
 	    "color": "#7A7E83",

+ 102 - 12
pages/buytickets/adjust.js

@@ -1,16 +1,106 @@
-
-
-	export default {
-		data() {
-			return {
-			
+import {
+	VueCropper
+} from 'vue-cropper'
+import * as WxJsApi from '@/utils/wxJsApi.js'
+	import {
+		dataUrlToFile
+	} from '@/utils'
+import * as API_Common from '@/apis/common'
+
+export default {
+	data() {
+		return {
+			localId:'',
+			imgBase64: '',
+			cropper: {
+
+				//img的路径自行修改
+				img: '',
+				info: true,
+				size: 0.8,
+				outputType: 'jpeg',
+				canScale: false,
+				autoCrop: true,
+				// 只有自动截图开启 宽度高度才生效
+				autoCropWidth: 250,
+				autoCropHeight: 350,
+				fixed: true,
+				// 真实的输出宽高
+				infoTrue: true,
+				fixedNumber: [5, 7],
+				fixedBox:true
+
+			},
+		}
+	},
+	components: {
+		VueCropper,
+	},
+	methods: {
+		//上传图片
+		uploadpic() {
+			this.$refs.common.showLoading()
+			var _this = this;
+			var formData = {
+				'photoName': '1.jpg',
+				'photoFile': this.imgBase64
 			}
-		},
-		methods: {
 			
+			API_Common.upload(formData).then(response => {
+				
+				var obj=this.carhelp.get("form");
+				obj.pic=response.data;
+				this.carhelp.set("form",obj);
+				this.$refs.common.showLoading(false,"上传成功!")
+				
+				uni.navigateTo({
+					url: '/pages/buytickets/confirm'
+				})
+			}).catch(error => {
+				this.$refs.common.showLoading(false,error)
+		
+			})
+		},
+		submit(){
+			this.$refs.cropper.goAutoCrop();
+			this.$refs.cropper.getCropData((data) => {
+				this.modelSrc = data
+				this.model = false;
+				//裁剪后的图片显示
+				//this.cropper.img = data;
+				//console.log(data)
+				this.imgBase64=data;
+				this.uploadpic();
+			})
+		},
+		close(){
+			step=1;
 		},
-		onLoad() {
+		rotateRight(){
+			this.$refs.cropper.rotateRight()
+		},
+		getData(res) {
+			var localData = res.localData
+			if (localData.indexOf('data:image') != 0) {
+				//判断是否有这样的头部
+				localData = 'data:image/jpeg;base64,' + localData
+			}
+			localData = localData.replace(/\r|\n/g, '').replace('data:image/jgp', 'data:image/jpeg')
+			this.imgBase64 = localData;
+			this.cropper.img=localData;
+			this.$refs.common.showLoading();
+		},imgLoad(){
+			this.$refs.common.showLoading(false);
+		}
+	},
+	onLoad(obj) {
+		this.localId = obj.localId;
+		
+	},onReady() {
+		this.$refs.common.showLoading()
+			 WxJsApi.getWxConfig([ 'getLocalImgData']).then(() => {
 			 
-		}
-	}
-
+			 	WxJsApi.getLocalImgData(this.localId, this.getData);
+			 });
+		}
+}

+ 13 - 19
pages/buytickets/adjust.vue

@@ -1,18 +1,20 @@
 <template>
 	<view>
+		<car-common :login="true" mytitle="调整照片" ref="common"></car-common>
+		
 		<view class="adjust-img">
-			<view class="adjust-icon">
-				<u-icon name="shuaxin" custom-prefix="custom-icon" color="#2979ff"></u-icon>
-			</view>
-			<view class="adjust-icon2">
-				<u-icon name="enlarge" custom-prefix="custom-icon"  color="#2979ff"></u-icon>
-			</view>
-			<img src="/static/img/1.jpg" alt="">
+		 
+			<vueCropper ref="cropper" :img="cropper.img " :outputSize="cropper.size" :outputType="cropper.outputType" :info="cropper.info"
+			 :canScale="cropper.canScale" :autoCrop="cropper.autoCrop" :autoCropWidth="cropper.autoCropWidth" :autoCropHeight="cropper.autoCropHeight"
+			 :fixed="cropper.fixed"  :fixedBox="cropper.fixedBox" :fixedNumber="cropper.fixedNumber"  @imgLoad="imgLoad" :enlarge="4"></vueCropper>
+			 
 		</view>
 		<view class="adjust-btn">
-			<u-button type="error" size="medium" shape="circle">取消</u-button>
-			<u-button type="primary" size="medium" shape="circle">选取</u-button>
+			<u-button type="primary" size="medium" shape="circle" @click="rotateRight()">旋转</u-button>
+			<u-button type="error" size="medium" shape="circle" @click="submit()">确定</u-button>
+			
 		</view>
+		
 		<view class="adjust-text">
 			<p>1.照片仅用于乘车时人脸识别设备的验证,请上传清晰现场拍摄的肩部半身照;</p>
 			<p>2.可拖动、旋转或缩放照片,将人脸区域调整至轮廓框以内。</p>
@@ -21,16 +23,8 @@
 </template>
 
 <script>
-	export default {
-		data() {
-			return {
-				
-			}
-		},
-		methods: {
-			
-		}
-	}
+	import api from './adjust.js'
+	export default api;
 </script>
 
 <style>

+ 32 - 3
pages/buytickets/confirm.js

@@ -1,16 +1,45 @@
+import * as API from '@/apis/buytickets.js'
 
 
 	export default {
 		data() {
 			return {
-			
+				id:'',
+				pic:'',
+				list:[],
 			}
 		},
 		methods: {
+			reload(){
+				uni.navigateBack({
+				    delta: 2
+				});
+			},
+			matchFaceImage(){
 			
+				var obj=this.carhelp.get("form");
+				if(obj&&obj.name=='buytickets'){
+					this.id=obj.id;
+					this.pic=obj.pic;
+					this.$refs.common.showLoading();
+					var form={
+						faceImageUrl:this.pic,
+						id:this.id,
+					}
+					API.matchFaceImage(form).then((res) => {
+						console.log(res)
+						this.$refs.common.showLoading(false);
+					}).catch(error => {
+						this.$refs.common.showLoading(false, error);
+					
+					})
+				}else{
+					this.$refs.alert("页面异常!");
+				}
+			}
 		},
-		onLoad() {
-			 
+		onReady() {
+			 this.matchFaceImage()
 		}
 	}
 

+ 14 - 16
pages/buytickets/confirm.vue

@@ -1,45 +1,42 @@
 <template>
 	<view>
+		<car-common :login="true"  mytitle="确认身份" ref="common"></car-common>
+		
 		<view class="confirm">
-			<view class="confirm-img-border2">
+			<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">
+			<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>确认以下哪张是您的照片?</h3>
-			<view class="confirm-pic">
+			<h3 v-if="list.length">确认以下哪张是您的照片?</h3>
+			<view class="confirm-pic" v-if="list.length">
 				<view class="confirm-pic-item active"><img src="/static/img/1.jpg" alt=""></view>
 				<view class="confirm-pic-item"><img src="/static/img/2.jpg" alt=""></view>
 				<view class="confirm-pic-item"><img src="/static/img/3.jpg" alt=""></view>
 				<view class="confirm-pic-item"><img src="/static/img/1.jpg" alt=""></view>
 			</view>
 		</view>
-		<view class="upload-button">
-			<u-button type="primary" shape="circle">确定</u-button>
+		<view class="upload-button" v-if="list.length">
+			<u-button type="primary" shape="circle" @click="submit">确定</u-button>
+		</view>
+		<view class="upload-button" v-if="!list.length">
+			<u-button type="primary" shape="circle" @click="reload">重新选择</u-button>
 		</view>
 	</view>
 </template>
 
 <script>
-	export default {
-		data() {
-			return {
-				
-			}
-		},
-		methods: {
-			
-		}
-	}
+	import api from './confirm.js'
+	export default api;
 </script>
 
 <style scoped lang="scss">
@@ -86,6 +83,7 @@
 		display: flex;
 		justify-content: space-between;
 		padding: 20px;
+		margin-bottom: 30px;
 		.confirm-pic-item{
 			height:80px;
 			width: 80px;

+ 183 - 90
pages/buytickets/index.js

@@ -1,96 +1,189 @@
-import * as WxJsApi from '@/utils/wxJsApi.js'
-export default {
-    data() {
-        return {
-			
-			show:false,
-			id:0, // 使用 marker点击事件 需要填写id
-            title: 'map',
-			info:{
-				init:false,
-				longitude: '',
-				latitude: '',
+import * as WxJsApi from '@/utils/wxJsApi.js'
+import * as API from '@/apis/buytickets.js'
+
+import Carmap from '@/components/Carmap.vue'
+
+export default {
+	data() {
+		return {
+			title: '乘车人',
+			show: false,
+			id: 0, // 使用 marker点击事件 需要填写id
+
+			//地图居中后的位置
+			longitude: 112.276527,
+			latitude: 30.306427,
+			shiftInfo: {
+
+			},
+			list: [{}, {}],
+			//车的位置
+			car: {
+				obj: null,
+				longitude: '',
+				latitude: '',
 			},
-			longitude: 112.276527,
-			latitude: 30.306427,
-            covers: [{
-               longitude: 112.276527,
-               latitude: 30.306427,
-               iconPath: '/static/img/map_0.png'
-            }, {
-               longitude: 112.276527,
-               latitude: 30.306427,
-               iconPath: '/static/img/map_2.png'
-            }]
-        }
-    },
-	
-    methods: {
-		getPoint(){
-		  
-		    //this.isLoading = true;
-		    WxJsApi.getLocation().then((res) => {
-		        this.isLoading = false;
-				this.info.init=true
-				
-		        var latitude = parseFloat(res.latitude);
-		        var longitude = parseFloat(res.longitude);
-				this.latitude=latitude;
-				this.longitude=longitude;
-		       // mui.toast("经纬度已经获取,正在转换地址...");
-				this.covers=[{
-				   longitude: longitude,
-				   latitude: latitude,
-				   iconPath: '/static/img/map_2.png'
-				}]
-		     
-		    }).catch(error => {
-		
-		        this.isLoading = false;
-		        console.log(error)
-		       // WxJsApi.addSysLog(error)
-		    })
-		}, 
-		update(){
-			this.covers=[{
-               longitude: 112.276527,
-               latitude: 30.306427,
-               iconPath: '/static/img/map_1.png'
-            }, {
-               longitude: 112.276527,
-               latitude: 30.306427,
-               iconPath: '/static/img/map_1.png'
-            }]
-		},
-		confirmBtn(){
-			uni.navigateTo({
-				url:'/pages/car/login'
+			stationList:[],
+			//个人
+			info: {
+				obj: null,
+				init: false,
+				longitude: '',
+				latitude: '',
+			},
+			myinterval:''
+
+		}
+	},
+	components: {
+		Carmap
+	},
+
+	methods: {
+		select(uid) {
+			uni.navigateTo({
+				url: '/pages/buytickets/site?id=' + this.id + '&uid=' + uid
+			})
+		},
+		add() {
+			uni.navigateTo({
+				url: '/pages/buytickets/site?id=' + this.id
+			})
+		},
+		submit() {
+			this.$refs.common.setFnc(this.confirmBtn)
+			this.$refs.common.alert2('您还不是车信达用户,注册后再购买车票。', '前往注册', '尚未注册')
+
+		},
+		drawing(point,startend) {
+			
+			this.$refs.amap.initMap(point,this.stationList,startend);
+		},
+		getShiftInfoResponse(response,response2) {
+
+			var res = response.data
+			this.title = res.routeName;
+			this.shiftInfo = res;
+			this.car.latitude = res.latitude;
+			this.car.longitude = res.longitude;
+			var point = [];
+			res.mapPath.split("|").forEach((item) => {
+				var sz = item.split(",");
+
+				point.push({
+					longitude: sz[0],
+					latitude: sz[1],
+				})
+				if (!process.car.SIMPLE_RUN) {
+					this.longitude = sz[0]
+					this.latitude = sz[1]
+				}
+
 			})
-		}
-		
-    },onReady(){
-		
-		if(!this.caruitl.get("personInfo")){
-			this.show=true;
-			return false;
-			uni.showModal({
-				title:'尚未注册',
-				content:'111',
-				showCancel:false,
-				confirmText:'前往注册',
-				success:(confirm)=>{
-					if(confirm){
-						uni.navigateTo({
-							url:'/pages/car/login'
-						})
-					}
+			var obj = this.carhelp.get("form")
+			
+			obj.getShiftInfo = response;
+			obj.getVehicleStationInfo = response2;
+			
+			this.stationList=obj.getVehicleStationInfo.data
+			
+			obj = this.carhelp.set("form", obj)
+			
+			var sz1=response.data.startStationCoordinate.split("|")
+			var sz2=response.data.endStationCoordinate.split("|")
+			var startend=[
+				{
+					longitude:sz1[0],
+					latitude:sz1[1],
+					name:response.data.startStation
+				},{
+					longitude:sz2[0],
+					latitude:sz2[1],
+					name:response.data.endStation
 				}
+			];
+			
+			this.drawing(point,startend);
+			this.$refs.common.showLoading(false);
+			
+			this.myinterval=setInterval(this.getPoint,10000);
+			
+		},
+		getShiftInfo() {
+			var obj = this.carhelp.get("form")
+			if (obj.getShiftInfo&&obj.getVehicleStationInfo) {
+				this.stationList=obj.getVehicleStationInfo.data
+				this.getShiftInfoResponse(obj.getShiftInfo,obj.getVehicleStationInfo);
+				return;
+			}
+
+			this.$refs.common.showLoading();
+			
+			API.getShiftInfo(this.id).then((response) => {
+				if (!response.result) {
+					this.$refs.common.goError(response.message)
+					return
+				}
+				API.getVehicleStationInfo(this.id).then((response2) => {
+					this.getShiftInfoResponse(response,response2);
+					
+				})
+				
+			}).catch(error => {
+				this.$refs.common.showLoading(false, error);
+
+			})
+		},
+		getPoint() {
+			
+			WxJsApi.getLocation().then((res) => {
+
+				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);
+
+			}).catch(error => {
+
 			})
-		}else{
-			WxJsApi.getWxConfig(['chooseImage', 'getLocalImgData', 'getLocation']);
-			this.getPoint();
+			
+			
+			API.getVehicleInfo(this.id).then((response) => {
+				this.car=response.data;
+				this.$refs.amap.setCar(this.car);
+				
+			}).catch(error => {
+				this.$refs.common.showLoading(false, error);
+			
+			})
+		},
+
+
+	},
+	onLoad(op) {
+
+		this.id = op.id
+	},
+	onUnload(){
+		if(this.myinterval){
+			clearInterval(this.myinterval)
 		}
-		
-		   
-	}
+	},
+	onReady() {
+
+
+
+		WxJsApi.getWxConfig(['getLocation']);
+		
+		this.getShiftInfo()
+
+	}
 }

+ 193 - 192
pages/buytickets/index.vue

@@ -1,197 +1,198 @@
-<template>
-	<view>
-		<map style="width: 100%; height: 240px;" scale="12" ></map>
-		<view class="map-text">
-			<h4>六中 → 锣场</h4>
-			<p>首班:06:05  末班:18:10</p>
-		</view>
-		<view class="ticket-item">
-			<view class="ticket-item-left">
-				<view class="ticket-head">
-					<u-avatar :src="src" size="mini"></u-avatar>
-					<h3>玉桥 - 宿架转盘</h3>
-				</view>
-				<view class="ticket-text">
-					<view class="ticket-text-row">
-						<p>票种:</p><span>成人票</span>
-					</view>
-					<view class="ticket-text-row">
-						<p>货票:</p><span>¥20.00</span>
-					</view>
-				</view>
-			</view>
-			<view class="ticket-item-right">
-				<h3>26.00</h3>
-				<p>票价</p>
+<template>
+	<view>
+		<car-common  :mytitle="title" ref="common"></car-common>
+
+		
+			<carmap ref="amap"></carmap>
+
+			<view class="map-text">
+				<h4>{{shiftInfo.startStation}} → {{shiftInfo.endStation}}</h4>
+				<p>首班:{{shiftInfo.startTime}} 末班:{{shiftInfo.endTime}}</p>
 			</view>
-		</view>
-		<view class="ticket-item">
-			<view class="ticket-item-left">
-				<view class="ticket-head">
-					<u-avatar :src="src" size="mini"></u-avatar>
-					<h3>玉桥 - 宿架转盘</h3>
-				</view>
-				<view class="ticket-text">
-					<view class="ticket-text-row">
-						<p>票种:</p><span>成人票</span>
+			<template  v-for="item in list">
+				<view class="ticket-item" @click="select">
+					<view class="ticket-item-left">
+						<view class="ticket-head">
+							<u-avatar size="mini"></u-avatar>
+							<h3>玉桥 - 宿架转盘</h3>
+						</view>
+						<view class="ticket-text">
+							<view class="ticket-text-row">
+								<p>票种:</p><span>成人票</span>
+							</view>
+							<view class="ticket-text-row">
+								<p>货票:</p><span>¥20.00</span>
+							</view>
+						</view>
 					</view>
-					<view class="ticket-text-row">
-						<p>货票:</p><span>¥20.00</span>
+					<view class="ticket-item-right">
+						<h3>26.00</h3>
+						<p>票价</p>
 					</view>
 				</view>
-			</view>
-			<view class="ticket-item-right">
-				<h3>26.00</h3>
-				<p>票价</p>
-			</view>
-		</view>
-		<view class="add-btn">
-			<u-button type="primary" plain="true">
-				<u-icon name="man-add-fill" color="#2979ff" size="32"></u-icon>
-				添加乘车人
-			</u-button>
-		</view>
-		<view class="add-foot">
-			<view class="add-foot-price">
-				<p>合计:</p>
-				<span>¥0.00</span>
-			</view>
-			<view class="add-foot-btn">
-				结算
-			</view>
-		</view>
-	</view>
-</template>
-
-<script>
-	export default {
-		data() {
-			return {
-				
-			}
-		},
-		methods: {
-			
-		}
-	}
-</script>
-
-<style>
-	page{
-		background-color: #f7f7f7;
-	}
-</style>
-<style scoped lang="scss">
-	.map-text{
-		background-color: #fff;
-		padding: 20rpx;
-		h4{
-			font-size: 16px;
-		}
-		p{
-			margin-top: 10rpx;
-			color:#999;
-		}
-	}
-	.ticket-item{
-		background-color: #fff;
-		margin:20rpx;
-		border-radius: 10px;
-		display: flex;
-		justify-content: space-between;
-		.ticket-item-left{
-			padding: 20rpx;
-			.ticket-head{
-				display: flex;
-				align-items: center;
-				h3{
-					margin-left: 10rpx;
-				}
-			}
-			.ticket-text{
-				margin-top: 20rpx;
-				.ticket-text-row{
-					display: flex;
-					align-items: center;
-					margin-bottom: 10rpx;
-					&:last-child{
-						margin-bottom: 0;
-					}
-					span{
-						color:#007AFF
-					}
-				}
-			}
-		}
-		.ticket-item-right{
-			width: 120px;
-			display: flex;
-			flex-direction: column;
-			justify-content: center;
-			align-items: center;
-			border-left: 1px dashed #eee;
-			position: relative;
-			&:before{
-				content: '';
-				position: absolute;
-				height: 30rpx;
-				width: 30rpx;
-				background-color: #f7f7f7;
-				border-radius: 50%;
-				left: -15rpx;
-				top:-15rpx;
-			}
-			&:after{
-				content: '';
-				position: absolute;
-				height: 30rpx;
-				width: 30rpx;
-				background-color: #f7f7f7;
-				border-radius: 50%;
-				left: -15rpx;
-				bottom:-15rpx;
-			}
-			h3{
-				color:#007AFF;
-				font-size:24px;
-			}
-		}
-		
-	}
-	.add-btn{
-		margin: 20rpx;
-		padding-bottom: 60px;
-		.u-icon{
-			margin-right: 10rpx;
-		}
-	}
-	.add-foot{
-		position: fixed;
-		background-color: #fff;
-		z-index: 99;
-		bottom:0;
-		left: 0;
-		right: 0;
-		height: 90rpx;
-		display: flex;
-		justify-content: space-between;
-		.add-foot-price{
-			display: flex;
-			align-items: center;
-			padding-left: 20rpx;
-			font-size: 32rpx;
-			font-weight: bold;
-			span{
-				color: #ff6200;
-			}
-		}
-		.add-foot-btn{
-			width: 240rpx;
-			background-color: #ff6200;
-			color:#fff;
-			font-size: 32rpx;
-			text-align: center;
-			line-height: 90rpx;
-		}
-	}
+			</template>
+			
+			 
+			<view class="add-btn">
+				<u-button type="primary" plain @click="add()">
+					<u-icon name="man-add-fill" color="#2979ff"  size="32"></u-icon>
+					添加乘车人
+				</u-button>
+			</view>
+			<view class="add-foot">
+				<view class="add-foot-price">
+					<p>合计:</p>
+					<span>¥0.00</span>
+				</view>
+				<view class="add-foot-btn" @click="submit()">
+					结算
+				</view>
+			</view>
+	
+	</view>
+</template>
+
+<script>
+	import api from './index.js'
+	export default api;
+</script>
+
+<style>
+	page {
+		background-color: #f7f7f7;
+	}
+</style>
+<style scoped lang="scss">
+	.map-text {
+		background-color: #fff;
+		padding: 20rpx;
+
+		h4 {
+			font-size: 16px;
+		}
+
+		p {
+			margin-top: 10rpx;
+			color: #999;
+		}
+	}
+
+	.ticket-item {
+		background-color: #fff;
+		margin: 20rpx;
+		border-radius: 10px;
+		display: flex;
+		justify-content: space-between;
+
+		.ticket-item-left {
+			padding: 20rpx;
+
+			.ticket-head {
+				display: flex;
+				align-items: center;
+
+				h3 {
+					margin-left: 10rpx;
+				}
+			}
+
+			.ticket-text {
+				margin-top: 20rpx;
+
+				.ticket-text-row {
+					display: flex;
+					align-items: center;
+					margin-bottom: 10rpx;
+
+					&:last-child {
+						margin-bottom: 0;
+					}
+
+					span {
+						color: #007AFF
+					}
+				}
+			}
+		}
+
+		.ticket-item-right {
+			width: 120px;
+			display: flex;
+			flex-direction: column;
+			justify-content: center;
+			align-items: center;
+			border-left: 1px dashed #eee;
+			position: relative;
+
+			&:before {
+				content: '';
+				position: absolute;
+				height: 30rpx;
+				width: 30rpx;
+				background-color: #f7f7f7;
+				border-radius: 50%;
+				left: -15rpx;
+				top: -15rpx;
+			}
+
+			&:after {
+				content: '';
+				position: absolute;
+				height: 30rpx;
+				width: 30rpx;
+				background-color: #f7f7f7;
+				border-radius: 50%;
+				left: -15rpx;
+				bottom: -15rpx;
+			}
+
+			h3 {
+				color: #007AFF;
+				font-size: 24px;
+			}
+		}
+
+	}
+
+	.add-btn {
+		margin: 20rpx;
+		padding-bottom: 60px;
+
+		.u-icon {
+			margin-right: 10rpx;
+		}
+	}
+
+	.add-foot {
+		position: fixed;
+		background-color: #fff;
+		z-index: 99;
+		bottom: 0;
+		left: 0;
+		right: 0;
+		height: 90rpx;
+		display: flex;
+		justify-content: space-between;
+
+		.add-foot-price {
+			display: flex;
+			align-items: center;
+			padding-left: 20rpx;
+			font-size: 32rpx;
+			font-weight: bold;
+
+			span {
+				color: #ff6200;
+			}
+		}
+
+		.add-foot-btn {
+			width: 240rpx;
+			background-color: #ff6200;
+			color: #fff;
+			font-size: 32rpx;
+			text-align: center;
+			line-height: 90rpx;
+		}
+	}
 </style>

+ 148 - 0
pages/buytickets/selectSite.js

@@ -0,0 +1,148 @@
+import * as WxJsApi from '@/utils/wxJsApi.js'
+import * as API from '@/apis/buytickets.js'
+import Carmap from '@/components/Carmap.vue'
+ 
+export default {
+	data() {
+		return {
+			
+			show: false,
+			id: 0, // 使用 marker点击事件 需要填写id
+			mytitle:'乘车人',
+			//地图居中后的位置
+			longitude: 112.276527,
+			latitude: 30.306427,
+			shiftInfo:{
+				
+			},
+			list:[
+				{},{}
+			],
+			//车的位置
+			car: {
+				obj:null,
+				longitude: '',
+				latitude: '',
+			},
+			//个人
+			info: {
+				obj:null,
+				init: false,
+				longitude: '',
+				latitude: '',
+			},
+
+		
+		}
+	},
+	components:{
+		Carmap
+	},
+	
+	methods: {
+		select(uid){
+			uni.navigateTo({
+				url: '/pages/buytickets/site?id='+this.id+'&uid='+uid
+			})
+		},
+		add(){
+			uni.navigateTo({
+				url: '/pages/buytickets/site?id='+this.id
+			})
+		},
+		submit() {
+			this.$refs.common.setFnc(this.confirmBtn)
+			this.$refs.common.alert2('您还不是车信达用户,注册后再购买车票。','前往注册','尚未注册')
+			 
+		},
+		 drawing(point){
+			 this.$refs.amap.initMap(point);
+		 },
+		 getShiftInfoResponse(response){
+			 
+			 	
+			 	if(!response.result){
+			 		 
+			 		this.$refs.common.goError(response.message)
+			 		
+			 		return
+			 	}
+			 	
+			 	var res=response.data
+			 	this.title=res.routeName;
+			 	this.shiftInfo=res;
+			 	this.car.latitude = res.latitude;
+			 	this.car.longitude = res.longitude;
+			 	var point=[];
+			 	res.mapPath.split("|").forEach((item) => {
+			 		var sz = item.split(",");
+			 
+			 		point.push({
+			 			longitude: sz[0],
+			 			latitude: sz[1],
+			 		})
+			 		if (!process.car.SIMPLE_RUN) {
+			 			this.longitude = sz[0]
+			 			this.latitude = sz[1]
+			 		}
+			 
+			 	})
+			 	this.drawing(point);
+			 	this.$refs.common.showLoading(false);
+		 },
+		getShiftInfo() {
+			
+			var obj=this.carhelp.get("form")
+			if(obj.getShiftInfo){
+				this.getShiftInfoResponse(obj.getShiftInfo);
+				return;
+			}
+			
+			this.$refs.common.showLoading();
+			API.getShiftInfo(this.id).then((response) => {
+				this.getShiftInfoResponse(response);
+				
+				obj.getShiftInfo=response;
+				obj=this.carhelp.set("form",obj)
+				
+			}).catch(error => {
+				this.$refs.common.showLoading(false, error);
+
+			})
+		},
+		getPoint() {
+
+
+			WxJsApi.getLocation().then((res) => {
+
+				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;
+				
+
+			}).catch(error => {
+
+			})
+		},
+	
+
+	},
+	onLoad(op) {
+		
+		this.id = op.id
+	},
+
+	onReady() {
+
+			WxJsApi.getWxConfig([ 'getLocation']);
+			this.getPoint();
+			this.getShiftInfo()
+	}
+}

+ 27 - 14
pages/buytickets/selectSite.vue

@@ -1,10 +1,12 @@
 <template>
 	<view>
-		<map style="width: 100%; height: 240px;" scale="12" ></map>
+		<car-common :login="true"  :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>
+				<h4>{{shiftInfo.startStation}} → {{shiftInfo.endStation}}</h4>
+				<p>首班:{{shiftInfo.startTime}} 末班:{{shiftInfo.endTime}}</p>
 			</view>
 			<!-- <view class="map-btn">
 				<u-icon name="swap" custom-prefix="custom-icon"  color="#2979ff"></u-icon>
@@ -12,10 +14,29 @@
 			</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">
+				<template v-for="item,i in stationList">
+					 <view class="map-route-origin" v-if="i==0">
+					 	<view class="map-route-circle"></view>
+					 	<view class="map-route-name">
+					 		1锣场
+					 	</view>
+					 </view>
+					 
+					 <view class="map-route-item map-after" v-if="item.id!=car.currentStationId">
+					 	<view class="map-route-circle"></view>
+					 	<view class="map-route-line"></view>
+					 	<view class="map-route-name">
+					 		2东方大道
+					 	</view>
+					 </view>
+					 
+				</template>
+			</view>
+			<view class="map-route-main" v-if="false">
 				<view class="map-route-origin">
 					<view class="map-route-circle"></view>
 					<view class="map-route-name">
@@ -98,16 +119,8 @@
 </template>
 
 <script>
-	export default {
-		data() {
-			return {
-				
-			}
-		},
-		methods: {
-			
-		}
-	}
+	import api from './index.js'
+	export default api;
 </script>
 <style scoped lang="scss">
 	.map-route{

+ 86 - 8
pages/buytickets/site.js

@@ -1,16 +1,94 @@
+ import * as API from '@/apis/buytickets.js'
 
-
-	export default {
+export default {
 		data() {
 			return {
-			
+				value: 0,
+				uid:'',//用户id ,有id是修改
+				id:'',//车id
+				down:{name:'美国'},
+				op:{
+					
+				}
 			}
 		},
 		methods: {
-			
-		},
-		onLoad() {
-			 
+			deleteBtn(){
+				if(this.uid){
+					uni.navigateTo({
+						url: '/pages/buytickets/index?id='+this.id
+					})
+				}
+			},
+			select(){
+				var obj=this.carhelp.get("form")
+				obj.op=this.op;
+				obj=this.carhelp.set("form",obj)
+				
+				uni.navigateTo({
+					url: '/pages/buytickets/selectSite?id='+this.id
+				})
+			},
+			clickBtn(){
+				var obj=this.carhelp.get("form")
+				obj.op=this.op;
+				obj=this.carhelp.set("form",obj)
+				
+				if(this.uid){
+					console.log("修改人员属性。。。")
+					uni.navigateTo({
+						url: '/pages/buytickets/index?id='+this.id
+					})
+				}else{
+					uni.navigateTo({
+						url: '/pages/buytickets/upload'
+					})
+				}
+			},
+			confirmBtn() {
+				var route_path = window.location.href.split("#")[1];
+				this.carhelp.set("back_url",route_path);
+				uni.reLaunch({
+					url: '/pages/car/login?back=true'
+				})
+			},
+			valChange(e) {
+				
+				console.log('当前值为: ' + e.value)
+			},
+			underLineChange(index) {
+				this.underLine = index == 0 ? true : false;
+			},
+		},
+	onLoad(op) {
+		this.id = op.id;
+		this.uid = op.uid;
+	},
+
+	onReady() {
+		
+		if(!this.id){
+			this.$refs.common.goError()
 		}
+		var obj=this.carhelp.get("form")
+		
+		if(obj&&obj.name=='buytickets'&&obj.id==this.id){
+			//不创建新订单
+		}else{
+			this.carhelp.set("form",{
+				name:'buytickets',
+				id:this.id,
+				list:[]
+			});
+		}
+		
+		if (!this.carhelp.getPersonInfo()) {
+			this.$refs.common.setFnc(this.confirmBtn)
+			this.$refs.common.alert2('您还不是车信达用户,注册后再购买车票。','前往注册','尚未注册')
+		} else {
+			
+		}
+
+
 	}
-
+}

+ 14 - 22
pages/buytickets/site.vue

@@ -1,10 +1,13 @@
 <template>
 	<view>
+		<car-common  ref="common"></car-common>
+		
+		
 		<u-navbar title="站点选择">
 			<view class="slot-wrap"></view>
-			<view class="navbar-right">
-				<u-icon name="shanchu" custom-prefix="custom-icon" size="40" color="#999"></u-icon>
-				<span>删除</span>
+			<view class="navbar-right"  @click="deleteBtn" >
+				<u-icon name="shanchu" custom-prefix="custom-icon" size="40" :color="uid?'red':'#999'"></u-icon>
+				<span :style="uid?'color:red':''">删除</span>
 			</view>
 		</u-navbar>
 		
@@ -24,15 +27,15 @@
 						<view class="circle"></view>
 						<span>下车站点</span>
 					</view>
-					<view class="content">
-						<span>宿架转盘</span>
+					<view class="content" @click="select">
+						<span v-text="down?down.name:'请选择'" :style="down?'':'color:#999'">宿架转盘</span>
 					</view>
 				</view>
 			</view>
 			<view class="site-foot">
 				<view class="site-foot-row">
 					<span>乘客类型</span>
-					<u-subsection vibrateShort :list="['儿童票', '成人票']" @change="underLineChange"></u-subsection>
+					<u-subsection current="1" vibrateShort :list="['儿童票', '成人票']" @change="underLineChange"></u-subsection>
 				</view>
 				<view class="site-foot-row">
 					<span>货票</span>
@@ -45,27 +48,16 @@
 			</view>
 		</view>
 		<view class="upload-button">
-			<u-button type="primary" shape="circle">上传照片</u-button>
+			<u-button type="primary" shape="circle" @click="clickBtn" v-text="uid?'保存':'上传照片'"></u-button>
 		</view>
 	</view>
 </template>
 
 <script>
-	export default {
-		data() {
-			return {
-				value: 0
-			}
-		},
-		methods: {
-			valChange(e) {
-				console.log('当前值为: ' + e.value)
-			},
-			underLineChange(index) {
-				this.underLine = index == 0 ? true : false;
-			},
-		}
-	}
+	import api from './site.js'
+	export default api;
+	
+	
 </script>
 
 <style>

+ 4 - 10
pages/buytickets/success.vue

@@ -1,5 +1,7 @@
 <template>
 	<view>
+		<car-common :login="true"  mytitle="缴费结果" ref="common"></car-common>
+		
 		<view class="success">
 			<u-icon name="checkmark-circle-fill" color="#08d152" size="200"></u-icon>
 			<h3>支付成功</h3>
@@ -31,16 +33,8 @@
 </template>
 
 <script>
-	export default {
-		data() {
-			return {
-				
-			}
-		},
-		methods: {
-			
-		}
-	}
+	import api from './index.js'
+	export default api;
 </script>
 
 <style>

+ 19 - 3
pages/buytickets/upload.js

@@ -1,16 +1,32 @@
 
+import * as WxJsApi from '@/utils/wxJsApi.js'
 
 	export default {
 		data() {
 			return {
-			
+				imgBase64:'',
+				step:1,
 			}
 		},
 		methods: {
 			
-		},
-		onLoad() {
+			uploadPic(){
+			 WxJsApi.chooseImage(1,true).then(res=>{
+				var localId=res[0]
+				uni.navigateTo({
+					url:'/pages/buytickets/adjust?localId='+localId
+				})
+			 })
 			 
+			}
+		},
+		
+		onReady() {
+			this.$refs.common.showLoading()
+			 WxJsApi.getWxConfig(['chooseImage']).then(()=>{
+				 this.$refs.common.showLoading(false)
+			 });
+	
 		}
 	}
 

+ 95 - 88
pages/buytickets/upload.vue

@@ -1,89 +1,96 @@
-<template>
-	<view>
-		<view class="upload">
-			<h4>确认本人操作</h4>
-			<view class="upload-img">
-				<img src="/static/img/face1.png" alt="">
-			</view>
-			<p>1.为了确保您的乘车信息的安全和真实性,我们需要对您进行人脸信息的匹配</p>
-			<p>2.请您本人亲自完成,请将脸部置于提示框内,并按提示</p>
-			<view class="upload-step">
-				<view class="upload-step-item">
-					<img src="/static/img/icon-face-1.png" alt="">
-					<span>摘下遮挡物</span>
-				</view>
-				<view class="upload-step-item">
-					<img src="/static/img/icon-face-2.png" alt="">
-					<span>正对手机</span>
-				</view>
-				<view class="upload-step-item">
-					<img src="/static/img/icon-face-3.png" alt="">
-					<span>光线充足</span>
-				</view>
-			</view>
-		</view>
-		<view class="upload-button">
-			<u-button type="primary" shape="circle">上传照片</u-button>
-		</view>
-	</view>
-</template>
-
-<script>
-	export default {
-		data() {
-			return {
-				
-			}
-		},
-		methods: {
-			
-		}
-	}
-</script>
-
-<style scoped lang="scss">
-	.upload{
-		padding: 100rpx 50rpx;
-		h4{
-			text-align: center;
-			font-size: 36rpx;
-		}
-		p{
-			color:#909090;
-			margin-bottom: 20rpx;
-		}
-		.upload-img{
-			height:220px;
-			width: 176px;
-			margin:40rpx auto;
-			img{
-				width: 100%;
-				height: 100%;
-			}
-		}
-		.upload-step{
-			display: flex;
-			justify-content: space-between;
-			padding: 10px 0;
-			.upload-step-item{
-				display: flex;
-				flex-direction: column;
-				align-items: center;
-				img{
-					height:60px;
-					width: 60px;
-				}
-				span{
-					margin-top: 10rpx;
-					font-size: 14px;
-				}
-			}
-		}
-	}
-	.upload-button{
-		position: fixed;
-		left: 30rpx;
-		bottom:30rpx;
-		right: 30rpx;
-	}
+<template>
+	<view  >
+		<car-common :login="true" mytitle="上传照片" ref="common"></car-common>
+			<view class="upload">
+				<h4>确认本人操作</h4>
+				<view class="upload-img">
+					<img src="/static/img/face1.png" alt="" v-if="!imgBase64">
+					<img :src="imgBase64" v-if="imgBase64" />
+				</view>
+				<p>1.为了确保您的乘车信息的安全和真实性,我们需要对您进行人脸信息的匹配</p>
+				<p>2.请您本人亲自完成,请将脸部置于提示框内,并按提示</p>
+				<view class="upload-step">
+					<view class="upload-step-item">
+						<img src="/static/img/icon-face-1.png" alt="">
+						<span>摘下遮挡物</span>
+					</view>
+					<view class="upload-step-item">
+						<img src="/static/img/icon-face-2.png" alt="">
+						<span>正对手机</span>
+					</view>
+					<view class="upload-step-item">
+						<img src="/static/img/icon-face-3.png" alt="">
+						<span>光线充足</span>
+					</view>
+				</view>
+			</view>
+			<view class="upload-button">
+				<u-button type="primary" shape="circle" @click="uploadPic">上传照片</u-button>
+			</view>
+	
+		
+		
+	</view>
+</template>
+
+<script>
+	import api from './upload.js'
+	export default api;
+</script>
+
+<style scoped lang="scss">
+	 
+	.upload {
+		padding: 100rpx 50rpx;
+
+		h4 {
+			text-align: center;
+			font-size: 36rpx;
+		}
+
+		p {
+			color: #909090;
+			margin-bottom: 20rpx;
+		}
+
+		.upload-img {
+			height: 220px;
+			width: 176px;
+			margin: 40rpx auto;
+
+			img {
+				width: 100%;
+				height: 100%;
+			}
+		}
+
+		.upload-step {
+			display: flex;
+			justify-content: space-between;
+			padding: 10px 0;
+
+			.upload-step-item {
+				display: flex;
+				flex-direction: column;
+				align-items: center;
+
+				img {
+					height: 60px;
+					width: 60px;
+				}
+
+				span {
+					margin-top: 10rpx;
+					font-size: 14px;
+				}
+			}
+		}
+	}
+
+	.upload-button {
+		position: fixed;
+		left: 30rpx;
+		bottom: 30rpx;
+		right: 30rpx;
+	}
 </style>

+ 0 - 29
pages/car/index.js

@@ -1,29 +0,0 @@
-
-
-	export default {
-		data() {
-			return {
-				message:"aaa"
-			}
-		},
-		methods: {
-			gotoLogin(){
-				    this.$Router.push('/pages/car/login')
-
-			},
-			gotoLogin2(){
-				    uni.navigateTo({
-						url:'/pages/car/login'
-					})
-			}
-			
-		},
-		onLoad() {
-			console.log("111")
-			uni.setTabBarBadge({
-			  index: 1,
-			  text: '8'
-			})
-		}
-	}
-

+ 0 - 212
pages/car/index.vue

@@ -1,212 +0,0 @@
-<template>
-	<view class="content">
-		<u-navbar :is-back="false" title="">	
-			<view class="slot-wrap">
-				<view class="navbar-left">
-					<u-dropdown ref="uDropdown">
-						<u-dropdown-item title="荆州">
-							<view class="slot-content">
-								<view class="u-text-center">沙市</view>
-								<view class="u-text-center">湖南</view>
-								<view class="u-text-center">湖北</view>
-								<u-button type="primary" @click="closeDropdown">确定</u-button>
-							</view>
-						</u-dropdown-item>
-					</u-dropdown>
-				</view>				
-				<view class="search-wrap">
-					<u-search placeholder="日照香炉生紫烟" :show-action="false"></u-search>
-				</view>
-				<view class="navbar-right">
-					<u-icon name="saoma" custom-prefix="custom-icon" size="40" color="#333"></u-icon>
-				</view>
-			</view>
-			
-		</u-navbar>	
-		<view class="banner">
-			<u-swiper :list="list" @click="clickSwiper"></u-swiper>
-		</view>
-		<view class="index-floor">
-			<view class="title">
-				<u-icon name="zhanpai" custom-prefix="custom-icon" size="40" color="#1677ff"></u-icon>
-				<span>玉桥小区</span>
-			</view>
-			<view class="content">
-				<view class="route">
-					<view class="route-item">
-						<view class="route-text">
-							<h4>沙岑线</h4>
-							<p>开往岑河物流园</p>
-						</view>
-						<view class="route-gap">
-							<view class="route-gap stop">
-								<span>已到站</span>
-								<u-icon name="arrow-right" color="#999" size="28"></u-icon>
-							</view>
-						</view>
-					</view>
-					<view class="route-item">
-						<view class="route-text">
-							<h4>沙岑线</h4>
-							<p>开往岑河物流园</p>
-						</view>
-						<view class="route-gap">
-							<span>1站5公里</span>
-							<u-icon name="arrow-right" color="#999" size="28"></u-icon>
-						</view>
-					</view>
-				</view>
-			</view>
-		</view>
-		<view class="index-floor">
-			<view class="title">
-				<u-icon name="zhanpai" custom-prefix="custom-icon" size="40" color="#1677ff"></u-icon>
-				<span>豉湖路站牌</span>
-			</view>
-			<view class="content">
-				<view class="route">
-					<view class="route-item">
-						<view class="route-text">
-							<h4>沙岑线</h4>
-							<p>开往岑河物流园</p>
-						</view>
-						<view class="route-gap">
-							<view class="route-gap stop">
-								<span>已到站</span>
-								<u-icon name="arrow-right" color="#999" size="28"></u-icon>
-							</view>
-						</view>
-					</view>
-					<view class="route-item">
-						<view class="route-text">
-							<h4>沙岑线</h4>
-							<p>开往岑河物流园</p>
-						</view>
-						<view class="route-gap">
-							<span>1站5公里</span>
-							<u-icon name="arrow-right" color="#999" size="28"></u-icon>
-						</view>
-					</view>
-				</view>
-			</view>
-		</view>
-	</view>
-</template>
-
-<script>
-	import api from './index.js'
-	export default {
-		data() {
-			return {
-				list: [{
-						image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
-						title: '昨夜星辰昨夜风,画楼西畔桂堂东',
-						url:"/pages/buytickets/index?id=1"
-					},
-					{
-						image: 'https://cdn.uviewui.com/uview/swiper/2.jpg',
-						title: '身无彩凤双飞翼,心有灵犀一点通',
-						url:"/pages/buytickets/index?id=2"
-					},
-					{
-						image: 'https://cdn.uviewui.com/uview/swiper/3.jpg',
-						title: '谁念西风独自凉,萧萧黄叶闭疏窗,沉思往事立残阳',
-						url:"/pages/buytickets/index?id=3"
-					}
-				],
-			}
-		},
-		methods: {
-			clickSwiper(index){
-				uni.navigateTo({
-					url:this.list[index].url
-				})
-			},
-			closeDropdown() {
-				this.$refs.uDropdown.close();
-			}
-		}
-	}
-</script>
-
-<style>
-	page{background-color: #f7f7f7;}
-</style>
-<style scoped lang="scss">
-	.slot-wrap {
-		display: flex;
-		align-items: center;
-		flex: 1;
-	}
-	.navbar-right {
-		display: flex;
-		margin-right: 20rpx;
-	}
-	.navbar-left{
-		display: flex;
-		align-items: center;
-		margin-left: 20rpx;
-		span{
-			margin-right: 6rpx;
-			font-size: 14px;
-		}
-	}
-	.search-wrap {
-		margin: 0 20rpx;
-		flex: 1;
-	}
-	.banner{
-		padding: 20rpx;
-		background-color: #fff;
-	}
-	.slot-content{
-		background-color: #fff;
-	}
-	.index-floor{
-		margin: 20rpx;
-		background-color: #fff;
-		border-radius: 20rpx;
-		.title{
-			padding: 20rpx;
-			border-bottom: 1px solid #f7f7f7;
-			display: flex;
-			align-items: center;
-			span{
-				margin-left: 10rpx;
-				font-size: 16px;
-				font-weight: bold;
-			}
-		}
-	}
-	.route{
-		margin:0 20rpx;
-	}
-	.route-item{
-		padding:  20rpx 0;
-		border-bottom: 1px solid #f7f7f7;
-		display: flex;
-		justify-content: space-between;
-		align-items: center;
-		&:last-child{
-			border: none;
-		}
-		h4{
-			font-size: 32rpx;
-		}
-		p{
-			margin-top: 6rpx;
-			color:#999;
-		}
-	}
-	.route-gap{
-		span{
-			font-size: 32rpx;
-			font-weight: bold;
-			margin-right: 10rpx;
-			color:#1677ff;
-		}
-		&.stop{
-			span{color:#ff731d}
-		}
-	}
-</style>

+ 67 - 31
pages/car/login.js

@@ -1,4 +1,4 @@
-
+import * as API_user from '@/apis/user'
 import {
 		checkPhone,
 	} from '@/utils'
@@ -9,20 +9,25 @@ import {
 				subFormCode: {
 					phone: '',
 					openId: '',
-					code: ''
+					verifyCode: ''
 				},
 				isSendMsgIng: false,
 				sendMsgSecond: 60,
+				back:false,
 			}
 		},
 		methods: {
 			codeCheckForm() {
 				let phoneResult = checkPhone(this.subFormCode.phone);
 				if (typeof phoneResult == 'string') {
-					mui.toast(phoneResult);
+				
+				
+					this.$refs.common.alert(phoneResult)
 					return false;
-				} else if (!this.subFormCode.code) {
-					mui.toast('请输入验证码');
+				} else if (!this.subFormCode.verifyCode) {
+				
+					this.$refs.common.alert('请输入验证码')
+					
 					return false;
 				} else {
 					return true;
@@ -35,41 +40,49 @@ import {
 			//验证码登录
 			codeSubmit() {
 				if (this.codeCheckForm()) {
-					this.isLoading = true;
+					this.$refs.common.showLoading()
 					API_user.validateCode(this.subFormCode).then(response => {
-						 
-			
-						var token = response ? response.token : '';
-						this.carutil.setToken(token);
-						this.carutil.setPersonInfo(response);
-						
-						this.loginSuccess();
-			
-					}).catch(error => {
+						  
+						if(response.data){
+							var token = response.data ? response.data.token : '';
+							this.carhelp.setToken(token);
+							this.carhelp.setPersonInfo(response.data.userInfo)
+							
+							this.loginSuccess();
+						}else{
+							 
+							this.$refs.common.showLoading(false,response.message);
+						}
 					
-						this.$refs.uToast.show({
-							title: error
-						})
-						
+			
+					}).catch(error => {					
+						this.$refs.common.showLoading(false,error);	
 					})
 				}
 			},
 			//发送验证码
 			sendMsg() {
+				
+				
 				if (!this.isSendMsgIng) {
 					let phoneResult = checkPhone(this.subFormCode.phone);
 					if (typeof phoneResult == 'string') {
-						mui.toast(phoneResult);
+					  
+						this.$refs.common.alert(phoneResult)
 					} else {
-						this.isLoading = true;
+					
 						API_user.getVerifyCode(this.subFormCode).then(response => {
-							this.isLoading = false;
-			
-							//倒计时
-							this.msgTimeInterval();
+							 
+							if(response.message){
+								//倒计时
+								this.msgTimeInterval();
+							}else{
+								this.$refs.common.alert("您的验证码已经发送[5分钟有效],请勿重复点击")
+							}
+							
 						}).catch(error => {
-							this.isLoading = false;
-							mui.toast(error);
+						 
+							this.$refs.common.alert(error)
 						})
 					}
 				}
@@ -90,15 +103,38 @@ import {
 				}, 1000)
 			},	//登录成功
 			loginSuccess() {
+				 var path=this.carhelp.get("back_url");
+				 
+				if(this.back&&path){
+					this.carhelp.remove("back_url");
+
+					uni.navigateTo({
+					    url: path
+					});
+				}else{
+					
+					uni.switchTab({
+					    url: '/pages/index/index'
+					});
+				}
 				
 			},
 		},
-		onLoad() {
-			if (this.person_temp) {
- 				this.subForm.phone = this.person_temp.phone;
+		onLoad(temp) {
+			 
+			var ob=this.carhelp.getPersonInfo()
+			if(ob){
+				this.loginSuccess()
+			}
+			if(temp.back){
+				this.back=true;
 			}
-			this.subFormCode.openId = this.carutil.getOpenId();
+			console.log(ob)
 			
+			this.subFormCode.openId = this.carhelp.getOpenId();
+			console.log(this.carhelp.getPrefix())
+			
+				
 		}
 	}
 

+ 7 - 5
pages/car/login.vue

@@ -1,5 +1,8 @@
 <template>
+	
 	<view class="login">
+		<car-common  mytitle="登录" ref="common"  ></car-common>
+		
 		<view class="login-logo">
 			<img src="/static/img/logo.png" alt="">
 		</view>
@@ -10,7 +13,7 @@
 					<u-icon name="zhanghao" custom-prefix="custom-icon"  size="38" color="#1677ff"></u-icon>
 				</view>
 				<view class="login-form-input">
-					<u-input placeholder="请输入手机号" type="text"></u-input>
+					<u-input placeholder="请输入手机号" v-model="subFormCode.phone" type="text"></u-input>
 				</view>
 			</view>
 			<view class="login-form-row">
@@ -18,14 +21,14 @@
 					<u-icon name="yanzhengma" custom-prefix="custom-icon"  size="38" color="#1677ff"></u-icon>
 				</view>
 				<view class="login-form-input">
-					<u-input placeholder="请输入验证码" type="text"></u-input>
+					<u-input placeholder="请输入验证码" v-model="subFormCode.verifyCode" type="number"  ></u-input>
 				</view>
 				<view class="login-form-code">
-					<span>发送验证码</span>
+					<span @click="sendMsg" v-text="isSendMsgIng?(sendMsgSecond+'秒'):'发送验证码'" >发送验证码</span>
 				</view>
 			</view>
 			<view class="login-button">
-				<u-button type="primary" shape="circle">立即登录</u-button>
+				<u-button type="primary" shape="circle" @click="login" >立即登录</u-button>
 			</view>
 			<view class="forget">
 				<span>忘记密码?</span>
@@ -34,7 +37,6 @@
 				<p>登录即为同意</p><span>《用户协议》</span><span>《隐私政策》</span>
 			</view>
 		</view>
-		<u-toast ref="uToast" />
 	</view>
 </template>
 

+ 69 - 11
pages/index/index.js

@@ -1,16 +1,74 @@
+import * as WxJsApi from '@/utils/wxJsApi.js'
+import * as API from '@/apis/index.js'
 
-
-	export default {
-		data() {
+export default {
+		data() {
 			return {
-			
-			}
+				longitude: '',
+				latitude: '',
+				list: [{
+						image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
+						title: '昨夜星辰昨夜风,画楼西畔桂堂东',
+						url:"/pages/buytickets/site?id=0cb4dd6c-ca33-4837-bd4a-7f01afb4d1a3"
+					},
+					{
+						image: 'https://cdn.uviewui.com/uview/swiper/2.jpg',
+						title: '身无彩凤双飞翼,心有灵犀一点通',
+						url:"/pages/buytickets/site?id=0cb4dd6c-ca33-4837-bd4a-7f01afb4d1a3"
+					},
+					{
+						image: 'https://cdn.uviewui.com/uview/swiper/3.jpg',
+						title: '谁念西风独自凉,萧萧黄叶闭疏窗,沉思往事立残阳',
+						url:"/pages/buytickets/site?id=0cb4dd6c-ca33-4837-bd4a-7f01afb4d1a3"
+					}
+				],
+			}
 		},
+		onLoad(){
+			
+		},
 		methods: {
+			getPoint() {
 			
-		},
-		onLoad() {
-			 
-		}
-	}
-
+			
+				WxJsApi.getLocation().then((res) => {
+			
+					var latitude = parseFloat(res.latitude);
+					var longitude = parseFloat(res.longitude);
+			
+					this.latitude = latitude;
+					this.longitude = longitude;
+					
+			
+				}).catch(error => {
+			
+				})
+			},
+			getScan(){
+				WxJsApi.scanQRCode(0).then(function(url){
+					console.log(url)
+					window.location.href=url;
+				});
+			},
+			clickSwiper(index){
+				var url=this.list[index].url;
+				if(url){
+					if(url.indexOf("http")==0){
+						window.location.href=url;
+					}else if(url.indexOf("/pages/")==0){
+						uni.navigateTo({
+							url:this.list[index].url
+						})
+					}
+				}
+			},
+			closeDropdown() {
+				this.$refs.uDropdown.close();
+			}
+		},onReady(){
+			WxJsApi.getWxConfig(['scanQRCode','getLocation']);
+			this.getPoint();
+			//清空缓存
+			this.carhelp.set("form",{});
+		}
+	}

+ 19 - 40
pages/index/index.vue

@@ -1,5 +1,7 @@
 <template>
-	<view class="content">
+	<view class="content">
+		<car-common   ref="common"  ></car-common>
+		
 		<u-navbar :is-back="false" title="">	
 			<view class="slot-wrap">
 				<view class="navbar-left">
@@ -8,7 +10,7 @@
 							<view class="slot-content">
 								<view class="u-text-center">沙市</view>
 								<view class="u-text-center">湖南</view>
-								<view class="u-text-center">湖北</view>
+								<view class="u-text-center">湖北</view>
 								<u-button type="primary" @click="closeDropdown">确定</u-button>
 							</view>
 						</u-dropdown-item>
@@ -17,14 +19,14 @@
 				<view class="search-wrap">
 					<u-search placeholder="日照香炉生紫烟" :show-action="false"></u-search>
 				</view>
-				<view class="navbar-right">
+				<view class="navbar-right"  @click="getScan">
 					<u-icon name="saoma" custom-prefix="custom-icon" size="40" color="#333"></u-icon>
 				</view>
 			</view>
 			
 		</u-navbar>	
 		<view class="banner">
-			<u-swiper :list="list"></u-swiper>
+			<u-swiper :list="list" @click="clickSwiper"></u-swiper>
 		</view>
 		<view class="index-floor">
 			<view class="title">
@@ -38,22 +40,22 @@
 							<h4>沙岑线</h4>
 							<p>开往岑河物流园</p>
 						</view>
-						<viwe class="route-gap">
-							<viwe class="route-gap stop">
+						<view class="route-gap">
+							<view class="route-gap stop">
 								<span>已到站</span>
 								<u-icon name="arrow-right" color="#999" size="28"></u-icon>
-							</viwe>
-						</viwe>
+							</view>
+						</view>
 					</view>
 					<view class="route-item">
 						<view class="route-text">
 							<h4>沙岑线</h4>
 							<p>开往岑河物流园</p>
 						</view>
-						<viwe class="route-gap">
+						<view class="route-gap">
 							<span>1站5公里</span>
 							<u-icon name="arrow-right" color="#999" size="28"></u-icon>
-						</viwe>
+						</view>
 					</view>
 				</view>
 			</view>
@@ -70,22 +72,22 @@
 							<h4>沙岑线</h4>
 							<p>开往岑河物流园</p>
 						</view>
-						<viwe class="route-gap">
-							<viwe class="route-gap stop">
+						<view class="route-gap">
+							<view class="route-gap stop">
 								<span>已到站</span>
 								<u-icon name="arrow-right" color="#999" size="28"></u-icon>
-							</viwe>
-						</viwe>
+							</view>
+						</view>
 					</view>
 					<view class="route-item">
 						<view class="route-text">
 							<h4>沙岑线</h4>
 							<p>开往岑河物流园</p>
 						</view>
-						<viwe class="route-gap">
+						<view class="route-gap">
 							<span>1站5公里</span>
 							<u-icon name="arrow-right" color="#999" size="28"></u-icon>
-						</viwe>
+						</view>
 					</view>
 				</view>
 			</view>
@@ -95,30 +97,7 @@
 
 <script>
 	import api from './index.js'
-	export default {
-		data() {
-			return {
-				list: [{
-						image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
-						title: '昨夜星辰昨夜风,画楼西畔桂堂东'
-					},
-					{
-						image: 'https://cdn.uviewui.com/uview/swiper/2.jpg',
-						title: '身无彩凤双飞翼,心有灵犀一点通'
-					},
-					{
-						image: 'https://cdn.uviewui.com/uview/swiper/3.jpg',
-						title: '谁念西风独自凉,萧萧黄叶闭疏窗,沉思往事立残阳'
-					}
-				],
-			}
-		},
-		methods: {
-			closeDropdown() {
-				this.$refs.uDropdown.close();
-			}
-		}
-	}
+	export default   api
 </script>
 
 <style>

+ 2 - 3
pages/my/index.vue

@@ -6,7 +6,6 @@
 </template>
 
 <script>
-	import CarCommon from '@/components/Common.vue'
 	import  * as m from '@/utils/mixin.js'
 	import * as API_WeiXin from '@/apis/weixin.js'
 	
@@ -52,10 +51,10 @@
 				}else{
 					console.log("code"+code)
 				
-					debugger
+					
 					  API_WeiXin.getDataByCode(code).then(response => {
 						console.log("openId+!!!!"+response.openid)
-						debugger
+						
 							m.set("wx_openId",code)
 						var linkUrl =document.URL.replace(/\?code=(.*?)&state=STATE/g, '');
 					window.location = linkUrl;//隐藏参数

+ 17 - 0
utils/AMap.js

@@ -0,0 +1,17 @@
+export default function MapLoader() {
+	return new Promise((resolve, reject) => {
+		if (window.AMap) {
+			resolve(window.AMap)
+		} else {
+			var script = document.createElement('script')
+			script.type = 'text/javascript'
+			script.async = true
+			script.src = 'https://webapi.amap.com/maps?v=1.4.15&callback=initAMap&key=09abadb2e35fc61fd84042c518e9aebf'
+			script.onerror = reject
+			document.head.appendChild(script)
+		}
+		window.initAMap = () => {
+			resolve(window.AMap)
+		}
+	})
+}

+ 17 - 12
utils/mixin.js

@@ -1,19 +1,24 @@
-var app = {
-	prefix : 'jp_car_' + process.car.NODE_ENV + '_',
-
-	get : key => uni.getStorageSync(this.prefix + key),
-
-	set : (key, value) => uni.setStorageSync(this.prefix + key, value),
+var prefix = 'jp_car_' + process.car.NODE_ENV + '_';
+
+var app = {
+	
+	 getPrefix:()=> prefix,
+	get : key =>  uni.getStorageSync(prefix + key),
 
-	getPersonInfo : () => uni.getStorageSync(this.prefix + 'personInfo'),
+	set : (key, value) => uni.setStorageSync(prefix + key, value),
+	remove: key =>  uni.removeStorageSync(prefix + key),
+	
+	getPersonInfo : () => {
+		 return uni.getStorageSync(prefix + 'personInfo')
+	},
 
-	getOpenId : () => uni.getStorageSync(this.prefix + 'wx_openId'),
+	getOpenId : () =>   uni.getStorageSync(prefix + 'wx_openId'),
 
-	setOpenId : (value) => uni.setStorageSync(this.prefix + 'personInfo', value),
-	setPersonInfo : (value) => uni.setStorageSync(this.prefix + 'wx_openId', value),
+	setOpenId : (value) => uni.setStorageSync(prefix + 'wx_openId', value),
+	setPersonInfo : (value) => uni.setStorageSync(prefix + 'personInfo', value),
 	
-	getToken : () => uni.getStorageSync(this.prefix + 'token'),
-	setToken : (value) => uni.setStorageSync(this.prefix + 'token', value),
+	getToken : () =>  uni.getStorageSync(prefix + 'token'),
+	setToken : (value) => uni.setStorageSync(prefix + 'token', value),
 	
 	
 }

+ 15 - 7
utils/request.js

@@ -1,29 +1,37 @@
+import  carhelp from '@/utils/mixin.js'
 
 //记录请求次数和响应次数
 let reqCount = 0,
 	resCount = 0;
 const request = (options) => {
 	reqCount++;
-	uni.showLoading();
+	
 	return new Promise((resolve, reject) => {
+		
 		uni.request({
-			method: options.method,
+			method: options.method?options.method:'get',
 			url: process.car.BASE_URL + options.url,
-			data: options.data,
-			header: options.header
+			data: options.data?options.data:{},
+			header: options.header?{
+				...options.header,
+				'Authorization':carhelp.getToken()
+			}:{
+				'Content-Type': 'application/x-www-form-urlencoded',
+				'X-Requested-With': 'XMLHttpRequest',
+				'Authorization':carhelp.getToken()
+			}
 		}).then((response) => {
 			resCount++
 			//防止连续请求多个接口时loading闪现
-			if (reqCount === resCount) uni.hideLoading();
 			let [error, res] = response;
 			if (res.data.code != 200) {
 				reject(res.data.message)
 			} else {
-				resolve(res.data.data);
+				resolve(res.data);
 			}
 		}).catch(error => {
 			resCount++
-			if (reqCount === resCount) uni.hideLoading();
+		
 			let [err, res] = error;
 			reject(err)
 		})

+ 37 - 36
utils/wxJsApi.js

@@ -21,7 +21,7 @@ export function getWxConfig(jsApiList) {
 		return new Promise((resolve, reject) => {
 			console.log(jsApiList);
 			API_WeiXin.getConfig().then(response => {
-				var wxconfig = response.wxConfig;
+				var wxconfig = response.data.wxConfig;
 				console.log(wxconfig.nonceStr)
 				wx.config({
 					debug: false, // 开启调试模式,
@@ -32,13 +32,13 @@ export function getWxConfig(jsApiList) {
 					jsApiList: jsApiList // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
 				});
 				wx.ready(function() {
-					resolve(response);
+					resolve(response.data);
 				})
 				wx.error(function(res) {
 					reject('微信api配置出错');
 				});
 			}).catch(error => {
-				mui.toast(error);
+				//mui.toast(error);
 				reject(error);
 			})
 		})
@@ -48,7 +48,7 @@ export function getWxConfig(jsApiList) {
 }
 
 //选择图片,多图上传和单图上传的回调处理不一样
-export function chooseImage(count) {
+export function chooseImage(count,islocalId) {
 	var count = count || 1;
 	let promise = new Promise((resolve, reject) => {
 		wx.chooseImage({
@@ -56,24 +56,34 @@ export function chooseImage(count) {
 			sizeType: ['compressed'],
 			sourceType: ['album', 'camera'],
 			success: function(res) {
+				 
 				var localIds = res.localIds;
 				console.log(localIds);
-				if (count == 1) {
-					wx.getLocalImgData({
-						localId: localIds[0],
-						success: function(res) {
-							resolve(res);
-						}
-					});
-				} else {
+				if(islocalId){
+					
 					resolve(localIds);
+				}else{
+					if (count == 1) {
+						wx.getLocalImgData({
+							localId: localIds[0],
+							success: function(res) {
+								resolve(res);
+							}
+						});
+					} else {
+						resolve(localIds);
+					}
 				}
+				
 			}
 		});
 	});
 	return promise;
 }
 
+
+
+
 //获取图片,用于多图上传时的递归处理
 export function getLocalImgData(localId, fun) {
 	wx.getLocalImgData({
@@ -97,7 +107,7 @@ export function uploadPic(imgBase64) {
 		API_Common.uploadBase64(formData).then(response => {
 			resolve(response);
 		}).catch(error => {
-			mui.toast(error);
+			//mui.toast(error);
 			reject(error);
 		})
 	});
@@ -118,19 +128,26 @@ export function getLocation() {
 				},
 				fail: function(res) {
 					if (res.errMsg == 'getLocation:timeout') {
-						mui.alert("定位超时,请检查是否开启'定位'");
+						
+						res="定位超时,请检查是否开启'定位'"
 					} else if (res.errMsg == 'getLocation:ERROR_NETWORK') {
-						mui.alert("网络异常");
+						//mui.alert("网络异常");
+						res="定位超时,请检查是否开启'定位'"
 					} else if (res.errMsg == 'getLocation:ERROR_NOCELL&WIFI_LOCATIONSWITCHOFF') {
-						mui.alert("没开启系统定位");
+						res="没开启系统定位"
+						//mui.alert("没开启系统定位");
 					} else if (res.errMsg == 'getLocation:system permission denied') {
-						mui.alert("未给微信位置授权");
+						res="未给微信位置授权"
+						//mui.alert("未给微信位置授权");
 					} else if (res.errMsg == 'getLocation:location permission') {
-						mui.alert("未给微信位置授权");
+						res="未给微信位置授权"
+						//mui.alert("未给微信位置授权");
 					} else if (res.errMsg == 'getLocation:auth denied') {
-						mui.alert("用户在小程序中未授权");
+						res="用户在小程序中未授权"
+						//mui.alert("用户在小程序中未授权");
 					} else if (res.errMsg == 'getLocation:fail authorize no response') {
-						mui.alert("用户在小程序中未授权");
+						res="用户在小程序中未授权"
+						//mui.alert("用户在小程序中未授权");
 					}
 					reject(res);
 				},
@@ -157,22 +174,6 @@ export function scanQRCode(needResult) {
 			},
 			fail: function(res) {
 
-
-				if (res.errMsg == 'getLocation:timeout') {
-					mui.alert("定位超时,请检查是否开启'定位'");
-				} else if (res.errMsg == 'getLocation:ERROR_NETWORK') {
-					mui.alert("网络异常");
-				} else if (res.errMsg == 'getLocation:ERROR_NOCELL&WIFI_LOCATIONSWITCHOFF') {
-					mui.alert("没开启系统定位");
-				} else if (res.errMsg == 'getLocation:system permission denied') {
-					mui.alert("未给微信位置授权");
-				} else if (res.errMsg == 'getLocation:location permission') {
-					mui.alert("未给微信位置授权");
-				} else if (res.errMsg == 'getLocation:auth denied') {
-					mui.alert("用户在小程序中未授权");
-				} else if (res.errMsg == 'getLocation:fail authorize no response') {
-					mui.alert("用户在小程序中未授权");
-				}
 				reject(res);
 			},
 			complete() {}

+ 1 - 1
vue.config.js

@@ -39,7 +39,7 @@ module.exports = {
 
 		config.plugins.delete('preload-index');
 		config.plugins.delete('prefetch-index');
-
+		
 		config.optimization.minimize(true);
 	},
 	configureWebpack: config => {