浇花器完善

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) { if (res.code) {
console.log('登录!', res); console.log('登录!', res);
let data = { 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) { if (res.code == 10003) {
uni.navigateTo({ uni.navigateTo({
url:'/pages/login/login' url:'/pages/login/login'

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff