Sfoglia il codice sorgente

界面跳转优化,地锁控制优化

aleyds 3 anni fa
parent
commit
8b9bc96db3

+ 3 - 1
common/apiurl.js

@@ -63,7 +63,9 @@ const apiurl = {
 	
 	version: '/payee/appversion/update',
 	
-	lockControl: '/payee/hardware/lock/control'
+	lockControl: '/payee/hardware/lock/control',
+	
+	lockList: '/payee/roadinfo/lockList/'
 }
 
 export {

+ 4 - 1
common/http.api.js

@@ -54,6 +54,8 @@ const install = (Vue, vm) => {
 	
 	let lockControl = (params = {}) => vm.$u.post(apiurl.lockControl, params);
 	
+	let lockList = (params = {}) => vm.$u.get(apiurl.lockList + params.roadNo);
+	
 	// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
 	vm.$u.api = {
 		login,
@@ -81,7 +83,8 @@ const install = (Vue, vm) => {
 		vehicleList,
 		payQuery,
 		appveriosn,
-		lockControl
+		lockControl,
+		lockList
 	};
 }
 

+ 10 - 9
pages/modifypwd/modifypwd.vue

@@ -40,9 +40,12 @@
 		},
 		methods:{
 			customBack(){
-				this.$u.route({
-					// type:'switchTab',
-					url: 'pages/setting/setting'
+				// this.$u.route({
+				// 	// type:'switchTab',
+				// 	url: 'pages/setting/setting'
+				// });
+				uni.navigateBack({
+				    delta: 1
 				});
 			},
 			submit(){
@@ -53,18 +56,16 @@
 				};
 				this.$u.api.modifyPwd(param)
 				.then(res=>{
-					this.$refs.uToast.show({
-						title: res.msg,
-						type: 'success',
-						url:'pages/index/index'
+					plus.nativeUI.toast('密码修改成功');
+					uni.reLaunch({
+					    url: '/pages/login/login'
 					});
-					console.log('modifyPwd',res)
 				}).catch(err=>{
 					this.$refs.uToast.show({
 						title: err.msg,
 						type: 'error',
 					});
-					console.log('modifyPwd ',err)
+
 				});
 			}
 			

+ 8 - 15
pages/roadlist/roadlist.vue

@@ -29,36 +29,29 @@
 		},
 		onLoad(){
 			this.Roads = this.$store.state.vuex_user?.roadList;
-			console.log('Roads',JSON.parse(JSON.stringify(this.Roads)));
 		},
 		onShow(){
 			
 		},
 		methods:{
 			customBack(){
-				this.$u.route({
-					// type:'switchTab',
-					url: 'pages/index/index'
+				uni.navigateBack({
+				    delta: 1
 				});
 			},
 			handleModifyRoad(id){
 				this.$u.api.modifyRoad({roadId:id})
 				.then(res=>{
-					this.$refs.uToast.show({
-						title: res.msg,
-						type: 'success',
-						url: 'pages/index/index'
-					});
 					let userdata = this.$store.state.vuex_user;
 					userdata.roadList = res.data?.roadList;
-					this.$u.vuex('vuex_user', res.data);
+					this.$u.vuex('vuex_user', userdata);
 					uni.setStorageSync('payee_roadinfo', JSON.stringify(userdata.roadList?.[0] || []));
-				}).catch(err=>{
-					this.$refs.uToast.show({
-						title: err.msg,
-						type: 'error',
+					plus.nativeUI.toast('切换路段成功');
+					uni.reLaunch({
+					    url: '/pages/index/index'
 					});
-					console.log('modifyRoad ',err)
+				}).catch(err=>{
+					plus.nativeUI.toast('失败' + err.msg);
 				});
 			}
 			

+ 49 - 20
pages/setting/setting.vue

@@ -28,13 +28,14 @@
 		<u-popup v-model="show" mode="center" length="auto" >
 			<view>
 			<u-form :model="lockForm" ref="uForm">
-					<u-form-item label="设备编码" label-width="150"><u-input v-model="lockForm.deviceNo" /></u-form-item>
-					<u-form-item label="是否开锁" label-width="150"><u-input v-model="lockForm.cmdLabel" type="select" @click="lockForm.cmdFlag = true"/></u-form-item>
+					<u-form-item label="车位" label-width="150"><u-input v-model="lockListForm.spaceName" type="select" @click="lockListForm.show = true"/></u-form-item>
+					<u-form-item label="命令" label-width="150"><u-input v-model="lockForm.cmdLabel" type="select" @click="lockForm.cmdFlag = true"/></u-form-item>
 			</u-form>
 			</view>
-			<u-button @click="submit" type="primary">提交</u-button>
+			<u-button @click="submit" type="primary">执行</u-button>
 		</u-popup>
 		<u-select v-model="lockForm.cmdFlag" :list="list" @confirm="getCmdValue"></u-select>
+		<u-select v-model="lockListForm.show" :list="lockList" @confirm="onLockSelect"></u-select>
 		<u-toast ref="uToast" />
 	</view>
 </template>
@@ -53,6 +54,12 @@
 					cmdLabel: '',
 					cmdFlag: false
 				},
+				lockListForm:{
+					show: false,
+					deviceNo:'',
+					spaceName:''
+				},
+				lockList:[],
 				list:[{
 						value: 'up',
 						label: '升板'
@@ -71,10 +78,37 @@
 		},
 		methods:{
 			lockControl(){
-				this.show=true;
+				let that = this;
+				let roadInfo = this.$store.state.vuex_user?.roadList?.[0]||[];
+				that.lockList = [];
+				this.$u.api.lockList({roadNo:roadInfo.roadNo})
+				.then(res => {
+					if(res.code == 200){
+						let list = res.data?.lockList;
+						if(list == null || list.length <=0){
+							plus.nativeUI.toast('没有可操作的车位锁' );
+						}else {
+							list.forEach(item => {
+								let pushItem = {
+									value: item.deviceNo,
+									label: item.spaceName
+								}
+								that.lockList.push(pushItem);
+							})
+							this.show=true;
+						}
+					}
+				})
+				.catch(err =>{
+					
+				})
 			},
 			submit(){
-				this.$u.api.lockControl({deviceNo:this.lockForm.deviceNo, cmd:this.lockForm.cmd})
+				let reqParams = {
+					deviceNo: this.lockListForm.deviceNo,
+					cmd: this.lockForm.cmd
+				}
+				this.$u.api.lockControl(reqParams)
 				.then( res =>{
 					if(res.code == 200){
 						this.$refs.uToast.show({
@@ -90,10 +124,9 @@
 					})
 			},
 			customBack(){
-				this.$u.route({
-					// type:'switchTab',
-					url: 'pages/index/index'
-				});
+				uni.navigateBack({
+				    delta: 1
+				})
 			},
 			openPage(path) {
 				// console.log('path',path);
@@ -117,6 +150,10 @@
 				this.lockForm.cmd = val[0].value
 				this.lockForm.cmdLabel = val[0].label
 			},
+			onLockSelect(val){
+				this.lockListForm.deviceNo = val[0].value;
+				this.lockListForm.spaceName = val[0].label;
+			},
 			onLoginOut(){
 				uni.showModal({
 				  title: '温馨提示',  
@@ -132,18 +169,10 @@
 								  this.userInfo = [];
 								  this.theRoad = [];
 								  uni.setStorageSync('pushreg_switch', '1');
-								  this.$refs.uToast.show({
-								  	title: '退出成功,即将跳转登录页!',
-								  	type: 'success',
-								  	url:'pages/login/login'
+								  plus.nativeUI.toast('切换路段成功');
+								  uni.reLaunch({
+								      url: '/pages/login/login'
 								  });
-									// uni.showToast({
-									// 	title: '退出成功',
-									// 	duration: 2000
-									// });
-									// uni.redirectTo({
-									// 	url:'../login/login'
-									// });
 							  }).catch(err=>{
 								  uni.showToast({
 								  	title: '退出失败',