|
@@ -234,25 +234,22 @@ Page({
|
|
|
mqttCallback(type, option) {
|
|
|
// console.log("gadsfadsfadsfa==888===" + type);
|
|
|
var that = this;
|
|
|
+
|
|
|
let payloads = null;
|
|
|
if (option) {
|
|
|
payloads = JSON.parse(option.payload);
|
|
|
};
|
|
|
|
|
|
switch (type) {
|
|
|
- ///连接成功订阅
|
|
|
+ ///先走订阅
|
|
|
case "connect":
|
|
|
that.subscribeDevicesStatus();
|
|
|
break;
|
|
|
+ ///再走有在线
|
|
|
case "message_onoffline":
|
|
|
that.onlineDevice(payloads);
|
|
|
break;
|
|
|
case "message":
|
|
|
- // 接收设备播放信息
|
|
|
- // if (!that.data.isLogin) {
|
|
|
- // return;
|
|
|
- // }
|
|
|
-
|
|
|
///获取频道数据
|
|
|
///锁定播放哪一个频道
|
|
|
if (payloads.type === "get_position" && payloads.other) {
|
|
@@ -401,7 +398,9 @@ Page({
|
|
|
var list = that.data.deviceList;
|
|
|
for (var i = 0; i < list.length; i++) {
|
|
|
if (list[i].state === "online" && list[i].connectType == 3) {
|
|
|
- that.actionDevice(i);
|
|
|
+ if (that.data.isLogin) {
|
|
|
+ that.actionDevice(i);
|
|
|
+ }
|
|
|
break;
|
|
|
}
|
|
|
}
|