From ff934f8fc407d0aadefc3303994613d64178120e Mon Sep 17 00:00:00 2001
From: Novecane <2322740715@qq.com>
Date: 星期一, 17 二月 2025 16:12:00 +0800
Subject: [PATCH] forth commit

---
 pages/router/deviceInfo/index.vue |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/pages/router/deviceInfo/index.vue b/pages/router/deviceInfo/index.vue
index ec08cd8..4501dc1 100644
--- a/pages/router/deviceInfo/index.vue
+++ b/pages/router/deviceInfo/index.vue
@@ -72,6 +72,9 @@
 	const flag = ref(false);
 	// 定义一个变量来存储定时器ID
 	let positionInterval;
+	// 控制 toast 是否已经显示的标志
+	let toastShown = false;
+
 
 	// 生命周期钩子 - 相当于 Vue 2 的 onLoad
 	onMounted(async () => {
@@ -92,24 +95,22 @@
 			console.error('Failed to fetch device info:', error);
 		}
 	}, );
-
 	const startGetPosition = () => {
+		uni.showLoading({
+			title: "正在操作设备",
+			mask: true
+		})
 		// 如果定时器已经存在,则先清除它
 		if (positionInterval) {
 			clearInterval(positionInterval);
 		}
-		uni.showToast({
-			title:"操作设备中",
-			icon:"loading",
-			mask:true,
-			duration:3500
-		})
 		// 设置定时器
 		positionInterval = setInterval(() => {
 			getControlInfo(state.value.facilityCode).then((res) => {
 				if (res.data.position >= 100) {
 					flag.value = false;
 					clearInterval(positionInterval); // 使用存储的定时器ID来清除定时器
+					uni.hideLoading(); // 隐藏加载框
 				}
 			}).catch((error) => {
 				console.error('Error fetching control info:', error); // 错误处理

--
Gitblit v1.9.3