From 2af5f043b60c1f7ac38ecccc8f5bf44743134325 Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期五, 12 十二月 2025 18:08:00 +0800
Subject: [PATCH] test
---
pages/teaching/index.vue | 69 +++++++++++++++++++++-------------
1 files changed, 43 insertions(+), 26 deletions(-)
diff --git a/pages/teaching/index.vue b/pages/teaching/index.vue
index 924f9a3..6cae10d 100644
--- a/pages/teaching/index.vue
+++ b/pages/teaching/index.vue
@@ -150,7 +150,9 @@
<script>
import {
showToast,
- showModal
+ showModal,
+ showError,
+ showInfo
} from "@/comm/utils.js"
import {
Button
@@ -181,7 +183,12 @@
} else if (this.mapOperationType == "public_teaching" || this.mapOperationType == "station_teaching") {
if (this.teachingStatus) {
- showModal("宸茶褰曠殑璺緞灏嗕細琚垹闄ゃ�", "鏄惁瑕侀�鍑虹ず鏁欙紵").then((res) => {
+ showModal({
+ title: `${this.translate('ask_exit_teaching')}`,
+ content: `${this.translate('recorded_path_will_be_deleted')}`,
+ confirmText: this.translate('yes'),
+ cancelText: this.translate('no'),
+ }).then((res) => {
if (res) {
this.mapOperationType = ""
}
@@ -284,7 +291,7 @@
} catch (ex) {
- this.showError(ex)
+ showError(ex, this.translate('error'))
}
},
async loadAgvState() {
@@ -292,7 +299,7 @@
const info = await getAgvState(this.ip)
return info
} catch (ex) {
- this.showError(ex)
+ showError(ex, this.translate('error'))
return {}
}
},
@@ -301,7 +308,7 @@
const info = await stations(this.ip)
return info.station_list || []
} catch (ex) {
- this.showError(ex)
+ showError(ex, this.translate('error'))
return []
}
},
@@ -367,7 +374,7 @@
}
} catch (ex) {
- this.showError(ex)
+ showError(ex, this.translate('error'))
}
},
@@ -386,7 +393,7 @@
this.askTeachingBiDirection(this.teachingModeCur)
}
} catch (ex) {
- this.showError(ex)
+ showError(ex, this.translate('error'))
}
},
@@ -405,7 +412,7 @@
}
} catch (ex) {
- this.showError(ex)
+ showError(ex, this.translate('error'))
}
},
async clickTeachingStart() {
@@ -420,7 +427,12 @@
const curIndex = stationTeaching.findIndex((a) => a.src_dst == srcDst)
if (curIndex > -1) {
- showModal("璇ョ珯鐐归棿宸叉湁绀烘暀璺緞锛岄噸鏂拌褰曚細瑕嗙洊涔嬪墠鐨勮矾寰勩�", "鏄惁瑕侀噸鏂拌褰曪紵").then(async (res) => {
+ showModal({
+ title: "鏄惁瑕侀噸鏂拌褰曪紵",
+ content: "璇ョ珯鐐归棿宸叉湁绀烘暀璺緞锛岄噸鏂拌褰曚細瑕嗙洊涔嬪墠鐨勮矾寰勩�",
+ confirmText: this.translate('yes'),
+ cancelText: this.translate('no'),
+ }).then(async (res) => {
if (res) {
try {
_this.teachingStatus = "teaching"
@@ -433,7 +445,7 @@
stationTeaching.splice(curIndex, 1)
_this.teachingStart("Stations")
} catch (ex) {
- this.showError(ex)
+ showError(ex, this.translate('error'))
}
} else {
@@ -452,7 +464,7 @@
}
} catch (ex) {
- this.showError(ex)
+ showError(ex, this.translate('error'))
}
},
clickTeachingEnd() {
@@ -465,7 +477,12 @@
},
clickTeachingReset() {
const _this = this
- showModal("宸茶褰曠殑璺緞灏嗕細琚垹闄ゃ�", "鏄惁瑕侀噸鏂拌褰曪紵").then(async (res) => {
+ showModal({
+ title: `${this.translate('ask_exit_teaching')}`,
+ content: `${this.translate('recorded_path_will_be_deleted')}`,
+ confirmText: this.translate('yes'),
+ cancelText: this.translate('no'),
+ }).then(async (res) => {
if (res) {
try {
await delTeachingMode(_this.ip, [_this.teachingModeCur])
@@ -473,7 +490,7 @@
_this.teachingMode = await getTeachingMode(_this.ip)
} catch (ex) {
- this.showError(ex)
+ showError(ex, this.translate('error'))
}
} else {
_this.teachingStatus = "save"
@@ -485,7 +502,7 @@
this.teachingStatus = "save"
try {} catch (ex) {
- this.showError(ex)
+ showError(ex, this.translate('error'))
}
},
@@ -637,7 +654,7 @@
}
} catch (ex) {
- this.showError(ex)
+ showError(ex, this.translate('error'))
}
},
async clickNoCalibration() {
@@ -662,11 +679,16 @@
}
} catch (ex) {
- this.showError(ex)
+ showError(ex, this.translate('error'))
}
},
askTeachingBiDirection(teachingMode) {
- showModal("鏄惁灏嗗綋鍓嶇ず鏁欒矾绾胯缃负鍙屽悜?", "绀烘暀缁撴潫").then((res) => {
+ showModal({
+ title: "绀烘暀缁撴潫",
+ content: "鏄惁灏嗗綋鍓嶇ず鏁欒矾绾胯缃负鍙屽悜?",
+ confirmText: this.translate('yes'),
+ cancelText: this.translate('no'),
+ }).then((res) => {
if (res) {
teachingMode.bidirection = "1"
} else {
@@ -683,22 +705,17 @@
this.teachingMode = await getTeachingMode(this.ip)
this.teachingStatus = "end"
} catch (ex) {
- this.showError(ex)
+ showError(ex, this.translate('error'))
}
},
clickBackTeaching() {
this.$refs.refPopupCalibration.close()
this.teachingStatus = ""
},
- showError(ex) {
- let exStr = JSON.stringify(ex)
- if (exStr == "{}")
- exStr = ex
- let tip = typeof ex.msg == "string" ? ex.msg : exStr
- showModal(tip, "閿欒", false, "纭畾")
+ translate(t) {
+ if (typeof this.$t == "function") return this.$t(`page.${t}`)
+ else return t;
},
-
-
}
}
</script>
--
Gitblit v1.9.1