优化
This commit is contained in:
		
							parent
							
								
									faab3bb12b
								
							
						
					
					
						commit
						3ba83c677e
					
				|  | @ -19,7 +19,7 @@ const install = (Vue, vm) => { | |||
| 	// 	},
 | ||||
| 	// }); 
 | ||||
| 	Vue.prototype.$u.http.setConfig({  | ||||
| 			// baseUrl: 'http://192.168.2.143:10002',
 | ||||
| 			// baseUrl: 'http://192.168.2.157:10002',
 | ||||
| 			baseUrl: 'https://kg.chuangtewl.com/prod-api', | ||||
| 			// loadingText: '努力加载中~',
 | ||||
| 			// loadingTime: 1000,
 | ||||
|  |  | |||
|  | @ -10,7 +10,7 @@ | |||
| 		<view class="card"> | ||||
| 			<view class="icon_img"> | ||||
| 				<image src="https://api.ccttiot.com/smartmeter/img/static/uIvJLAq6xh67FZAI5qEC" mode=""></image> | ||||
| 				<view class="">设备主图</view> | ||||
| 				<view class="">设备展示图</view> | ||||
| 			</view> | ||||
| 			<view class="shebeitit">展示设备的外观信息</view> | ||||
| 			<view class="icon"> | ||||
|  | @ -28,7 +28,7 @@ | |||
| 						<image style="width: 100rpx;height: 100rpx;margin-left: 76rpx;margin-top: 50rpx;" src="https://api.ccttiot.com/smartmeter/img/static/urkb8tICILUpvA86HoxB" | ||||
| 							mode="aspectFit"></image> | ||||
| 							<view class="" style="width: 100%;text-align: center;margin-top: 15rpx;"> | ||||
| 								上传设备主图 | ||||
| 								上传设备展示图 | ||||
| 							</view> | ||||
| 					</view> | ||||
| 				</view> | ||||
|  |  | |||
|  | @ -257,7 +257,7 @@ | |||
| 				orderno: '', | ||||
| 				jieshuflag: false, | ||||
| 				feeprice: '', | ||||
| 				temperature:'', | ||||
| 				temperature:null, | ||||
| 				du:'' | ||||
| 			} | ||||
| 		}, | ||||
|  | @ -516,8 +516,8 @@ | |||
| 						} | ||||
| 					} | ||||
| 				} else { | ||||
| 					console.log(this.temperature,'this.temperature'); | ||||
| 					if (this.temperature == '') { | ||||
| 					// console.log(this.temperature,'this.temperature'); | ||||
| 					if (this.temperature == null) { | ||||
| 						uni.showLoading({ | ||||
| 							title: '切换中' | ||||
| 						}) | ||||
|  |  | |||
|  | @ -103,10 +103,10 @@ | |||
| 				</view> | ||||
| 				<view class="feems" style="border: 0;"> | ||||
| 					<view class="feelt"> | ||||
| 						备注 | ||||
| 						详细说明 | ||||
| 					</view> | ||||
| 					<view class="feert"> | ||||
| 						<input type="text" placeholder="请输入备注" v-model="description" /> | ||||
| 						<input type="text" placeholder="请输入详细说明" v-model="description" /> | ||||
| 					</view> | ||||
| 				</view> | ||||
| 			</view> | ||||
|  |  | |||
|  | @ -141,7 +141,7 @@ | |||
| 							<view class="top"> | ||||
| 								<u-switch v-model="checked" active-color="#8883F0"></u-switch> | ||||
| 							</view> | ||||
| 							<view class="bot" style="margin-top: 10rpx;">{{tdtxt}}</view> | ||||
| 							<view class="bot" style="margin-top: 12rpx;">{{tdtxt}}</view> | ||||
| 						</view> | ||||
| 						 | ||||
| 					</view> | ||||
|  | @ -353,44 +353,130 @@ | |||
| 			}, | ||||
| 			// 开启和关闭 | ||||
| 			btnkq(){ | ||||
| 				if(this.tdtxt == '开启'){ | ||||
| 					this.$u.put(`/app/device/${this.id}/changePower?status=0`).then((res) => { | ||||
| 						if (res.code == 200) { | ||||
| 							this.tdtxt = '关闭' | ||||
| 							this.checked = false | ||||
| 							uni.showToast({ | ||||
| 								title: res.msg, | ||||
| 								icon: 'success', | ||||
| 								duration: 2000 | ||||
| 							}) | ||||
| 						}else{ | ||||
| 							this.checked = false | ||||
| 							uni.showToast({ | ||||
| 								title: res.msg, | ||||
| 								icon: 'none', | ||||
| 								duration: 2000 | ||||
| 							}) | ||||
| 						} | ||||
| 					}) | ||||
| 				if(this.deviceInfo.onlineStatus == 1){ | ||||
| 					if(this.tdtxt == '开启'){ | ||||
| 						this.$u.put(`/app/device/${this.id}/changePower?status=0`).then((res) => { | ||||
| 							if (res.code == 200) { | ||||
| 								this.tdtxt = '关闭' | ||||
| 								this.checked = false | ||||
| 								uni.showToast({ | ||||
| 									title: res.msg, | ||||
| 									icon: 'success', | ||||
| 									duration: 2000 | ||||
| 								}) | ||||
| 							}else{ | ||||
| 								this.checked = false | ||||
| 								uni.showToast({ | ||||
| 									title: res.msg, | ||||
| 									icon: 'none', | ||||
| 									duration: 2000 | ||||
| 								}) | ||||
| 							} | ||||
| 						}) | ||||
| 					}else{ | ||||
| 						this.$u.put(`/app/device/${this.id}/changePower?status=1`).then((res) => { | ||||
| 							if (res.code == 200) { | ||||
| 								this.checked = true | ||||
| 								this.tdtxt = '开启' | ||||
| 								uni.showToast({ | ||||
| 									title: res.msg, | ||||
| 									icon: 'success', | ||||
| 									duration: 2000 | ||||
| 								}) | ||||
| 							}else{ | ||||
| 								this.checked = false | ||||
| 								uni.showToast({ | ||||
| 									title: res.msg, | ||||
| 									icon: 'none', | ||||
| 									duration: 2000 | ||||
| 								}) | ||||
| 							} | ||||
| 						}) | ||||
| 					} | ||||
| 				}else{ | ||||
| 					this.$u.put(`/app/device/${this.id}/changePower?status=1`).then((res) => { | ||||
| 						if (res.code == 200) { | ||||
| 							this.checked = true | ||||
| 							this.tdtxt = '开启' | ||||
| 							uni.showToast({ | ||||
| 								title: res.msg, | ||||
| 								icon: 'success', | ||||
| 								duration: 2000 | ||||
| 							}) | ||||
| 						}else{ | ||||
| 							this.checked = false | ||||
| 							uni.showToast({ | ||||
| 								title: res.msg, | ||||
| 								icon: 'none', | ||||
| 								duration: 2000 | ||||
| 							}) | ||||
| 						} | ||||
| 					}) | ||||
|                     if(this.setMode == null){ | ||||
| 						this.btnmsk = false | ||||
| 						this.shibaiflag = false | ||||
| 						this.bluetoothflag = true | ||||
|                     	xBlufi.initXBlufi(1) | ||||
|                     	xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent) | ||||
|                     	xBlufi.notifyStartDiscoverBle({ | ||||
|                     		'isStart': true | ||||
|                     	}) | ||||
|                     	// 停止蓝牙搜索   | ||||
|                     	setTimeout(() => { | ||||
|                     		xBlufi.notifyStartDiscoverBle({ | ||||
|                     			'isStart': false | ||||
|                     		}) | ||||
|                     		xBlufi.notifyConnectBle({ | ||||
|                     			isStart: true, | ||||
|                     			deviceId: this.deviceId, | ||||
|                     			name: this.name | ||||
|                     		}) | ||||
|                     		xBlufi.notifyInitBleEsp32({ | ||||
|                     			deviceId: this.deviceId | ||||
|                     		}) | ||||
|                     		let name = '' | ||||
|                     		let index = this.name.indexOf('-') | ||||
|                     		if (index !== -1) { | ||||
|                     			name = this.name.slice(index + 1) | ||||
|                     		} | ||||
|                     		if(this.deviceInfo.powerStatus == 0){ | ||||
|                     			this.checked = false | ||||
|                     		}else{ | ||||
|                     			this.checked = true | ||||
|                     		} | ||||
|                     	}, 1000) | ||||
|                     }else{ | ||||
| 						// console.log(this.tdtxt,'020202'); | ||||
|                         if(this.tdtxt == '开启'){	 | ||||
| 							let that = this | ||||
|                     		uni.getNetworkType({ | ||||
|                     			success(res) { | ||||
|                     				if (res.networkType !== 'none') { | ||||
|                     					uni.getConnectedBluetoothDevices({ | ||||
|                     						success(res) {  | ||||
|                     							setTimeout(()=> { | ||||
| 													// console.log('close关闭'); | ||||
| 													that.tdtxt = '关闭' | ||||
| 													that.checked = false | ||||
|                     								xBlufi.notifySendCustomData({ | ||||
|                     										customData: 'close' | ||||
|                     									}) | ||||
|                     							},1000) | ||||
|                     						}, | ||||
|                     						fail(err) { | ||||
|                     							console.error('获取已连接蓝牙设备信息失败:',err) | ||||
|                     						} | ||||
|                     					}) | ||||
|                     				}  | ||||
|                     			} | ||||
|                     		}) | ||||
|                     	}else{ | ||||
| 							let that = this | ||||
|                     		uni.getNetworkType({ | ||||
|                     			success(res) { | ||||
|                     				if (res.networkType !== 'none') { | ||||
|                     					uni.getConnectedBluetoothDevices({ | ||||
|                     						success(res) {  | ||||
|                     							setTimeout(()=> { | ||||
| 													// console.log('open开启'); | ||||
| 													that.tdtxt = '开启' | ||||
| 													that.checked = true | ||||
|                     								xBlufi.notifySendCustomData({ | ||||
|                     										customData: 'open' | ||||
|                     									}) | ||||
|                     							},1000) | ||||
|                     						}, | ||||
|                     						fail(err) { | ||||
|                     							console.error('获取已连接蓝牙设备信息失败:',err) | ||||
|                     						} | ||||
|                     					}) | ||||
|                     				}  | ||||
|                     			} | ||||
|                     		}) | ||||
|                     	} | ||||
|                     } | ||||
| 				} | ||||
| 			}, | ||||
| 			getQiniuToken() { | ||||
|  | @ -821,7 +907,7 @@ | |||
| 			trueje(){ | ||||
| 				if (this.timer) { | ||||
| 				  clearInterval(this.timer) | ||||
| 				  this.timer = null;  | ||||
| 				  this.timer = null | ||||
| 				}   | ||||
| 				let id = this.deviceInfo.deviceId | ||||
| 				this.vipflag = false | ||||
|  |  | |||
|  | @ -193,7 +193,8 @@ | |||
| 						if(this.serviceType == 2){ | ||||
| 							this.serviceRates = this.serviceRate | ||||
| 						}else{ | ||||
| 							this.serviceRates = 0 | ||||
| 							// this.serviceRates = 0 | ||||
| 							this.serviceRates = this.serviceRate * this.money / 100 | ||||
| 						} | ||||
| 					} | ||||
| 				}) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user