程志平 3 лет назад
Родитель
Сommit
82548c0449
2 измененных файлов с 13 добавлено и 4 удалено
  1. 5 0
      pagesAir/addAir/addAir.vue
  2. 8 4
      pagesAir/shareAir/shareAir.vue

+ 5 - 0
pagesAir/addAir/addAir.vue

@@ -304,6 +304,8 @@
 											children: []
 											children: []
 										})
 										})
 									}
 									}
+									// 房间排序
+									room.sort((a, b) => a.label.localeCompare(b.label));
 									let floor = {
 									let floor = {
 										id: floors[k].id,
 										id: floors[k].id,
 										label: floors[k].floor,
 										label: floors[k].floor,
@@ -312,6 +314,7 @@
 									}
 									}
 									tmpFloors.push(floor)
 									tmpFloors.push(floor)
 								}
 								}
+								// 楼层排序
 								tmpFloors.sort((a, b) => a.label.localeCompare(b.label))
 								tmpFloors.sort((a, b) => a.label.localeCompare(b.label))
 								tmpBuilds.id = builds[j].id
 								tmpBuilds.id = builds[j].id
 								tmpBuilds.label = builds[j].building
 								tmpBuilds.label = builds[j].building
@@ -320,6 +323,7 @@
 								tmpBuilds.children = tmpFloors
 								tmpBuilds.children = tmpFloors
 								nData.push(tmpBuilds)
 								nData.push(tmpBuilds)
 							}
 							}
+							// 栋排序
 							nData.sort((a, b) => a.label.localeCompare(b.label))
 							nData.sort((a, b) => a.label.localeCompare(b.label))
 							tmpSchool.push({
 							tmpSchool.push({
 								id: school[i].id,
 								id: school[i].id,
@@ -328,6 +332,7 @@
 								children: nData
 								children: nData
 							})
 							})
 						}
 						}
+						// 校区排序
 						tmpSchool.sort((a, b) => b.label.localeCompare(a.label))
 						tmpSchool.sort((a, b) => b.label.localeCompare(a.label))
 						this.treeData = tmpSchool
 						this.treeData = tmpSchool
 						// console.log(JSON.stringify(this.treeData));
 						// console.log(JSON.stringify(this.treeData));

+ 8 - 4
pagesAir/shareAir/shareAir.vue

@@ -56,7 +56,7 @@
 			<scroll-view scroll-y="true" :style="{height: screenHeight}" @scrolltoupper="scroll_to_upper"
 			<scroll-view scroll-y="true" :style="{height: screenHeight}" @scrolltoupper="scroll_to_upper"
 				@scrolltolower="scroll_to_lower">
 				@scrolltolower="scroll_to_lower">
 				<view class="list-items" v-for="(item, index) in airs" :key="index">
 				<view class="list-items" v-for="(item, index) in airs" :key="index">
-					<view v-if="item.on" class="item-air" @longpress="itemLongPress($event, 1, item.air_ip)">
+					<view v-if="item.on === true" class="item-air" @longpress="itemLongPress($event, 1, item.air_ip)">
 						<view class="item-left">
 						<view class="item-left">
 							<view class="item-icon">
 							<view class="item-icon">
 								<view class="circle1"></view>
 								<view class="circle1"></view>
@@ -295,10 +295,10 @@
 					}
 					}
 				})
 				})
 
 
-				console.log(res.data, tmpAirs[index].air_ip);
+				// console.log(res.data, tmpAirs[index].air_ip);
 				if (res.data.code == 200) {
 				if (res.data.code == 200) {
 					let data = res.data;
 					let data = res.data;
-					if (data.is_on === '1') {
+					if (data.is_on == 1) {
 						if (typeof data.order_num === 'undefined') {
 						if (typeof data.order_num === 'undefined') {
 							// 提示返回信息
 							// 提示返回信息
 							uni.showToast({
 							uni.showToast({
@@ -310,6 +310,10 @@
 						tmpAirs[index].on = true
 						tmpAirs[index].on = true
 						tmpAirs[index].time = data.start_time
 						tmpAirs[index].time = data.start_time
 						tmpAirs[index].order_num = data.order_num
 						tmpAirs[index].order_num = data.order_num
+					} else {
+						tmpAirs[index].on = false
+						tmpAirs[index].time = ''
+						tmpAirs[index].order_num = ''
 					}
 					}
 					// 更新自己绑定的空调列表
 					// 更新自己绑定的空调列表
 					this.airs.push(tmpAirs[index])
 					this.airs.push(tmpAirs[index])
@@ -675,7 +679,7 @@
 
 
 				// console.log(res.data);
 				// console.log(res.data);
 				if (res.data.code == 200) {
 				if (res.data.code == 200) {
-					if (res.data.is_on === '0') {
+					if (res.data.is_on == 0) {
 						// 显示已经关闭图标
 						// 显示已经关闭图标
 						this.airs[index].on = false
 						this.airs[index].on = false
 						uni.showToast({
 						uni.showToast({