浇花器完善

This commit is contained in:
3321822538@qq.com 2024-10-31 17:57:18 +08:00
parent f6c4e7d835
commit caf9895d28
6 changed files with 568 additions and 363 deletions

View File

@ -110,10 +110,10 @@ const install = (Vue, vm) => {
if (res.code) {
console.log('登录!', res);
let data = {
wxOpenId: res.code,
jsCode: res.code,
};
vm.$u.post('/app/auth/wxLogin',data).then(res=>{
vm.$u.post(`/loginByopenid?jsCode=${res.code}`,data).then(res=>{
if (res.code == 10003) {
uni.navigateTo({
url:'/pages/login/login'

View File

@ -311,7 +311,8 @@
break;
case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA:
console.log("1收到设备发来的自定义数据结果", options.data)
const inputString = options.data
const inputString = options.data.slice(0, -1) + ";"
console.log(inputString,'12121212100')
const pairs = inputString.split(';')
const showObject = {}
const pSetObjects = {}

View File

@ -99,11 +99,11 @@
'isStart': false
})
if (that.devicesList.length > 0) {
xBlufi.notifyConnectBle({
isStart: true,
deviceId: that.deviceId,
name: that.name
})
// xBlufi.notifyConnectBle({
// isStart: true,
// deviceId: that.deviceId,
// name: that.name
// })
}
}, 2000)
},
@ -113,21 +113,26 @@
this.$u.get(`/appVerify/profile`).then((res) => {
if (res.code == 200) {
this.userid = res.data.userId
}else if(res.code == 401){
uni.navigateTo({
url:'/pages/login/login'
})
}
})
},
//
btnadd(e){
let mac = e.name.slice(5, 17)
console.log(e,'0101');
let mac = e.slice(5, 17)
let data = {
mac:mac,
userId:this.userid
}
this.$u.get(`/app/bandDevice`,data).then((res) => {
this.$u.post(`/app/bandDevice`,data).then((res) => {
if (res.code == 200) {
uni.showToast({
title: '添加成功',
icon: 'none',
icon: 'success',
duration: 3000
})
}else{
@ -157,11 +162,11 @@
})
if (that.devicesList.length > 0) {
that.flags = true
xBlufi.notifyConnectBle({
isStart: true,
deviceId: that.deviceId,
name: that.name
})
// xBlufi.notifyConnectBle({
// isStart: true,
// deviceId: that.deviceId,
// name: that.name
// })
}else{
that.flags = false
}
@ -188,7 +193,7 @@
}
})
}
break;
break
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS:
if (options.result) {
let devicesarr = options.data
@ -206,7 +211,7 @@
// }
// })
}
break;
break
case xBlufi.XBLUFI_TYPE.TYPE_CONNECTED:
console.log("连接回调:" + JSON.stringify(options));
if (options.result) {
@ -220,9 +225,10 @@
}else{
}
break;
break
case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA:
this.ver_data = this.parseCustomData(options.data)
// this.ver_data = this.parseCustomData(options.data)
this.ver_data = options.data
console.log("1收到设备发来的自定义数据结果", this.ver_data)
break;
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_STOP:
@ -245,19 +251,19 @@
} else {
}
break;
break
}
},
//
parseCustomData(data) {
// "@"
const dataArray = data.split('@');
const voltage = parseFloat(dataArray[0].substring(1)); // "V"
const switchState = dataArray[1].substring(1); // "S"
const current = parseFloat(dataArray[2].substring(1)); // "A"
const power = parseFloat(dataArray[4].substring(1)); // "P"
const remainingPower = parseFloat(dataArray[5].substring(1)); // "M"
const setMode = dataArray[6].substring(1); // "T"
const dataArray = data.split('@')
const voltage = parseFloat(dataArray[0].substring(1)) // "V"
const switchState = dataArray[1].substring(1) // "S"
const current = parseFloat(dataArray[2].substring(1)) // "A"
const power = parseFloat(dataArray[4].substring(1)) // "P"
const remainingPower = parseFloat(dataArray[5].substring(1)) // "M"
const setMode = dataArray[6].substring(1) // "T"
//
return {
voltage,

View File

@ -347,16 +347,12 @@
top: 18rpx;
left: 38rpx;
color: #999;
/* placeholder颜色 */
pointer-events: none;
/* 确保点击事件可以穿透到textarea上 */
}
.custom-textarea {
width: 100%;
height: 100%;
/* 设置一个合适高度 */
padding-top: 18rpx;
/* 为placeholder留出空间 */
padding-left: 38rpx;
padding-bottom: 54rpx;
overflow: hidden;

View File

@ -7,14 +7,14 @@
<image class="img" src="https://api.ccttiot.com/smartmeter/img/static/uVKucPVDjxjaCDCpFKvw" mode=""></image>
</view>
<view class="name" @click="nameflag = true">
<view class="">小发财树1号</view>
<view class="">{{user.deviceName == undefined ? '--' : user.deviceName}}</view>
<image src="https://api.ccttiot.com/smartmeter/img/static/uL6FHnMGWFrdptmDokDI" mode=""></image>
</view>
<view class="model">
<text class="one">型号</text> <text>G-1232161</text>
<text class="one">型号</text> <text>{{user.model == undefined ? '--' : user.model}}</text>
</view>
<view class="model" style="margin-top: 24rpx;">
<text class="one" style="margin-right: 124rpx;">MAC</text> <text>2131897412</text>
<text class="one" style="margin-right: 124rpx;">MAC</text> <text>{{user.mac == undefined ? '--' : user.mac}}</text>
</view>
<view class="wifi">
<view class="">WIFI</view>
@ -92,6 +92,8 @@
value: '2',
label: 'v2.1.3'
}],
deviceid:'',
user:{}
}
},
//
@ -110,10 +112,20 @@
path: '/pages/index/index'
}
},
onLoad() {
onLoad(option) {
this.deviceid = option.deviceid
this.getshebxq()
},
methods: {
//
getshebxq(){
this.$u.get(`/app/getDeviceInfo/${this.deviceid}`).then(res => {
if(res.code == 200){
this.user = res.data
}
})
},
//
xpconfirm(e){
this.xptxt = e[0].label
@ -144,8 +156,8 @@
margin-bottom: 22rpx;
}
.editname{
width: 440rpx;
height: 320rpx;
width: 530rpx;
height: 340rpx;
background-color: #fff;
position: fixed;
top: 600rpx;
@ -164,7 +176,7 @@
font-weight: 600;
}
input{
width: 360rpx;
width: 450rpx;
height: 80rpx;
background-color: #eee;
border-radius: 10rpx;

File diff suppressed because it is too large Load Diff