From caf9895d28f7ac67360d818e05407746e37899ee Mon Sep 17 00:00:00 2001
From: "3321822538@qq.com" <3321822538@qq.com>
Date: Thu, 31 Oct 2024 17:57:18 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B5=87=E8=8A=B1=E5=99=A8=E5=AE=8C=E5=96=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
common/http.interceptor.js | 4 +-
page_user/dingshi.vue | 3 +-
page_user/lanya.vue | 56 +--
page_user/opinion.vue | 4 -
page_user/upload.vue | 28 +-
pages/index/index.vue | 836 +++++++++++++++++++++++--------------
6 files changed, 568 insertions(+), 363 deletions(-)
diff --git a/common/http.interceptor.js b/common/http.interceptor.js
index 7de1ec6..f5b14ff 100644
--- a/common/http.interceptor.js
+++ b/common/http.interceptor.js
@@ -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'
diff --git a/page_user/dingshi.vue b/page_user/dingshi.vue
index fc2d88e..e1c08e2 100644
--- a/page_user/dingshi.vue
+++ b/page_user/dingshi.vue
@@ -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 = {}
diff --git a/page_user/lanya.vue b/page_user/lanya.vue
index ea91922..99c6686 100644
--- a/page_user/lanya.vue
+++ b/page_user/lanya.vue
@@ -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,
diff --git a/page_user/opinion.vue b/page_user/opinion.vue
index 0fc57be..d08525b 100644
--- a/page_user/opinion.vue
+++ b/page_user/opinion.vue
@@ -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;
diff --git a/page_user/upload.vue b/page_user/upload.vue
index ab865be..a928cff 100644
--- a/page_user/upload.vue
+++ b/page_user/upload.vue
@@ -7,14 +7,14 @@
- 小发财树1号
+ {{user.deviceName == undefined ? '--' : user.deviceName}}
- 型号 G-1232161
+ 型号 {{user.model == undefined ? '--' : user.model}}
- MAC 2131897412
+ MAC {{user.mac == undefined ? '--' : user.mac}}
WIFI
@@ -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;
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 3c750a0..471a615 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -22,7 +22,7 @@
- 小发财树1号
+ 切换设备
@@ -31,7 +31,7 @@
- 丁丁浇花器
+ {{user.deviceName == undefined ? '--' : user.deviceName}}
@@ -43,8 +43,8 @@
- 型号:G-145255445
- SN:G-145255445
+ 型号:{{user.model == undefined ? '--' : user.model}}
+ MAC:{{user.mac == undefined ? '--' : user.mac}}
@@ -73,7 +73,9 @@
P1
-
+
@@ -88,7 +90,9 @@
P2
-
+
@@ -103,7 +107,9 @@
P3
-
+
@@ -118,7 +124,9 @@
P4
-
+
@@ -133,7 +141,9 @@
P5
-
+
@@ -148,7 +158,9 @@
P6
-
+
@@ -160,16 +172,20 @@
- 雨水感应
-
-
+ 雨水感应
+
+
- 儿童锁
-
+ 儿童锁
+
@@ -201,15 +217,15 @@
-
+
-
+
- 小发财树1号
- 型号:12354121
+ {{item.deviceName}}
+ 型号:{{item.model}}
@@ -223,12 +239,12 @@
- 选择浇水时长
+ 选择浇水时长
- {{minute}}分
+ {{minute}}分
:
- {{second}}秒
+ {{second}}秒
@@ -240,7 +256,7 @@
-
+
@@ -249,22 +265,22 @@
\ No newline at end of file