关机按钮

This commit is contained in:
2025-01-15 09:52:08 +08:00
parent 069165cc00
commit 1203e1da84
6 changed files with 65 additions and 20 deletions

View File

@@ -161,6 +161,8 @@ module.exports = {
toast1: 'Old password cannot be empty',
toast2: 'The new password cannot be empty',
toast3: 'Enter a new password',
toast4: 'The new password input is inconsistent, please re-enter it'
toast4: 'The new password input is inconsistent, please re-enter it',
toast5: 'Are you sure to shut down?',
warning: 'Warning'
}
}

View File

@@ -161,6 +161,8 @@ module.exports = {
toast1: '旧密码不能为空',
toast2: '新密码不能为空',
toast3: '输入新密码',
toast4: '新密码输入不一致,请重新输入'
toast4: '新密码输入不一致,请重新输入',
toast5: '是否确定关机?',
warning: '提示'
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@@ -8,10 +8,10 @@
</div>
</div>
</div>
<button class="absolute onoff_wraper" @click="switchDown('1', '0')" :disabled="disabled">
<!-- <button class="absolute onoff_wraper" @click="switchDown('1', '0')" :disabled="disabled">
<div class="onoff_power"><img src="../../../images/new/switch_10.png" alt=""></div>
<div class="onoff_power_txt">{{ $t('vehiclecontrol.poweroff') }}</div>
</button>
</button> -->
</div>
</template>

View File

@@ -59,7 +59,7 @@
</div>
<jxDialog
ref="child"
title="修改密码"
:title="$t('common.changepassword')"
:unclick="unclick"
@toSure="toSureDialog"
@toCancle="toCancle"

View File

@@ -30,13 +30,17 @@
</div>
<div v-show="dropdown" class="header_dropdown_wraper">
<ul>
<li @click="showDialog">{{ $t('common.changepassword') }}</li>
<li @click="showDialog(1)">{{ $t('common.changepassword') }}</li>
<li @click="$router.push('/mini/debug'), dropdown = false">debuger</li>
<li @click="toEixt">{{ $t('common.exit') }}</li>
</ul>
<div class="popper__arrow"></div>
</div>
<div class="state-line" style="margin-right: 0"></div>
<div class="state-line"></div>
</div>
<div class="header_user_wraper">
<button class="onoff_power" :disabled="disabled" @click="showDialog(2)"></button>
<div class="state-line"></div>
</div>
<div class="time-container">
<jxTime></jxTime>
@@ -57,12 +61,12 @@
</div>
<jxDialog
ref="child"
title="修改密码"
:title="type === 1 ? $t('common.changepassword') : $t('common.warning')"
:unclick="unclick"
@toSure="toSureDialog"
@toCancle="toCancle"
>
<div class="form_wraper">
<div v-if="type === 1" class="form_wraper">
<div class="form">
<div class="form_item">
<div class="form_item__label form_item__label_pass"><i>*</i>{{ $t('common.oldpassword') }}</div>
@@ -88,6 +92,7 @@
</div>
</div>
</div>
<div v-if="type === 2" class="form_wraper">{{ $t('common.toast5') }}</div>
</jxDialog>
<vue-touch-keyboard id="keyboard" :options="options" v-if="visible" :layout="layout" :cancel="hide" :accept="accept" :input="input" :next="next" />
</div>
@@ -96,7 +101,7 @@
<script>
import jxTime from '@components/time.vue'
import jxDialog from '@components/dialog.vue'
import { updatePass, authLogout } from '@config/getData2.js'
import { updatePass, authLogout, ShutDown } from '@config/getData2.js'
import { sendWebsocket, closeWebsocket } from '@/config/websocket.js'
import {encrypt} from '../../../main.js'
export default {
@@ -124,7 +129,9 @@ export default {
},
topInfo: {},
selectTypeList: [{value: 'zh-cn', label: '中文'}, {value: 'en-us', label: 'English'}],
selectType: ''
selectType: '',
type: null,
disabled: false
}
},
watch: {
@@ -197,17 +204,46 @@ export default {
showDropdown () {
this.dropdown = !this.dropdown
},
showDialog () {
this.dropdown = false
this.$refs.child.active = true
this.oldpassword = ''
this.newpassword1 = ''
this.newpassword2 = ''
this.unclick = true
showDialog (type) {
this.type = type
if (type === 1) {
this.dropdown = false
this.$refs.child.active = true
this.oldpassword = ''
this.newpassword1 = ''
this.newpassword2 = ''
this.unclick = true
} else if (type === 2) {
this.$refs.child.active = true
}
},
toSureDialog () {
this._updatePass()
this.hide()
if (this.type === 1) {
this._updatePass()
this.hide()
} else if (this.type === 2) {
this.switchDown('1', '0')
this.hide()
}
},
switchDown (type, bool) {
this.disabled = true
bool = bool === '0' ? '1' : '0'
this._ShutDown(type, bool)
},
async _ShutDown (type, bool) {
try {
let res = await ShutDown(type, bool) // type:1-关机、2-显示屏控制、3-TCS控制、4-SCHE控制、5-RC控制、6-Joy控制7-退出8-软启动9-跳过起点10-重启11-全屏12-跳过检测 ; bool:开关或按钮的值开关开启传1关闭传0按钮点击直接传1
if (res.code === '1') {
this.toast(res.desc)
} else {
this.toast(res.desc)
}
this.disabled = false
} catch (e) {
this.disabled = false
this.toast(this.$t('common.operationfailed'))
}
},
toCancle () {
this.hide()
@@ -554,4 +590,9 @@ export default {
width calc(100% - 205px)
.home_button p
letter-spacing 2px
.onoff_power
width 38px
height 38px
background center /100% auto url(../../../images/new/switch_10.png) no-repeat
margin 0 5px
</style>