|
@@ -14,7 +14,6 @@ Page({
|
|
|
showCapsule: 1, //是否显示左上角图标 1表示显示 0表示不显示
|
|
|
title: '设备详情', //导航栏 中间的标题
|
|
|
},
|
|
|
- hasNew: false,
|
|
|
// 页面数据
|
|
|
device: {},
|
|
|
btHelper: null,
|
|
@@ -24,13 +23,13 @@ Page({
|
|
|
},
|
|
|
checkOtaVersion(device) {
|
|
|
let _this = this;
|
|
|
- console.log("OTA:", device);
|
|
|
+ console.log("OTA1:", device);
|
|
|
deviceVersion(device.clientType, device.connectType, device.version).then(res => {
|
|
|
- console.log("OTA:", res);
|
|
|
+ console.log("OTA2:", res);
|
|
|
let updateData = res.data ?? {};
|
|
|
let hasNewVersion = updateData.isEnforcement === 1 || updateData.isEnforcement === 2;
|
|
|
+ updateData.hasNewVersion = hasNewVersion;
|
|
|
_this.setData({
|
|
|
- hasNew: hasNewVersion,
|
|
|
updateData: updateData
|
|
|
});
|
|
|
})
|
|
@@ -43,21 +42,15 @@ Page({
|
|
|
},
|
|
|
|
|
|
goToOta: function () {
|
|
|
- if (this.data.hasNew) {
|
|
|
- let param = {
|
|
|
- "device": this.data.device,
|
|
|
- "otaData": this.data.updateData,
|
|
|
- }
|
|
|
- let newParam = JSON.stringify(param);
|
|
|
- // wx.navigateTo({
|
|
|
- // url: '/pages/ota/ota' + "?param=" + param
|
|
|
- // });
|
|
|
- route_util.jumpParam('/pages/ota/ota', newParam)
|
|
|
- } else {
|
|
|
- wx.showToast({
|
|
|
- title: '没有新版本',
|
|
|
- })
|
|
|
+ let param = {
|
|
|
+ "device": this.data.device,
|
|
|
+ "otaData": this.data.updateData,
|
|
|
}
|
|
|
+ let newParam = JSON.stringify(param);
|
|
|
+ // wx.navigateTo({
|
|
|
+ // url: '/pages/ota/ota' + "?param=" + param
|
|
|
+ // });
|
|
|
+ route_util.jumpParam('/pages/ota/ota', newParam)
|
|
|
},
|
|
|
powerTap(e) {
|
|
|
console.log(e)
|