|
@@ -1,7 +1,8 @@
|
|
|
const app = getApp();
|
|
|
const {
|
|
|
login,
|
|
|
- listByDevice
|
|
|
+ listByDevice,
|
|
|
+ getBanner
|
|
|
} = require('../../utils/api.js');
|
|
|
|
|
|
import time_util from '../../utils/time_util.js';
|
|
@@ -78,13 +79,14 @@ Page({
|
|
|
|
|
|
deviceMacId: null,
|
|
|
deviceListSelect: null,
|
|
|
- deviceList: [{
|
|
|
- "connectType": 3,
|
|
|
- // "mac": "AIrSMArT_861210052356337",
|
|
|
- // "deviceId": "D0:31:10:86:AC:9A"
|
|
|
- "name": "MW-X4(BZK)",
|
|
|
- "deviceId": "AIrSMArT_861210052356337"
|
|
|
- }],
|
|
|
+ deviceList:[],
|
|
|
+ // deviceList: [{
|
|
|
+ // "connectType": 3,
|
|
|
+ // // "mac": "AIrSMArT_861210052356337",
|
|
|
+ // // "deviceId": "D0:31:10:86:AC:9A"
|
|
|
+ // "name": "MW-X4(BZK)",
|
|
|
+ // "deviceId": "AIrSMArT_861210052356337"
|
|
|
+ // }],
|
|
|
_willConnectBle: null,
|
|
|
_hasShowModal: null,
|
|
|
// deviceList: [{
|
|
@@ -896,11 +898,11 @@ Page({
|
|
|
console.log("有蓝牙设备上线")
|
|
|
that.stopIntervalId1();
|
|
|
} else {
|
|
|
- let onLineBle = deviceList.find(item => {
|
|
|
- return item.state == "online" && item.connectType === 1
|
|
|
+ // 有wifi设备在线
|
|
|
+ let wifiDevice = deviceList.find(item => {
|
|
|
+ return item.state == "online" && item.connectType === 3
|
|
|
})
|
|
|
- if (!onLineBle) {
|
|
|
- // 没有在线的蓝牙
|
|
|
+ if (!wifiDevice) {
|
|
|
that.startBleTimer(isFirst);
|
|
|
}
|
|
|
}
|
|
@@ -917,15 +919,16 @@ Page({
|
|
|
console.log("没有找到在线的对应的蓝牙设备")
|
|
|
return;
|
|
|
}
|
|
|
- that.disconnectDev(event, disDevice)
|
|
|
+
|
|
|
disDevice.state = event.commonValue;
|
|
|
console.log("首页设备状态变化", disDevice.state, disDevice.deviceId)
|
|
|
|
|
|
if (event.commonValue == "online") {
|
|
|
// BtHelper.getInstance().connect()
|
|
|
- console.log("首页上线连接", disDevice)
|
|
|
+ console.log("首页连接上线", disDevice)
|
|
|
} else {
|
|
|
- console.log("首页断开连接", disDevice)
|
|
|
+ that.disconnectDev(event, disDevice)
|
|
|
+ console.log("首页连接断开", disDevice)
|
|
|
that.updateDeviceList(deviceList, false, false);
|
|
|
}
|
|
|
}
|
|
@@ -991,8 +994,22 @@ Page({
|
|
|
|
|
|
///点击banner事件
|
|
|
onTapBanner(e) {
|
|
|
- var that = this;
|
|
|
var item = e.currentTarget.dataset.item;
|
|
|
+ try {
|
|
|
+ if (strings.isEmpty(item.forwardUrl)) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (item.forwardType == 0) {
|
|
|
+ // 内链,暂时不支持
|
|
|
+ route_util.jump(item.forwardUrl, item.forwardUrl);
|
|
|
+ } else if (item.forwardType == 1) {
|
|
|
+ // 外链
|
|
|
+ route_util.jumpParam(route_constant.webview, item.forwardUrl);
|
|
|
+ }
|
|
|
+ } catch (err) {
|
|
|
+ console.log("跳转失败", err)
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
|
|
|
///添加设备
|
|
@@ -1158,12 +1175,13 @@ Page({
|
|
|
|
|
|
onBannerShow() {
|
|
|
var that = this;
|
|
|
- // getBanner({}).then((res) => {
|
|
|
- // that.setData({
|
|
|
- // bannerList: res
|
|
|
- // });
|
|
|
- // store.setStore("homeBanner", res);
|
|
|
- // })
|
|
|
+ getBanner({}).then((res) => {
|
|
|
+ console.log("banner:", res)
|
|
|
+ that.setData({
|
|
|
+ bannerList: res
|
|
|
+ });
|
|
|
+ store.setStore("homeBanner", res);
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
stopIntervalId1: function () {
|