This commit is contained in:
3321822538@qq.com 2024-06-14 20:22:07 +08:00
parent a9d108e752
commit e5608a0ad1
3 changed files with 39 additions and 14 deletions

View File

@ -60,7 +60,8 @@
listobj: {}, listobj: {},
deviceId: '', deviceId: '',
name: '', name: '',
mac: '' mac: '',
macs:''
} }
}, },
onLoad(option) { onLoad(option) {
@ -183,6 +184,8 @@
let id = getQueryParam(decodedValue, 's') let id = getQueryParam(decodedValue, 's')
this.$u.get(`/app/device/${id}/bySn`).then((res) => { this.$u.get(`/app/device/${id}/bySn`).then((res) => {
if (res.code == 200) { if (res.code == 200) {
console.log(res,'resres');
this.macs = res.data.mac
this.qrResult = 'CTKG-' + res.data.mac this.qrResult = 'CTKG-' + res.data.mac
xBlufi.initXBlufi(1); xBlufi.initXBlufi(1);
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent); xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent);
@ -263,7 +266,7 @@
} }
let data = { let data = {
storeId: this.storeId, storeId: this.storeId,
mac: this.mac mac: this.macs
} }
this.$u.put('/app/device/bind', data).then((res) => { this.$u.put('/app/device/bind', data).then((res) => {
if (res.code == 200) { if (res.code == 200) {
@ -280,18 +283,28 @@
content: '你已绑定成功,需前去配网吗?', content: '你已绑定成功,需前去配网吗?',
success: function(res) { success: function(res) {
if (res.confirm) { if (res.confirm) {
let systemInfo = uni.getSystemInfoSync(); if(vm.mac == ''){
if (systemInfo.platform === 'android') { uni.showToast({
// Android title: '当前设备不在线',
uni.navigateTo({ icon: 'none',
url: '/page_components/wifilist/index?deviceId=' +options.data.deviceId + '&name=' +options.data.name duration: 2000
}) });
} else if (systemInfo.platform === 'ios') { }else{
// iOS let systemInfo = uni.getSystemInfoSync();
uni.navigateTo({ if (systemInfo.platform === 'android') {
url: '/page_fenbao/device/wifivideo?deviceId=' +options.data.deviceId + '&name=' +options.data.name // Android
}) uni.navigateTo({
url: '/page_components/wifilist/index?deviceId=' +options.data.deviceId + '&name=' +options.data.name
})
} else if (systemInfo.platform === 'ios') {
// iOS
uni.navigateTo({
url: '/page_fenbao/device/wifivideo?deviceId=' +options.data.deviceId + '&name=' +options.data.name
})
}
} }
} else if (res.cancel) { } else if (res.cancel) {
console.log('用户点击了取消'); console.log('用户点击了取消');
} }
@ -300,7 +313,7 @@
} else if (res.code == 500) { } else if (res.code == 500) {
uni.showToast({ uni.showToast({
title: '该设备已被绑定', title: res.msg,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}); });

View File

@ -144,6 +144,12 @@
setTimeout(() => { setTimeout(() => {
uni.navigateBack() uni.navigateBack()
}, 1000) }, 1000)
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration: 1000,
})
} }
}) })
} }

View File

@ -72,6 +72,12 @@
if (res.code == 200) { if (res.code == 200) {
this.$u.toast(`删除成功`); this.$u.toast(`删除成功`);
this.getlist() this.getlist()
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration: 1000,
})
} }
}); });