|
@@ -11,11 +11,12 @@ module.exports = {
|
|
|
///新添加蓝牙设备
|
|
|
function addBlueDevice(device) {
|
|
|
// 同一个设备处理
|
|
|
- var deviceList = getCurrentPages()[0].getDeviceList();
|
|
|
+ var pages = getCurrentPages();
|
|
|
+ var deviceList = pages[0].getDeviceList();
|
|
|
var tempList = deviceList.filter((v) => v.deviceId === device.deviceId);
|
|
|
const strings = require('../strings');
|
|
|
if (!strings.isEmpty(tempList)) {
|
|
|
- deviceList = deviceList.filter((v) => v.deviceId !== device.deviceId);
|
|
|
+ deviceList = tempList.filter((v) => v.deviceId !== device.deviceId);
|
|
|
}
|
|
|
/// 添加到第一个
|
|
|
deviceList.unshift({
|
|
@@ -27,7 +28,7 @@ function addBlueDevice(device) {
|
|
|
mac: device.mac,
|
|
|
ProdModel: device.ProdModel || device.clientType,
|
|
|
clientType: device.clientType || device.ProdModel,
|
|
|
- image: device.image,
|
|
|
+ imageUrl: device.imageUrl,
|
|
|
});
|
|
|
return deviceList;
|
|
|
};
|
|
@@ -36,11 +37,11 @@ function addBlueDevice(device) {
|
|
|
// [{"deviceId":"BLUFI_7cdfa1fcbb24","name":"BLUFI_7cdfa1fcbb24","state":"online"}]
|
|
|
function addWifiDevice(device) {
|
|
|
// 同一个设备处理
|
|
|
- var deviceList = getCurrentPages()[0].getDeviceList();
|
|
|
- var tempList = deviceList.filter((v) => v.deviceId === device.deviceId);
|
|
|
+ var pages = getCurrentPages();
|
|
|
+ var deviceList = pages[0].getDeviceList();
|
|
|
const strings = require('../strings');
|
|
|
- if (!strings.isEmpty(tempList)) {
|
|
|
- deviceList = deviceList.filter((v) => v.deviceId !== device.deviceId);
|
|
|
+ if (!strings.isEmpty(deviceList)) {
|
|
|
+ deviceList = deviceList.filter((v) => v.deviceId != device.deviceId);
|
|
|
}
|
|
|
/// 添加到第一个
|
|
|
deviceList.unshift(device);
|