From fb026e6052b4d843d327312db398cf791ac57ab9 Mon Sep 17 00:00:00 2001
From: cyy <cuiqian2004@163.com>
Date: 星期日, 28 九月 2025 22:43:29 +0800
Subject: [PATCH] test

---
 pages/index/connect.vue |   45 +++++++++++++++++++++++----------------------
 1 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/pages/index/connect.vue b/pages/index/connect.vue
index 9fcc16b..9fddb1c 100644
--- a/pages/index/connect.vue
+++ b/pages/index/connect.vue
@@ -11,14 +11,14 @@
 		<view class="content" v-else-if="connectState == 2">
 			<view class="title">杩炴帴鎴愬姛</view>
 			<view class="content2">
-				<image class="img" src="/images/Frame 178.svg" alt=" 鍥剧墖" />
+				<image class="img" src="/images/Frame_178.svg" alt=" 鍥剧墖" />
 				<view>銆恵{connectedDevice}}銆戣繛鎺ユ垚鍔�/view>
 			</view>
 		</view>
 		<view class="content" v-else-if="connectState == 3">
 			<view class="title">杩炴帴澶辫触</view>
 			<view class="content2">
-				<image class="img" src="/images/Frame 179.svg" alt=" 鍥剧墖" />
+				<image class="img" src="/images/Frame_179.svg" alt=" 鍥剧墖" />
 				<view class="title">鏃犳硶杩炴帴璁惧</view>
 				<view>璇风‘淇濊溅杈嗗紑鏈轰笖鏈笌鍏朵粬缁堢閰嶅</view>
 			</view>
@@ -29,7 +29,7 @@
 
 				<view>1銆佽灏嗘墜鏈鸿繛鎺ュ埌鈥榹{ip}}鈥欑殑Wifi缃戠粶</view>
 				<view>2銆佽繛鎺ュ悗鍥炲埌鏈簲鐢�/view>
-				<image class="img-2" src="/images/Frame 180.svg" alt=" 鍥剧墖" />
+				<image class="img-2" src="/images/Frame_180.svg" alt=" 鍥剧墖" />
 			</view>
 		</view>
 		<view class="content" v-else>
@@ -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>
@@ -56,7 +56,9 @@
 	import {
 		session,
 		showToast,
-		showModal
+		showModal,
+		showError,
+		showInfo
 	} from "@/comm/utils.js"
 	import {
 		Button
@@ -143,7 +145,7 @@
 
 
 				} catch (ex) {
-					this.showError(ex)
+					showError(ex)
 				}
 			},
 			checkConnectStatus() {
@@ -181,11 +183,11 @@
 							const result = res.result || ""
 							const arCode = result.split(";")
 							if (arCode.length != 3) {
-								showModal("鏃犳晥鐨勪簩缁寸爜锛�, "鎻愮ず")
+								showInfo("鏃犳晥鐨勪簩缁寸爜锛�)
 								return
 							}
 							if (!arCode[0].trim() || !arCode[0].trim()) {
-								showModal("鏃犳晥鐨勪簩缁寸爜锛�, "鎻愮ず")
+						showInfo("鏃犳晥鐨勪簩缁寸爜锛�)
 								return
 							}
 							that.ip = arCode[0]
@@ -219,7 +221,7 @@
 				}
 				this.connectState = 1
 
-				this.checkConnectVehicle()
+				this.checkConnectVehicle(60)
 			},
 			clickStudyMore() {
 				showToast("鍚庣画鍙戝紑涓�)
@@ -241,7 +243,7 @@
 								androidWifi.connectWifi(this.wifiSID,
 									this.wifiPassword
 								)
-								this.checkConnectVehicle()
+								this.checkConnectVehicle(60)
 								// 
 							} else {
 								if (first) {
@@ -261,7 +263,7 @@
 						}
 						this.connectState = 1
 
-						this.checkConnectVehicle()
+						this.checkConnectVehicle(60)
 
 					}
 				} else {
@@ -285,11 +287,13 @@
 			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)
+					// showError(ex)
 				}
 			},
 
@@ -336,8 +340,13 @@
 					})
 				}, 1000)
 			},
-			checkConnectVehicle() {
+			checkConnectVehicle(sec) {
 				if (this.unloadFlag) {
+					return
+				}
+				if(sec <= 0)
+				{
+					this.connectState = 3
 					return
 				}
 				checkIpLinkSuccess(this.ip).then((res) => {
@@ -349,18 +358,10 @@
 					}
 				}).catch((ex) => {
 					setTimeout(() => {
-						this.checkConnectVehicle()
+						this.checkConnectVehicle(sec- 7)
 					}, 2000)
 				})
 			},
-			showError(ex) {
-				let exStr = JSON.stringify(ex)
-				if (exStr == "{}")
-					exStr = ex
-				let tip = typeof ex.msg == "string" ? ex.msg : exStr
-				showModal(tip, "閿欒", false)
-			},
-
 		}
 	}
 </script>

--
Gitblit v1.9.1