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/index.vue |  248 +++++++++++++++++++++++++++++-------------------
 1 files changed, 149 insertions(+), 99 deletions(-)

diff --git a/pages/index/index.vue b/pages/index/index.vue
index d3e179b..e3c22da 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -20,63 +20,63 @@
 		<swiper v-if="pageList.length > 0" circular indicator-dots class="swiper" :current="currentPage"
 			@change="changeSwiper">
 			<swiper-item v-for="(page,index) in pageList" class="swiper-item">
-				<view class="vehicle-header">
-					<view class="link-view">
-						<view v-if="page.link_status">
-							<!-- <image class="img-battery-charging" src="/images/bx_battery3.svg" alt="SVG 鍥剧墖" /> -->
-							<image class="img-battery-charging" src="/images/bx_battery2.svg" alt="SVG 鍥剧墖" />
-							<image class="img-battery-soc" :style="{width:(page.soc*0.4)+'rpx'}"
-								src="/images/bx_battery4.svg" alt="SVG 鍥剧墖" />
+			
+					<view class="vehicle-header">
+						<view class="link-view">
+							<view v-if="page.link_status">
+								<!-- <image class="img-battery-charging" src="/images/bx_battery3.svg" alt="SVG 鍥剧墖" /> -->
+								<image class="img-battery-charging" src="/images/bx_battery2.svg" alt="SVG 鍥剧墖" />
+								<image class="img-battery-soc" :style="{width:(page.soc*0.4)+'rpx'}"
+									src="/images/bx_battery4.svg" alt="SVG 鍥剧墖" />
+
+							</view>
+							<view v-else>
+								<image class="img-battery" src="/images/bx_battery1.svg" alt="SVG 鍥剧墖" />
+							</view>
+							<template v-if="page.link_status">
+								<view class="soc-text">{{page.soc}}%</view>
+								<view class="status-text">{{getAgvStateText(page)}}</view>
+							</template>
+
+
+							<view v-else class="gray-text">宸茬绾�/view>
+						</view>
+					</view>
+					<image class="vehicle-img " :class="page.link_status ?'':'gray-image'" mode="aspectFit"
+						src="/images/che.png" alt="鍥剧墖" />
+					<view v-if="page.link_status" class="img-button-group">
+						<view type="primary" plain="true" class="img-text-button" @click="clickToMap(index,page)">
+							<a-button class="img-button" color='primary'>
+								<text class="ico map" />
+							</a-button>
+							<text>鍦烘櫙鏋勫缓</text>
 
 						</view>
-						<view v-else>
-							<image class="img-battery" src="/images/bx_battery1.svg" alt="SVG 鍥剧墖" />
+						<view type="primary" class="img-text-button" @click="clickToTask(page)">
+							<a-button class="img-button" color='primary'>
+								<text class="ico task-list" />
+							</a-button>
+							<text>浠诲姟璁板綍</text>
 						</view>
-						<template v-if="page.link_status">
-							<view class="soc-text">{{page.soc}}%</view>
-							<view class="status-text">{{getAgvStateText(page)}}</view>
-						</template>
-
-
-						<view v-else class="gray-text">宸茬绾�/view>
 					</view>
-				</view>
-				<image class="vehicle-img " :class="page.link_status ?'':'gray-image'" mode="aspectFit"
-					src="/images/image 11.png" alt="鍥剧墖" />
-				<view v-if="page.link_status" class="img-button-group">
-					<view type="primary" class="img-text-button" @click="clickToTask(index,page)">
-						<a-button class="img-button" color='primary' disabled>
-							<text class="ico task-list" />
-						</a-button>
-						<text>浠诲姟鍒楄〃</text>
-					</view>
-					<view type="primary" plain="true" class="img-text-button" @click="clickToMap(index,page)">
-						<a-button class="img-button" color='primary'>
-							<text class="ico map" />
-						</a-button>
-						<text>杩涘叆鍦板浘</text>
+					<view v-else class="unlink-content">
+						<view class="content2" v-if="page.conntecting">
+							<view class="auto-circle"></view>
+
+							<view class="text">杩炴帴涓�..</view>
+						</view>
+						<view class="content2" v-else>
+							<view class="text"> 杞﹁締宸茬绾匡紝璇烽噸鏂拌繛鎺�/view>
+							<a-button type="primary" class="button" @click="clickRelink">閲嶆柊杩炴帴
+							</a-button>
+						</view>
 
 					</view>
-				</view>
-				<view v-else class="unlink-content">
-					<view class="content2" v-if="page.conntecting">
-						<view class="auto-circle"></view>
-
-						<view class="text">杩炴帴涓�..</view>
-					</view>
-					<view class="content2" v-else>
-						<view class="text"> 杞﹁締宸茬绾匡紝璇烽噸鏂拌繛鎺�/view>
-						<a-button type="primary" class="button" @click="clickRelink">閲嶆柊杩炴帴
-						</a-button>
-					</view>
-
-				</view>
-
-
+				
 			</swiper-item>
-			<swiper-item class="swiper-item">
+				<swiper-item class="swiper-item">
 
-				<image class="title-img gray-image" src="/images/image 15.png" alt="鍥剧墖" />
+				<image class="title-img gray-image" src="/images/image_15.png" alt="鍥剧墖" />
 				<view class="button-group">
 					<a-button type="primary" class="button" @click="clickScanCode">鎵弿娣诲姞璁惧</a-button>
 					<a-button type="ghost" class="button" @click="clickManualAdd">鎵嬪姩娣诲姞璁惧</a-button>
@@ -85,7 +85,7 @@
 		</swiper>
 		<view v-else class="no-page items-center">
 			<view class="content ">
-				<image class="title-img gray-image" src="/images/image 15.png" alt="鍥剧墖" />
+				<image class="title-img gray-image" src="/images/image_15.png" alt="鍥剧墖" />
 				<view class="button-group">
 					<a-button type="primary" class="button" @click="clickScanCode">鎵弿娣诲姞璁惧</a-button>
 					<a-button type="ghost" class="button" @click="clickManualAdd">鎵嬪姩娣诲姞璁惧</a-button>
@@ -123,9 +123,12 @@
 	import {
 		session,
 		showToast,
-		showModal
+		showModal,
+		showError,
+		showInfo
 	} from "@/comm/utils.js"
 	import {
+		getAllScene,
 		mtBattery,
 		getAgvState,
 		checkIpLinkSuccess,
@@ -201,8 +204,13 @@
 			console.log("hide")
 		},
 		computed: {
-
+			tabList() {
+				return [...this.pageList, {
+					ip: ""
+				}]
+			}
 		},
+
 		methods: {
 			setData(obj) {
 				let that = this;
@@ -258,8 +266,10 @@
 								break
 							}
 						}
-
-						this.pageList = [...list]
+						this.setData({
+							pageList: list
+						})
+						//this.pageList = [...list]
 					} else {
 						this.setData({
 							currentPage: curIndex
@@ -279,13 +289,13 @@
 					}
 				} catch (ex) {
 
-					this.showError(ex)
+					showError(ex)
 				}
 			},
 
 			async loadVehicleBattery() {
 				try {
-					
+
 					const list = this.pageList
 					if (this.currentPage < list.length && this.currentPage > -1) {
 						const page = list[this.currentPage]
@@ -299,11 +309,14 @@
 							page.soc = 0
 							page.link_status = false
 						}
+						this.pageList = [...list]
 					}
-					this.pageList = [...list]
+
+					// this.pageList = [...list]
 
 				} catch (ex) {
-					this.showError(ex)
+					// showError(ex)
+					showToast(ex)
 				}
 
 			},
@@ -375,6 +388,7 @@
 					this.navigationBarTitle = "娣诲姞璁惧"
 				else
 					this.navigationBarTitle = this.pageList[this.currentPage].name
+				this.loadVehicleBattery()
 			},
 			async clickRelink() {
 				try {
@@ -408,7 +422,7 @@
 						}
 					}
 				} catch (ex) {
-					this.showError(ex)
+					showError(ex)
 				}
 			},
 			async checkConnectSuccess(ip) {
@@ -459,12 +473,7 @@
 				this.inputPopupValue = ""
 				this.$refs.refPopupInput.open()
 			},
-			clickToTask(index, page) {
-				showToast("璇ュ姛鑳借繕鍦ㄥ紑鍙戜腑")
-				// uni.navigateTo({
-				// 	url: `/pages/task/index?ip=${page.ip}`
-				// })
-			},
+
 			clickMore() {
 				if (this.currentPage < this.pageList.length) {
 					this.$refs.refPopupMenu.open("top")
@@ -486,10 +495,13 @@
 								pageList: list
 							})
 							session.setValue("vehicles", list)
-							if (list.length > 0)
-								that.navigationBarTitle = that.pageList[that.currentPage].name
-							else
-								that.navigationBarTitle = "娣诲姞璁惧"
+							// if (list.length > 0)
+							// 	that.navigationBarTitle = that.pageList[that.currentPage].name
+							// else
+							// 	that.navigationBarTitle = "娣诲姞璁惧"
+							uni.reLaunch({
+								url:"/pages/indde/index"
+							})
 						},
 						update_vehicle: function(data) {
 							console.log("update_vehicle", data)
@@ -504,19 +516,51 @@
 					}
 				})
 			},
+			async clickToMap(index, page) {
+				try {
+console.log("clicktomap")
+					const _this = this
+					const res = await getAllScene(page.ip) || []
+					const list = res?.sceneList || []
+					if (list.length === 0) {
+						uni.navigateTo({
+							url: `/pages/map/scene?ip=${page.ip}`,
+							events: {
+								// 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�鍒板綋鍓嶉〉闈㈢殑鏁版嵁
+								create_finish: function() {
+									setTimeout(() => {
+										_this.clickToMap(index, page)
+									}, 500);
 
-			clickToMap(index, page) {
-				const _this = this
-				uni.navigateTo({
-					url: `/pages/map/index?ip=${page.ip}`,
-					events: {
-						// 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�鍒板綋鍓嶉〉闈㈢殑鏁版嵁
-						check_connect: function(flag) {
-							page.link_status = flag
-							_this.checkPageConnected(index)
-						},
+								},
+							}
+						})
+						return
 					}
+					//	getApp().globalData.sceneList = list
+
+					uni.navigateTo({
+						url: `/pages/map/index?ip=${page.ip}`,
+						events: {
+							// 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�鍒板綋鍓嶉〉闈㈢殑鏁版嵁
+							check_connect: function(flag) {
+								page.link_status = flag
+								console.log(flag)
+								_this.checkPageConnected(index)
+							},
+						}
+					})
+				} catch (ex) {
+					showError(ex)
+				}
+
+			},
+			clickToTask(page) {
+
+				uni.navigateTo({
+					url: `/pages/task/log-list?ip=${page.ip}`
 				})
+
 			},
 			isValidIP(ip) {
 				// IPv4 鍦板潃姝e垯琛ㄨ揪寮�@@ -569,31 +613,35 @@
 
 				} else if (item.text == "鍒犻櫎") {
 					const page = this.pageList[this.currentPage]
-					showModal(`纭畾瑕佸垹闄よ澶団�${ page.name}鈥濆悧`, "璀﹀憡").then((res) => {
+					showModal(`纭畾瑕佸垹闄よ澶団�${ page.name}鈥濆悧`, "璀﹀憡", true, "纭畾", "鍙栨秷").then((res) => {
 						if (res) {
 							const list = this.pageList
-							const curPage = this.currentPage
+							let curPage = this.currentPage
 							list.splice(this.currentPage, 1)
-							this.setData({
-								currentPage: curPage,
-								pageList: list
-							})
+
+							// this.setData({
+							// 	currentPage: 0,
+							// 	pageList: list
+							// })
+							console.log(curPage, this.currentPage, this.pageList)
 							session.setValue("vehicles", list)
-							if (list.length > 0)
-								this.navigationBarTitle = this.pageList[this.currentPage].name
-							else
-								this.navigationBarTitle = "娣诲姞璁惧"
+							// if (list.length > 0)
+							// 	this.navigationBarTitle = this.pageList[this.currentPage].name
+							// else
+							// 	this.navigationBarTitle = "娣诲姞璁惧"
+							uni.reLaunch({
+								url: "/pages/index/index"
+							})
 
 						}
 					})
+				} else if (item.text == "澶囦唤") {
+					const page = this.pageList[this.currentPage]
+					uni.navigateTo({
+
+						url: `/pages/index/backup?ip=${page.ip}`
+					})
 				}
-			},
-			showError(ex) {
-				let exStr = JSON.stringify(ex)
-				if (exStr == "{}")
-					exStr = ex
-				let tip = typeof ex.msg == "string" ? ex.msg : exStr
-				showModal(tip, "閿欒", false)
 			},
 			closeMenu() {
 				this.$refs.refPopupMenu.close()
@@ -767,10 +815,10 @@
 
 		.vehicle-img {
 			margin-top: 20rpx;
-			margin-left: calc(50% - 280rpx);
+			margin-left: calc(50% - 325rpx);
 			display: block;
-			width: 560rpx;
-			height: 560rpx;
+			width: 650rpx;
+			height: 692rpx;
 
 		}
 
@@ -851,6 +899,8 @@
 			margin-top: 150rpx;
 			margin-left: calc(750rpx - 330rpx);
 			width: 320rpx;
+			max-height: 50vh;
+			overflow: auto;
 			align-items: center;
 			justify-content: center;
 			flex-direction: column;

--
Gitblit v1.9.1