فهرست منبع

去掉开关前边的房间名称
加湿器和空调可以调节多个湿度温度

hanchong 1 سال پیش
والد
کامیت
a828330653

+ 10 - 1
app.json

@@ -3,7 +3,8 @@
 	  "pages/scan/scan",
 	  "pages/index/index",
 	  "pages/data/data",
-	  "pages/testSAS/testSAS"
+	  "pages/testSAS/testSAS",
+	  "pages/sleepEvaluation/sleepEvaluation"
 	
   ],
   "window": {
@@ -60,6 +61,14 @@
 		"selectedColor": "#00dede",
 		"iconPath": "static/tabs/question_gay.png",
 		"selectedIconPath": "static/tabs/question_green.png"
+      },
+      {
+        "pagePath": "pages/sleepEvaluation/sleepEvaluation",
+        "text": "入住评价",
+		"color": "#959595",
+		"selectedColor": "#00dede",
+		"iconPath": "static/tabs/question_gay.png",
+		"selectedIconPath": "static/tabs/question_green.png"
       }
     ]
   },

+ 166 - 26
pages/index/index.js

@@ -590,6 +590,7 @@ Page({
 	isClickedOnHumidifierDown: false,
 	isClickedOnClimateAuto: false,
 	isClickedOnClimateUp: false,
+	isClickedToggleAromlight: false,//香薰机灯光
 	intervalId1: null,  
 	intervalId2: null,
 	
@@ -892,6 +893,53 @@ onSelect_All(e) {
 	});
 	
   },
+//香薰机灯光控制
+onSelect_All_aromlight(e) {	
+	var that = this;
+	this.setData({
+	  isClickedToggleAromlight: true  
+	});
+	// 获取绑定的参数
+	var param0 = e.currentTarget.dataset.param0;
+	var param1 = e.currentTarget.dataset.param1;
+	var param2 = e.currentTarget.dataset.param2;
+	// var param3 = e.currentTarget.dataset.param3;
+	// var param4 = e.currentTarget.dataset.param4;
+	var param5 = e.currentTarget.dataset.param5;
+	console.log('param1='+param1);
+	console.log('param2='+param2);
+	// console.log('param3='+param3);
+	// console.log('param4='+param4);
+	console.log('param5='+param5);
+    // this.setData({
+    //   status_beep: Number(param4)
+    // })
+	// if(param3 == "/turn_on"){
+	// 	that.data.listSwitch[param0].state = "off";
+	// 	that.data.listSwitch[param0].service = "turn_off";
+	// }else if(param3 == "/turn_off"){
+	// 	that.data.listSwitch[param0].state = "on";
+	// 	that.data.listSwitch[param0].service = "turn_on";
+	// }
+	 console.log('switch 发生 change 事件,携带值为', e.detail.value)
+	wx.request({
+	  url: `${homeApi_https}`+param1+param2+'/turn_on', 
+	  method: 'POST',
+	  data: {
+	      "entity_id":param5
+	    },
+	   header: {
+		  'content-type': 'application/json', // 默认值
+	      'Authorization': 'Bearer ' + token // 在头部设置认证信息,例如使用Bearer Token
+	    },
+	  success(res) {
+		// if(res.data){
+		// 	that.getSwitch(res.data,that)
+		// }
+	  },
+	});
+	
+  },
   onSelect_Cover(e) {
   	var that = this;
   	// 获取绑定的参数
@@ -1407,7 +1455,7 @@ onSelect_beep1(e) {
 	  			  }
 	  			  obj.state = (resData[i].state=='unknown'?"未知":resData[i].state);
 	  			  if(resData[i].attributes && resData[i].attributes.friendly_name){
-	  				obj.friendly_name = resData[i].attributes.friendly_name; //设备名称
+	  				obj.friendly_name = that.truncateString(resData[i].attributes.friendly_name); //设备名称
 	  			  }
 	  			  if(resData[i].attributes && resData[i].attributes.home_room){
 	  				obj.home_room = resData[i].attributes.home_room.split(' ')[1]; //房间号
@@ -1421,6 +1469,8 @@ onSelect_beep1(e) {
 	  				  }else if(resData[i].state=='off'){
 	  					  obj.service = 'turn_off';
 	  				  }
+					  //是否 是香薰机灯光
+					  obj.isAromlight = obj.friendly_name.includes('香薰机灯光')
 	  				  if(obj.entity_id && obj.state && obj.friendly_name && obj.domain){
 	  					  listSwitchTemp.push(obj)
 	  				  }
@@ -1489,7 +1539,27 @@ onSelect_beep1(e) {
 	      }
 	  this.getService("/services","/"+domain,"/set_value","POST",data);
     },  
-	
+	changeHumidity(e){
+			let list = this.data.listHumidifier;//这里是将需要循环的数组赋值给list
+			let indexS = Number(e.currentTarget.dataset.index);
+			let domain = e.currentTarget.dataset.domain;
+			let entity_id = e.currentTarget.dataset.id;
+			  // 将本地缓存数据渲染到对应修改的案例
+			list.forEach(function (value,index, array){
+			  
+			  if (index == indexS) {
+			     array[index].humidity = e.detail.value;
+			    }
+			})
+			this.setData({
+			  listHumidifier: list
+			})
+			let data = {
+			      "entity_id":entity_id,
+			  	  "humidity":e.detail.value
+			      }
+			  this.getService("/services","/"+domain,"/set_humidity","POST",data); 
+	  },
     onHumidifierDown(e) {
 	  var that = this;
 	  this.setData({
@@ -1585,7 +1655,68 @@ onSelect_beep1(e) {
 	    this.getService("/services","/"+domain,"/turn_off","POST",data);
 	  },
 	  
-	  
+	  changeClimate(e) {
+	  		  var that = this;
+	  		  this.setData({
+	  		    isClickedOnClimateUp: true  
+	  		  });
+	  		  console.log('that.data.climateMode=='+that.data.climateMode);
+	  		  if(!that.data.climateMode){
+	  		  	wx.showToast({
+	  		  	  title: '请先选择模式',  
+	  		  	  icon: 'none'  
+	  		  	});  
+	  		  	return;
+	  		  }
+	  	      let currentValue = e.currentTarget.dataset.temperature;  
+	  		  let fanMode = e.currentTarget.dataset.fanMode;  
+	  	       
+	  		  let min = e.currentTarget.dataset.min;
+	  		  let max = e.currentTarget.dataset.max;
+	  	  	  let domain = e.currentTarget.dataset.domain;
+	  	  	  let entity_id = e.currentTarget.dataset.id;
+	  	  	  let data = {};
+	  	  	  if(that.data.climateMode=='heat' ||that.data.climateMode=='cool'){
+	  	  	  	let newValue = parseInt(currentValue) + 1; // 假设文本框中的是数字 
+	  	  	  	 if(newValue>max) newValue = max;
+	  			 let list = this.data.listClimate;//这里是将需要循环的数组赋值给list
+	  			  let indexS = Number(e.currentTarget.dataset.index);
+	  			   // 将本地缓存数据渲染到对应修改的案例
+	  			  list.forEach(function (value,index, array){
+	  				if (index == indexS) {
+	  				   array[index].temperature = e.detail.value;
+	  				  }
+	  			  })
+	  			  this.setData({
+	  				listClimate: list
+	  			  })
+	  	  	  	data = {
+	  	  	  	  "entity_id":entity_id,
+	  	  	  		"temperature":e.detail.value,
+	  				"hvac_mode":that.data.climateMode
+	  	  	  	}
+	  	  	  	this.getService("/services","/"+domain,"/set_temperature","POST",data);
+	  	  	  }else if(that.data.climateMode=='dry'){
+	  	  	  	let newValue = parseInt(currentValue) + 1; // 假设文本框中的是数字 
+	  	  	  	 if(newValue>max) newValue = max;
+	  	  	  	data = {
+	  	  	  	  "entity_id":entity_id,
+	  	  	  		"temperature":e.detail.value,
+	  				"hvac_mode":that.data.climateMode
+	  	  	  	}
+	  	  	  	this.getService("/services","/"+domain,"/set_temperature","POST",data);
+	  	  	  }else if(that.data.climateMode=='fan_only'){
+	  		   let newValue = parseInt(currentValue) + 1; // 假设文本框中的是数字
+	  		   if(newValue>max) newValue = max;
+	  	  	  	data = {
+	  	  	  	  "entity_id":entity_id,
+	  	  	  	  // "fan_mode":(fanMode=='Fan Speed Up')?'Fan Speed Down':'Fan Speed Up',
+	  	  	  		"temperature":e.detail.value,
+	  				"hvac_mode":that.data.climateMode
+	  	  	  	}
+	  	  	  	this.getService("/services","/"+domain,"/set_temperature","POST",data);
+	  	  	  }
+	  	    },
 	  onClimateDown(e) {
 		  var that = this;
 		if(!that.data.climateMode){
@@ -2382,7 +2513,9 @@ onSelect_beep1(e) {
 									  obj.service = 'turn_off';
 								  }
 								  //截取字符串,防止开关设备名称过长
-								  obj.friendly_name = that.truncateString(resData[i].attributes.friendly_name); 
+								  obj.friendly_name = that.truncateString(resData[i].attributes.friendly_name,roomcode); 
+								  //是否 是香薰机灯光
+								  obj.isAromlight = obj.friendly_name.includes('香薰机灯光')
 								  if(obj.entity_id && obj.state && obj.friendly_name && obj.domain){
 									  listSwitchTemp.push(obj)
 								  }
@@ -2392,7 +2525,7 @@ onSelect_beep1(e) {
 							  ){
 								  obj.current_position = resData[i].attributes.current_position;
 								  obj.target_position = resData[i].attributes.target_position;
-								  obj.friendly_name = that.truncateString(resData[i].attributes.friendly_name); 
+								  obj.friendly_name = that.truncateString(resData[i].attributes.friendly_name,roomcode); 
 								  if(obj.entity_id && obj.state && obj.friendly_name && obj.domain){
 									  listCoverTemp.push(obj)
 								  }
@@ -2405,7 +2538,7 @@ onSelect_beep1(e) {
 								//   obj.min = resData[i].attributes.min;
 								//   obj.max = resData[i].attributes.max;
 								//   obj.step = resData[i].attributes.step;
-								//   obj.friendly_name = that.truncateString(resData[i].attributes.friendly_name); 
+								//   obj.friendly_name = that.truncateString(resData[i].attributes.friendly_name,roomcode); 
 								//   if(resData[i].state!='unknown'){
 								// 	  obj.unit_of_measurement = resData[i].attributes.unit_of_measurement;
 								//   }
@@ -2426,7 +2559,7 @@ onSelect_beep1(e) {
 								// (resData[i].state && obj.domain && obj.domain=='button' && resData[i].attributes && resData[i].attributes.parent_entity_id && entityIdList && entityIdList.includes(resData[i].attributes.parent_entity_id)
 								//  )
 							 //  ){
-								//   obj.friendly_name = that.truncateString(resData[i].attributes.friendly_name); 
+								//   obj.friendly_name = that.truncateString(resData[i].attributes.friendly_name,roomcode); 
 								//   if(obj.entity_id && obj.state && obj.friendly_name && obj.domain){
 								// 	listButtonTemp.push(obj);
 								//   }
@@ -2435,7 +2568,7 @@ onSelect_beep1(e) {
 								// (resData[i].state && obj.domain && obj.domain=='select' && resData[i].attributes && resData[i].attributes.parent_entity_id && entityIdList && entityIdList.includes(resData[i].attributes.parent_entity_id)
 								//  )
 							 //  ){
-								//   obj.friendly_name = that.truncateString(resData[i].attributes.friendly_name); 
+								//   obj.friendly_name = that.truncateString(resData[i].attributes.friendly_name,roomcode); 
 								//   obj.options = resData[i].attributes.options;
 								//   obj.selectedIndex = 0;
 								//   if(obj.entity_id && obj.state && obj.friendly_name && obj.domain){
@@ -2516,7 +2649,7 @@ onSelect_beep1(e) {
 							  if((resData[i].state && obj.domain && obj.domain=='media_player') && that.checkFuzzyMatch(resData[i])
 							  ){
 								  
-								  obj.friendly_name = resData[i].attributes.friendly_name;
+								  obj.friendly_name = that.truncateString(resData[i].attributes.friendly_name,roomcode);
 								  if(obj.entity_id.includes('teevee') || (obj.entity_id.includes('media_player') && obj.entity_id.includes('tv_dlna_') && obj.friendly_name && obj.friendly_name.includes('电视'))){
 									  obj.volume_level = resData[i].attributes.volume_level;
 									  obj.is_volume_muted = resData[i].attributes.is_volume_muted;
@@ -2558,7 +2691,7 @@ onSelect_beep1(e) {
 								// (resData[i].state && obj.domain && obj.domain=='sensor' && resData[i].attributes && resData[i].attributes.parent_entity_id && entityIdList && entityIdList.includes(resData[i].attributes.parent_entity_id)
 								//  )
 							 //  ){
-								//   obj.friendly_name = that.truncateString(resData[i].attributes.friendly_name); 
+								//   obj.friendly_name = that.truncateString(resData[i].attributes.friendly_name,roomcode); 
 								//   obj.unit_of_measurement = resData[i].attributes.unit_of_measurement;
 								//   if(obj.entity_id && obj.state && obj.friendly_name && obj.domain){
 								// 	listSensorTemp.push(obj);
@@ -2569,7 +2702,7 @@ onSelect_beep1(e) {
 								// (resData[i].state && obj.domain && obj.domain=='text' && resData[i].attributes && resData[i].attributes.parent_entity_id && entityIdList && entityIdList.includes(resData[i].attributes.parent_entity_id)
 								//  )
 							 //  ){
-								//   obj.friendly_name = that.truncateString(resData[i].attributes.friendly_name);
+								//   obj.friendly_name = that.truncateString(resData[i].attributes.friendly_name,roomcode);
 								//   obj.min = resData[i].attributes.min;
 								//   obj.max = resData[i].attributes.max;
 								//   if(obj.entity_id && obj.state && obj.friendly_name && obj.domain){
@@ -2634,6 +2767,9 @@ onSelect_beep1(e) {
 						  listCover:listCoverTemp,
 					  })
 					  // console.log('listMiotMediaPlayerTemp='+JSON.stringify(listMiotMediaPlayerTemp));
+						// console.log('listHumidityTemp='+JSON.stringify(listHumidityTemp));
+						// console.log('listClimateTemp='+JSON.stringify(listClimateTemp));
+						console.log('listSwitchTemp='+JSON.stringify(listSwitchTemp));
 						},
 						});
 				
@@ -2806,7 +2942,7 @@ onSelect_beep1(e) {
 						  }
 						  obj.state = (resData[i].state=='unknown'?"未知":resData[i].state);
 						  if(resData[i].attributes && resData[i].attributes.friendly_name){
-							obj.friendly_name = resData[i].attributes.friendly_name; //设备名称
+							obj.friendly_name = that.truncateString(resData[i].attributes.friendly_name,roomcode); //设备名称
 							
 							if(obj.friendly_name.includes("灯")){
 								obj.imgSrc = '/static/images/led.png';
@@ -2833,7 +2969,9 @@ onSelect_beep1(e) {
 								  obj.service = 'turn_off';
 							  }
 							  //截取字符串,防止开关设备名称过长
-							  obj.friendly_name = that.truncateString(resData[i].attributes.friendly_name); 
+							  obj.friendly_name = that.truncateString(resData[i].attributes.friendly_name,roomcode); 
+							  //是否 是香薰机灯光
+							  obj.isAromlight = obj.friendly_name.includes('香薰机灯光')
 							  if(obj.entity_id && obj.state && obj.friendly_name && obj.domain){
 								  listSwitchTemp.push(obj)
 							  }
@@ -2843,7 +2981,7 @@ onSelect_beep1(e) {
 						  ){
 							  obj.current_position = resData[i].attributes.current_position;
 							  obj.target_position = resData[i].attributes.target_position;
-							  obj.friendly_name = that.truncateString(resData[i].attributes.friendly_name); 
+							  obj.friendly_name = that.truncateString(resData[i].attributes.friendly_name,roomcode); 
 							  if(obj.entity_id && obj.state && obj.friendly_name && obj.domain){
 								  listCoverTemp.push(obj)
 							  }
@@ -2856,7 +2994,7 @@ onSelect_beep1(e) {
 							//   obj.min = resData[i].attributes.min;
 							//   obj.max = resData[i].attributes.max;
 							//   obj.step = resData[i].attributes.step;
-							//   obj.friendly_name = that.truncateString(resData[i].attributes.friendly_name); 
+							//   obj.friendly_name = that.truncateString(resData[i].attributes.friendly_name,roomcode); 
 							//   if(resData[i].state!='unknown'){
 							// 	  obj.unit_of_measurement = resData[i].attributes.unit_of_measurement;
 							//   }
@@ -2877,7 +3015,7 @@ onSelect_beep1(e) {
 							// (resData[i].state && obj.domain && obj.domain=='button' && resData[i].attributes && resData[i].attributes.parent_entity_id && entityIdList && entityIdList.includes(resData[i].attributes.parent_entity_id)
 							//  )
 						 //  ){
-							//   obj.friendly_name = that.truncateString(resData[i].attributes.friendly_name); 
+							//   obj.friendly_name = that.truncateString(resData[i].attributes.friendly_name,roomcode); 
 							//   if(obj.entity_id && obj.state && obj.friendly_name && obj.domain){
 							// 	listButtonTemp.push(obj);
 							//   }
@@ -2886,7 +3024,7 @@ onSelect_beep1(e) {
 							// (resData[i].state && obj.domain && obj.domain=='select' && resData[i].attributes && resData[i].attributes.parent_entity_id && entityIdList && entityIdList.includes(resData[i].attributes.parent_entity_id)
 							//  )
 						 //  ){
-							//   obj.friendly_name = that.truncateString(resData[i].attributes.friendly_name); 
+							//   obj.friendly_name = that.truncateString(resData[i].attributes.friendly_name,roomcode); 
 							//   obj.options = resData[i].attributes.options;
 							//   obj.selectedIndex = 0;
 							//   if(obj.entity_id && obj.state && obj.friendly_name && obj.domain){
@@ -2966,7 +3104,7 @@ onSelect_beep1(e) {
 						  
 						  if((resData[i].state && obj.domain && obj.domain=='media_player') && that.checkFuzzyMatch(resData[i])
 						  ){ 
-							  obj.friendly_name = resData[i].attributes.friendly_name;
+							  obj.friendly_name = that.truncateString(resData[i].attributes.friendly_name,roomcode);
 							  if(obj.entity_id.includes('teevee') || (obj.friendly_name && obj.friendly_name.includes('电视'))){
 								  obj.volume_level = resData[i].attributes.volume_level;
 								  obj.is_volume_muted = resData[i].attributes.is_volume_muted;
@@ -3008,7 +3146,7 @@ onSelect_beep1(e) {
 							// (resData[i].state && obj.domain && obj.domain=='sensor' && resData[i].attributes && resData[i].attributes.parent_entity_id && entityIdList && entityIdList.includes(resData[i].attributes.parent_entity_id)
 							//  )
 						 //  ){
-							//   obj.friendly_name = that.truncateString(resData[i].attributes.friendly_name); 
+							//   obj.friendly_name = that.truncateString(resData[i].attributes.friendly_name,roomcode); 
 							//   obj.unit_of_measurement = resData[i].attributes.unit_of_measurement;
 							//   if(obj.entity_id && obj.state && obj.friendly_name && obj.domain){
 							// 	listSensorTemp.push(obj);
@@ -3019,7 +3157,7 @@ onSelect_beep1(e) {
 							// (resData[i].state && obj.domain && obj.domain=='text' && resData[i].attributes && resData[i].attributes.parent_entity_id && entityIdList && entityIdList.includes(resData[i].attributes.parent_entity_id)
 							//  )
 						 //  ){
-							//   obj.friendly_name = that.truncateString(resData[i].attributes.friendly_name);
+							//   obj.friendly_name = that.truncateString(resData[i].attributes.friendly_name,roomcode);
 							//   obj.min = resData[i].attributes.min;
 							//   obj.max = resData[i].attributes.max;
 							//   if(obj.entity_id && obj.state && obj.friendly_name && obj.domain){
@@ -3163,6 +3301,7 @@ onSelect_beep1(e) {
 				  isClickedOnHumidifierDown: false,
 				  isClickedOnClimateAuto: false,
 				  isClickedOnClimateUp: false,
+				  isClickedToggleAromlight: false,//香薰机灯光
 	            });
 	    }, 300);
   },
@@ -3186,14 +3325,15 @@ onSelect_beep1(e) {
 	 stopTouchMove: function(e) {
 	     return false;
 	   },
-	   truncateString: function(str) {
-		if(!str) return ';'
-	     if (str.length <= 6) {  
+	   truncateString: function(str,roomcode) {
+		if(!str) return ''
+		let strR = str.replace(roomcode, '')
+	     if (strR.length <= 6) {  
 	       // 如果字符串长度小于等于5,直接返回原字符串  
-	       return str;  
+	       return strR;  
 	     } else{  
-	       // 如果字符串长度在6到9之间,返回后个字符(此时没有前部分可拼接)  
-	       return '..'+str.slice(-6);  
+	       // 如果字符串长度在6到9之间,返回后6个字符(此时没有前部分可拼接)  
+	       return strR.slice(-6);  
 	     }  
 	   },
 onLoad(option){

+ 24 - 12
pages/index/index.wxml

@@ -95,9 +95,13 @@
 			<view class="data-card__title1">
 			{{item.friendly_name}}
 			</view>
-			<view class="data-card__value">
+			<view class="data-card__value" wx:if="{{item.isAromlight}}">
+				<image class="control-button_media_2 play {{isClickedToggleAromlight ? 'clicked' : ''}}" src="/static/images/start.png" bindtap="onSelect_All_aromlight" data-param0='{{index}}' data-param1='/services'  data-param2='/{{item.domain}}'
+				data-param3='/turn_on'  data-param4='{{item.state=="on"?"0":"1"}}'  data-param5='{{item.entity_id}}'/> 
+			</view>
+			<view class="data-card__value" wx:else>
 				<switch checked="{{item.state=='on'}}" bindchange="onSelect_All"  data-param0='{{index}}' data-param1='/services'  data-param2='/{{item.domain}}'
-                 data-param3='{{item.state=="on"?"/turn_off":"/turn_on"}}'  data-param4='{{item.state=="on"?"0":"1"}}'  data-param5='{{item.entity_id}}'/>
+			     data-param3='{{item.state=="on"?"/turn_off":"/turn_on"}}'  data-param4='{{item.state=="on"?"0":"1"}}'  data-param5='{{item.entity_id}}'/>
 			</view>
 		  </view>
 		</view>
@@ -137,7 +141,7 @@
 	  </view>
 
 	  <view class="data-container data-card">
-		  <view class="data-card">
+		  <!-- <view class="data-card">
 			<image class="data-card__icon" src="/static/images/hum.png"/>
 			<view class="data-card__text">
 			  <view class="data-card__title">
@@ -147,7 +151,7 @@
 			  {{item.humidity}}%
 			  </view>
 			</view>
-		  </view>
+		  </view> -->
 		  <view class="data-card">
 		  			<image class="data-card__icon"src="/static/images/hum.png"/>
 		  			<view class="data-card__text">
@@ -164,14 +168,17 @@
 		  			<image class="data-card__icon"src="/static/images/hum.png"/>
 		  			<view class="data-card__text">
 		  			  <view class="data-card__title">
-		  			  湿度+
-		  			  </view>
-		  			  <view class="data-card__value">
-		  			  <button class="{{isButtonPressedHumidityUp ? 'round-gradient-button-pressed' : 'round-gradient-button'}} {{isClickedOnHumidifierUp ? 'clicked' : ''}}" bindtap="onHumidifierUp" style="width: 120rpx;height: 70rpx;" data-state='{{item.state}}' data-id="{{item.entity_id}}" data-domain='{{item.domain}}' data-min='{{item.min}}' data-max='{{item.max}}' data-humidity='{{item.humidity}}'>增加+</button>
+		  			  湿度:{{item.humidity}}%
 		  			  </view>
+		  			  <view class="data-card__value1">
+		  			  <!-- <button class="{{isButtonPressedHumidityUp ? 'round-gradient-button-pressed' : 'round-gradient-button'}} {{isClickedOnHumidifierUp ? 'clicked' : ''}}" bindtap="onHumidifierUp" style="width: 120rpx;height: 70rpx;" data-state='{{item.state}}' data-id="{{item.entity_id}}" data-domain='{{item.domain}}' data-min='{{item.min}}' data-max='{{item.max}}' data-humidity='{{item.humidity}}'>增加+</button>
+		  			  -->
+					  <slider class="tui-slider-box" bindchange="changeHumidity" step="1" min="{{item.min}}" max="{{item.max}}" data-id="{{item.entity_id}}" data-index='{{index}}' data-domain='{{item.domain}}' value="{{item.humidity}}" min="{{item.min}}" max="{{item.max}}"  data-humidity='{{item.humidity}}'>
+					  </slider>	
+					  </view>
 		  			</view>
 		  </view>
-		  <view class="data-card">
+		  <!-- <view class="data-card">
 		  			<image class="data-card__icon"src="/static/images/hum.png"/>
 		  			<view class="data-card__text">
 		  			  <view class="data-card__title">
@@ -181,7 +188,7 @@
 		  			  <button class="{{isButtonPressedHumidityDown ? 'round-gradient-button-pressed' : 'round-gradient-button'}} {{isClickedOnHumidifierDown ? 'clicked' : ''}}" bindtap="onHumidifierDown" style="width: 120rpx;height: 60rpx;" data-state='{{item.state}}' data-id="{{item.entity_id}}" data-domain='{{item.domain}}' data-min='{{item.min}}' data-max='{{item.max}}' data-humidity='{{item.humidity}}'>减少-</button>
 		  			  </view>
 		  			</view>
-		  </view>
+		  </view> -->
 		  <view style="margin-top: 10rpx;">
 		  </view>
 	  </view>
@@ -196,8 +203,13 @@
 	  </view>
 	  <view class="value-display">{{temperatureHumidifyName}}:{{item.temperature}}°C</view>
 	      <view class="button-row">  
-	  	  <button class="{{isButtonPressedClimateUp ? 'round-gradient-button-pressed' : 'round-gradient-button'}} {{isClickedOnClimateAuto ? 'clicked' : ''}}" bindtap="onClimateUp" data-state='{{item.state}}' data-id="{{item.entity_id}}" data-domain='{{item.domain}}' data-min='{{item.min}}' data-max='{{item.max}}' data-temperature='{{item.temperature}}' data-fanMode='{{item.fan_mode}}'>增加+</button>
-	  	  <button class="{{isButtonPressedClimateDown ? 'round-gradient-button-pressed' : 'round-gradient-button'}}" bindtap="onClimateDown" data-state='{{item.state}}' data-id="{{item.entity_id}}" data-domain='{{item.domain}}' data-min='{{item.min}}' data-max='{{item.max}}' data-temperature='{{item.temperature}}' data-fanMode='{{item.fan_mode}}'>减少-</button>
+	  	  <!-- <button class="{{isButtonPressedClimateUp ? 'round-gradient-button-pressed' : 'round-gradient-button'}} {{isClickedOnClimateAuto ? 'clicked' : ''}}" bindtap="onClimateUp" data-state='{{item.state}}' data-id="{{item.entity_id}}" data-domain='{{item.domain}}' data-min='{{item.min}}' data-max='{{item.max}}' data-temperature='{{item.temperature}}' data-fanMode='{{item.fan_mode}}'>增加+</button>
+	  	  <button class="{{isButtonPressedClimateDown ? 'round-gradient-button-pressed' : 'round-gradient-button'}}" bindtap="onClimateDown" data-state='{{item.state}}' data-id="{{item.entity_id}}" data-domain='{{item.domain}}' data-min='{{item.min}}' data-max='{{item.max}}' data-temperature='{{item.temperature}}' data-fanMode='{{item.fan_mode}}'>减少-</button> -->
+		  
+		  <slider class="tui-slider-box" bindchange="changeClimate" min="{{item.min_temp}}" max="{{item.max_temp}}" step="1" value="{{item.temperature}}" data-state='{{item.state}}' data-id="{{item.entity_id}}" data-domain='{{item.domain}}' data-min='{{item.min_temp}}' data-max='{{item.max_temp}}' data-temperature='{{item.temperature}}' data-fanMode='{{item.fan_mode}}'>
+		    <text style="color:white">{{item.temperature}}°C</text>
+		  </slider>	
+		  
 	      </view> 
 	  <view class="air-conditioner-controls">
 	  		<button class="{{item.state=='auto'?'control-button_1':'control-button'}} {{isClickedOnClimateAuto ? 'clicked' : ''}}" bindtap="onClimateAuto" data-state='{{item.state}}' data-temperature='{{item.temperature}}' data-id="{{item.entity_id}}" data-domain='{{item.domain}}'>  

+ 22 - 4
pages/index/index.wxss

@@ -297,10 +297,10 @@ page {
 }
 
 .tui-slider-box{
- width: 80%; 
- height: 50rpx;
- line-height: 50rpx;
- font-size: 25rpx;
+ width: 83%; 
+ height: 30rpx;
+ line-height: 30rpx;
+ font-size: 20rpx;
  color: #666;
 }
 
@@ -542,6 +542,18 @@ page {
   margin: 0 10rpx;  
 }
 
+.control-button_media_2 {  
+  width: 80rpx;  
+  height: 80rpx;  
+  border-radius: 50%;  
+  flex-direction: column;  
+  align-items: right;  
+  justify-content: right;  
+  background-color: rgba(203, 203, 203, 0.5);  
+  box-shadow: 0 4rpx 10rpx rgba(0, 0, 0, 0.1);  
+  margin: 0 10rpx;
+}  
+
 .control-icon {  
   width: 40rpx;  
   height: 40rpx;  
@@ -713,6 +725,12 @@ page {
   color: #ffffff;
 }
 
+.data-container .data-card .data-card__value1{
+  padding-top: 49rpx;
+  font-size: 30rpx;
+  color: #ffffff;
+}
+
 .sliderList {
 -webkit-overflow-scrolling: touch  
 }

+ 130 - 0
pages/sleepEvaluation/sleepEvaluation.js

@@ -0,0 +1,130 @@
+Page({  
+  data: {  
+    gender: '',  
+    // ... 其他数据  
+    satisfactionOptions: [  
+      { value: 'verySatisfied', label: '非常满意' },  
+      { value: 'satisfied', label: '满意' },  
+      // ... 其他选项  
+    ],  
+    comfortOptions: [  
+      { value: 'veryComfortable', label: '非常舒适' },  
+      { value: 'comfortable', label: '舒适' },  
+      // ... 其他选项  
+    ],  
+    improvementOptions: [  
+      { value: 'comfort', label: '舒适度' },  
+      { value: 'functionality', label: '功能性' },  
+      // ... 其他选项  
+    ],  
+    sleepEnvironmentQuietness: '',  
+    sleepEnvironmentComfort: '',  
+    productComfort: '',  
+	improvementAreas: [], // 使用数组来存储多选答案  
+    suggestion: '', // 文本输入的建议  
+    // ... 其他数据  
+  },  
+  
+    // 处理性别选择  
+    bindGenderChange: function(e) {  
+      this.setData({  
+        gender: e.detail.value  
+      });  
+    },  
+    
+    // 处理睡眠环境安静程度的选择  
+    bindSleepEnvironmentQuietness: function(e) {  
+      this.setData({  
+        sleepEnvironmentQuietness: e.detail.value  
+      });  
+    },  
+    
+    // 处理睡眠环境舒适度(温度、湿度)的选择  
+    bindSleepEnvironmentComfort: function(e) {  
+      this.setData({  
+        sleepEnvironmentComfort: e.detail.value  
+      });  
+    },  
+    
+    // 处理睡眠产品舒适度的选择  
+    bindProductComfort: function(e) {  
+      this.setData({  
+        productComfort: e.detail.value  
+      });  
+    },  
+    
+    // 处理改进空间的多选问题  
+    bindImprovementAreas: function(e) {  
+      this.setData({  
+        improvementAreas: e.detail.value // 直接将选中项的值数组设置为data中的improvementAreas  
+      });  
+    },  
+    
+    // 处理文本输入的建议  
+    bindSuggestionInput: function(e) {  
+      this.setData({  
+        suggestion: e.detail.value  
+      });  
+    },  
+    
+    // 提交问卷的函数  
+    submitSurvey: function() {  
+      let surveyData = {  
+        gender: this.data.gender,  
+        sleepEnvironmentQuietness: this.data.sleepEnvironmentQuietness,  
+        sleepEnvironmentComfort: this.data.sleepEnvironmentComfort,  
+        productComfort: this.data.productComfort,  
+        improvementAreas: this.data.improvementAreas,  
+        suggestion: this.data.suggestion,  
+        // ... 其他需要提交的数据  
+      };  
+    
+      // 将surveyData发送到服务器  
+      console.log('提交的问卷数据:', surveyData); 
+	   
+	    //后边会提交到数据库
+	    //   wx.request({
+		//   url: `${aipushApi}/getdatefromsn`, //
+		//   method: 'POST',
+		// 	header: {
+		// 		  'content-type': 'application/json', // 默认值
+		// 		  'Authorization': 'Bearer ' + token // 在头部设置认证信息,例如使用Bearer Token
+		// 	 },
+		// 	data:{
+		// 	     "surveyData":surveyData,"token":"token_push"
+		// 	 },
+		//   success(res) {
+		// 	wx.showToast({
+		// 	  title: '问卷提交成功',  
+		// 	  icon: 'success',  
+		// 	  duration: 2000  
+		// 	}); 
+			
+		//   },
+		//   fail: function (error) {
+		// 	  console.error('error', error);  
+		// 	} ,
+		//   complete: function (e) {
+		//   }
+		// });	
+			
+    
+      wx.showToast({  
+        title: '问卷提交成功',  
+        icon: 'success',  
+        duration: 2000  
+      });  
+    
+	  // 清空表单:  
+      // this.setData({  
+      //   gender: '',  
+      //   sleepEnvironmentQuietness: '',  
+	  //   sleepEnvironmentComfort: '', 
+	  //   productComfort: '', 
+	  //   improvementAreas: '',   
+	  //   suggestion: '',   
+      //   // ... 重置其他数据  
+      // });  
+    },  
+    
+});

+ 4 - 0
pages/sleepEvaluation/sleepEvaluation.json

@@ -0,0 +1,4 @@
+{
+  "usingComponents": {
+  }
+}

+ 65 - 0
pages/sleepEvaluation/sleepEvaluation.wxml

@@ -0,0 +1,65 @@
+<view class="container">  
+  <!-- 基本信息 -->  
+  <view class='title'>服务满意度调查问卷</view>
+  <view class="section">  
+    <text>性别:</text>  
+    <radio-group bindchange="bindGenderChange">  
+      <label><radio value="male">男</radio></label>  
+      <label><radio value="female">女</radio></label>  
+    </radio-group>
+  </view>  
+  
+  <!-- 睡眠环境评价 -->  
+  <view class="section">  
+    <text>您对睡眠环境的安静程度满意吗?</text>  
+    <radio-group bindchange="bindSleepEnvironmentQuietness">  
+      <block wx:for="{{satisfactionOptions}}" wx:key="index">  
+        <label><radio value="{{item.value}}">{{item.label}}</radio></label>  
+      </block>  
+    </radio-group>  
+  </view>  
+  
+  <view class="section">  
+    <text>您对睡眠环境的温度、湿度感觉如何?</text>  
+    <radio-group bindchange="bindSleepEnvironmentComfort">  
+      <block wx:for="{{comfortOptions}}" wx:key="index">  
+        <label><radio value="{{item.value}}">{{item.label}}</radio></label>  
+      </block>  
+    </radio-group>  
+  </view>  
+  
+  <!-- 睡眠产品/服务评价 -->  
+  <view class="section">  
+    <text>如果您使用了我们的睡眠产品(如床垫、枕头等),请对其舒适度进行评价:</text>  
+    <radio-group bindchange="bindProductComfort">  
+      <block wx:for="{{comfortOptions}}" wx:key="index">  
+        <label><radio value="{{item.value}}">{{item.label}}</radio></label>  
+      </block>  
+    </radio-group>  
+  </view>  
+  
+  <!-- 多选问题示例 -->  
+  <view class="section">  
+    <text>您认为我们的睡眠产品/服务在哪些方面还有改进空间?(可多选)</text>  
+    <checkbox-group bindchange="bindImprovementAreas">  
+      <block wx:for="{{improvementOptions}}" wx:key="index">  
+        <label><checkbox value="{{item.value}}">{{item.label}}</checkbox></label>  
+      </block>  
+    </checkbox-group>  
+  </view>  
+  
+  <!-- 文本输入问题示例 -->  
+  <view class="section">  
+    <text>您有什么具体的建议或意见,希望我们未来能够改进或增加哪些服务/产品?</text>  
+    <input type="text" placeholder="请填写您的建议" bindinput="bindSuggestionInput" />  
+  </view>  
+  
+  <!-- 提交按钮 -->  
+  <button bindtap="submitSurvey">提交问卷</button>  
+  
+  <view class="section">
+    <text>感谢您的参与和支持!</text>  
+    <text>通过这份问卷,我们可以更好地了解受访者的睡眠状况及其影响因素,从而为他们提供更有效的改善建议。希望您能如实填写,以便我们为您提供更好的服务。</text> 
+  </view> 
+  
+</view>

+ 85 - 0
pages/sleepEvaluation/sleepEvaluation.wxss

@@ -0,0 +1,85 @@
+/* pages/survey/survey.wxss */  
+  
+/* 通用样式 */  
+.container {  
+  width: 100%;  
+  padding: 20px;
+  text-align: left; 
+}  
+
+.section {  
+  margin-bottom: 15px;  
+  margin-top: 25px;  
+}
+
+.title {
+  position: fixed; 
+  text-align: center;
+  font-size: 38rpx;
+  color: #000000;
+  font-weight: bold;
+  margin: auto;
+  top: 10rpx;
+}
+
+/* 标题样式 */  
+/* .title {  
+  font-size: 18px;  
+  font-weight: bold;  
+  margin-bottom: 10px;  
+} */ 
+  
+/* 输入框和选择器的样式 */  
+.input-area, .picker-area {  
+  margin-bottom: 20px;  
+}  
+  
+.input-area input, .picker-area picker {  
+  width: 100%;  
+  padding: 10px;  
+  box-sizing: border-box; /* 包括内边距和边框在总宽度内 */  
+  border: 1px solid #ccc;  
+  border-radius: 4px;  
+  font-size: 16px;  
+}  
+  
+/* 特别是针对选择器的样式(微信小程序中没有原生的<picker>标签,这里仅作为示例) */  
+/* 实际上,您可能会使用微信小程序的picker组件,并通过自定义类来样式化它周围的容器 */  
+.picker-container {  
+  position: relative;  
+}  
+  
+.picker-container picker {  
+  /* 注意:这里的picker是假设的,微信小程序中picker组件的样式需要通过其他方式控制,如自定义模态框 */  
+  /* 实际上,您可能不需要直接对picker进行样式化,而是样式化触发picker的按钮或容器 */  
+}  
+  
+/* 提交按钮的样式 */  
+.submit-btn {  
+  display: block;  
+  width: 100%;  
+  padding: 10px;  
+  background-color: #007aff;  
+  color: white;  
+  font-size: 16px;  
+  border: none;  
+  border-radius: 4px;  
+  cursor: pointer;  
+  margin-top: 20px;  
+}  
+  
+.submit-btn:hover { /* 注意:微信小程序中不支持:hover伪类,这里仅作为Web开发的参考 */  
+  background-color: #0056b3;  
+}  
+  
+/* 如果有多选问题,可能需要为checkbox或radio列表添加样式 */  
+.checkbox-group, .radio-group {  
+  margin-bottom: 20px;  
+}  
+  
+.checkbox-group label, .radio-group label {  
+  display: block;  
+  margin-bottom: 10px;  
+}  
+  
+/* 根据需要为其他元素添加样式 */