开关完善

This commit is contained in:
3321822538@qq.com 2024-06-13 18:02:12 +08:00
parent 763b37c5a4
commit ba6b85fe31
4 changed files with 73 additions and 62 deletions

View File

@ -37,7 +37,10 @@
充值 充值
</view> </view>
</view> </view>
<view class="masks" v-if="maskflag">
</view>
<!-- <view class="anniu" @click="Search"> <!-- <view class="anniu" @click="Search">
<button>重新扫描</button> <button>重新扫描</button>
</view> --> </view> -->
@ -93,7 +96,8 @@
bgc: { bgc: {
background: '#8883F0' background: '#8883F0'
}, },
billNo: '' billNo: '',
maskflag:true
} }
}, },
onLoad(e) { onLoad(e) {
@ -130,6 +134,7 @@
}); });
// //
if (this.devicesList.length == 0) { if (this.devicesList.length == 0) {
uni.showToast({ uni.showToast({
title: '暂无发现对应设备,请靠近设备', title: '暂无发现对应设备,请靠近设备',
icon: 'none', icon: 'none',
@ -145,7 +150,7 @@
// uni.hideLoading() // uni.hideLoading()
} }
this.status = true this.status = true
}, 2000) }, 4000)
}, },
onShow: function() { onShow: function() {
@ -371,6 +376,7 @@
} }
} }
}else{ }else{
this.maskflag = false
uni.hideLoading() uni.hideLoading()
uni.showToast({ uni.showToast({
title: '未连接到设备,请靠近设备尝试', title: '未连接到设备,请靠近设备尝试',
@ -382,6 +388,7 @@
case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA: case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA:
this.ver_data = this.parseCustomData(options.data) this.ver_data = this.parseCustomData(options.data)
this.maskflag = false
uni.hideLoading() uni.hideLoading()
console.log("1收到设备发来的自定义数据结果", this.ver_data); console.log("1收到设备发来的自定义数据结果", this.ver_data);
break; break;
@ -499,7 +506,18 @@
page { page {
background-color: #F7FAFE !important; background-color: #F7FAFE !important;
} }
.masks{
width: 100%;
height: 100vh;
position: fixed;
top: 0;
left: 50%;
transform: translateX(-50%);
background-color: #ccc;
opacity: .6;
}
.card { .card {
margin-top: 50rpx; margin-top: 50rpx;
display: flex; display: flex;

View File

@ -27,7 +27,7 @@
<view class="mid_right"> <view class="mid_right">
<view class="mid_top"> <view class="mid_top">
{{ deviceInfo.deviceName == null ? '' : deviceInfo.deviceName }} {{ deviceInfo.deviceName == null ? '' : deviceInfo.deviceName }}
<view class="" style="font-size: 26rpx;"> <view class="" style="font-size: 26rpx;margin-top: 8rpx;">
更新时间{{deviceInfo.lastPullTime}}</view> 更新时间{{deviceInfo.lastPullTime}}</view>
</view> </view>
<view class="mid_bot"> <view class="mid_bot">
@ -114,7 +114,7 @@
<view class="cont" style="text-align: center;"> <view class="cont" style="text-align: center;">
<view class="tit"> <view class="tit">
{{timeday}} {{timeday}}
sb:{{setMode}} <!-- sb:{{setMode}} -->
</view> </view>
<view class="txt"> <view class="txt">
剩余分钟 剩余分钟
@ -128,7 +128,7 @@
<view class="tit">其他</view> <view class="tit">其他</view>
<view class="cont_box" style="display: block;"> <view class="cont_box" style="display: block;">
<view class="" style="display: flex;justify-content: space-between;"> <view class="" style="display: flex;justify-content: space-between;">
<view class="cont" style="width: 120rpx;" @click="topage(0)"> <view class="cont" style="width: 120rpx;margin-right: 50rpx;" @click="topage(0)">
<view class="top"> <view class="top">
<image src="https://api.ccttiot.com/smartmeter/img/static/uKrpw3p37UHW56IypPJU" mode="" <image src="https://api.ccttiot.com/smartmeter/img/static/uKrpw3p37UHW56IypPJU" mode=""
style="width: 58rpx;height: 56rpx;"></image> style="width: 58rpx;height: 56rpx;"></image>
@ -158,14 +158,14 @@
</view> </view>
</view> </view>
<view class="" style="display: flex;margin-top: 20rpx;"> <view class="" style="display: flex;margin-top: 20rpx;">
<view class="cont" style="width: 120rpx;" @click="topage(3)"> <view class="cont" style="width: 120rpx;margin-right: 56rpx;" @click="topage(3)">
<view class="top"> <view class="top">
<image src="https://api.ccttiot.com/smartmeter/img/static/umjPUc8nDKf1JwVqRAeb" mode="" <image src="https://api.ccttiot.com/smartmeter/img/static/umjPUc8nDKf1JwVqRAeb" mode=""
style="width: 58rpx;height: 60rpx;"></image> style="width: 58rpx;height: 60rpx;"></image>
</view> </view>
<view class="bot">收费方式</view> <view class="bot">收费方式</view>
</view> </view>
<view class="cont" style="width: 60rpx;" @click="topage(4)"> <view class="cont" style="width: 66rpx;" @click="topage(4)">
<view class="top"> <view class="top">
<image src="https://api.ccttiot.com/smartmeter/img/static/u2Uco0iXf8aure0H2ihz" mode=""> <image src="https://api.ccttiot.com/smartmeter/img/static/u2Uco0iXf8aure0H2ihz" mode="">
</image> </image>
@ -259,27 +259,27 @@
this.id = id this.id = id
this.getDevice(id) this.getDevice(id)
xBlufi.initXBlufi(1); // xBlufi.initXBlufi(1);
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent); // xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent);
xBlufi.notifyStartDiscoverBle({ // xBlufi.notifyStartDiscoverBle({
'isStart': true // 'isStart': true
}) // })
// //
setTimeout(() => { // setTimeout(() => {
xBlufi.notifyStartDiscoverBle({ // xBlufi.notifyStartDiscoverBle({
'isStart': false // 'isStart': false
}); // });
xBlufi.notifyConnectBle({ // xBlufi.notifyConnectBle({
isStart: true, // isStart: true,
deviceId: this.deviceId, // deviceId: this.deviceId,
name: this.name // name: this.name
}) // })
xBlufi.notifyInitBleEsp32({ // xBlufi.notifyInitBleEsp32({
deviceId: this.deviceId // deviceId: this.deviceId
}); // });
}, 2000) // }, 2000)
}, },
onShow() { onShow() {
@ -323,34 +323,29 @@
} }
}); });
}, },
btnpic() { btnpic(e) {
let _this = this let _this = this
let math = 'static/' + _this.$u.guid(20) let math = 'static/' + _this.$u.guid(20)
uni.chooseImage({ const tempFilePaths = e.detail.avatarUrl
count: 1, wx.uploadFile({
type: 'all', url: 'https://up-z2.qiniup.com',
success(res) { name: 'file',
const tempFilePaths = res.tempFiles filePath: tempFilePaths,
wx.uploadFile({ formData: {
url: 'https://up-z2.qiniup.com', token: _this.token,
name: 'file', key: 'smartmeter/img/' + math
filePath: tempFilePaths[0].path, },
formData: { success: function(res) {
token: _this.token, //token let str = JSON.parse(res.data)
key: 'smartmeter/img/' + math console.log(str.key)
}, _this.userImgs = 'https://api.ccttiot.com/' + str.key
success: function(res) { _this.imglist = _this.userImgs
let str = JSON.parse(res.data) _this.imgflag = false
_this.userImgs = 'https://api.ccttiot.com/' + str.key let data = {
_this.imglist = _this.userImgs deviceId:_this.id,
let data = { customPicture:_this.imglist
deviceId: _this.id,
customPicture: _this.imglist
}
_this.putdevice(data)
} }
}); _this.putdevice(data)
} }
}) })
}, },
@ -362,9 +357,9 @@
icon: 'success', icon: 'success',
duration: 2000 duration: 2000
}) })
} else if (res.code == 500) { } else {
uni.showToast({ uni.showToast({
title: '设备不在线', title: res.msg,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}) })
@ -393,7 +388,7 @@
let now = new Date(); let now = new Date();
let differenceInMs = expireDate - now; let differenceInMs = expireDate - now;
if (differenceInMs <= 0) { if (differenceInMs <= 0) {
this.timeday = null this.timeday = 0
} else { } else {
this.timeday = Math.abs(Math.floor(differenceInMs / (1000 * 60))); this.timeday = Math.abs(Math.floor(differenceInMs / (1000 * 60)));
} }

View File

@ -20,7 +20,7 @@
</view> </view>
<view class="info"> <view class="info">
<view class="txt"> <view class="txt">
{{remake}} {{remake == null ? '' : remake}}
</view> </view>
<view class="iconfont icon-xiangyou1"></view> <view class="iconfont icon-xiangyou1"></view>
</view> </view>
@ -43,7 +43,7 @@
</view> </view>
<view class="info"> <view class="info">
<view class="txt"> <view class="txt">
{{listobj.deviceNo}} {{listobj.deviceNo == null ? '' : listobj.deviceNo}}
</view> </view>
</view> </view>
</view> </view>
@ -53,7 +53,7 @@
</view> </view>
<view class="info"> <view class="info">
<view class="txt"> <view class="txt">
{{listobj.model}} {{listobj.model == null ? '' : listobj.model}}
</view> </view>
</view> </view>
</view> </view>

View File

@ -807,7 +807,6 @@
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
border-left: 2rpx solid #D8D8D8; border-left: 2rpx solid #D8D8D8;
font-weight: 500; font-weight: 500;
font-size: 36rpx; font-size: 36rpx;
@ -855,7 +854,6 @@
height: 96rpx; height: 96rpx;
background: #8883F0; background: #8883F0;
border-radius: 16rpx; border-radius: 16rpx;
font-weight: 500; font-weight: 500;
font-size: 36rpx; font-size: 36rpx;
color: #FFFFFF; color: #FFFFFF;
@ -1312,7 +1310,7 @@
// align-items: center; // align-items: center;
margin-top: 20rpx; margin-top: 20rpx;
width: 658rpx; width: 658rpx;
height: 282rpx; height: 250rpx;
background: #fff; background: #fff;
box-shadow: 0rpx 16rpx 40rpx 0rpx rgba(255, 255, 255, 0); box-shadow: 0rpx 16rpx 40rpx 0rpx rgba(255, 255, 255, 0);
border-radius: 24rpx 24rpx 24rpx 24rpx; border-radius: 24rpx 24rpx 24rpx 24rpx;
@ -1367,7 +1365,7 @@
image { image {
width: 180rpx; width: 180rpx;
height: 200rpx; height: 180rpx;
} }
} }
} }