浇花器优化
This commit is contained in:
		
							parent
							
								
									caf9895d28
								
							
						
					
					
						commit
						99888f22c5
					
				|  | @ -4,52 +4,56 @@ | |||
| 			id="navbar"> | ||||
| 		</u-navbar> | ||||
|         <image class="bj" src="https://api.ccttiot.com/smartmeter/img/static/urqUoIyCCEBykZ2oG8eO" mode=""></image> | ||||
| 		 <view class="list">   | ||||
| 		    <view class="list_val" v-for="(values, key, index) in list" :key="key">   | ||||
| 		      <view class="lt" @click="btnitem(key,index,values)">   | ||||
| 		        <view class="one">{{ formattedTime(values[0], values[1]) }}</view>   | ||||
| 		        <view class="two">P{{ index + 1 }} <text></text> {{ formatTime(values[2]) }}</view>   | ||||
| 		      </view>   | ||||
| 		      <view class="rt">   | ||||
| 		        <u-switch v-model="values[3]" @change="btnchange(key,index,values)" active-color="#48893B" inactive-color="#BDBCBC"></u-switch>   | ||||
| 		      </view>   | ||||
| 		    </view>   | ||||
| 		  </view>   | ||||
| 		 | ||||
| 		<!-- 设置浇水时间弹窗 --> | ||||
| 		<view class="jiaoshui" v-if="timeflag"> | ||||
| 			<view class="top"> | ||||
| 				设置浇水 | ||||
| 			</view> | ||||
| 			<view class="ts"> | ||||
| 				距离下次浇水时间还有{{xctime}} | ||||
| 			</view> | ||||
| 			<view class="shifen" @click="show = true"> | ||||
| 				<text>{{hour}}时</text> <text>{{minutekq}}分</text> | ||||
| 			</view> | ||||
| 			<view class="jssc"> | ||||
| 				浇水时长 | ||||
| 			</view> | ||||
| 			<view class="shifen" @click="shows = true"> | ||||
| 				<text>{{minute}}分</text> <text>{{second}}秒</text> | ||||
| 			</view> | ||||
| 			<view class="anniu"> | ||||
| 				<view class="qx" @click="btnqx"> | ||||
| 					取消 | ||||
| 				</view> | ||||
| 				<view class="qd" @click="btnqd"> | ||||
| 					确定 | ||||
| 				</view> | ||||
| 			</view> | ||||
| 		 <view class="" v-if="list.length > 0 || list != null"> | ||||
| 		 	<view class="list"> | ||||
| 		 	    <view class="list_val" v-for="(values, key, index) in list" :key="key">   | ||||
| 		 	      <view class="lt" @click="btnitem(key,index,values)">   | ||||
| 		 	        <view class="one">{{ formattedTime(values[0], values[1]) }}</view>   | ||||
| 		 	        <view class="two">P{{ index + 1 }} <text></text> {{ formatTime(values[2]) }}</view>   | ||||
| 		 	      </view>   | ||||
| 		 	      <view class="rt">   | ||||
| 		 	        <u-switch v-model="values[3]" @change="btnchange(key,index,values)" active-color="#48893B" inactive-color="#BDBCBC"></u-switch>   | ||||
| 		 	      </view>   | ||||
| 		 	    </view>   | ||||
| 		 	  </view>   | ||||
| 		 	 | ||||
| 		 	<!-- 设置浇水时间弹窗 --> | ||||
| 		 	<view class="jiaoshui" v-if="timeflag"> | ||||
| 		 		<view class="top"> | ||||
| 		 			设置浇水 | ||||
| 		 		</view> | ||||
| 		 		<view class="ts"> | ||||
| 		 			距离下次浇水时间还有{{xctime}} | ||||
| 		 		</view> | ||||
| 		 		<view class="shifen" @click="show = true"> | ||||
| 		 			<text>{{hour}}时</text> <text>{{minutekq}}分</text> | ||||
| 		 		</view> | ||||
| 		 		<view class="jssc"> | ||||
| 		 			浇水时长 | ||||
| 		 		</view> | ||||
| 		 		<view class="shifen" @click="shows = true"> | ||||
| 		 			<text>{{minute}}分</text> <text>{{second}}秒</text> | ||||
| 		 		</view> | ||||
| 		 		<view class="anniu"> | ||||
| 		 			<view class="qx" @click="btnqx"> | ||||
| 		 				取消 | ||||
| 		 			</view> | ||||
| 		 			<view class="qd" @click="btnqd"> | ||||
| 		 				确定 | ||||
| 		 			</view> | ||||
| 		 		</view> | ||||
| 		 	</view> | ||||
| 		 	<view class="mask" v-if="timeflag"></view> | ||||
| 		 	<!-- 定时时间 --> | ||||
| 		 	<u-picker v-model="show" mode="time" :params="paramss" @confirm="confirm"></u-picker> | ||||
| 		 	<!-- 定时时长 --> | ||||
| 		 	<u-picker v-model="shows" mode="time" :params="params" @confirm="confirms"></u-picker> | ||||
| 		 	 | ||||
| 		 	<view class="mask" style="z-index: 9999;" v-if="kgflag"></view> | ||||
| 		 </view> | ||||
| 		<view class="" style="width: 100%;padding-top: 80rpx;text-align: center;color: #000;font-size: 36rpx;"> | ||||
| 			设备未连接 | ||||
| 		</view> | ||||
| 		<view class="mask" v-if="timeflag"></view> | ||||
| 		<!-- 定时时间 --> | ||||
| 		<u-picker v-model="show" mode="time" :params="paramss" @confirm="confirm"></u-picker> | ||||
| 		<!-- 定时时长 --> | ||||
| 		<u-picker v-model="shows" mode="time" :params="params" @confirm="confirms"></u-picker> | ||||
| 		 | ||||
| 		<view class="mask" style="z-index: 9999;" v-if="kgflag"></view> | ||||
| 		 | ||||
| 	</view> | ||||
| </template> | ||||
| 
 | ||||
|  | @ -65,7 +69,7 @@ | |||
| 					flag:false, | ||||
| 					checked:false, | ||||
| 					timeflag:false, | ||||
| 					 | ||||
| 
 | ||||
| 					show: false, | ||||
| 					params: { | ||||
| 						year: false, | ||||
|  |  | |||
|  | @ -83,7 +83,7 @@ | |||
| 					} | ||||
| 				}) | ||||
| 			}, | ||||
| 
 | ||||
|             // 返回首页 | ||||
| 			btnback() { | ||||
| 				uni.switchTab({ | ||||
| 					url: '/pages/index/index' | ||||
|  | @ -130,10 +130,11 @@ | |||
| 										}) | ||||
| 									} else { | ||||
| 										uni.showToast({ | ||||
| 											title: '网络波动异常,请重新识别', | ||||
| 											title: '识别失败,请重新识别', | ||||
| 											icon: 'none', | ||||
| 											duration: 1000 | ||||
| 										}) | ||||
| 										that.maskpic = '' | ||||
| 									} | ||||
| 								}) | ||||
| 							 } | ||||
|  | @ -141,13 +142,13 @@ | |||
| 					} | ||||
| 				}) | ||||
| 			}, | ||||
| 
 | ||||
|             // 处理相机错误情况 | ||||
| 			handleCameraError(e) { | ||||
| 				console.error('相机出错:', e.detail); | ||||
| 				// 处理相机错误情况   | ||||
| 			}, | ||||
| 			// 切换摄像头位置   | ||||
| 			switchCamera() { | ||||
| 				this.cameraPosition = this.cameraPosition == 'back' ? 'front' : 'back'; // 切换摄像头位置   | ||||
| 				this.cameraPosition = this.cameraPosition == 'back' ? 'front' : 'back';  | ||||
| 			}, | ||||
|             // 从相册选择图 | ||||
| 			uploadPictrue() { | ||||
|  | @ -189,7 +190,7 @@ | |||
| 										}) | ||||
| 									} else { | ||||
| 										uni.showToast({ | ||||
| 											title: '网络波动异常,请重新识别', | ||||
| 											title: '识别失败,请重新识别', | ||||
| 											icon: 'none', | ||||
| 											duration: 1000 | ||||
| 										}) | ||||
|  |  | |||
|  | @ -8,20 +8,18 @@ | |||
|         <view class="list"> | ||||
|         	<view class="list_val" v-for="(item,index) in zwlist" :key="index" @click="btnxq(item.plantId)"> | ||||
|         		<view class="lt"> | ||||
|         			<image :src="item.url" mode=""></image> | ||||
|         			<image :src="item.url" mode="aspectFill"></image> | ||||
|         		</view> | ||||
|         		<view class="rt"> | ||||
|         			<view class="name"> | ||||
|         				<text>{{item.name}}</text> <text style="color: #48893B;font-size: 32rpx;">{{Number(item.score * 100).toFixed(1) + '%'}}</text> | ||||
|         			</view> | ||||
|         			<view class="wz"> | ||||
|         				{{item.msg == null ? '暂无简介' : item.msg}} | ||||
|         				{{ item.introduce == null ? '暂无简介' : (item.introduce.length > 20 ? item.introduce.substring(0, 20) + '...' : item.introduce) }} | ||||
|         			</view> | ||||
|         		</view> | ||||
|         	</view> | ||||
|         </view> | ||||
| 
 | ||||
| 		 | ||||
| 		 | ||||
| 	</view> | ||||
| </template> | ||||
|  | @ -55,16 +53,24 @@ | |||
| 				} | ||||
| 			}, | ||||
| 			onLoad(option) { | ||||
| 				this.cartpic = JSON.parse(option.cart) | ||||
| 				this.zwlist = JSON.parse(option.list) | ||||
| 				this.cartpic = JSON.parse(option.cart) //植物图片 | ||||
| 				this.zwlist = JSON.parse(option.list) //植物信息 | ||||
| 			}, | ||||
| 			methods:{ | ||||
| 				// 点击请求植物详情跳转到详情页 | ||||
| 				btnxq(plantId){ | ||||
| 					uni.navigateTo({ | ||||
| 						url:'/page_user/photoxq?plantId=' + plantId | ||||
| 					}) | ||||
| 					if(plantId == null || plantId == ''){ | ||||
| 						uni.showToast({ | ||||
| 							title: '无该非植物信息', | ||||
| 							icon: 'none', | ||||
| 							duration: 2000 | ||||
| 						}) | ||||
| 					}else{ | ||||
| 						uni.navigateTo({ | ||||
| 							url:'/page_user/photoxq?plantId=' + plantId | ||||
| 						}) | ||||
| 					} | ||||
| 				} | ||||
| 				 | ||||
| 			} | ||||
| 		} | ||||
| </script> | ||||
|  | @ -101,6 +107,7 @@ | |||
| 					width: 140rpx; | ||||
| 					height: 140rpx; | ||||
| 					margin-right: 18rpx; | ||||
| 					border-radius: 10rpx; | ||||
| 				} | ||||
| 			} | ||||
| 			.rt{ | ||||
|  |  | |||
|  | @ -31,7 +31,7 @@ | |||
| 					</view> | ||||
| 				</view> | ||||
| 				<view class="cont_right"> | ||||
| 					<image :src="item.picture" mode=""></image> | ||||
| 					<image :src="list.picture" mode="aspectFill"></image> | ||||
| 				</view> | ||||
| 			</view> | ||||
| 		</view> | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ | |||
| 		<view class="img"> | ||||
| 			<image class="img" src="https://api.ccttiot.com/smartmeter/img/static/uVKucPVDjxjaCDCpFKvw" mode=""></image> | ||||
| 		</view> | ||||
| 		<view class="name" @click="nameflag = true"> | ||||
| 		<view class="name" @click="btnxianshi"> | ||||
| 			<view class="">{{user.deviceName == undefined ? '--' : user.deviceName}}</view> | ||||
| 			<image src="https://api.ccttiot.com/smartmeter/img/static/uL6FHnMGWFrdptmDokDI" mode=""></image> | ||||
| 		</view> | ||||
|  | @ -18,20 +18,17 @@ | |||
| 		</view> | ||||
| 		<view class="wifi"> | ||||
| 			<view class="">WIFI</view> | ||||
| 			<view class="flex">ChangteA-5G <image | ||||
| 					src="https://api.ccttiot.com/smartmeter/img/static/uiTIUYnR3ClrmqOTyF8F" mode=""></image> | ||||
| 			<view class="flex">ChangteA-5G <image src="https://api.ccttiot.com/smartmeter/img/static/uiTIUYnR3ClrmqOTyF8F" mode=""></image> | ||||
| 			</view> | ||||
| 		</view> | ||||
| 		<view class="wifi" style="margin-top: 78rpx;" @click="xpshow = true"> | ||||
| 			<view class="">息屏</view> | ||||
| 			<view class="flex">{{xptxt}} <image src="https://api.ccttiot.com/smartmeter/img/static/uiTIUYnR3ClrmqOTyF8F" | ||||
| 					mode=""></image> | ||||
| 			<view class="flex">{{xptxt}} <image src="https://api.ccttiot.com/smartmeter/img/static/uiTIUYnR3ClrmqOTyF8F" mode=""></image> | ||||
| 			</view> | ||||
| 		</view> | ||||
| 		<view class="wifi" style="margin-top: 24rpx;" @click="gjshow = true"> | ||||
| 			<view class="">固件更新</view> | ||||
| 			<view class="flex">{{gjtxt}}<image src="https://api.ccttiot.com/smartmeter/img/static/uiTIUYnR3ClrmqOTyF8F" | ||||
| 					mode=""></image> | ||||
| 			<view class="flex">{{gjtxt}}<image src="https://api.ccttiot.com/smartmeter/img/static/uiTIUYnR3ClrmqOTyF8F" mode=""></image> | ||||
| 			</view> | ||||
| 		</view> | ||||
| 		<!-- 息屏选择器 --> | ||||
|  | @ -43,7 +40,7 @@ | |||
| 	        <view class="top"> | ||||
| 	        	修改名称 | ||||
| 	        </view>	 | ||||
| 			 <input type="text" placeholder="请输入您想要修改的名字" /> | ||||
| 			 <input type="text" v-model="namesb" placeholder="请输入您想要修改的名字" /> | ||||
| 			 <view class="anniu"> | ||||
| 			 	<view class="qx" @click="btnqx"> | ||||
| 			 		取消 | ||||
|  | @ -93,7 +90,8 @@ | |||
| 						label: 'v2.1.3' | ||||
| 					}], | ||||
| 					deviceid:'', | ||||
| 					user:{} | ||||
| 					user:{}, | ||||
| 					namesb:'' | ||||
| 			} | ||||
| 		}, | ||||
| 		// 分享到好友(会话) | ||||
|  | @ -103,7 +101,6 @@ | |||
| 				path: '/pages/index/index' | ||||
| 			} | ||||
| 		}, | ||||
| 		 | ||||
| 		// 分享到朋友圈   | ||||
| 		onShareTimeline: function() { | ||||
| 			return { | ||||
|  | @ -125,7 +122,11 @@ | |||
| 					} | ||||
| 				}) | ||||
| 			}, | ||||
| 			 | ||||
| 			// 点击显示修改名称弹框 | ||||
|             btnxianshi(){ | ||||
| 				this.nameflag = true | ||||
| 				this.namesb = this.user.deviceName | ||||
| 			}, | ||||
| 			// 选择息屏时间 | ||||
| 			xpconfirm(e){ | ||||
| 				this.xptxt = e[0].label | ||||
|  | @ -140,9 +141,24 @@ | |||
| 			}, | ||||
| 			// 点击确定修改设备名称 | ||||
| 			btnqd(){ | ||||
| 				this.nameflag = false | ||||
| 			} | ||||
| 			 | ||||
| 				this.$u.put(`/app/editDeviceName?deviceId=${this.deviceid}&deviceName=${this.namesb}`).then(res => { | ||||
| 					if(res.code == 200){ | ||||
| 						this.nameflag = false | ||||
| 						this.user.deviceName = this.namesb | ||||
| 						uni.showToast({ | ||||
| 							title: '修改成功', | ||||
| 							icon: 'success', | ||||
| 							duration:2000 | ||||
| 						}) | ||||
| 					}else{ | ||||
| 						uni.showToast({ | ||||
| 							title: res.msg, | ||||
| 							icon: 'none', | ||||
| 							duration:2000 | ||||
| 						}) | ||||
| 					} | ||||
| 				}) | ||||
| 			}, | ||||
| 		} | ||||
| 	} | ||||
| </script> | ||||
|  | @ -151,7 +167,6 @@ | |||
| 	/deep/ .u-title { | ||||
| 		margin-bottom: 22rpx; | ||||
| 	} | ||||
| 
 | ||||
| 	/deep/ .uicon-nav-back { | ||||
| 		margin-bottom: 22rpx; | ||||
| 	} | ||||
|  | @ -223,7 +238,6 @@ | |||
| 		height: 332rpx; | ||||
| 		margin: auto; | ||||
| 	} | ||||
| 
 | ||||
| 	.name { | ||||
| 		width: 100%; | ||||
| 		font-weight: 600; | ||||
|  | @ -233,14 +247,12 @@ | |||
| 		margin-top: 64rpx; | ||||
| 		justify-content: center; | ||||
| 		align-items: center; | ||||
| 
 | ||||
| 		image { | ||||
| 			width: 44rpx; | ||||
| 			height: 44rpx; | ||||
| 			margin-left: 26rpx; | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	.model { | ||||
| 		width: 100%; | ||||
| 		display: flex; | ||||
|  | @ -248,13 +260,11 @@ | |||
| 		font-size: 32rpx; | ||||
| 		color: #3D3D3D; | ||||
| 		margin-top: 48rpx; | ||||
| 
 | ||||
| 		.one { | ||||
| 			margin-left: 74rpx; | ||||
| 			margin-right: 144rpx; | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	.wifi { | ||||
| 		width: 678rpx; | ||||
| 		height: 104rpx; | ||||
|  | @ -270,11 +280,9 @@ | |||
| 		justify-content: space-between; | ||||
| 		padding: 0 42rpx; | ||||
| 		box-sizing: border-box; | ||||
| 
 | ||||
| 		.flex { | ||||
| 			display: flex; | ||||
| 			align-items: center; | ||||
| 
 | ||||
| 			image { | ||||
| 				width: 40rpx; | ||||
| 				height: 40rpx; | ||||
|  |  | |||
|  | @ -44,6 +44,7 @@ | |||
| 				this.getxq() | ||||
| 			}, | ||||
| 			methods:{ | ||||
| 				// 请求文章详情 | ||||
| 				getxq() { | ||||
| 					this.$u.get(`/app/article/${this.id}`).then((res) => { | ||||
| 						if (res.code == 200) { | ||||
|  |  | |||
|  | @ -7,14 +7,14 @@ | |||
| 		</view> | ||||
| 		<!-- 背景图 --> | ||||
| 		<!-- 没设备时展示 --> | ||||
| 		<image class="bjimg" v-if="false" src="https://api.ccttiot.com/smartmeter/img/static/uz8MR6BuZW2qRANnYgLu" | ||||
| 		<image class="bjimg" v-if="bjflag" src="https://api.ccttiot.com/smartmeter/img/static/uz8MR6BuZW2qRANnYgLu" | ||||
| 			mode=""></image> | ||||
| 		<!-- 有设备时展示 --> | ||||
| 		<image class="bjimg" v-else src="https://api.ccttiot.com/smartmeter/img/static/uXBpJuaUs0XUNb8HTahh" mode=""> | ||||
| 		</image> | ||||
| 		<view class="wusb" v-if="false"> | ||||
| 		<view class="wusb" v-if="bjflag"> | ||||
| 			<text>暂无设备,请先绑定设备</text> | ||||
| 			<view class="bang"> | ||||
| 			<view class="bang" @click="btnaddsb"> | ||||
| 				绑定 | ||||
| 			</view> | ||||
| 		</view> | ||||
|  | @ -310,7 +310,9 @@ | |||
| 				devicelist:[], | ||||
| 				shebid:'', | ||||
| 				user:{}, | ||||
| 				lastChar:'' | ||||
| 				lastChar:'', | ||||
| 				timer:'', | ||||
| 				bjflag:false | ||||
| 			} | ||||
| 		}, | ||||
| 		// 分享到好友(会话) | ||||
|  | @ -333,7 +335,9 @@ | |||
| 			 | ||||
| 		}, | ||||
| 		onShow() { | ||||
| 			// 请求个人信息 | ||||
| 			this.getinfo() | ||||
| 			// 一进来每分钟发一次上传信息命令 | ||||
| 			this.getshuju() | ||||
| 
 | ||||
| 		}, | ||||
|  | @ -342,7 +346,7 @@ | |||
| 			btnshowjs() { | ||||
| 				this.showjs = true | ||||
| 			}, | ||||
| 
 | ||||
|             // 补零函数 | ||||
| 			formattedTime(minutes, seconds) { | ||||
| 				// 将数字转换为字符串并补零   | ||||
| 				const formattedMinutes = String(minutes).padStart(2, '0'); | ||||
|  | @ -388,8 +392,10 @@ | |||
| 						    content: '未连接成功,是否重新连接,重新连接请确保设备在附近5米范围内',   | ||||
| 						    success: function (res) {   | ||||
| 						        if (res.confirm) { | ||||
| 								   uni.hideLoading() | ||||
| 								   that.getinfo() | ||||
| 						        } else if (res.cancel) {   | ||||
| 						        } else if (res.cancel) {  | ||||
| 								   uni.hideLoading() | ||||
| 						           uni.showToast({ | ||||
| 						           	title: '已取消连接', | ||||
| 						           	icon: 'none', | ||||
|  | @ -454,103 +460,203 @@ | |||
| 			}, | ||||
| 			// 雨水感应开启 | ||||
| 			btnyushui() { | ||||
| 				let that = this | ||||
| 				uni.getNetworkType({ | ||||
| 					success(res) { | ||||
| 						if (res.networkType !== 'none') { | ||||
| 							uni.getConnectedBluetoothDevices({ | ||||
| 								success(res) { | ||||
| 									setTimeout(() => { | ||||
| 										that.yschecked = false | ||||
| 										xBlufi.notifySendCustomData({ | ||||
| 											customData: '11yudi' | ||||
| 										}) | ||||
| 									}, 1500) | ||||
| 								}, | ||||
| 								fail(err) { | ||||
| 									console.error('获取已连接蓝牙设备信息失败:', err) | ||||
| 								} | ||||
| 							}) | ||||
| 						} else { | ||||
| 							console.log('手机未连接网络') | ||||
| 				if(this.datalist == ''){ | ||||
| 					let that = this | ||||
| 					uni.showModal({ | ||||
| 					    title: '提示',   | ||||
| 					    content: '设备未连接,是否进行设备连接?',   | ||||
| 					    success: function (res) {   | ||||
| 					        if (res.confirm) { | ||||
| 							   uni.hideLoading() | ||||
| 							   that.btnlj() | ||||
| 					        } else if (res.cancel) {   | ||||
| 							   uni.hideLoading() | ||||
| 					           uni.showToast({ | ||||
| 					           	title: '已取消连接', | ||||
| 					           	icon: 'none', | ||||
| 					           	duration:2000 | ||||
| 					           }) | ||||
| 					        }   | ||||
| 					    }   | ||||
| 					}) | ||||
| 				}else{ | ||||
| 					uni.showLoading({ | ||||
| 						title: '开启中...' | ||||
| 					}) | ||||
| 					let that = this | ||||
| 					uni.getNetworkType({ | ||||
| 						success(res) { | ||||
| 							if (res.networkType !== 'none') { | ||||
| 								uni.getConnectedBluetoothDevices({ | ||||
| 									success(res) { | ||||
| 										setTimeout(() => { | ||||
| 											that.yschecked = false | ||||
| 											xBlufi.notifySendCustomData({ | ||||
| 												customData: '11yudi' | ||||
| 											}) | ||||
| 											uni.hideLoading() | ||||
| 										}, 1500) | ||||
| 									}, | ||||
| 									fail(err) { | ||||
| 										console.error('获取已连接蓝牙设备信息失败:', err) | ||||
| 									} | ||||
| 								}) | ||||
| 							} else { | ||||
| 								console.log('手机未连接网络') | ||||
| 							} | ||||
| 						} | ||||
| 					} | ||||
| 				}) | ||||
| 					}) | ||||
| 				} | ||||
| 			}, | ||||
| 			// 雨水感应关闭 | ||||
| 			btnyushuis() { | ||||
| 				let that = this | ||||
| 				uni.getNetworkType({ | ||||
| 					success(res) { | ||||
| 						if (res.networkType !== 'none') { | ||||
| 							uni.getConnectedBluetoothDevices({ | ||||
| 								success(res) { | ||||
| 									setTimeout(() => { | ||||
| 										that.yschecked = true | ||||
| 										xBlufi.notifySendCustomData({ | ||||
| 											customData: '11unyudi' | ||||
| 										}) | ||||
| 									}, 1500) | ||||
| 								}, | ||||
| 								fail(err) { | ||||
| 									console.error('获取已连接蓝牙设备信息失败:', err) | ||||
| 								} | ||||
| 							}) | ||||
| 						} else { | ||||
| 							console.log('手机未连接网络') | ||||
| 				if(this.datalist == ''){ | ||||
| 					let that = this | ||||
| 					uni.showModal({ | ||||
| 					    title: '提示',   | ||||
| 					    content: '设备未连接,是否进行设备连接?',   | ||||
| 					    success: function (res) {   | ||||
| 					        if (res.confirm) { | ||||
| 							   uni.hideLoading() | ||||
| 							   that.btnlj() | ||||
| 					        } else if (res.cancel) {  | ||||
| 							   uni.hideLoading() | ||||
| 					           uni.showToast({ | ||||
| 					           	title: '已取消连接', | ||||
| 					           	icon: 'none', | ||||
| 					           	duration:2000 | ||||
| 					           }) | ||||
| 					        }   | ||||
| 					    }   | ||||
| 					}) | ||||
| 				}else{ | ||||
| 					uni.showLoading({ | ||||
| 						title: '开启中...' | ||||
| 					}) | ||||
| 					let that = this | ||||
| 					uni.getNetworkType({ | ||||
| 						success(res) { | ||||
| 							if (res.networkType !== 'none') { | ||||
| 								uni.getConnectedBluetoothDevices({ | ||||
| 									success(res) { | ||||
| 										setTimeout(() => { | ||||
| 											that.yschecked = true | ||||
| 											xBlufi.notifySendCustomData({ | ||||
| 												customData: '11unyudi' | ||||
| 											}) | ||||
| 											uni.hideLoading() | ||||
| 										}, 1500) | ||||
| 									}, | ||||
| 									fail(err) { | ||||
| 										console.error('获取已连接蓝牙设备信息失败:', err) | ||||
| 									} | ||||
| 								}) | ||||
| 							} else { | ||||
| 								console.log('手机未连接网络') | ||||
| 							} | ||||
| 						} | ||||
| 					} | ||||
| 				}) | ||||
| 					}) | ||||
| 				} | ||||
| 			}, | ||||
| 			// 点击儿童锁开启 | ||||
| 			btnertong() { | ||||
| 				let that = this | ||||
| 				uni.getNetworkType({ | ||||
| 					success(res) { | ||||
| 						if (res.networkType !== 'none') { | ||||
| 							uni.getConnectedBluetoothDevices({ | ||||
| 								success(res) { | ||||
| 									setTimeout(() => { | ||||
| 										that.etchecked = false | ||||
| 										xBlufi.notifySendCustomData({ | ||||
| 											customData: '11lock' | ||||
| 										}) | ||||
| 									}, 1500) | ||||
| 								}, | ||||
| 								fail(err) { | ||||
| 									console.error('获取已连接蓝牙设备信息失败:', err) | ||||
| 								} | ||||
| 							}) | ||||
| 						} else { | ||||
| 							console.log('手机未连接网络') | ||||
| 				if(this.datalist == ''){ | ||||
| 					let that = this | ||||
| 				 	uni.showModal({ | ||||
| 				 	    title: '提示',   | ||||
| 				 	    content: '设备未连接,是否进行设备连接?',   | ||||
| 				 	    success: function (res) {   | ||||
| 				 	        if (res.confirm) { | ||||
| 							   uni.hideLoading() | ||||
| 				 			   that.btnlj() | ||||
| 				 	        } else if (res.cancel) {   | ||||
| 							   uni.hideLoading() | ||||
| 				 	           uni.showToast({ | ||||
| 				 	           	title: '已取消连接', | ||||
| 				 	           	icon: 'none', | ||||
| 				 	           	duration:2000 | ||||
| 				 	           }) | ||||
| 				 	        }   | ||||
| 				 	    }   | ||||
| 				 	}) | ||||
| 				}else{ | ||||
| 					uni.showLoading({ | ||||
| 						title: '开启中...' | ||||
| 					}) | ||||
| 					let that = this | ||||
| 					uni.getNetworkType({ | ||||
| 						success(res) { | ||||
| 							if (res.networkType !== 'none') { | ||||
| 								uni.getConnectedBluetoothDevices({ | ||||
| 									success(res) { | ||||
| 										setTimeout(() => { | ||||
| 											that.etchecked = false | ||||
| 											xBlufi.notifySendCustomData({ | ||||
| 												customData: '11lock' | ||||
| 											}) | ||||
| 											uni.hideLoading() | ||||
| 										}, 1500) | ||||
| 									}, | ||||
| 									fail(err) { | ||||
| 										console.error('获取已连接蓝牙设备信息失败:', err) | ||||
| 									} | ||||
| 								}) | ||||
| 							} else { | ||||
| 								console.log('手机未连接网络') | ||||
| 							} | ||||
| 						} | ||||
| 					} | ||||
| 				}) | ||||
| 					}) | ||||
| 				} | ||||
| 			}, | ||||
| 			// 点击儿童锁关闭 | ||||
| 			btnertongs() { | ||||
| 				let that = this | ||||
| 				uni.getNetworkType({ | ||||
| 					success(res) { | ||||
| 						if (res.networkType !== 'none') { | ||||
| 							uni.getConnectedBluetoothDevices({ | ||||
| 								success(res) { | ||||
| 									setTimeout(() => { | ||||
| 										that.etchecked = true | ||||
| 										xBlufi.notifySendCustomData({ | ||||
| 											customData: '11unlock' | ||||
| 										}) | ||||
| 									}, 1500) | ||||
| 								}, | ||||
| 								fail(err) { | ||||
| 									console.error('获取已连接蓝牙设备信息失败:', err) | ||||
| 								} | ||||
| 							}) | ||||
| 						} else { | ||||
| 							console.log('手机未连接网络') | ||||
| 				if(this.datalist == ''){ | ||||
| 					let that = this | ||||
| 			     	uni.showModal({ | ||||
| 			     	    title: '提示',   | ||||
| 			     	    content: '设备未连接,是否进行设备连接?',   | ||||
| 			     	    success: function (res) {   | ||||
| 			     	        if (res.confirm) { | ||||
| 							   uni.hideLoading() | ||||
| 			     			   that.btnlj() | ||||
| 			     	        } else if (res.cancel) { | ||||
| 							   uni.hideLoading() | ||||
| 			     	           uni.showToast({ | ||||
| 			     	           	title: '已取消连接', | ||||
| 			     	           	icon: 'none', | ||||
| 			     	           	duration:2000 | ||||
| 			     	           }) | ||||
| 			     	        }   | ||||
| 			     	    }   | ||||
| 			     	}) | ||||
| 			    }else{ | ||||
| 					uni.showLoading({ | ||||
| 						title: '开启中...' | ||||
| 					}) | ||||
| 					let that = this | ||||
| 					uni.getNetworkType({ | ||||
| 						success(res) { | ||||
| 							if (res.networkType !== 'none') { | ||||
| 								uni.getConnectedBluetoothDevices({ | ||||
| 									success(res) { | ||||
| 										setTimeout(() => { | ||||
| 											that.etchecked = true | ||||
| 											xBlufi.notifySendCustomData({ | ||||
| 												customData: '11unlock' | ||||
| 											}) | ||||
| 											uni.hideLoading() | ||||
| 										}, 1500) | ||||
| 									}, | ||||
| 									fail(err) { | ||||
| 										console.error('获取已连接蓝牙设备信息失败:', err) | ||||
| 									} | ||||
| 								}) | ||||
| 							} else { | ||||
| 								console.log('手机未连接网络') | ||||
| 							} | ||||
| 						} | ||||
| 					} | ||||
| 				}) | ||||
| 					}) | ||||
| 				} | ||||
| 			}, | ||||
| 
 | ||||
| 			// 点击添加设备  | ||||
|  | @ -577,6 +683,7 @@ | |||
| 					url: '/page_user/dingshi?list=' + JSON.stringify(this.ver_data) | ||||
| 				}) | ||||
| 			}, | ||||
| 			 | ||||
| 
 | ||||
| 			// 点击取消手动浇水 | ||||
| 			btnqx() { | ||||
|  | @ -591,6 +698,9 @@ | |||
| 						duration: 3000 | ||||
| 					}) | ||||
| 				} else { | ||||
| 					uni.showLoading({ | ||||
| 						title: '开启中...' | ||||
| 					}) | ||||
| 					let that = this | ||||
| 					uni.getNetworkType({ | ||||
| 						success(res) { | ||||
|  | @ -601,6 +711,7 @@ | |||
| 											xBlufi.notifySendCustomData({ | ||||
| 												customData: "11time@" + that.jstime + '@' | ||||
| 											}) | ||||
| 											uni.hideLoading() | ||||
| 											that.startTimer(that.jstime) | ||||
| 											that.sdjsflag = false | ||||
| 											that.kgflag = true | ||||
|  | @ -619,58 +730,104 @@ | |||
| 			}, | ||||
| 
 | ||||
| 			// 手动浇水定时器 | ||||
| 			startTimer(totalSeconds) { | ||||
| 				let sdseconds = totalSeconds | ||||
| 				console.log(remainingSeconds, '000'); | ||||
| 				const timer = setInterval(() => { | ||||
| 					// 计算分钟和秒   | ||||
| 					const minutes = Math.floor(remainingSeconds / 60).toString() | ||||
| 					const secs = (remainingSeconds % 60).toString() | ||||
| 					// 格式化秒,确保是两位数   | ||||
| 					this.sdseconds = secs.padStart(2, '0') | ||||
| 					// 如果分钟大于0,则显示分钟;否则,不显示(只显示秒)   | ||||
| 					this.sdminutes = minutes.padStart(2, '0') | ||||
| 					// 更新剩余秒数   | ||||
| 					remainingSeconds--; | ||||
| 					// 如果剩余秒数为0,则停止定时器   | ||||
| 					if (remainingSeconds <= 0) { | ||||
| 						clearInterval(timer) | ||||
| 						this.btnkq() | ||||
| 						this.sdminutes = '' | ||||
| 						this.sdseconds = '' | ||||
| 					} | ||||
| 				}, 1000) | ||||
| 			startTimer(totalSeconds) {   | ||||
| 			    let remainingSeconds = totalSeconds; // 正确初始化 remainingSeconds   | ||||
| 			    const sdminutes = ''; // 如果您打算在组件中使用这些变量,最好在这里声明它们   | ||||
| 			    const sdseconds = '';   | ||||
| 			    this.timer = setInterval(() => {   | ||||
| 			        // 计算分钟和秒   | ||||
| 			        const minutes = Math.floor(remainingSeconds / 60).toString();   | ||||
| 			        const secs = (remainingSeconds % 60).toString();   | ||||
| 			        // 格式化秒和分钟,确保是两位数   | ||||
| 			        this.sdseconds = secs.padStart(2, '0');   | ||||
| 			        this.sdminutes = (minutes > 0 ? minutes : '').padStart(2, '0'); // 如果分钟为0,则不显示分钟   | ||||
| 			        // 更新剩余秒数   | ||||
| 			        remainingSeconds--;   | ||||
| 			        // 如果剩余秒数为0,则停止定时器   | ||||
| 			        if (remainingSeconds <= 0) {   | ||||
| 			            clearInterval(this.timer);   | ||||
| 			            this.btnkq(); // 确保这个函数是存在的,并且您想要在这里调用它   | ||||
| 			            this.sdminutes = ''; // 清除分钟显示(可选,根据您的需求)   | ||||
| 			            this.sdseconds = ''; // 清除秒显示(可选,根据您的需求)   | ||||
| 			        }   | ||||
| 			    }, 1000);   | ||||
| 			}, | ||||
| 
 | ||||
| 			 | ||||
| 			// 关闭手动浇水 | ||||
| 			btnkq() { | ||||
| 				let that = this | ||||
| 				uni.getNetworkType({ | ||||
| 					success(res) { | ||||
| 						if (res.networkType !== 'none') { | ||||
| 							uni.getConnectedBluetoothDevices({ | ||||
| 								success(res) { | ||||
| 									setTimeout(() => { | ||||
| 										xBlufi.notifySendCustomData({ | ||||
| 											customData: "11close" | ||||
| 										}) | ||||
| 										that.startTimer(0) | ||||
| 										that.sdminutes = '' | ||||
| 										that.sdseconds = '' | ||||
| 										that.kgflag = false | ||||
| 									}, 1500) | ||||
| 								}, | ||||
| 								fail(err) { | ||||
| 									console.error('获取已连接蓝牙设备信息失败:', err) | ||||
| 								} | ||||
| 							}) | ||||
| 				if(this.datalist == ''){ | ||||
| 					let that = this | ||||
| 					uni.showModal({ | ||||
| 					    title: '提示',   | ||||
| 					    content: '设备未连接,是否进行设备连接?',   | ||||
| 					    success: function (res) {   | ||||
| 					        if (res.confirm) { | ||||
| 							   uni.hideLoading() | ||||
| 							   that.btnlj() | ||||
| 					        } else if (res.cancel) {   | ||||
| 							   uni.hideLoading() | ||||
| 					           uni.showToast({ | ||||
| 					           	title: '已取消连接', | ||||
| 					           	icon: 'none', | ||||
| 					           	duration:2000 | ||||
| 					           }) | ||||
| 					        }   | ||||
| 					    }   | ||||
| 					}) | ||||
| 				}else{ | ||||
| 					uni.showLoading({ | ||||
| 						title: '关闭中...' | ||||
| 					}) | ||||
| 					let that = this | ||||
| 					uni.getNetworkType({ | ||||
| 						success(res) { | ||||
| 							if (res.networkType !== 'none') { | ||||
| 								uni.getConnectedBluetoothDevices({ | ||||
| 									success(res) { | ||||
| 										setTimeout(() => { | ||||
| 											xBlufi.notifySendCustomData({ | ||||
| 												customData: "11close" | ||||
| 											}) | ||||
| 											// that.startTimer(0) | ||||
| 											clearInterval(that.timer) | ||||
| 											that.sdminutes = '' | ||||
| 											that.sdseconds = '' | ||||
| 											that.kgflag = false | ||||
| 											uni.hideLoading() | ||||
| 										}, 1500) | ||||
| 									}, | ||||
| 									fail(err) { | ||||
| 										console.error('获取已连接蓝牙设备信息失败:', err) | ||||
| 									} | ||||
| 								}) | ||||
| 							} | ||||
| 						} | ||||
| 					} | ||||
| 				}) | ||||
| 					}) | ||||
| 				} | ||||
| 			}, | ||||
| 			// 开启手动浇水 | ||||
| 			btngb() { | ||||
| 				this.sdjsflag = true | ||||
| 				if(this.datalist == ''){ | ||||
| 					uni.showModal({ | ||||
| 					    title: '提示',   | ||||
| 					    content: '设备未连接,是否进行设备连接?',   | ||||
| 					    success: function (res) {   | ||||
| 					        if (res.confirm) { | ||||
| 							   uni.hideLoading() | ||||
| 							   that.btnlj() | ||||
| 					        } else if (res.cancel) { | ||||
| 							   uni.hideLoading() | ||||
| 					           uni.showToast({ | ||||
| 					           	title: '已取消连接', | ||||
| 					           	icon: 'none', | ||||
| 					           	duration:2000 | ||||
| 					           }) | ||||
| 					        }   | ||||
| 					    }   | ||||
| 					}) | ||||
| 				}else{ | ||||
| 					this.sdjsflag = true | ||||
| 				} | ||||
| 			}, | ||||
| 
 | ||||
| 			// 跳转到设置 | ||||
|  | @ -699,6 +856,8 @@ | |||
| 						this.datalist = '' | ||||
| 						this.mac = '' | ||||
| 						this.ver_data = {} | ||||
| 						this.name = '' | ||||
| 						this.deviceId = '' | ||||
| 						this.xuanzeflag = false | ||||
| 						let that = this | ||||
| 						xBlufi.initXBlufi(1) | ||||
|  | @ -744,34 +903,39 @@ | |||
| 			getlist(){ | ||||
| 				this.$u.get(`/app/getDeviceInfoByUser?userId=${this.userobj.userId}`).then((res) => { | ||||
| 					if (res.code == 200) { | ||||
| 						this.devicelist = res.data | ||||
| 				        this.mac = res.data[0].mac | ||||
| 						this.user = res.data[0] | ||||
| 						this.shebid = res.data[0].deviceId | ||||
| 						if(this.datalist == ''){ | ||||
| 							let that = this | ||||
| 							xBlufi.initXBlufi(1) | ||||
| 							xBlufi.listenDeviceMsgEvent(true, that.funListenDeviceMsgEvent) | ||||
| 							xBlufi.notifyStartDiscoverBle({ | ||||
| 								'isStart': true | ||||
| 							}) | ||||
| 							setTimeout(() => { | ||||
| 								xBlufi.notifyStartDiscoverBle({ | ||||
| 									'isStart': false | ||||
| 						if(res.data.length > 0 || res.data != ''){ | ||||
| 							this.bjflag = false | ||||
| 							this.devicelist = res.data | ||||
| 							this.mac = res.data[0].mac | ||||
| 							this.user = res.data[0] | ||||
| 							this.shebid = res.data[0].deviceId | ||||
| 							if(this.datalist == ''){ | ||||
| 								let that = this | ||||
| 								uni.showModal({ | ||||
| 									    title: '提示',   | ||||
| 									    content: '设备未连接,是否进行设备连接?',   | ||||
| 									    success: function (res) {   | ||||
| 									        if (res.confirm) { | ||||
| 											   uni.hideLoading() | ||||
| 											   that.btnlj() | ||||
| 									        } else if (res.cancel) { | ||||
| 											   uni.hideLoading() | ||||
| 									           uni.showToast({ | ||||
| 									           	title: '已取消连接', | ||||
| 									           	icon: 'none', | ||||
| 									           	duration:2000 | ||||
| 									        }) | ||||
| 									    }   | ||||
| 									}   | ||||
| 								}) | ||||
| 								if (that.devicesList.length > 0) { | ||||
| 									xBlufi.notifyConnectBle({ | ||||
| 										isStart: true, | ||||
| 										deviceId: that.deviceId, | ||||
| 										name: that.name | ||||
| 									}) | ||||
| 								} | ||||
| 							}, 2000) | ||||
| 							that.getchao() | ||||
| 							} | ||||
| 						}else{ | ||||
| 							this.bjflag = true | ||||
| 						} | ||||
| 					} | ||||
| 				}) | ||||
| 			}, | ||||
| 			// 点击切换设备 | ||||
| 			btnksxz() { | ||||
| 				if (this.xuanzeflag == true) { | ||||
| 					this.xuanzeflag = false | ||||
|  | @ -848,7 +1012,6 @@ | |||
| 								xBlufi.notifyInitBleEsp32({ | ||||
| 									deviceId: this.deviceId | ||||
| 								}) | ||||
| 								this.deviceIds = options.data.deviceId | ||||
| 								this.name = this.name | ||||
| 							} | ||||
| 						} else { | ||||
|  | @ -871,32 +1034,34 @@ | |||
| 						break; | ||||
| 					case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START: | ||||
| 						if (!options.result) { | ||||
| 							uni.showToast({ | ||||
| 								title: '蓝牙未开启', | ||||
| 								icon: 'none', | ||||
| 								duration: 3000 | ||||
| 							}) | ||||
| 							// uni.showModal({ | ||||
| 							//     title: '提示',   | ||||
| 							//     content: '请打开蓝牙和位置信息',   | ||||
| 							//     success: function (res) {   | ||||
| 							//         if (res.confirm) { | ||||
| 							// 		   that.getinfo() | ||||
| 							//         } else if (res.cancel) {   | ||||
| 							//            uni.showToast({ | ||||
| 							//            	title: '已取消连接', | ||||
| 							//            	icon: 'none', | ||||
| 							//            	duration:2000 | ||||
| 							//            }) | ||||
| 							//         }   | ||||
| 							//     }   | ||||
| 							uni.hideLoading() | ||||
| 							// uni.showToast({ | ||||
| 							// 	title: '蓝牙未开启', | ||||
| 							// 	icon: 'none', | ||||
| 							// 	duration: 3000 | ||||
| 							// }) | ||||
| 							uni.showModal({ | ||||
| 							    title: '提示',   | ||||
| 							    content: '请打开蓝牙和位置信息',   | ||||
| 							    success: function (res) {   | ||||
| 							        if (res.confirm) { | ||||
| 									   uni.hideLoading() | ||||
| 									   that.btnlj() | ||||
| 							        } else if (res.cancel) {  | ||||
| 									   uni.hideLoading() | ||||
| 							           uni.showToast({ | ||||
| 							           	title: '已取消连接', | ||||
| 							           	icon: 'none', | ||||
| 							           	duration:2000 | ||||
| 							           }) | ||||
| 							        }   | ||||
| 							    }   | ||||
| 							}) | ||||
| 							return | ||||
| 						} | ||||
| 						break | ||||
| 				} | ||||
| 			}, | ||||
| 
 | ||||
| 			// 每隔一分钟发送一次获取数据 | ||||
| 			getshuju() { | ||||
| 				let that = this | ||||
|  | @ -927,7 +1092,7 @@ | |||
| 				}, 60000) | ||||
| 			}, | ||||
| 
 | ||||
| 			// 处理接收数据 | ||||
| 			// 处理从设备接收数据 | ||||
| 			getchuli() { | ||||
| 				const inputString = this.datalist | ||||
| 				const pairs = inputString.split(';') | ||||
|  | @ -943,7 +1108,6 @@ | |||
| 					} | ||||
| 				}) | ||||
| 				this.ver_data = pSetObjects //六个浇水时间段 | ||||
| 				// this.ver_data.p_set5[3] = this.lastChar | ||||
| 				console.log(inputString,this.ver_data, '002002002') | ||||
| 				this.showobj = showObject //雨滴,锁,等是否开启 | ||||
| 				if (this.showobj.showArray[1] == 1) { | ||||
|  | @ -967,7 +1131,7 @@ | |||
| 					const [hour, minute,minutes, second, /* other fields */ ] = timeArray | ||||
| 					const date = new Date() | ||||
| 					date.setHours(hour, minute,minute, second, 0) // 毫秒设为0   | ||||
| 					console.log(date,'11111'); | ||||
| 					console.log(date,'11111') | ||||
| 					return date | ||||
| 				} | ||||
| 				function timeDifference(date1, date2) { | ||||
|  | @ -989,9 +1153,8 @@ | |||
| 				for (const key in ver_Data) { | ||||
| 					if (ver_Data.hasOwnProperty(key) && ver_Data[key][3] === 1) { | ||||
| 						const timeArray = ver_Data[key] | ||||
| 						console.log(timeArray,'00000'); | ||||
| 						console.log(timeArray,'00000') | ||||
| 						const timeDate = timeArrayToDate(timeArray) | ||||
| 					 | ||||
| 						const diff = timeDifference(timeDate, new Date()) | ||||
| 						if (timeDate > new Date()) { | ||||
| 							if (!nextTime || (diff.hours * 60 + diff.minutes < (nextTimeDiff.hours || 0) * 60 + ( | ||||
|  | @ -1009,16 +1172,11 @@ | |||
| 					} | ||||
| 				} | ||||
| 				// 输出结果,确保在访问 null 值之前进行检查   | ||||
| 				this.xctime = nextTime ? `${nextTimeDiff.hours}时${nextTimeDiff.minutes}分` : '无距离下次浇水时间'; | ||||
| 				this.xctimesc = nextWaterDuration || '未知'; | ||||
| 				this.sctimejs = prevTime ? prevTime.toTimeString().split(' ')[0].slice(0, -3) : '无上次浇水时间'; | ||||
| 				this.xctimesj = nextTime ? nextTime.toTimeString().split(' ')[0].slice(0, -3) : '无下次浇水时间'; | ||||
| 				this.xctime = nextTime ? `${nextTimeDiff.hours}时${nextTimeDiff.minutes}分` : '无距离下次浇水时间' | ||||
| 				this.xctimesc = nextWaterDuration || '未知' | ||||
| 				this.sctimejs = prevTime ? prevTime.toTimeString().split(' ')[0].slice(0, -3) : '无上次浇水时间' | ||||
| 				this.xctimesj = nextTime ? nextTime.toTimeString().split(' ')[0].slice(0, -3) : '无下次浇水时间' | ||||
| 				console.log('下次浇水时间',this.xctimesj,'距离下次浇水时间',this.xctime,'上次浇水时间',this.sctimejs) | ||||
| 				// console.log('距离下次最近的时间差:', nextTimeDiff ? `${nextTimeDiff.hours}时${nextTimeDiff.minutes}分` : '无'); | ||||
| 				// console.log('下次时间:', nextTime ? nextTime.toTimeString().split(' ')[0] : '无'); | ||||
| 				// console.log('下次浇水时长:', nextWaterDuration || '无'); | ||||
| 				// console.log('距离上次最近的时间差:', prevTimeDiff ? `${prevTimeDiff.hours}时${prevTimeDiff.minutes}分` : '无');     | ||||
| 				// console.log('上次时间:', prevTime ? prevTime.toTimeString().split(' ')[0] : '无') | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
|  | @ -1171,7 +1329,7 @@ | |||
| 				border-radius: 20rpx; | ||||
| 				margin-top: 40rpx; | ||||
| 			} | ||||
| 
 | ||||
|            | ||||
| 			.sblist { | ||||
| 				width: 100%; | ||||
| 				height: 68vh; | ||||
|  |  | |||
|  | @ -21,7 +21,8 @@ | |||
| 				<image src="https://api.ccttiot.com/smartmeter/img/static/uFiLt1SC4cHdZrIDRxeO" mode=""></image> 密码	 | ||||
| 			</view> | ||||
| 			<view class="yzm"> | ||||
| 				<input :type="txt" v-model="password" placeholder="请输入密码"/> | ||||
| 				<input  v-if="txt == 'password'" type="password" v-model="password" placeholder="请输入密码"/> | ||||
| 				<input v-else type="text" v-model="password" placeholder="请输入密码"/> | ||||
| 				<image v-if="txt == 'password'" src="https://api.ccttiot.com/smartmeter/img/static/uWm6nstWoT5VIJuXvcGu" @click="btn(1)" mode=""></image> | ||||
| 				<image v-else src="https://api.ccttiot.com/smartmeter/img/static/uyVRL3hjK3JzSxbiIzBA" @click="btn(2)" mode=""></image> | ||||
| 			</view> | ||||
|  | @ -81,26 +82,40 @@ | |||
| 			methods:{ | ||||
| 				// 点击登录 | ||||
| 				btndl(){ | ||||
| 					let data = { | ||||
| 						phone:this.tel, | ||||
| 						// phoneCode:this.yzm, | ||||
| 						// uuid:this.uuid, | ||||
| 						password:this.password | ||||
| 					} | ||||
| 					this.$u.post(`/appCodeLogin`,data).then((res) => { | ||||
| 						if (res.code == 200) { | ||||
| 							wx.setStorageSync('token', res.token) | ||||
| 							uni.switchTab({ | ||||
| 								url:'/pages/index/index' | ||||
| 							}) | ||||
| 						}else{ | ||||
| 							uni.showToast({ | ||||
| 								title: res.msg, | ||||
| 								icon: 'none', | ||||
| 								duration: 2000 | ||||
| 							}) | ||||
| 					if(this.tel == ''){ | ||||
| 						uni.showToast({ | ||||
| 							title: '手机号不能为空', | ||||
| 							icon: 'none', | ||||
| 							duration: 2000 | ||||
| 						}) | ||||
| 					}else if(this.password == ''){ | ||||
| 						uni.showToast({ | ||||
| 							title: '密码不能为空', | ||||
| 							icon: 'none', | ||||
| 							duration: 2000 | ||||
| 						}) | ||||
| 					}else{ | ||||
| 						let data = { | ||||
| 							phone:this.tel, | ||||
| 							// phoneCode:this.yzm, | ||||
| 							// uuid:this.uuid, | ||||
| 							password:this.password | ||||
| 						} | ||||
| 					}) | ||||
| 						this.$u.post(`/appCodeLogin`,data).then((res) => { | ||||
| 							if (res.code == 200) { | ||||
| 								wx.setStorageSync('token', res.token) | ||||
| 								uni.switchTab({ | ||||
| 									url:'/pages/index/index' | ||||
| 								}) | ||||
| 							}else{ | ||||
| 								uni.showToast({ | ||||
| 									title: res.msg, | ||||
| 									icon: 'none', | ||||
| 									duration: 2000 | ||||
| 								}) | ||||
| 							} | ||||
| 						}) | ||||
| 					} | ||||
| 				}, | ||||
| 				// 点击微信一键登录 | ||||
| 				getPhoneNumber(e) { | ||||
|  | @ -141,7 +156,7 @@ | |||
| 					}) | ||||
| 				}, | ||||
| 				 | ||||
| 				 | ||||
| 				// 显示密码可见可不见 | ||||
| 				btn(num){ | ||||
| 					if(num == 1){ | ||||
| 						this.txt = 'txt' | ||||
|  |  | |||
|  | @ -39,11 +39,13 @@ | |||
| 				 | ||||
| 			}, | ||||
| 			methods:{ | ||||
| 				// 跳转到注册页 | ||||
| 				btnzc(){ | ||||
| 					uni.navigateTo({ | ||||
| 						url:'/pages/login/zhuce' | ||||
| 					}) | ||||
| 				}, | ||||
| 				// 跳转到登录页 | ||||
| 				denglu(){ | ||||
| 					uni.navigateTo({ | ||||
| 						url:'/pages/login/denglu' | ||||
|  |  | |||
|  | @ -33,7 +33,8 @@ | |||
|         		<image src="https://api.ccttiot.com/smartmeter/img/static/uFiLt1SC4cHdZrIDRxeO" mode=""></image> 新密码	 | ||||
|         	</view> | ||||
|         	<view class="yzm"> | ||||
|         		<input :type="txt" v-model="password" placeholder="请输入新密码"/> | ||||
| 				<input  v-if="txt == 'password'" type="password" v-model="password" placeholder="请输入新密码"/> | ||||
| 				<input v-else type="text" v-model="password" placeholder="请输入新密码"/> | ||||
|         		<image v-if="txt == 'password'" src="https://api.ccttiot.com/smartmeter/img/static/uWm6nstWoT5VIJuXvcGu" @click="btn(1)" mode=""></image> | ||||
|         		<image v-else src="https://api.ccttiot.com/smartmeter/img/static/uyVRL3hjK3JzSxbiIzBA" @click="btn(2)" mode=""></image> | ||||
|         	</view> | ||||
|  | @ -43,7 +44,8 @@ | |||
| 				<image src="https://api.ccttiot.com/smartmeter/img/static/uFiLt1SC4cHdZrIDRxeO" mode=""></image> 确认密码	 | ||||
| 			</view> | ||||
| 			<view class="yzm"> | ||||
| 				<input :type="txts" v-model="passwords" placeholder="请再次输入新密码"/> | ||||
| 				<input  v-if="txts == 'password'" type="password" v-model="passwords" placeholder="请再次输入新密码"/> | ||||
| 				<input v-else type="text" v-model="passwords" placeholder="请再次输入新密码"/> | ||||
| 				<image v-if="txts == 'password'" src="https://api.ccttiot.com/smartmeter/img/static/uWm6nstWoT5VIJuXvcGu" @click="btns(1)" mode=""></image> | ||||
| 				<image v-else src="https://api.ccttiot.com/smartmeter/img/static/uyVRL3hjK3JzSxbiIzBA" @click="btns(2)" mode=""></image> | ||||
| 			</view> | ||||
|  | @ -71,7 +73,8 @@ | |||
| 					yzm:'', | ||||
| 					countdown: 60,  | ||||
| 					timer: null, | ||||
| 					uuid:'' | ||||
| 					uuid:'', | ||||
| 					yzmkg:false | ||||
| 				} | ||||
| 			}, | ||||
| 			// 分享到好友(会话) | ||||
|  | @ -157,7 +160,7 @@ | |||
| 						}) | ||||
| 					}  | ||||
| 				}, | ||||
| 				 | ||||
| 				// 切换新密码显示与不显示 | ||||
| 				btn(num){ | ||||
| 					if(num == 1){ | ||||
| 						this.txt = 'txt' | ||||
|  | @ -165,6 +168,7 @@ | |||
| 						this.txt = 'password' | ||||
| 					} | ||||
| 				}, | ||||
| 				// 切换确认密码显示与不显示 | ||||
| 				btns(num){ | ||||
| 					if(num == 1){ | ||||
| 						this.txts = 'txt' | ||||
|  | @ -195,10 +199,27 @@ | |||
| 				 | ||||
| 				// 点击获取验证码 | ||||
| 				btnhuoqu(){ | ||||
| 					this.startCountdown() | ||||
| 					this.$u.get(`appCaptcha?phone=${this.tel}&type=2`).then(res => { | ||||
| 						this.uuid = res.uuid | ||||
| 					}) | ||||
| 					if(this.tel == ''){ | ||||
| 						uni.showToast({ | ||||
| 							title: '手机号不能为空', | ||||
| 							icon: 'none', | ||||
| 							duration: 2000 | ||||
| 						}) | ||||
| 					}else{ | ||||
| 						if(this.yzmkg == false){ | ||||
| 							this.yzmkg = true | ||||
| 							this.startCountdown() | ||||
| 							this.$u.get(`appCaptcha?phone=${this.tel}&type=2`).then(res => { | ||||
| 								this.uuid = res.uuid | ||||
| 							}) | ||||
| 						}else{ | ||||
| 							uni.showToast({ | ||||
| 								title: '不要重复点击', | ||||
| 								icon: 'none', | ||||
| 								duration: 2000 | ||||
| 							}) | ||||
| 						} | ||||
| 					} | ||||
| 				}, | ||||
| 			} | ||||
| 		} | ||||
|  |  | |||
|  | @ -36,7 +36,8 @@ | |||
| 				<image src="https://api.ccttiot.com/smartmeter/img/static/uFiLt1SC4cHdZrIDRxeO" mode=""></image> 密码	 | ||||
| 			</view> | ||||
| 			<view class="yzm"> | ||||
| 				<input :type="txt" v-model="password" placeholder="请输入密码"/> | ||||
| 				<input  v-if="txt == 'password'" type="password" v-model="password" placeholder="请输入密码"/> | ||||
| 				<input v-else type="text" v-model="password" placeholder="请输入密码"/> | ||||
| 				<image v-if="txt == 'password'" src="https://api.ccttiot.com/smartmeter/img/static/uWm6nstWoT5VIJuXvcGu" @click="btn(1)" mode=""></image> | ||||
| 				<image v-else src="https://api.ccttiot.com/smartmeter/img/static/uyVRL3hjK3JzSxbiIzBA" @click="btn(2)" mode=""></image> | ||||
| 			</view> | ||||
|  | @ -54,15 +55,11 @@ | |||
| 		<view class="wxlogo"> | ||||
| 			——————  其他登录方式  —————— | ||||
| 		</view> | ||||
| 		<!-- <view class="lofo"> | ||||
| 			<image src="https://api.ccttiot.com/smartmeter/img/static/uxWMldLMb888YHm0qOgN" mode=""></image> | ||||
| 		</view> --> | ||||
| 
 | ||||
| 		<button class="lofo" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber"> | ||||
| 			<image src="https://api.ccttiot.com/smartmeter/img/static/uxWMldLMb888YHm0qOgN" mode=""></image> | ||||
| 		</button> | ||||
| 		<!-- <button class="button" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" style="margin-left: -10rpx;"> | ||||
| 			授权登录 | ||||
| 		</button> --> | ||||
| 
 | ||||
| 		 | ||||
| 		 | ||||
| 	</view> | ||||
|  | @ -79,7 +76,8 @@ | |||
| 					yzm:'', | ||||
| 					countdown: 60,  | ||||
| 					timer: null, | ||||
| 					uuid:'' | ||||
| 					uuid:'', | ||||
| 					yzmkg:false | ||||
| 				} | ||||
| 			}, | ||||
| 			// 分享到好友(会话) | ||||
|  | @ -194,10 +192,10 @@ | |||
| 						console.error(err) | ||||
| 					}) | ||||
| 				}, | ||||
| 				 | ||||
| 				// 显示密码可见可不见 | ||||
| 				btn(num){ | ||||
| 					if(num == 1){ | ||||
| 						this.txt = 'txt' | ||||
| 						this.txt = 'text' | ||||
| 					}else if(num == 2){ | ||||
| 						this.txt = 'password' | ||||
| 					} | ||||
|  | @ -225,10 +223,27 @@ | |||
| 				 | ||||
| 				// 点击获取验证码 | ||||
| 				btnhuoqu(){ | ||||
| 					this.startCountdown() | ||||
| 					this.$u.get(`appCaptcha?phone=${this.tel}&type=2`).then(res => { | ||||
| 						this.uuid = res.uuid | ||||
| 					}) | ||||
| 					if(this.tel == ''){ | ||||
| 						uni.showToast({ | ||||
| 							title: '手机号不能为空', | ||||
| 							icon: 'none', | ||||
| 							duration: 2000 | ||||
| 						}) | ||||
| 					}else{ | ||||
| 						if(this.yzmkg == false){ | ||||
| 							this.yzmkg = true | ||||
| 							this.startCountdown() | ||||
| 							this.$u.get(`appCaptcha?phone=${this.tel}&type=2`).then(res => { | ||||
| 								this.uuid = res.uuid | ||||
| 							}) | ||||
| 						}else{ | ||||
| 							uni.showToast({ | ||||
| 								title: '不要重复点击', | ||||
| 								icon: 'none', | ||||
| 								duration: 2000 | ||||
| 							}) | ||||
| 						} | ||||
| 					} | ||||
| 				}, | ||||
| 				// 点击跳转到立即登录页 | ||||
| 				btnljdl(){ | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user