瀏覽代碼

Merge branch 'master' of http://172.16.90.201:3000/parking/parking_pda

aleyds 4 年之前
父節點
當前提交
5db9a7ddce
共有 8 個文件被更改,包括 96 次插入42 次删除
  1. 41 33
      App.vue
  2. 4 0
      README.md
  3. 1 1
      pages.json
  4. 15 1
      pages/getout/getout.vue
  5. 1 1
      pages/getout/getoutpage/getoutpage.vue
  6. 13 0
      pages/index/index.vue
  7. 13 5
      pages/login/login.vue
  8. 8 1
      pages/parking/parking.vue

+ 41 - 33
App.vue

@@ -4,46 +4,54 @@
 	export default {
 		onLaunch: function() {
 			//判断客户端类别
-			const _handlePush = function(message) {  
-						// console.log("接收到推送消息:" ,message);
-						// alert(message)
-						//{"message":{"__UUID__":"androidPushMsg222631973","appid":"__UNI__29ECCC8","content":"{\"type\":2,\"jumpTo\":\"pages/login/login\"}","payload":{"jumpTo":"pages/login/login","type":2},"title":"智慧停车PDA"}}
-						AndroidLog.info({message: message.content})
-						let content = JSON.parse(message.content)
-						AndroidLog.info({message: content.jumpTo})
-						
-			        };  
-					
-		setTimeout(()=>{
-			var pinf = plus.push.getClientInfo();
-			var cid = pinf.clientid;//客户端标识  
-			if(cid != null && cid !=  '' && cid != 'null'){
-				//注册设备
-				var deviceInfo = device.getDeviceInfo()
-				this.$u.api.deviceReg({deviceNo:deviceInfo.deviceId,pushCid: cid})
-				.then(res=>{
-						if (res.code == 200){
-							plus.nativeUI.toast('设备注册成功');
-						}else{
+			const _handlePush = function(message) {
+				// console.log("接收到推送消息:" ,message);
+				// alert(message)
+				//{"message":{"__UUID__":"androidPushMsg222631973","appid":"__UNI__29ECCC8","content":"{\"type\":2,\"jumpTo\":\"pages/login/login\"}","payload":{"jumpTo":"pages/login/login","type":2},"title":"智慧停车PDA"}}
+				AndroidLog.info({
+					message: message.content
+				})
+				let content = JSON.parse(message.content)
+				AndroidLog.info({
+					message: content.jumpTo
+				})
+
+			};
+			// 
+			setTimeout(() => {
+				var pinf = plus.push.getClientInfo();
+				var cid = pinf.clientid; //客户端标识  
+				if (cid != null && cid != '' && cid != 'null') {
+					//注册设备
+					var deviceInfo = device.getDeviceInfo()
+					this.$u.api.deviceReg({
+							deviceNo: deviceInfo.deviceId,
+							pushCid: cid
+						})
+						.then(res => {
+							if (res.code == 200) {
+								plus.nativeUI.toast('设备注册成功');
+							} else {
+								plus.nativeUI.toast('设备注册失败');
+							}
+						}).catch(err => {
 							plus.nativeUI.toast('设备注册失败');
-						}
-				}).catch(err=>{
-					plus.nativeUI.toast('设备注册失败');
-				});
-				clearTimeout()
-			}
-		}, 400);
-			
+						});
+					clearTimeout()
+				}
+			}, 400);
+			// 
+
 			//监听系统通知栏消息点击事件  
-			plus.push.addEventListener('click', _handlePush,false);  
-			
+			plus.push.addEventListener('click', _handlePush, false);
+
 			//监听接收透传消息事件
-			plus.push.addEventListener('receive', _handlePush,false);  
+			plus.push.addEventListener('receive', _handlePush, false);
 			// this.$wxApi.config();
 		},
 		onShow: function() {
 			// console.log('App Show')
-			
+
 		},
 		onHide: function() {
 			// console.log('App Hide')

+ 4 - 0
README.md

@@ -1,3 +1,7 @@
 ## 城市智慧停车PDA
+### H5调试,因为没有app方法,需要如下操作调试
+- `login.vue中` 找到到 `handleLogin()` 设置设配编号为固定值
+
+
 
 

+ 1 - 1
pages.json

@@ -36,7 +36,7 @@
 		{
 			"path": "pages/getout/getout",
 			"style": {
-				// "navigationStyle":"custom",// 隐藏系统导航栏
+				"navigationStyle":"custom",// 隐藏系统导航栏
 				"navigationBarTitleText": "车辆出场"
 			}
 		},

+ 15 - 1
pages/getout/getout.vue

@@ -1,5 +1,6 @@
 <template>
 	<view>
+		<u-navbar title="车辆出场" title-color="#fff" :custom-back="customBack" :border-bottom="false" back-icon-color="#CCE8FF" :background="{background: '#008CFF' }"></u-navbar>
 		<u-empty class="u-m-t-80" text="暂无停车" mode="data" v-if="roadspaceList.length == 0"></u-empty>
 		<view class="roadspace-list wrap">
 			<view class="roadspace-list-item" :class="{used:item.placeStatus==1}" @click="roadspaceClick(item)" v-for="item in roadspaceList" :key="item.id">
@@ -58,6 +59,12 @@
 					url: path
 				})
 			},
+			customBack(){
+				this.$u.route({
+					// type:'switchTab',
+					url: 'pages/index/index'
+				});
+			},
 			handleGetRoadspace(roadNo){
 				this.$u.api.getRoadspace({roadNo:this.roadNo,placeStatus:1})
 				.then(res=>{
@@ -68,7 +75,14 @@
 					this.roadspaceList = res.data;
 					console.log('handleGetRoadspace',res)
 				}).catch(err=>{
-					this.$refs.uToast.show({
+					if(err.errMsg){
+						this.$refs.uToast.show({
+							title: '请检查网络',
+							type: 'error',
+						});
+						return false;
+					};
+					err.msg&&this.$refs.uToast.show({
 						title: err.msg,
 						type: 'error',
 					});

+ 1 - 1
pages/getout/getoutpage/getoutpage.vue

@@ -26,7 +26,7 @@
 		<view class="bottom-btn-wrap" v-if="payStatus==0">
 			<view class="bottom-btn-box u-flex">
 				<view class="bottom-btn bg-blue" @click="handleOut">出场</view>
-				<view class="bottom-btn bg-gray">取消</view>
+				<view class="bottom-btn bg-gray" @click="openPage('pages/getout/getout')">取消</view>
 			</view>
 		</view>
 		

+ 13 - 0
pages/index/index.vue

@@ -105,6 +105,7 @@
 				console.log('this.userInfo',this.userInfo);
 			}else{
 				this.userInfo = [];
+				this.openPage('pages/login/login');
 			};
 			
 		},
@@ -150,6 +151,11 @@
 				this.$u.vuex('vuex_hasLogin', false);
 				this.userInfo = [];
 				this.theRoad = [];
+				this.$refs.uToast.show({
+					title: '退出成功,即将跳转登录页!',
+					type: 'success',
+					url:'pages/login/login'
+				});
 				// this.$u.route(-1);
 			},
 			handleGetIndex(roadNo){
@@ -162,6 +168,13 @@
 					this.spaceInfo = res.data.spaceInfo;
 					console.log('this.spaceInfo',this.spaceInfo)
 				}).catch(err=>{
+					if(err.errMsg){
+						this.$refs.uToast.show({
+							title: '请检查网络',
+							type: 'error',
+						});
+						return false;
+					};
 					this.$refs.uToast.show({
 						title: err.msg,
 						type: 'error',

+ 13 - 5
pages/login/login.vue

@@ -3,8 +3,8 @@
 		<view class="wrap">
 			<view class="title">城市智慧停车场管理<br>PDA登录</view>
 			<u-form class="login-form" :model="form" ref="uForm">
-				<u-form-item label="账号:" :border-bottom="false" label-width="100rpx">
-					<u-input v-model="form.name" placeholder="请输入您的工号" maxlength="11" placeholder-style="color:rgba(255,255,255,.5)" />
+				<u-form-item class="u-p-r-40" label="账号:" :border-bottom="false" label-width="100rpx">
+					<u-input v-model="form.name" placeholder="请输入您的工号" type="number" maxlength="11" placeholder-style="color:rgba(255,255,255,.5)" />
 				</u-form-item>
 				<u-form-item class="u-p-r-40" label="密码:" :border-bottom="false" label-width="100rpx">
 					<u-input class="password" v-model="form.password" type="password" placeholder="请输入您的密码" placeholder-style="color:rgba(255,255,255,.5)" />
@@ -69,7 +69,8 @@
 			// 	}
 			// },
 			handleLogin(){
-				this.form.deviceNo = device.getDeviceInfo().deviceId;
+				// this.form.deviceNo = '1122334455';
+				this.form.deviceNo = device?.getDeviceInfo()?.deviceId;
 				this.$u.api.login(this.form)
 				.then(res=>{
 					this.$refs.uToast.show({
@@ -92,8 +93,15 @@
 					this.$u.route('pages/index/index', {});
 					console.log('login',res)
 				}).catch(err=>{
-					this.$refs.uToast.show({
-						title: err.msg??'登录出错',
+					if(err.errMsg){
+						this.$refs.uToast.show({
+							title: '请检查网络',
+							type: 'error',
+						});
+						return false;
+					};
+					err.msg&&this.$refs.uToast.show({
+						title: err.msg,
 						type: 'error',
 					});
 					console.log('login ',err)

+ 8 - 1
pages/parking/parking.vue

@@ -2,7 +2,7 @@
 	<view>
 		<u-empty class="u-m-t-80" text="暂无车位" mode="data" v-if="roadspaceList.length == 0"></u-empty>
 		<view class="roadspace-list wrap">
-			<view class="roadspace-list-item" @click="roadspaceClick(item)" v-for="item in roadspaceList">
+			<view class="roadspace-list-item" @click="roadspaceClick(item)" v-for="item in roadspaceList" key="item.id">
 				<view class="block">
 					
 				</view>
@@ -55,6 +55,13 @@
 					this.roadspaceList = res.data;
 					console.log('handleGetRoadspace',res)
 				}).catch(err=>{
+					if(err.errMsg){
+						this.$refs.uToast.show({
+							title: '请检查网络',
+							type: 'error',
+						});
+						return false;
+					};
 					this.$refs.uToast.show({
 						title: err.msg,
 						type: 'error',