国际化
This commit is contained in:
@@ -1,31 +1,30 @@
|
||||
<template>
|
||||
<div class="page_container">
|
||||
<div class="page_container" :class="{'enClass': $i18n.locale === 'en-us'}">
|
||||
<div id="v-step-1" class="map_container">
|
||||
<gl-map ref="glMap"/>
|
||||
</div>
|
||||
<el-row type="flex" justify="space-between">
|
||||
<el-col :span="10"><button id="v-step-2" class="button_control" :disabled="disabled" @click="addPoint"><p>打点</p></button></el-col>
|
||||
<el-col :span="10"><button id="v-step-2" class="button_control" :disabled="disabled" @click="addPoint"><p>{{$t('MarkPoint')}}</p></button></el-col>
|
||||
<el-col :span="14">
|
||||
<el-row type="flex" justify="end">
|
||||
<button class="button_control" @click="$router.push('/index/home')"><p>放弃建图</p></button>
|
||||
<button id="v-step-3" class="button_control" style="margin-left: 10px" :disabled="disabled" @click="stopMappingConfirm"><p>结束建图</p></button>
|
||||
<button class="button_control" @click="$router.push('/index/home')"><p>{{$t('AbandonMapbuild')}}</p></button>
|
||||
<button id="v-step-3" class="button_control" style="margin-left: 10px" :disabled="disabled" @click="stopMappingConfirm"><p>{{$t('FinishMapbuild')}}</p></button>
|
||||
</el-row>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-dialog
|
||||
title="设置站点"
|
||||
:title="$t('SetUpStation')"
|
||||
:visible.sync="dialogVisible"
|
||||
width="55%">
|
||||
<el-form :model="dataForm" ref="dataForm" :label-width="$i18n.locale === 'en-us' ? '' : '1.1rem'" size="mini">
|
||||
<el-form-item label="站点名称" prop="stationName">
|
||||
<el-input v-model="dataForm.stationName" id="stationName" @focus="show" data-layout="normal"></el-input>
|
||||
<el-form-item :label="$t('StationName')" prop="stationName">
|
||||
<el-input v-model="dataForm.stationName" id="stationName"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row type="flex" justify="space-around" style="margin-top: .3rem">
|
||||
<el-col :span="7"><button class="button_control button_control_disabled" @click="dialogVisible = false"><p>{{$t('Cancel')}}</p></button></el-col>
|
||||
<el-col :span="7"><button class="button_control" @click="_setStation"><p>{{$t('Save')}}</p></button></el-col>
|
||||
</el-row>
|
||||
<!-- <vue-touch-keyboard id="keyboard" :options="options" v-if="visible" :layout="layout" :cancel="hide" :accept="accept" :input="input" :next="next" /> -->
|
||||
</el-dialog>
|
||||
<transition name="custom-message" >
|
||||
<div v-if="message" class="message" :style="{'top': isTop ? '.87rem' : '.57rem', 'color': error ? '#F56C6C' : '#67C23A'}">
|
||||
@@ -36,7 +35,7 @@
|
||||
<div v-if="showProgress" class="progress-mask">
|
||||
<!-- 进度条内容区 -->
|
||||
<div class="progress-container">
|
||||
<div class="progress_tip">{{warnTip ? '正在部署地图中...' : '正在生成地图中...'}}</div>
|
||||
<div class="progress_tip">{{warnTip ? $t('Mapdeployed') : $t('Mapgenerated')}}</div>
|
||||
<el-progress
|
||||
v-show="!warnTip"
|
||||
:percentage="percentage"
|
||||
@@ -61,9 +60,9 @@ export default {
|
||||
},
|
||||
beforeRouteLeave (to, from, next) {
|
||||
if (this.needsConfirmation) {
|
||||
this.$confirm('是否放弃本次建图?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
this.$confirm(this.$t('Doabandonmapattempt'), this.$t('Prompt'), {
|
||||
confirmButtonText: this.$t('Confirm'),
|
||||
cancelButtonText: this.$t('Cancel'),
|
||||
type: 'warning'
|
||||
}).then(async () => {
|
||||
try {
|
||||
@@ -82,13 +81,12 @@ export default {
|
||||
next()
|
||||
} else {
|
||||
// 接口返回失败,提示错误并阻止离开
|
||||
this.$message.error(res.message || '放弃建图失败,请重试')
|
||||
this.$message.error(res.message)
|
||||
next(false)
|
||||
}
|
||||
} catch (error) {
|
||||
// 发生异常,提示错误并阻止离开
|
||||
this.loading.close()
|
||||
this.$message.error('操作失败:' + error.message)
|
||||
next(false)
|
||||
}
|
||||
}).catch(() => {
|
||||
@@ -113,13 +111,6 @@ export default {
|
||||
disabled: false,
|
||||
message: '', // 用于显示消息
|
||||
error: false,
|
||||
visible: false,
|
||||
layout: 'normal',
|
||||
input: null,
|
||||
options: {
|
||||
useKbEvents: false,
|
||||
preventClickEvent: false
|
||||
},
|
||||
showProgress: false,
|
||||
warnTip: false,
|
||||
percentage: 0,
|
||||
@@ -151,9 +142,9 @@ export default {
|
||||
overlayOpacity: 0.7,
|
||||
popoverClass: 'driverjs-theme',
|
||||
stagePadding: 0,
|
||||
nextBtnText: '下一步',
|
||||
prevBtnText: '上一步',
|
||||
doneBtnText: '完成',
|
||||
nextBtnText: this.$t('next'),
|
||||
prevBtnText: this.$t('previous'),
|
||||
doneBtnText: this.$t('close'),
|
||||
onNextClick: (element, step) => {
|
||||
if (step.element === '#v-step-3') {
|
||||
this.driverActive = false
|
||||
@@ -182,7 +173,7 @@ export default {
|
||||
{
|
||||
element: '#v-step-1',
|
||||
popover: {
|
||||
description: '当前车辆扫描的周围环境,拉动车辆将开始记录行走路线',
|
||||
description: this.$t('driverTxt1'),
|
||||
side: 'left',
|
||||
align: 'center'
|
||||
}
|
||||
@@ -190,7 +181,7 @@ export default {
|
||||
{
|
||||
element: '#v-step-2',
|
||||
popover: {
|
||||
description: '移动到工位点时,点击打点按钮记录当前车辆所在位置为工位点。',
|
||||
description: this.$t('driverTxt2'),
|
||||
side: 'top',
|
||||
align: 'start'
|
||||
}
|
||||
@@ -198,7 +189,7 @@ export default {
|
||||
{
|
||||
element: '#v-step-3',
|
||||
popover: {
|
||||
description: '完成建图,点击结束建图按钮,等待地图自动生成。',
|
||||
description: this.$t('driverTxt3'),
|
||||
side: 'top',
|
||||
align: 'end'
|
||||
}
|
||||
@@ -210,40 +201,6 @@ export default {
|
||||
})
|
||||
this.driver.drive()
|
||||
},
|
||||
show (e) {
|
||||
// 关闭中文keyboard
|
||||
let arr = document.querySelectorAll('.hg-theme-default')
|
||||
arr.forEach((ele) => {
|
||||
ele.style.visibility = 'hidden'
|
||||
})
|
||||
this.input = e.target
|
||||
this.layout = e.target.dataset.layout
|
||||
if (!this.visible) {
|
||||
this.visible = true
|
||||
}
|
||||
},
|
||||
hide () {
|
||||
this.visible = false
|
||||
},
|
||||
accept () {
|
||||
this.hide()
|
||||
},
|
||||
next () {
|
||||
let inputs = document.querySelectorAll('input')
|
||||
let found = false;
|
||||
[].forEach.call(inputs, (item, i) => {
|
||||
if (!found && item === this.input && i < inputs.length - 1 && this.input.dataset.next === '1') {
|
||||
found = true
|
||||
this.$nextTick(() => {
|
||||
inputs[i + 1].focus()
|
||||
})
|
||||
}
|
||||
})
|
||||
if (!found) {
|
||||
this.input.blur()
|
||||
this.hide()
|
||||
}
|
||||
},
|
||||
// 开始建图
|
||||
async _startMapping () {
|
||||
try {
|
||||
@@ -262,7 +219,7 @@ export default {
|
||||
this.mapName = `apt_map_${year}${month}${day}${hours}${minutes}${seconds}`
|
||||
let res = await startMapping(this.mapName)
|
||||
if (res && res.code === 200) {
|
||||
this.message = '小车正在建图中'
|
||||
this.message = this.$t('carbuildingmap')
|
||||
this.error = false
|
||||
this.$nextTick(() => {
|
||||
this.$refs.glMap.init()
|
||||
@@ -270,7 +227,7 @@ export default {
|
||||
}
|
||||
this.loading.close()
|
||||
} catch (e) {
|
||||
this.message = '建图出现错误,需要重新建图'
|
||||
this.message = this.$t('errorbuildingredone')
|
||||
this.error = true
|
||||
this.loading.close()
|
||||
}
|
||||
@@ -280,7 +237,8 @@ export default {
|
||||
if (this.driverActive) return
|
||||
this.dialogVisible = true
|
||||
this.dataForm.stationCode = 'B' + (this.keyPoints.length + 1)
|
||||
this.dataForm.stationName = '工作点' + (this.keyPoints.length + 1)
|
||||
const na = this.$i18n.locale === 'en-us' ? 'Work point ' : '工作点'
|
||||
this.dataForm.stationName = `${na}${this.keyPoints.length + 1}`
|
||||
},
|
||||
// 打点->保存
|
||||
async _setStation () {
|
||||
@@ -299,27 +257,25 @@ export default {
|
||||
}
|
||||
}
|
||||
this.dialogVisible = false
|
||||
this.visible = false
|
||||
this.disabled = false
|
||||
} catch (e) {
|
||||
this.$message.error(e)
|
||||
this.dialogVisible = false
|
||||
this.visible = false
|
||||
this.disabled = false
|
||||
}
|
||||
},
|
||||
stopMappingConfirm () {
|
||||
if (this.driverActive) return
|
||||
this.$confirm('确定是否结束建图?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
this.$confirm(this.$t('sureendbuilding'), this.$t('Prompt'), {
|
||||
confirmButtonText: this.$t('Confirm'),
|
||||
cancelButtonText: this.$t('Cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this._stopMapping()
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消结束建图'
|
||||
message: this.$t('endbuildingcancel')
|
||||
})
|
||||
})
|
||||
},
|
||||
@@ -344,7 +300,7 @@ export default {
|
||||
this.disabled = false
|
||||
this.loading.close()
|
||||
} catch (e) {
|
||||
this.message = '结束建图出现错误'
|
||||
this.message = this.$t('errorendbuilding')
|
||||
this.error = true
|
||||
this.disabled = false
|
||||
this.loading.close()
|
||||
@@ -371,16 +327,16 @@ export default {
|
||||
this.showProgress = false
|
||||
this.percentage = 0
|
||||
this.keyPoints = []
|
||||
this.$confirm('新建地图失败, 是否重新建图?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
this.$confirm(this.$t('Newfailedagain'), this.$t('Prompt'), {
|
||||
confirmButtonText: this.$t('Confirm'),
|
||||
cancelButtonText: this.$t('Cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this._startMapping()
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消建图'
|
||||
message: this.$t('Mapbuildingcancel')
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -388,16 +344,16 @@ export default {
|
||||
this.message = ''
|
||||
this.error = false
|
||||
this.keyPoints = []
|
||||
this.$confirm('新建地图失败, 是否重新建图?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
this.$confirm(this.$t('Newfailedagain'), this.$t('Prompt'), {
|
||||
confirmButtonText: this.$t('Confirm'),
|
||||
cancelButtonText: this.$t('Cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this._startMapping()
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消建图'
|
||||
message: this.$t('Mapbuildingcancel')
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -452,7 +408,7 @@ export default {
|
||||
transition opacity .3s,transform .4s
|
||||
overflow hidden
|
||||
padding 8px 15px
|
||||
z-index 2025
|
||||
z-index 2003
|
||||
display flex
|
||||
align-items center
|
||||
font-size .16rem
|
||||
@@ -489,4 +445,9 @@ export default {
|
||||
color: #000
|
||||
font-weight: 700
|
||||
}
|
||||
.enClass
|
||||
.button_control
|
||||
p
|
||||
font-size .18rem
|
||||
line-height .16rem
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user