2025-06-26 17:47:20 +08:00
|
|
|
<template>
|
|
|
|
|
<el-dialog
|
2025-06-27 18:16:47 +08:00
|
|
|
:title="$t('Configuration')"
|
2025-06-26 17:47:20 +08:00
|
|
|
:visible.sync="dialogVisible"
|
|
|
|
|
width="50%"
|
|
|
|
|
:before-close="handleClose">
|
2025-06-27 18:16:47 +08:00
|
|
|
<el-form :model="dataForm" ref="dataForm" :rules="dataRule" :label-width="$i18n.locale === 'en-us' ? '1.3rem' : '1.1rem'" size="mini">
|
|
|
|
|
<p class="tip">{{$t('Languageselection')}}</p>
|
|
|
|
|
<el-form-item :label="$t('Language')" prop="selectedLanguage">
|
2025-07-04 17:52:10 +08:00
|
|
|
<el-select v-model="dataForm.selectedLanguage" :placeholder="$t('Pleaseselect')" id="selectedLanguage" style="width: 100%;">
|
2025-06-26 17:47:20 +08:00
|
|
|
<el-option
|
|
|
|
|
v-for="item in languages"
|
|
|
|
|
:key="item.value"
|
|
|
|
|
:label="item.label"
|
|
|
|
|
:value="item.value">
|
|
|
|
|
</el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
2025-06-27 18:16:47 +08:00
|
|
|
<p class="tip">{{$t('Parameterconfiguration')}}</p>
|
|
|
|
|
<el-form-item :label="$t('SchedulingIP')" prop="ip">
|
2025-07-04 17:52:10 +08:00
|
|
|
<el-input :placeholder="$t('PleaseIP')" v-model="dataForm.ip" id="ip" @focus="show" data-layout="normal"></el-input>
|
2025-06-26 17:47:20 +08:00
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="WIFI" prop="wifi">
|
2025-07-04 17:52:10 +08:00
|
|
|
<el-input :placeholder="$t('PleaseWIFI')" v-model="dataForm.wifi" id="wifi" @focus="show" data-layout="normal"></el-input>
|
2025-06-26 17:47:20 +08:00
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<el-row type="flex" justify="space-around" style="margin-top: .3rem">
|
2025-06-27 18:16:47 +08:00
|
|
|
<el-col :span="7"><button class="button_control button_control_disabled" @click="exitUser"><p>{{$t('Cancel')}}</p></button></el-col>
|
|
|
|
|
<el-col :span="7"><button class="button_control" @click="dataFormSubmit"><p>{{$t('Save')}}</p></button></el-col>
|
2025-06-26 17:47:20 +08:00
|
|
|
</el-row>
|
|
|
|
|
<vue-touch-keyboard id="keyboard" :options="options" v-if="visible" :layout="layout" :cancel="hide" :accept="accept" :input="input" :next="next" />
|
|
|
|
|
</el-dialog>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
|
|
|
|
data () {
|
|
|
|
|
return {
|
|
|
|
|
dialogVisible: false,
|
|
|
|
|
dataForm: {
|
|
|
|
|
selectedLanguage: '',
|
|
|
|
|
ip: '',
|
|
|
|
|
wifi: ''
|
|
|
|
|
},
|
|
|
|
|
dataRule: {
|
|
|
|
|
ip: [
|
2025-06-27 18:16:47 +08:00
|
|
|
{ required: true, message: this.$t('Schedulingnotempty'), trigger: 'blur' }
|
2025-06-26 17:47:20 +08:00
|
|
|
],
|
|
|
|
|
wifi: [
|
2025-06-27 18:16:47 +08:00
|
|
|
{ required: true, message: this.$t('WIFInotempty'), trigger: 'blur' }
|
2025-06-26 17:47:20 +08:00
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
languages: [
|
2025-06-27 17:07:21 +08:00
|
|
|
{label: '中文', value: 'zh-cn'},
|
|
|
|
|
{label: 'English', value: 'en-us'}
|
|
|
|
|
// {label: 'Español', value: 'es'}
|
2025-06-26 17:47:20 +08:00
|
|
|
],
|
|
|
|
|
visible: false,
|
|
|
|
|
layout: 'normal',
|
|
|
|
|
input: null,
|
|
|
|
|
options: {
|
|
|
|
|
useKbEvents: false,
|
|
|
|
|
preventClickEvent: false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
init () {
|
2025-06-27 17:07:21 +08:00
|
|
|
if (this.$i18n.locale === 'zh-cn') {
|
|
|
|
|
this.dataForm.selectedLanguage = 'zh-cn'
|
|
|
|
|
} else if (this.$i18n.locale === 'en-us') {
|
|
|
|
|
this.dataForm.selectedLanguage = 'en-us'
|
|
|
|
|
}
|
2025-06-26 17:47:20 +08:00
|
|
|
this.dialogVisible = true
|
|
|
|
|
},
|
|
|
|
|
exitUser () {
|
|
|
|
|
this.dialogVisible = false
|
|
|
|
|
this.visible = false
|
|
|
|
|
},
|
|
|
|
|
dataFormSubmit () {
|
|
|
|
|
this.dialogVisible = false
|
|
|
|
|
this.visible = false
|
2025-06-27 17:07:21 +08:00
|
|
|
this.$i18n.locale = this.dataForm.selectedLanguage
|
|
|
|
|
window.localStorage.setItem('locale', this.dataForm.selectedLanguage)
|
2025-06-26 17:47:20 +08:00
|
|
|
},
|
|
|
|
|
handleClose (done) {
|
|
|
|
|
this.visible = false
|
|
|
|
|
done()
|
|
|
|
|
},
|
|
|
|
|
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()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
|
|
|
|
.tip
|
|
|
|
|
font-size .2rem
|
|
|
|
|
font-weight 700
|
|
|
|
|
font-family 'SourceHanSansCN-Bold'
|
|
|
|
|
line-height .2rem
|
|
|
|
|
color #E54F29
|
|
|
|
|
margin-bottom .1rem
|
|
|
|
|
</style>
|