|
@@ -45,7 +45,6 @@ Page({
|
|
|
isSetWake: false,
|
|
|
thisDeviceMac: null,
|
|
|
battery: 4, // 0≤电量<20,0格
|
|
|
- newVersion: false,
|
|
|
|
|
|
////我的界面
|
|
|
loginStatus: true,
|
|
@@ -102,22 +101,6 @@ Page({
|
|
|
|
|
|
onHomeLoad() {
|
|
|
var that = this;
|
|
|
- // 版本自动更新代码
|
|
|
- const updateManager = wx.getUpdateManager();
|
|
|
- updateManager.onUpdateReady(function () {
|
|
|
- that.setData({
|
|
|
- newVersion: true
|
|
|
- });
|
|
|
- })
|
|
|
- updateManager.onUpdateFailed(function () {
|
|
|
- // 新的版本下载失败
|
|
|
- wx.showModal({
|
|
|
- title: '已有新版本咯',
|
|
|
- content: '请您删除当前小程序,重新打开呦~',
|
|
|
- showCancel: false
|
|
|
- })
|
|
|
- })
|
|
|
-
|
|
|
// wx.showLoading({
|
|
|
// title: '加载中',
|
|
|
// });
|
|
@@ -145,7 +128,6 @@ Page({
|
|
|
},
|
|
|
|
|
|
onMeLoad() {
|
|
|
- // wx.getStorage("userInfo")
|
|
|
var that = this;
|
|
|
wx.getStorage({
|
|
|
key: "userInfo",
|
|
@@ -588,11 +570,10 @@ Page({
|
|
|
// other
|
|
|
// });
|
|
|
}
|
|
|
-
|
|
|
})
|
|
|
},
|
|
|
|
|
|
- goChnnel() {
|
|
|
+ goChannel() {
|
|
|
var that = this;
|
|
|
wx.setStorage({
|
|
|
key: "channelDeta",
|
|
@@ -610,13 +591,6 @@ Page({
|
|
|
wx.getUpdateManager().applyUpdate()
|
|
|
},
|
|
|
|
|
|
- updataClone() {
|
|
|
- var that = this;
|
|
|
- that.setData({
|
|
|
- newVersion: false
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
onUnload() {
|
|
|
if (app.globalData.client === null) {
|
|
|
return;
|
|
@@ -699,19 +673,29 @@ Page({
|
|
|
|
|
|
///点击item
|
|
|
// [{"deviceId":"BLUFI_7cdfa1fcbb24","name":"BLUFI_7cdfa1fcbb24","state":"online","ProdModel":"MW-2AX(WIFI-N)","devName":"猫王小王子OTR-X"}]
|
|
|
- onTapIem(e) {
|
|
|
+ onTapItem(e) {
|
|
|
var that = this;
|
|
|
var item = e.currentTarget.dataset.item;
|
|
|
var ProdModel = item.ProdModel;
|
|
|
if (ProdModel == "MW-2AX(WIFI-N)") {
|
|
|
+ console.log("gadfadsfadsfaf===aa");
|
|
|
if (e.currentTarget.dataset.index === that.data.deviceListIndex) {
|
|
|
+ console.log("gadfadsfadsfaf===bbb");
|
|
|
that.goWake();
|
|
|
} else {
|
|
|
+ console.log("gadfadsfadsfaf===ccc");
|
|
|
that.actionDevice(e.currentTarget.dataset.index)
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
|
///去蓝牙连接处理
|
|
|
+ that.addConnectBlueDevice({
|
|
|
+ deviceId: item.deviceId,
|
|
|
+ name: item.devName,
|
|
|
+ state: item.state,
|
|
|
+ clientType: item.ProdModel,
|
|
|
+ mac: item.mac,
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
actionDevice(index) {
|
|
@@ -720,6 +704,7 @@ Page({
|
|
|
if (device.state !== "online") {
|
|
|
return;
|
|
|
};
|
|
|
+
|
|
|
// 取消订阅
|
|
|
if (that.data.thisDeviceMac !== null) {
|
|
|
app.unsubscribe(`/${that.data.thisDeviceMac}/user/pub_response`);
|
|
@@ -856,10 +841,11 @@ Page({
|
|
|
var that = this;
|
|
|
// 同一个设备
|
|
|
var deviceList = that.data.deviceList;
|
|
|
- var tempList = deviceList.filter((v) => v.deviceId === newDevice.name);
|
|
|
+ var tempList = deviceList.filter((v) => v.deviceId === newDevice.deviceId);
|
|
|
if (tempList && tempList.length > 0) {
|
|
|
- deviceList = deviceList.filter((v) => v.deviceId !== newDevice.name);
|
|
|
+ deviceList = deviceList.filter((v) => v.deviceId !== newDevice.deviceId);
|
|
|
};
|
|
|
+
|
|
|
deviceList.unshift({
|
|
|
/// 蓝牙ble连接
|
|
|
connectType: 1,
|
|
@@ -868,6 +854,7 @@ Page({
|
|
|
state: "online",
|
|
|
ProdModel: newDevice.clientType,
|
|
|
devName: newDevice.name,
|
|
|
+ mac: newDevice.mac,
|
|
|
});
|
|
|
|
|
|
var finalList = that.updateDeviceList(deviceList);
|
|
@@ -968,4 +955,12 @@ Page({
|
|
|
return finalList;
|
|
|
},
|
|
|
|
|
|
-})
|
|
|
+})
|
|
|
+
|
|
|
+
|
|
|
+// updataClone() {
|
|
|
+// var that = this;
|
|
|
+// that.setData({
|
|
|
+// newVersion: false
|
|
|
+// })
|
|
|
+// },
|