浇花器
This commit is contained in:
		
							parent
							
								
									3a672a3795
								
							
						
					
					
						commit
						0c19bc56db
					
				|  | @ -280,6 +280,9 @@ | |||
| 
 | ||||
| 			// 点击开关是否开启 | ||||
| 			async btnchange(key, index, values) { | ||||
| 				uni.showLoading({ | ||||
| 					title: '操作中...' | ||||
| 				}) | ||||
| 				try { | ||||
| 					this.showLoading() | ||||
| 					// this.kgflag = true | ||||
|  | @ -310,10 +313,11 @@ | |||
| 						customData: "11get" | ||||
| 					}) | ||||
| 					 | ||||
| 					// setTimeout(() => { | ||||
| 					setTimeout(() => { | ||||
| 						// this.kgflag = false | ||||
| 						uni.hideLoading() | ||||
| 						this.hideLoading() | ||||
| 					// }, 2000) | ||||
| 					}, 1000) | ||||
| 				} catch (error) { | ||||
| 					console.error('btnchange error:', error) | ||||
| 					this.retryOperation() | ||||
|  | @ -425,7 +429,15 @@ | |||
| 					 | ||||
| 					this.showLoading(); | ||||
| 					this.timeflag = false; | ||||
| 					let cucun = '11pset' + ',' + this.shi + ',' + this.fen + ',' + this.miao + ',' + this.tian; | ||||
| 					if(this.tian > 99){ | ||||
| 						uni.showToast({ | ||||
| 							title: '间隔最大时间为99天', | ||||
| 							icon: 'none', | ||||
| 							duration:2000 | ||||
| 						}) | ||||
| 					} | ||||
| 					let tian = this.tian > 99 ? 99 : this.tian | ||||
| 					let cucun = '11pset' + ',' + this.shi + ',' + this.fen + ',' + this.miao + ',' + tian + '@' | ||||
| 					this.lastOperation = () => { | ||||
| 						xBlufi.notifySendCustomData({ | ||||
| 							customData: cucun | ||||
|  |  | |||
|  | @ -1303,40 +1303,43 @@ | |||
| 		         } | ||||
| 		     }, | ||||
|             // 处理抽水泵接收数据 | ||||
| 			getcsbshuju(){ | ||||
| 				const input = this.datalist | ||||
| 				const inputString = this.datalist; | ||||
| 				const hasAtSymbol = inputString.includes('@'); | ||||
| 				let processedString; | ||||
| 				let currentDay = 0; | ||||
| 				if (hasAtSymbol) { | ||||
| 				    const [ver, restOfString] = inputString.split('@'); | ||||
| 				    this.ver = ver || ''; | ||||
| 				    processedString = restOfString || ''; | ||||
| 				    // 解析当前天数 | ||||
| 				    const showMatch = processedString.match(/show:([^;]+)/); | ||||
| 				    if (showMatch) { | ||||
| 				        const showValues = showMatch[1].split(','); | ||||
| 				        currentDay = parseInt(showValues[showValues.length - 1]) || 0; | ||||
| 				    } | ||||
| 				} else { | ||||
| 				    processedString = inputString; | ||||
| 				    this.ver = ''; | ||||
| 				} | ||||
| 				const version = this.ver; | ||||
| 				const parts = input.replace(";", "").split(":") | ||||
| 				// 获取时间部分并分割 | ||||
| 				const timeParts = parts[1].split(",") | ||||
| 				// 解析为对象 | ||||
| 				this.csbobj = { | ||||
| 				    hour: parseInt(timeParts[0]) < 10 ? '0' + parseInt(timeParts[0]) : parseInt(timeParts[0]), // 小时 | ||||
| 				    minute: parseInt(timeParts[1])  < 10 ? '0' + parseInt(timeParts[1]) : parseInt(timeParts[1]), // 分钟 | ||||
| 				    second: parseInt(timeParts[2]), // 秒 | ||||
| 				    day: parseInt(timeParts[3]) // 天数 | ||||
| 				} | ||||
| 				this.devicetime = parseInt(timeParts[4]) + ':' + parseInt(timeParts[5]) | ||||
| 				this.ver_data = this.csbobj | ||||
|                 // console.log(this.csbobj); | ||||
| 			getcsbshuju() { | ||||
| 			    // 1. 获取原始数据 | ||||
| 			    const inputString = this.datalist; | ||||
| 			     | ||||
| 			    // 2. 先处理分号(替换为逗号) | ||||
| 			    const normalizedString = inputString.replace(/;/g, ','); | ||||
| 			     | ||||
| 			    // 3. 分割版本信息和数据部分 | ||||
| 			    const parts = normalizedString.split(':'); | ||||
| 			    console.log('分割结果:', parts); // 应该输出 ["ver3@p_set0", "11,5,603,99,19,9,0,"] | ||||
| 			     | ||||
| 			    // 4. 处理数据部分(移除末尾可能的多余逗号) | ||||
| 			    let dataPart = parts[1]; | ||||
| 			    if (dataPart.endsWith(',')) { | ||||
| 			        dataPart = dataPart.slice(0, -1); | ||||
| 			    } | ||||
| 			     | ||||
| 			    // 5. 重新组合为期望的格式 | ||||
| 			    const result = [parts[0], dataPart]; | ||||
| 			    console.log('最终结果:', result); // ["ver3@p_set0", "11,5,603,99,19,9,0"] | ||||
| 			     | ||||
| 			    // 6. 继续您原来的处理逻辑 | ||||
| 			    const timeParts = dataPart.split(','); | ||||
| 			     | ||||
| 			    this.csbobj = { | ||||
| 			        hour: String(timeParts[0]).padStart(2, '0'), | ||||
| 			        minute: String(timeParts[1]).padStart(2, '0'), | ||||
| 			        second: timeParts[2], | ||||
| 			        day: timeParts[3] | ||||
| 			    }; | ||||
| 			     | ||||
| 			    const hours = parseInt(timeParts[4]) || 0; | ||||
| 			    const minutes = parseInt(timeParts[5]) || 0; | ||||
| 			    this.devicetime = `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}`; | ||||
| 			     | ||||
| 			    this.ver_data = {...this.csbobj}; | ||||
| 			    console.log('设备时间:', this.devicetime); | ||||
| 			}, | ||||
| 			// 处理从设备接收数据 | ||||
| 			getchuli() { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user