|
@@ -1,9 +1,17 @@
|
|
|
-const { BtHelper } = require("../../../devices/bt_helper");
|
|
|
-import { EnumCmdEvent, CmdEvent } from '../../../devices/cmd_key_event';
|
|
|
+const {
|
|
|
+ BtHelper
|
|
|
+} = require("../../../devices/bt_helper");
|
|
|
+import {
|
|
|
+ EnumCmdEvent,
|
|
|
+ CmdEvent
|
|
|
+} from '../../../devices/cmd_key_event';
|
|
|
import eventBus from '../../../utils/eventBus'
|
|
|
import routeUtil from '../../../utils/routeUtil';
|
|
|
import routePath from '../../../utils/routePath.js';
|
|
|
-import { BtCmd } from '../../../devices/bluetooth/bt_cmd.js';
|
|
|
+import routeRoot from '../../../utils/routeRoot.js';
|
|
|
+import {
|
|
|
+ BtCmd
|
|
|
+} from '../../../devices/bluetooth/bt_cmd.js';
|
|
|
import strings from '../../../utils/strings.js';
|
|
|
const {
|
|
|
deviceVersion
|
|
@@ -182,14 +190,14 @@ Page({
|
|
|
} else {
|
|
|
_this.downloadOtaFile(urlPath, localPath)
|
|
|
}
|
|
|
- }, fail(err) {
|
|
|
+ },
|
|
|
+ fail(err) {
|
|
|
// 文件不存在或其他错误
|
|
|
console.log(err)
|
|
|
// 文件不存在,开始下载
|
|
|
_this.downloadOtaFile(urlPath, localPath)
|
|
|
}
|
|
|
- }
|
|
|
- );
|
|
|
+ });
|
|
|
},
|
|
|
downloadOtaFile(urlPath, localPath) {
|
|
|
let _this = this;
|
|
@@ -302,7 +310,8 @@ Page({
|
|
|
}
|
|
|
_this.sendOtaData(this.data._chunks, 0)
|
|
|
// }
|
|
|
- }, sendOtaData(imageBuffer, index) {
|
|
|
+ },
|
|
|
+ sendOtaData(imageBuffer, index) {
|
|
|
let _this = this
|
|
|
|
|
|
if (index >= imageBuffer.length) {
|
|
@@ -365,15 +374,14 @@ Page({
|
|
|
}
|
|
|
},
|
|
|
otaSuccess() {
|
|
|
-
|
|
|
var pages = getCurrentPages();
|
|
|
var length = pages.length;
|
|
|
var currentPage = pages[length - 1];
|
|
|
- console.log("currentPage==", currentPage.route)
|
|
|
- if (currentPage.route == "pages/setWifi/setWifi") {
|
|
|
- console.log("currentPage==222", currentPage.route)
|
|
|
+
|
|
|
+ if (currentPage.route == routeRoot.setWifi) {
|
|
|
currentPage.wifiPageSuccess()
|
|
|
}
|
|
|
+
|
|
|
wx.hideLoading();
|
|
|
// 流程成功
|
|
|
wx.showModal({
|
|
@@ -427,8 +435,7 @@ Page({
|
|
|
_this.otaFailure()
|
|
|
} else if (otaCmd === 0 && kind == 1) {
|
|
|
_this.otaSuccess()
|
|
|
- }
|
|
|
- else if (kind == 0) {
|
|
|
+ } else if (kind == 0) {
|
|
|
|
|
|
}
|
|
|
break;
|