浇花器完善
This commit is contained in:
parent
f6c4e7d835
commit
caf9895d28
|
@ -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'
|
||||
|
|
|
@ -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 = {}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
Loading…
Reference in New Issue
Block a user