发送信息列表接口联调,
This commit is contained in:
@ -35,18 +35,21 @@
|
||||
return {
|
||||
deviceId: '',
|
||||
isConnecting: false, // 是否正在连接
|
||||
isConnected: false ,// 是否连接成功
|
||||
isConnectNo:false,
|
||||
isSuccess:false
|
||||
isConnected: false, // 是否连接成功
|
||||
isConnectNo: false,
|
||||
isSuccess: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async handleConnect() {
|
||||
if (this.isConnecting) {
|
||||
// 绑定成功,确认按钮跳转到首页并通知刷新数据
|
||||
uni.$emit('refreshDeviceList'); // 发出刷新事件
|
||||
// 绑定成功,确认按钮跳转到首页
|
||||
uni.switchTab({
|
||||
url: '/pages/common/index/index'
|
||||
})
|
||||
|
||||
} else {
|
||||
// 开始连接逻辑
|
||||
uni.showLoading({
|
||||
@ -54,7 +57,7 @@
|
||||
title: '加载中....'
|
||||
})
|
||||
this.isConnecting = true;
|
||||
this.isConnectNo=true
|
||||
this.isConnectNo = true
|
||||
try {
|
||||
// 调用绑定设备接口
|
||||
const res = await deviceBind({
|
||||
@ -62,10 +65,10 @@
|
||||
deviceMac: '',
|
||||
communicationMode: '0', //0是4g,1是蓝牙
|
||||
})
|
||||
console.log(this.deviceId,'deerer ere');
|
||||
console.log(this.deviceId, 'deerer ere');
|
||||
if (res.code == 200) {
|
||||
this.isConnectNo=false
|
||||
this.isSuccess =true
|
||||
this.isConnectNo = false
|
||||
this.isSuccess = true
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: res.data,
|
||||
@ -73,7 +76,7 @@
|
||||
});
|
||||
this.isConnecting = true;
|
||||
} else {
|
||||
this.isConnectNo=false
|
||||
this.isConnectNo = false
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
});
|
||||
|
Reference in New Issue
Block a user