关机按钮

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', toast1: 'Old password cannot be empty',
toast2: 'The new password cannot be empty', toast2: 'The new password cannot be empty',
toast3: 'Enter a new password', 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: '旧密码不能为空', toast1: '旧密码不能为空',
toast2: '新密码不能为空', toast2: '新密码不能为空',
toast3: '输入新密码', 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> </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"><img src="../../../images/new/switch_10.png" alt=""></div>
<div class="onoff_power_txt">{{ $t('vehiclecontrol.poweroff') }}</div> <div class="onoff_power_txt">{{ $t('vehiclecontrol.poweroff') }}</div>
</button> </button> -->
</div> </div>
</template> </template>

View File

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

View File

@@ -30,13 +30,17 @@
</div> </div>
<div v-show="dropdown" class="header_dropdown_wraper"> <div v-show="dropdown" class="header_dropdown_wraper">
<ul> <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="$router.push('/mini/debug'), dropdown = false">debuger</li>
<li @click="toEixt">{{ $t('common.exit') }}</li> <li @click="toEixt">{{ $t('common.exit') }}</li>
</ul> </ul>
<div class="popper__arrow"></div> <div class="popper__arrow"></div>
</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>
<div class="time-container"> <div class="time-container">
<jxTime></jxTime> <jxTime></jxTime>
@@ -57,12 +61,12 @@
</div> </div>
<jxDialog <jxDialog
ref="child" ref="child"
title="修改密码" :title="type === 1 ? $t('common.changepassword') : $t('common.warning')"
:unclick="unclick" :unclick="unclick"
@toSure="toSureDialog" @toSure="toSureDialog"
@toCancle="toCancle" @toCancle="toCancle"
> >
<div class="form_wraper"> <div v-if="type === 1" class="form_wraper">
<div class="form"> <div class="form">
<div class="form_item"> <div class="form_item">
<div class="form_item__label form_item__label_pass"><i>*</i>{{ $t('common.oldpassword') }}</div> <div class="form_item__label form_item__label_pass"><i>*</i>{{ $t('common.oldpassword') }}</div>
@@ -88,6 +92,7 @@
</div> </div>
</div> </div>
</div> </div>
<div v-if="type === 2" class="form_wraper">{{ $t('common.toast5') }}</div>
</jxDialog> </jxDialog>
<vue-touch-keyboard id="keyboard" :options="options" v-if="visible" :layout="layout" :cancel="hide" :accept="accept" :input="input" :next="next" /> <vue-touch-keyboard id="keyboard" :options="options" v-if="visible" :layout="layout" :cancel="hide" :accept="accept" :input="input" :next="next" />
</div> </div>
@@ -96,7 +101,7 @@
<script> <script>
import jxTime from '@components/time.vue' import jxTime from '@components/time.vue'
import jxDialog from '@components/dialog.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 { sendWebsocket, closeWebsocket } from '@/config/websocket.js'
import {encrypt} from '../../../main.js' import {encrypt} from '../../../main.js'
export default { export default {
@@ -124,7 +129,9 @@ export default {
}, },
topInfo: {}, topInfo: {},
selectTypeList: [{value: 'zh-cn', label: '中文'}, {value: 'en-us', label: 'English'}], selectTypeList: [{value: 'zh-cn', label: '中文'}, {value: 'en-us', label: 'English'}],
selectType: '' selectType: '',
type: null,
disabled: false
} }
}, },
watch: { watch: {
@@ -197,17 +204,46 @@ export default {
showDropdown () { showDropdown () {
this.dropdown = !this.dropdown this.dropdown = !this.dropdown
}, },
showDialog () { showDialog (type) {
this.dropdown = false this.type = type
this.$refs.child.active = true if (type === 1) {
this.oldpassword = '' this.dropdown = false
this.newpassword1 = '' this.$refs.child.active = true
this.newpassword2 = '' this.oldpassword = ''
this.unclick = true this.newpassword1 = ''
this.newpassword2 = ''
this.unclick = true
} else if (type === 2) {
this.$refs.child.active = true
}
}, },
toSureDialog () { toSureDialog () {
this._updatePass() if (this.type === 1) {
this.hide() 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 () { toCancle () {
this.hide() this.hide()
@@ -554,4 +590,9 @@ export default {
width calc(100% - 205px) width calc(100% - 205px)
.home_button p .home_button p
letter-spacing 2px 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> </style>