From 3ba83c677e24ff6d0b1dfdfd057b9c589f384814 Mon Sep 17 00:00:00 2001 From: "3321822538@qq.com" <3321822538@qq.com> Date: Sat, 31 Aug 2024 17:41:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/http.interceptor.js | 2 +- page_components/bindsz.vue | 4 +- page_components/eletj.vue | 6 +- .../statulist/taocanlist/addtaocan/index.vue | 4 +- page_user/sbdetail.vue | 164 +++++++++++++----- page_user/yetx.vue | 3 +- 6 files changed, 135 insertions(+), 48 deletions(-) diff --git a/common/http.interceptor.js b/common/http.interceptor.js index ee90c50..db43480 100644 --- a/common/http.interceptor.js +++ b/common/http.interceptor.js @@ -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, diff --git a/page_components/bindsz.vue b/page_components/bindsz.vue index a6096db..0fec532 100644 --- a/page_components/bindsz.vue +++ b/page_components/bindsz.vue @@ -10,7 +10,7 @@ - 设备主图 + 设备展示图 展示设备的外观信息 @@ -28,7 +28,7 @@ - 上传设备主图 + 上传设备展示图 diff --git a/page_components/eletj.vue b/page_components/eletj.vue index 49e7247..a298dd0 100644 --- a/page_components/eletj.vue +++ b/page_components/eletj.vue @@ -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: '切换中' }) diff --git a/page_fenbao/statulist/taocanlist/addtaocan/index.vue b/page_fenbao/statulist/taocanlist/addtaocan/index.vue index 7ecfa21..857f17d 100644 --- a/page_fenbao/statulist/taocanlist/addtaocan/index.vue +++ b/page_fenbao/statulist/taocanlist/addtaocan/index.vue @@ -103,10 +103,10 @@ - 备注 + 详细说明 - + diff --git a/page_user/sbdetail.vue b/page_user/sbdetail.vue index 609d97c..cc98208 100644 --- a/page_user/sbdetail.vue +++ b/page_user/sbdetail.vue @@ -141,7 +141,7 @@ - {{tdtxt}} + {{tdtxt}} @@ -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 diff --git a/page_user/yetx.vue b/page_user/yetx.vue index d3a7125..730486a 100644 --- a/page_user/yetx.vue +++ b/page_user/yetx.vue @@ -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 } } })