From 9efd4a80aae58cf36266e774d3c820cc8e115028 Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期四, 25 九月 2025 17:33:45 +0800
Subject: [PATCH] test
---
pages/map/index.vue | 140 +++++++++++++++++++++++++++++++++-------------
1 files changed, 100 insertions(+), 40 deletions(-)
diff --git a/pages/map/index.vue b/pages/map/index.vue
index e176d03..b76665c 100644
--- a/pages/map/index.vue
+++ b/pages/map/index.vue
@@ -33,7 +33,9 @@
v-model:opSceneType="opSceneType" @create-ok="onCreateSceneOk"></SceneCreateInfo> -->
<view class="map-content" v-show="mapOperationType !='scene_create'">
<view class="content">
- <view class="fabric" :message="ctxDataStr" :change:message="ctx.receiveMsg" id="canvasMap"></view>
+ <view ref="canvasCtx" class="fabric" id="canvasMap" :message="ctxDataStr"
+ :change:message="ctx.receiveMsg">
+ </view>
<view class="loading-overlay" v-if="bgLoading">
<view class="loading-content">
<view class="loading-spinner"></view>
@@ -386,9 +388,10 @@
</view>
</template>
<script src="./js/ctx.js" module="ctx" lang="renderjs"></script>
-
-
<script>
+ import {
+ ref
+ } from "vue";
import {
showToast,
showModal,
@@ -440,6 +443,7 @@
list: []
},
sceneList: [],
+
ctxDataStr: "[]",
mapOperationType: "",
mapOperationStatus: "",
@@ -482,7 +486,9 @@
img_x: 1,
img_y: 1
},
- positioningAgv: false
+ positioningAgv: false,
+ isPageVisible: true,
+ destroyFlag: false,
}
},
computed: {
@@ -539,10 +545,29 @@
},
onHide() {
this.isPageVisible = false
+
},
- onUnload() {
+ async onUnload() {
+
this.isPageVisible = false
+
+ console.log("onUnload")
+
+
},
+ onBackPress() {
+ this.isPageVisible = false
+ if (this.destroyFlag)
+ return false
+ else {
+ this.ctxDataStr = JSON.stringify([{
+ method: "destroy",
+ }])
+ return true
+ }
+
+ },
+
methods: {
setData(obj) {
let that = this;
@@ -583,6 +608,10 @@
},
clickShowMenu() {
+ // const list = [...this.sceneList]
+ // for(let i =0; i < 20;i++){
+ // list.push("test" + i)
+ // }
this.menuPopup = {
type: "scene",
list: this.sceneList,
@@ -786,7 +815,7 @@
// this.mapOperationType = 'scene_create'
// this.opSceneType = 'add_name'
uni.navigateTo({
- url: `/pages/map/scene?ip=${this.vehicleIp}`,
+ url: `/pages/map/scene?ip=${_this.vehicleIp}`,
events: {
// 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�鍒板綋鍓嶉〉闈㈢殑鏁版嵁
create_finish: function(data) {
@@ -910,12 +939,18 @@
},
{
method: "public_teaching_path",
- param: this.teachingMode.Public || []
+ param: {
+ list: this.teachingMode.Public || [],
+ show: this.showTeachingPathFlag
+ }
},
{
method: "station_teaching_path",
- param: this.teachingMode.Stations || []
+ param: {
+ list: this.teachingMode.Stations || [],
+ show: this.showTeachingPathFlag
+ }
},
{
@@ -939,7 +974,14 @@
receiveRenderData(param) {
console.log('鎺ユ敹鍒拌鍥惧眰鐨勬暟鎹細', param);
- if (param.method == "set_backgroud_progress") {
+ if (param.method === "destroy_complete") {
+ if (param.param) {
+ this.destroyFlag = true
+ uni.navigateBack({
+ delta: 1
+ })
+ }
+ } else if (param.method == "set_backgroud_progress") {
if (param.type == "start") {
this.setData({
bgProgressPercent: 50,
@@ -1129,6 +1171,7 @@
this.mapOperationType = "edit_map"
},
clickExtendMap() {
+ const _this = this
uni.navigateTo({
url: `/pages/map/scene?ip=${this.vehicleIp}&opType=extend&sceneId=${this.sceneId}`,
events: {
@@ -1170,6 +1213,7 @@
},
async loadSceneList() {
try {
+
uni.showLoading({
title: "鍔犺浇鍦烘櫙涓�
})
@@ -1846,26 +1890,40 @@
}
}
},
- async reloadTeachingMode() {
+ async reloadTeachingMode(finish) {
try {
this.teachingMode = await this.loadTeachingMode()
- this.ctxDataStr = JSON.stringify([{
+
+ const list = [{
method: "clear_teaching_path",
},
{
method: "public_teaching_path",
- param: this.teachingMode.Public || []
+ param: {
+ list: this.teachingMode.Public || [],
+ show: this.showTeachingPathFlag
+ }
},
{
method: "station_teaching_path",
- param: this.teachingMode.Stations || []
- }, {
- method: "show_teaching_path",
param: {
+ list: this.teachingMode.Stations || [],
show: this.showTeachingPathFlag
}
}
- ])
+ // , {
+ // method: "show_teaching_path",
+ // param: {
+ // show: this.showTeachingPathFlag
+ // }
+ // }
+ ]
+ if (finish) {
+ list.push({
+ method: "teaching_finish",
+ })
+ }
+ this.ctxDataStr = JSON.stringify(list)
} catch (ex) {
showError(ex)
@@ -1939,8 +1997,8 @@
param: {
x: agv.x,
y: agv.y,
- width:80,
- height:80,
+ width: 80,
+ height: 80,
}
})
@@ -2049,10 +2107,8 @@
},
clickTeachingFinish() {
this.mapOperationType = ""
- this.ctxDataStr = JSON.stringify([{
- method: "teaching_finish",
- }])
- this.reloadTeachingMode()
+
+ this.reloadTeachingMode(true)
},
async teachingStart(mode) {
@@ -2155,24 +2211,26 @@
)
if (res?.name)
this.teachingModeCur.name = res.name
-
- const {
- data
- } = await getTeachingMode(this.vehicleIp)
-
- const publicList = data.Public || []
- const curIndex = publicList.findIndex((a)=>a.name == oldName)
-
- if(curIndex > -1)
- {
- this.ctxDataStr = JSON.stringify([{
- method: "public_teaching_path",
- param: [publicList[curIndex]]
- } ])
-
- }
-
-
+
+ const {
+ data
+ } = await getTeachingMode(this.vehicleIp)
+
+ const publicList = data.Public || []
+ const curIndex = publicList.findIndex((a) => a.name == oldName)
+
+ if (curIndex > -1) {
+ this.ctxDataStr = JSON.stringify([{
+ method: "public_teaching_path",
+ param: {
+ list: [publicList[curIndex]],
+ show: true
+ }
+ }])
+
+ }
+
+
} else {
this.teachingModeCur
.main_road =
@@ -2705,6 +2763,8 @@
margin-top: 140rpx;
margin-left: 225rpx;
width: 300rpx;
+ max-height: 50vh;
+ overflow: auto;
align-items: center;
justify-content: center;
flex-direction: column;
--
Gitblit v1.9.1