aleyds 3 rokov pred
rodič
commit
6a1c768b22

+ 1 - 0
pages/login/login.vue

@@ -88,6 +88,7 @@
 					this.$u.vuex('vuex_token', res.data.accessToken);
 					this.$u.vuex('vuex_user', res.data);
 					this.$u.vuex('vuex_hasLogin', true);
+					uni.setStorageSync('payee_roadinfo', JSON.stringify(res.data?.roadList?.[0] || []));
 					if(this.form.passCheck){
 						uni.setStorage({
 							key:'loginData',

+ 4 - 2
pages/roadlist/roadlist.vue

@@ -42,7 +42,6 @@
 				});
 			},
 			handleModifyRoad(id){
-				console.log('id',id);
 				this.$u.api.modifyRoad({roadId:id})
 				.then(res=>{
 					this.$refs.uToast.show({
@@ -50,7 +49,10 @@
 						type: 'success',
 						url: 'pages/index/index'
 					});
-					console.log('modifyRoad',res)
+					let userdata = this.$store.state.vuex_user;
+					userdata.roadList = res.data?.roadList;
+					this.$u.vuex('vuex_user', res.data);
+					uni.setStorageSync('payee_roadinfo', JSON.stringify(userdata.roadList?.[0] || []));
 				}).catch(err=>{
 					this.$refs.uToast.show({
 						title: err.msg,

+ 1 - 0
pages/setting/setting.vue

@@ -131,6 +131,7 @@
 								  this.$u.vuex('vuex_hasLogin', false);
 								  this.userInfo = [];
 								  this.theRoad = [];
+								  uni.setStorageSync('pushreg_switch', '1');
 								  this.$refs.uToast.show({
 								  	title: '退出成功,即将跳转登录页!',
 								  	type: 'success',

+ 13 - 4
utils/pushUtils.js

@@ -5,15 +5,24 @@ let speaker = uni.requireNativePlugin("SpeechPlug");
 const _handlePush = function(message) {
 				//{"message":{"__UUID__":"androidPushMsg222631973","appid":"__UNI__29ECCC8","content":"{\"type\":2,\"jumpTo\":\"pages/login/login\"}","payload":{"jumpTo":"pages/login/login","type":2},"title":"智慧停车PDA"}}
 				try {
+					alog.info({msg: '接收到消息:' + message});
 					const value = uni.getStorageSync('pushreg_switch');
 					if (value) {
 					    return;
 					}
+					const roadinfoCache = uni.getStorageSync('payee_roadinfo');
+					alog.info({msg: '本地路段信息:' + roadinfoCache});
+					if (!roadinfoCache){
+						return;
+					}
 					let content = JSON.parse(message.content);
-					if (content.type === 1){
-						deviceParkIn(content)
-					}else if (content.type === 2){
-						deviceParkOut(content)
+					const roadinfo = JSON.parse(roadinfoCache) ;
+					if(content.roadNo && roadinfo.roadNo && content.roadNo == roadinfo.roadNo){
+						if (content.type === 1){
+							deviceParkIn(content)
+						}else if (content.type === 2){
+							deviceParkOut(content)
+						}
 					}
 				} catch(e){