cuiqian2004
2025-09-12 d87c256a957a6a5c3b40eaf9c52ec68f2fc22c97
pages/index/connect.vue
@@ -37,7 +37,7 @@
      </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>
@@ -181,11 +181,11 @@
                     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]
@@ -219,7 +219,7 @@
            }
            this.connectState = 1
            this.checkConnectVehicle()
            this.checkConnectVehicle(60)
         },
         clickStudyMore() {
            showToast("后续发开中")
@@ -241,7 +241,7 @@
                        androidWifi.connectWifi(this.wifiSID,
                           this.wifiPassword
                        )
                        this.checkConnectVehicle()
                        this.checkConnectVehicle(60)
                        // 
                     } else {
                        if (first) {
@@ -261,7 +261,7 @@
                  }
                  this.connectState = 1
                  this.checkConnectVehicle()
                  this.checkConnectVehicle(60)
               }
            } else {
@@ -285,9 +285,11 @@
         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)
            }
@@ -336,8 +338,13 @@
               })
            }, 1000)
         },
         checkConnectVehicle() {
         checkConnectVehicle(sec) {
            if (this.unloadFlag) {
               return
            }
            if(sec <= 0)
            {
               this.connectState = 3
               return
            }
            checkIpLinkSuccess(this.ip).then((res) => {
@@ -349,7 +356,7 @@
               }
            }).catch((ex) => {
               setTimeout(() => {
                  this.checkConnectVehicle()
                  this.checkConnectVehicle(sec- 7)
               }, 2000)
            })
         },
@@ -358,7 +365,7 @@
            if (exStr == "{}")
               exStr = ex
            let tip = typeof ex.msg == "string" ? ex.msg : exStr
            showModal(tip, "错误", false)
            showModal(tip, "错误", false,"确定")
         },
      }