|
@@ -71,6 +71,14 @@ Page({
|
|
|
// 更新
|
|
|
else if (that.data.deviceListIndex !== null) {
|
|
|
that.actionDevice(that.data.deviceListIndex);
|
|
|
+ } else if (app.globalData.client == null) {
|
|
|
+ app.connect();
|
|
|
+ } else if (that.data.deviceListIndex == null && that.data.deviceList.length > 0) {
|
|
|
+ that.actionDevice(0)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (app.globalData.client == null) {
|
|
|
+ app.connect();
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -79,7 +87,6 @@ Page({
|
|
|
onDeviceLoad() {
|
|
|
var that = this;
|
|
|
var devicelist = wx.getStorageSync("devicelist") || "";
|
|
|
- console.log("gadfasdfqwerqwerqewrqr====" + devicelist);
|
|
|
if (!strings.isEmpty(devicelist)) {
|
|
|
var list = JSON.parse(devicelist);
|
|
|
that.updateDeviceList(list, true);
|
|
@@ -132,16 +139,20 @@ Page({
|
|
|
payloads = JSON.parse(option.payload);
|
|
|
};
|
|
|
|
|
|
+ console.log("gadsfadsfadsfa==8888===" + type);
|
|
|
switch (type) {
|
|
|
///连接成功订阅
|
|
|
case "connect":
|
|
|
that.subscribeDevicesStatus();
|
|
|
break;
|
|
|
case "message_onoffline":
|
|
|
- that.online(payloads);
|
|
|
+ that.onlineDevice(payloads);
|
|
|
break;
|
|
|
case "message":
|
|
|
// 接收设备播放信息
|
|
|
+ // if (!that.data.isLogin) {
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
if (payloads.type === "get_position" && payloads.other) {
|
|
|
let actionIndex = null;
|
|
|
that.data.channelData.map((v, index) => {
|
|
@@ -235,7 +246,7 @@ Page({
|
|
|
///连上就调用2次 处理离线在线问题 wifi设备 BLUFI_
|
|
|
/// payloads:{"uuid":"AIrSMArT_7cdfa1fcbb24","state":"online","userid":"1"}
|
|
|
// [{"deviceId":"BLUFI_7cdfa1fcbb24","name":"BLUFI_7cdfa1fcbb24","state":"online","ProdModel":"MW-2AX(WIFI-N)","devName":"猫王小王子OTR-X"}]
|
|
|
- online(payloads) {
|
|
|
+ onlineDevice(payloads) {
|
|
|
// 设置在线状态
|
|
|
var that = this;
|
|
|
console.log("gadsfadsfadsfa==777===" + JSON.stringify(payloads));
|
|
@@ -536,6 +547,9 @@ Page({
|
|
|
|
|
|
actionDevice(index) {
|
|
|
var that = this;
|
|
|
+ if (!that.data.isLogin) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (that.data.deviceList.length <= index) {
|
|
|
return;
|
|
|
};
|