|
@@ -67,10 +67,6 @@ Page({
|
|
// 获取设备本地数据
|
|
// 获取设备本地数据
|
|
if (app.globalData.newDeviceId) {
|
|
if (app.globalData.newDeviceId) {
|
|
that.addNewDeviceId();
|
|
that.addNewDeviceId();
|
|
- }
|
|
|
|
- // 更新
|
|
|
|
- else if (that.data.deviceListIndex !== null) {
|
|
|
|
- that.actionDevice(that.data.deviceListIndex);
|
|
|
|
} else if (app.globalData.client == null) {
|
|
} else if (app.globalData.client == null) {
|
|
app.connect();
|
|
app.connect();
|
|
} else if (that.data.deviceListIndex == null && that.data.deviceList.length > 0) {
|
|
} else if (that.data.deviceListIndex == null && that.data.deviceList.length > 0) {
|
|
@@ -83,9 +79,9 @@ Page({
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
|
|
- ///开始时home的
|
|
|
|
onDeviceLoad() {
|
|
onDeviceLoad() {
|
|
var that = this;
|
|
var that = this;
|
|
|
|
+ console.log("gadfqrqwerqwerqrrqwer===222=");
|
|
var devicelist = wx.getStorageSync("devicelist") || "";
|
|
var devicelist = wx.getStorageSync("devicelist") || "";
|
|
if (!strings.isEmpty(devicelist)) {
|
|
if (!strings.isEmpty(devicelist)) {
|
|
var list = JSON.parse(devicelist);
|
|
var list = JSON.parse(devicelist);
|
|
@@ -133,13 +129,13 @@ Page({
|
|
|
|
|
|
// 回调
|
|
// 回调
|
|
mqttCallback(type, option) {
|
|
mqttCallback(type, option) {
|
|
|
|
+ console.log("gadsfadsfadsfa==888===" + type);
|
|
var that = this;
|
|
var that = this;
|
|
let payloads = null;
|
|
let payloads = null;
|
|
if (option) {
|
|
if (option) {
|
|
payloads = JSON.parse(option.payload);
|
|
payloads = JSON.parse(option.payload);
|
|
};
|
|
};
|
|
|
|
|
|
- console.log("gadsfadsfadsfa==8888===" + type);
|
|
|
|
switch (type) {
|
|
switch (type) {
|
|
///连接成功订阅
|
|
///连接成功订阅
|
|
case "connect":
|
|
case "connect":
|
|
@@ -690,6 +686,8 @@ Page({
|
|
deviceList = deviceList.filter((v) => v.deviceId !== newDevice.deviceId);
|
|
deviceList = deviceList.filter((v) => v.deviceId !== newDevice.deviceId);
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ console.log("gadsfqwerqr==00==" + deviceList.length);
|
|
|
|
+ console.log("gadsfqwerqr==11==" + JSON.stringify(deviceList));
|
|
deviceList.unshift({
|
|
deviceList.unshift({
|
|
/// 蓝牙ble连接
|
|
/// 蓝牙ble连接
|
|
connectType: 1,
|
|
connectType: 1,
|
|
@@ -701,8 +699,14 @@ Page({
|
|
mac: newDevice.mac,
|
|
mac: newDevice.mac,
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ console.log("gadsfqwerqr==222==" + deviceList.length);
|
|
|
|
+ console.log("gadsfqwerqr==333==" + JSON.stringify(deviceList));
|
|
|
|
+
|
|
///在线排序前面,wifi设备排序前面
|
|
///在线排序前面,wifi设备排序前面
|
|
that.updateDeviceList(deviceList, false);
|
|
that.updateDeviceList(deviceList, false);
|
|
|
|
+
|
|
|
|
+ console.log("gadsfqwerqr==444==" + that.data.deviceList.length);
|
|
|
|
+ console.log("gadsfqwerqr==555==" + JSON.stringify(that.data.deviceList));
|
|
var indexPage = that.data.indexPage;
|
|
var indexPage = that.data.indexPage;
|
|
if (indexPage != 0) {
|
|
if (indexPage != 0) {
|
|
that.setData({
|
|
that.setData({
|
|
@@ -746,6 +750,7 @@ Page({
|
|
|
|
|
|
///区分在线和离线
|
|
///区分在线和离线
|
|
for (var i = 0; i < deviceList.length; i++) {
|
|
for (var i = 0; i < deviceList.length; i++) {
|
|
|
|
+ console.log("gadfqrqwerqwerqrrqwer===111=" + isInit);
|
|
if (isInit) {
|
|
if (isInit) {
|
|
deviceList[i].state = "offline";
|
|
deviceList[i].state = "offline";
|
|
} else {
|
|
} else {
|