|
@@ -90,7 +90,7 @@ Page({
|
|
|
onDeviceLoad() {
|
|
|
var that = this;
|
|
|
var deviceList = store.getStore("deviceList");
|
|
|
- if (!strings.isEmpty(deviceList)) {
|
|
|
+ if (!strings.isEmpty(deviceList)) {
|
|
|
that.updateDeviceList(deviceList, true, false);
|
|
|
}
|
|
|
|
|
@@ -136,9 +136,11 @@ Page({
|
|
|
lexin_connect.searchOnlineDevice(payloads, function (list) {
|
|
|
that.updateDeviceList(list, false, false);
|
|
|
}, function () {
|
|
|
+ var indexPage = that.data.indexPage;
|
|
|
that.setData({
|
|
|
actionIndex: null,
|
|
|
deviceListSelect: null,
|
|
|
+ indexPage: indexPage == 1 ? 0 : indexPage,
|
|
|
});
|
|
|
});
|
|
|
break;
|
|
@@ -330,10 +332,12 @@ Page({
|
|
|
if (!strings.isEmpty(deviceMacId)) {
|
|
|
var pubResponse = lexin_util.getResponseByDeviceMacId(deviceMacId);
|
|
|
app.unsubscribe(pubResponse);
|
|
|
+ var indexPage = that.data.indexPage;
|
|
|
that.setData({
|
|
|
deviceMacId: null,
|
|
|
actionIndex: null,
|
|
|
deviceListSelect: null,
|
|
|
+ indexPage: indexPage == 1 ? 0 : indexPage,
|
|
|
});
|
|
|
};
|
|
|
}
|
|
@@ -476,17 +480,12 @@ Page({
|
|
|
});
|
|
|
|
|
|
store.setStore("deviceList", deviceList);
|
|
|
- if (isCurrentIndex) {
|
|
|
- that.setData({
|
|
|
- deviceListSelect: null,
|
|
|
- deviceList: deviceList,
|
|
|
- });
|
|
|
- } else {
|
|
|
- that.setData({
|
|
|
- deviceList: deviceList,
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
+ var indexPage = that.data.indexPage;
|
|
|
+ that.setData({
|
|
|
+ deviceList: deviceList,
|
|
|
+ indexPage: indexPage == 1 ? 0 : indexPage,
|
|
|
+ deviceListSelect: isCurrentIndex ? null : deviceListSelect,
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
/// 断开连接wifi
|
|
@@ -517,18 +516,14 @@ Page({
|
|
|
});
|
|
|
|
|
|
store.setStore("deviceList", deviceList);
|
|
|
- if (isCurrentIndex) {
|
|
|
- that.setData({
|
|
|
- deviceList: deviceList,
|
|
|
- deviceMacId: null,
|
|
|
- actionIndex: null,
|
|
|
- deviceListSelect: null,
|
|
|
- });
|
|
|
- } else {
|
|
|
- that.setData({
|
|
|
- deviceList: deviceList,
|
|
|
- });
|
|
|
- }
|
|
|
+ var indexPage = that.data.indexPage;
|
|
|
+ that.setData({
|
|
|
+ deviceList: deviceList,
|
|
|
+ deviceMacId: isCurrentIndex ? null : deviceMacId,
|
|
|
+ actionIndex: isCurrentIndex ? null : actionIndex,
|
|
|
+ deviceListSelect: isCurrentIndex ? null : deviceListSelect,
|
|
|
+ indexPage: indexPage == 1 ? 0 : indexPage,
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
/// 新添加蓝牙设备
|
|
@@ -558,9 +553,12 @@ Page({
|
|
|
var deviceId = device.deviceId;
|
|
|
var addDeviceList = lexin_add.addWifiDevice(device);
|
|
|
that.updateDeviceList(addDeviceList, false, false);
|
|
|
+
|
|
|
+ var indexPage = that.data.indexPage;
|
|
|
that.setData({
|
|
|
deviceListSelect: null,
|
|
|
connectDeviceIding: deviceId,
|
|
|
+ indexPage: indexPage == 1 ? 0 : indexPage,
|
|
|
});
|
|
|
lexin_subscribe.subscribeSingleDevice(device);
|
|
|
},
|