list
This commit is contained in:
@@ -53,7 +53,7 @@ Page({
|
|||||||
})
|
})
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
wx.navigateBack({
|
wx.navigateBack({
|
||||||
delta: 1
|
delta: 2
|
||||||
})
|
})
|
||||||
}, 1500);
|
}, 1500);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -164,37 +164,45 @@ Page({
|
|||||||
this.setData({
|
this.setData({
|
||||||
devicesList: res
|
devicesList: res
|
||||||
});
|
});
|
||||||
|
this.selectDevice();
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
selectDevice() {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setData({
|
if(this.data.devicesList && this.data.devicesList.length) {
|
||||||
getDeviceSetting: false,
|
this.setData({
|
||||||
initText: "设备搜索完成"
|
getDeviceSetting: false,
|
||||||
});
|
initText: "设备搜索完成"
|
||||||
app.globalData.ppScale.plugin.Blue.stopBluetoothDevicesDiscovery();
|
});
|
||||||
app.globalData.ppScale.device.list = this.data.devicesList;
|
app.globalData.ppScale.plugin.Blue.stopBluetoothDevicesDiscovery();
|
||||||
if(this.data.devicesList.length === 1) {
|
app.globalData.ppScale.device.list = this.data.devicesList;
|
||||||
app.globalData.ppScale.device.connection = this.data.devicesList[0];
|
if(this.data.devicesList.length === 1) {
|
||||||
wx.navigateTo({
|
app.globalData.ppScale.device.connection = this.data.devicesList[0];
|
||||||
url: "/pages/connectedDevice/connectedDevice"
|
wx.navigateTo({
|
||||||
})
|
url: "/pages/connectedDevice/connectedDevice"
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
let itemLists = this.data.devicesList.map(item => item.name);
|
||||||
|
wx.showActionSheet({
|
||||||
|
itemList: itemLists,
|
||||||
|
alertText: "请选择你要使用的设备",
|
||||||
|
success: (res) => {
|
||||||
|
app.globalData.ppScale.device.connection = this.data.devicesList[res.tapIndex];
|
||||||
|
wx.navigateTo({
|
||||||
|
url: "/pages/connectedDevice/connectedDevice"
|
||||||
|
})
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
wx.navigateBack({
|
||||||
|
delta: 1
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
let itemLists = this.data.devicesList.map(item => item.name);
|
this.selectDevice();
|
||||||
wx.showActionSheet({
|
|
||||||
itemList: itemLists,
|
|
||||||
alertText: "请选择你要使用的设备",
|
|
||||||
success: (res) => {
|
|
||||||
app.globalData.ppScale.device.connection = this.data.devicesList[res.tapIndex];
|
|
||||||
wx.navigateTo({
|
|
||||||
url: "/pages/connectedDevice/connectedDevice"
|
|
||||||
})
|
|
||||||
},
|
|
||||||
fail: () => {
|
|
||||||
wx.navigateBack({
|
|
||||||
delta: 1
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}, 3000)
|
}, 3000);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
Reference in New Issue
Block a user