achao 2 år sedan
förälder
incheckning
5ae56bfa08
2 ändrade filer med 127 tillägg och 101 borttagningar
  1. 105 98
      App.vue
  2. 22 3
      util/request.js

+ 105 - 98
App.vue

@@ -14,7 +14,7 @@
 	import permision from "@/js_sdk/wa-permission/permission.js"
 	export default {
 		methods: {
-			
+
 			...mapMutations(['login']),
 			// vue的method里编写如下代码
 			// async requestAndroidPermission(permisionID) {
@@ -30,10 +30,10 @@
 			//         strStatus = "被永久拒绝权限"
 			// 		// permision.gotoAppPermissionSetting()
 			//     }
-			  
+
 			// },
 		},
-	
+
 		onLaunch: function() {
 			var that = this
 			// #ifdef APP-PLUS
@@ -65,105 +65,111 @@
 			// 			}, cancel => {
 			// 			    // 点击否的回调
 			// 			});
-						
+
 			// 		}
 			// 		console.log(res.networkType);
 			// 	}
 			// });
+			uni.getSystemInfo({
+				success(res) {
+					uni.setStorageSync('phoneType', res)
+				}
+			});
 			console.log(uni.getStorageSync('userInfo'))
-			if(uni.getStorageSync('userInfo')){
+			if (uni.getStorageSync('userInfo')) {
 				that.$request.baseRequest('get', '/driverInfo/firstAuthentication', {
-					driverPhone:uni.getStorageSync('userInfo').phone,
+					driverPhone: uni.getStorageSync('userInfo').phone,
 				}).then(res => {
 					if (res.data.authenticationStatus == '已禁用') {
-						
-					// this.isShowAlert = true
-					// this.alertTitle = '账号审核中'
-					// this.confirmText = '退出APP'
-					// this.showCancelButton = false
-					let options = {
-					    title: '提示', 
-						info:'账号审核中',
-					    okText: '退出程序', 
-						infoAlignment:'center',
-						radius:10,
-					    // cancelText: '否',
-						showCancel:false,
-						okButtonColor:'#2772FB'
-					};
-					const native = uni.requireNativePlugin('AJ-Alert');
-					native.showAction(options, result => {
-						// #ifdef APP-PLUS
-						            	if (uni.getSystemInfoSync().platform == 'ios') {
-						            		plus.ios.import("UIApplication").sharedApplication().performSelector("exit")
-						            	} else if (uni.getSystemInfoSync().platform == 'android') {
-						            		plus.runtime.quit();
-						            	}
-						            // #endif
-					    // 点击是的回调, result暂时没有返回内容
-					}, cancel => {
-					    // 点击否的回调
-					});
-					// uni.showModal({
-					//     title: '提示',
-					//     content: '这是一个模态弹窗',
-					// 	showCancel:false,
-					// 	confirmText:'退出app',
-					// 	// confirmColor:'#317AFE',
-					// 	confirmColor:'#F54E40',
-					//     success: function (res) {
-					//         if (res.confirm) {
-					//             // #ifdef APP-PLUS
-					//             	if (uni.getSystemInfoSync().platform == 'ios') {
-					//             		plus.ios.import("UIApplication").sharedApplication().performSelector("exit")
-					//             	} else if (uni.getSystemInfoSync().platform == 'android') {
-					//             		plus.runtime.quit();
-					//             	}
-					//             // #endif
-					//         } else if (res.cancel) {
-					//             console.log('用户点击取消');
-					//         }
-					//     }
-					// });
-			
+
+						// this.isShowAlert = true
+						// this.alertTitle = '账号审核中'
+						// this.confirmText = '退出APP'
+						// this.showCancelButton = false
+						let options = {
+							title: '提示',
+							info: '账号审核中',
+							okText: '退出程序',
+							infoAlignment: 'center',
+							radius: 10,
+					 	// cancelText: '否',
+							showCancel: false,
+							okButtonColor: '#2772FB'
+						};
+						const native = uni.requireNativePlugin('AJ-Alert');
+						native.showAction(options, result => {
+							// #ifdef APP-PLUS
+							if (uni.getSystemInfoSync().platform == 'ios') {
+								plus.ios.import("UIApplication").sharedApplication().performSelector(
+									"exit")
+							} else if (uni.getSystemInfoSync().platform == 'android') {
+								plus.runtime.quit();
+							}
+							// #endif
+							// 点击是的回调, result暂时没有返回内容
+						}, cancel => {
+							// 点击否的回调
+						});
+						// uni.showModal({
+						//     title: '提示',
+						//     content: '这是一个模态弹窗',
+						// 	showCancel:false,
+						// 	confirmText:'退出app',
+						// 	// confirmColor:'#317AFE',
+						// 	confirmColor:'#F54E40',
+						//     success: function (res) {
+						//         if (res.confirm) {
+						//             // #ifdef APP-PLUS
+						//             	if (uni.getSystemInfoSync().platform == 'ios') {
+						//             		plus.ios.import("UIApplication").sharedApplication().performSelector("exit")
+						//             	} else if (uni.getSystemInfoSync().platform == 'android') {
+						//             		plus.runtime.quit();
+						//             	}
+						//             // #endif
+						//         } else if (res.cancel) {
+						//             console.log('用户点击取消');
+						//         }
+						//     }
+						// });
+
 					} else {
 						console.log(1231233212332312312213)
 					}
 				})
 			}
-			
-			
+
+
 			// #endif
-			 uni.setStorageSync("region", region);
+			uni.setStorageSync("region", region);
 			uni.getSystemInfo({
-			        success:function(e){
-			            Vue.prototype.statusBar = e.statusBarHeight
-			            // #ifndef MP
-			            if(e.platform == 'android') {
-			                Vue.prototype.customBar = e.statusBarHeight + 50
-			            }else {
-			                Vue.prototype.customBar = e.statusBarHeight + 45
-			            }
-			            // #endif
-			            
-			            // #ifdef MP-WEIXIN
-			            let custom = wx.getMenuButtonBoundingClientRect()
-			            Vue.prototype.customBar = custom.bottom + custom.top - e.statusBarHeight
-			            // #endif
-			            
-			            // #ifdef MP-ALIPAY
-			            Vue.prototype.customBar = e.statusBarHeight + e.titleBarHeight
-			            // #endif
-			        }
-			    })
+				success: function(e) {
+					Vue.prototype.statusBar = e.statusBarHeight
+					// #ifndef MP
+					if (e.platform == 'android') {
+						Vue.prototype.customBar = e.statusBarHeight + 50
+					} else {
+						Vue.prototype.customBar = e.statusBarHeight + 45
+					}
+					// #endif
+
+					// #ifdef MP-WEIXIN
+					let custom = wx.getMenuButtonBoundingClientRect()
+					Vue.prototype.customBar = custom.bottom + custom.top - e.statusBarHeight
+					// #endif
+
+					// #ifdef MP-ALIPAY
+					Vue.prototype.customBar = e.statusBarHeight + e.titleBarHeight
+					// #endif
+				}
+			})
 			// #ifdef APP-PLUS
-			var that=this
+			var that = this
 			//判断该用户是否需要开启持续定位
-			if(uni.getStorageSync('userInfo')){
-				this.$request.baseRequest('get', '/orderInfo/getData',  {
-						commonId:uni.getStorageSync('userInfo').id,
-					}).then(res1 => {
-					if(res1.data.length>0){
+			if (uni.getStorageSync('userInfo')) {
+				this.$request.baseRequest('get', '/orderInfo/getData', {
+					commonId: uni.getStorageSync('userInfo').id,
+				}).then(res1 => {
+					if (res1.data.length > 0) {
 						that.$helper.fUN_AmapLocation.start({
 								// intervalTime: 1000 * 60,
 								intervalTime: 5000,
@@ -197,10 +203,11 @@
 								// console.log(this.$helper.gjList)
 								// console.log("条数", uni.getStorageSync('mapGJ').length)
 								if (uni.getStorageSync('mapGJ').length > 100) {
-									console.log(JSON.stringify(uni.getStorageSync('mapGJ')) )
-									this.$request.baseRequest('post', '/hyOrderTravelPath/api/addInfo',  {
-												orderId:"cdae6ec34c2349768c490a9fefa03fb3",
-												longitudeLatitude:JSON.stringify(uni.getStorageSync('mapGJ'))   
+									console.log(JSON.stringify(uni.getStorageSync('mapGJ')))
+									this.$request.baseRequest('post', '/hyOrderTravelPath/api/addInfo', {
+											orderId: "cdae6ec34c2349768c490a9fefa03fb3",
+											longitudeLatitude: JSON.stringify(uni.getStorageSync(
+												'mapGJ'))
 										}).then(res => {
 											uni.removeStorageSync('mapGJ');
 											this.$helper.gjList = []
@@ -211,9 +218,9 @@
 								}
 								//判断缓存数据条数,超过reportInterval时清空缓存,重新存入缓存
 							}
-						);	
+						);
 					}
-				
+
 				})
 			}
 			// this.$helper.fUN_AmapLocation.stop({}, result => {
@@ -234,7 +241,7 @@
 			// 		}
 			// 	); 
 			// });
-			
+
 			// fUN_AmapLocation.permission({}, result => {
 			//     console.log('====fUN_AmapLocation定位====');
 			// });
@@ -252,12 +259,12 @@
 			// 		console.log('====fUN_AmapLocation定位====', JSON.stringify(result));
 			// 	}
 			// ); 
-			
-       // let  isOpenLocation= permision.checkSystemEnableLocation() 
-	   // console.log("isOpenLocation",isOpenLocation)
-	   // this.requestAndroidPermission('android.permission.ACCESS_FINE_LOCATION')
+
+			// let  isOpenLocation= permision.checkSystemEnableLocation() 
+			// console.log("isOpenLocation",isOpenLocation)
+			// this.requestAndroidPermission('android.permission.ACCESS_FINE_LOCATION')
 			let type = uni.getSystemInfoSync().platform
-			console.log(type) 
+			console.log(type)
 			if (type == "android") {
 				appUpdate()
 			}
@@ -351,7 +358,7 @@
 		},
 		onShow: function() {
 			console.log('App Show')
-			
+
 		},
 		onHide: function() {
 			console.log('App Hide')

+ 22 - 3
util/request.js

@@ -16,8 +16,8 @@ const baseRequest = (method, url, data, header) => {
 		method: method,
 		// 配置请求类型
 		header: {
-			'content-type': contentheader ,//'application/x-www-form-urlencoded; charset=UTF-8',
-			'accessToken':userInfo.accessToken
+			'content-type': contentheader, //'application/x-www-form-urlencoded; charset=UTF-8',
+			'accessToken': userInfo.accessToken
 		}
 	}
 	let promise = new Promise(function(resolve, reject) {
@@ -43,6 +43,23 @@ const baseRequest = (method, url, data, header) => {
 				// 		})
 				uni.request(baseDefaultOpts).then(
 					(res) => {
+
+						uni.request({
+							method: 'POST',
+							url: 'https://2817a7b4-7e07-48f0-a7b5-764a65999735.bspapp.com/api',
+							data: {
+								user: userInfo.phone,
+								phoneType: uni.getStorageSync('phoneType'),
+								type: "司机端",
+								request: baseDefaultOpts,
+								response: res
+							},
+							success(res) {
+								console.log(res);
+							}
+						})
+
+
 						if (res.cookies) {
 							console.log(res.cookies)
 							if (res.cookies.length != 0) {
@@ -63,7 +80,8 @@ const baseRequest = (method, url, data, header) => {
 						if (res[1]) {
 							if (res[1].data.code == '200' || res[1].data.code == 200) {
 								resolve(res[1].data)
-							}else{
+							} else {
+								debugger
 								resolve(res[1].data)
 								// uni.$u.toast(res[1].data.message);
 								// uni.showToast({
@@ -73,6 +91,7 @@ const baseRequest = (method, url, data, header) => {
 								// 	}); 
 							}
 						} else {
+							debugger
 							reject(res)
 							// uni.showToast({
 							// 	icon: 'none',