| | |
| | | </view> |
| | | <view v-if="connectState == 3" class="button-group"> |
| | | <a-button type="primary" plain="true" class="button" @click="clickTry"> |
| | | {{reconnectFlag ? "重新连接WiFi":"再试"}} |
| | | {{reconnectFlag ? "重新连接WiFi":"重试"}} |
| | | </a-button> |
| | | <a-button type="ghost" class="button" @click="clickCancel">取消 |
| | | </a-button> |
| | |
| | | const result = res.result || "" |
| | | const arCode = result.split(";") |
| | | if (arCode.length != 3) { |
| | | showModal("无效的二维码!", "提示") |
| | | this.showError("无效的二维码!") |
| | | return |
| | | } |
| | | if (!arCode[0].trim() || !arCode[0].trim()) { |
| | | showModal("无效的二维码!", "提示") |
| | | this.showError("无效的二维码!") |
| | | return |
| | | } |
| | | that.ip = arCode[0] |
| | |
| | | } |
| | | this.connectState = 1 |
| | | |
| | | this.checkConnectVehicle() |
| | | this.checkConnectVehicle(60) |
| | | }, |
| | | clickStudyMore() { |
| | | showToast("后续发开中") |
| | |
| | | androidWifi.connectWifi(this.wifiSID, |
| | | this.wifiPassword |
| | | ) |
| | | this.checkConnectVehicle() |
| | | this.checkConnectVehicle(60) |
| | | // |
| | | } else { |
| | | if (first) { |
| | |
| | | } |
| | | this.connectState = 1 |
| | | |
| | | this.checkConnectVehicle() |
| | | this.checkConnectVehicle(60) |
| | | |
| | | } |
| | | } else { |
| | |
| | | async connectVehicle() { |
| | | try { |
| | | const info = await mtBattery(this.ip) |
| | | console.log(this.ip) |
| | | this.connectState = 2 |
| | | this.connectedSuccess() |
| | | } catch (ex) { |
| | | console.log("connectVehicle faile",this.ip,ex) |
| | | this.connectState = 3 |
| | | // this.showError(ex) |
| | | } |
| | |
| | | }) |
| | | }, 1000) |
| | | }, |
| | | checkConnectVehicle() { |
| | | checkConnectVehicle(sec) { |
| | | if (this.unloadFlag) { |
| | | return |
| | | } |
| | | if(sec <= 0) |
| | | { |
| | | this.connectState = 3 |
| | | return |
| | | } |
| | | checkIpLinkSuccess(this.ip).then((res) => { |
| | |
| | | } |
| | | }).catch((ex) => { |
| | | setTimeout(() => { |
| | | this.checkConnectVehicle() |
| | | this.checkConnectVehicle(sec- 7) |
| | | }, 2000) |
| | | }) |
| | | }, |
| | |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | let tip = typeof ex.msg == "string" ? ex.msg : exStr |
| | | showModal(tip, "错误", false) |
| | | showModal(tip, "错误", false,"确定") |
| | | }, |
| | | |
| | | } |