This commit is contained in:
3321822538@qq.com 2024-08-31 17:41:21 +08:00
parent faab3bb12b
commit 3ba83c677e
6 changed files with 135 additions and 48 deletions

View File

@ -19,7 +19,7 @@ const install = (Vue, vm) => {
// }, // },
// }); // });
Vue.prototype.$u.http.setConfig({ 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', baseUrl: 'https://kg.chuangtewl.com/prod-api',
// loadingText: '努力加载中~', // loadingText: '努力加载中~',
// loadingTime: 1000, // loadingTime: 1000,

View File

@ -10,7 +10,7 @@
<view class="card"> <view class="card">
<view class="icon_img"> <view class="icon_img">
<image src="https://api.ccttiot.com/smartmeter/img/static/uIvJLAq6xh67FZAI5qEC" mode=""></image> <image src="https://api.ccttiot.com/smartmeter/img/static/uIvJLAq6xh67FZAI5qEC" mode=""></image>
<view class="">设备</view> <view class="">设备展示</view>
</view> </view>
<view class="shebeitit">展示设备的外观信息</view> <view class="shebeitit">展示设备的外观信息</view>
<view class="icon"> <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" <image style="width: 100rpx;height: 100rpx;margin-left: 76rpx;margin-top: 50rpx;" src="https://api.ccttiot.com/smartmeter/img/static/urkb8tICILUpvA86HoxB"
mode="aspectFit"></image> mode="aspectFit"></image>
<view class="" style="width: 100%;text-align: center;margin-top: 15rpx;"> <view class="" style="width: 100%;text-align: center;margin-top: 15rpx;">
上传设备 上传设备展示
</view> </view>
</view> </view>
</view> </view>

View File

@ -257,7 +257,7 @@
orderno: '', orderno: '',
jieshuflag: false, jieshuflag: false,
feeprice: '', feeprice: '',
temperature:'', temperature:null,
du:'' du:''
} }
}, },
@ -516,8 +516,8 @@
} }
} }
} else { } else {
console.log(this.temperature,'this.temperature'); // console.log(this.temperature,'this.temperature');
if (this.temperature == '') { if (this.temperature == null) {
uni.showLoading({ uni.showLoading({
title: '切换中' title: '切换中'
}) })

View File

@ -103,10 +103,10 @@
</view> </view>
<view class="feems" style="border: 0;"> <view class="feems" style="border: 0;">
<view class="feelt"> <view class="feelt">
备注 详细说明
</view> </view>
<view class="feert"> <view class="feert">
<input type="text" placeholder="请输入备注" v-model="description" /> <input type="text" placeholder="请输入详细说明" v-model="description" />
</view> </view>
</view> </view>
</view> </view>

View File

@ -141,7 +141,7 @@
<view class="top"> <view class="top">
<u-switch v-model="checked" active-color="#8883F0"></u-switch> <u-switch v-model="checked" active-color="#8883F0"></u-switch>
</view> </view>
<view class="bot" style="margin-top: 10rpx;">{{tdtxt}}</view> <view class="bot" style="margin-top: 12rpx;">{{tdtxt}}</view>
</view> </view>
</view> </view>
@ -353,44 +353,130 @@
}, },
// //
btnkq(){ btnkq(){
if(this.tdtxt == '开启'){ if(this.deviceInfo.onlineStatus == 1){
this.$u.put(`/app/device/${this.id}/changePower?status=0`).then((res) => { if(this.tdtxt == '开启'){
if (res.code == 200) { this.$u.put(`/app/device/${this.id}/changePower?status=0`).then((res) => {
this.tdtxt = '关闭' if (res.code == 200) {
this.checked = false this.tdtxt = '关闭'
uni.showToast({ this.checked = false
title: res.msg, uni.showToast({
icon: 'success', title: res.msg,
duration: 2000 icon: 'success',
}) duration: 2000
}else{ })
this.checked = false }else{
uni.showToast({ this.checked = false
title: res.msg, uni.showToast({
icon: 'none', title: res.msg,
duration: 2000 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{ }else{
this.$u.put(`/app/device/${this.id}/changePower?status=1`).then((res) => { if(this.setMode == null){
if (res.code == 200) { this.btnmsk = false
this.checked = true this.shibaiflag = false
this.tdtxt = '开启' this.bluetoothflag = true
uni.showToast({ xBlufi.initXBlufi(1)
title: res.msg, xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
icon: 'success', xBlufi.notifyStartDiscoverBle({
duration: 2000 'isStart': true
}) })
}else{ //
this.checked = false setTimeout(() => {
uni.showToast({ xBlufi.notifyStartDiscoverBle({
title: res.msg, 'isStart': false
icon: 'none', })
duration: 2000 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() { getQiniuToken() {
@ -821,7 +907,7 @@
trueje(){ trueje(){
if (this.timer) { if (this.timer) {
clearInterval(this.timer) clearInterval(this.timer)
this.timer = null; this.timer = null
} }
let id = this.deviceInfo.deviceId let id = this.deviceInfo.deviceId
this.vipflag = false this.vipflag = false

View File

@ -193,7 +193,8 @@
if(this.serviceType == 2){ if(this.serviceType == 2){
this.serviceRates = this.serviceRate this.serviceRates = this.serviceRate
}else{ }else{
this.serviceRates = 0 // this.serviceRates = 0
this.serviceRates = this.serviceRate * this.money / 100
} }
} }
}) })