学习机3.4.0版本
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
<n-space vertical justify="space-around" align="center" item-style="width: 50%;" class="gesture-recognition-config-view">
|
||||
<n-form-item size="large" label-placement="left" label="翻页动画时长:" path="animationDuration">
|
||||
<n-select
|
||||
:disabled="!serialPort.isOpen"
|
||||
placeholder="请选择翻页动画时长"
|
||||
v-model:value="model.animationDuration"
|
||||
:options="animationDurationOptions"
|
||||
@@ -16,7 +15,6 @@
|
||||
|
||||
<n-form-item size="large" label-placement="left" label="日期显示时长:" path="dateDisplayDuration">
|
||||
<n-select
|
||||
:disabled="!serialPort.isOpen"
|
||||
placeholder="请选择日期显示时长"
|
||||
v-model:value="model.dateDisplayDuration"
|
||||
:options="dateDisplayDurationOptions"
|
||||
@@ -36,43 +34,27 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { NSpace, NFormItem, NSelect, useMessage } from 'naive-ui'
|
||||
import { NSpace, NFormItem, NSelect } from 'naive-ui'
|
||||
import ResetButtonView from '../ResetButtonView.vue'
|
||||
import { animationDurationOptions, dateDisplayDurationOptions } from './data'
|
||||
import { useSerialPortStore } from '@/stores/serialPort'
|
||||
|
||||
const message = useMessage()
|
||||
|
||||
const serialPort = useSerialPortStore()
|
||||
const model = ref({
|
||||
animationDuration : null,
|
||||
dateDisplayDuration: null,
|
||||
})
|
||||
|
||||
const onAnimationDurationUpdate = () => {
|
||||
if (!serialPort.isOpen) {
|
||||
message.error('请先连接无线通信模块并打开串口')
|
||||
return
|
||||
}
|
||||
|
||||
let cmd = `$SCANSP,${model.value.animationDuration}*`
|
||||
cmd += cmd.length
|
||||
cmd += '\r\n'
|
||||
|
||||
serialPort.write(cmd)
|
||||
window.ipcRenderer.send('COM_WRITE',cmd)
|
||||
}
|
||||
|
||||
const onDateDisplayDurationUpdate = () => {
|
||||
if (!serialPort.isOpen) {
|
||||
message.error('请先连接无线通信模块并打开串口')
|
||||
return
|
||||
}
|
||||
|
||||
let cmd = `$SETSDT,${model.value.dateDisplayDuration}*`
|
||||
cmd += cmd.length
|
||||
cmd += '\r\n'
|
||||
|
||||
serialPort.write(cmd)
|
||||
window.ipcRenderer.send('COM_WRITE',cmd)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
</n-form-item>
|
||||
|
||||
<div class="text-center">
|
||||
<n-button :disabled="!serialPort.isOpen" type="primary" size="large" @click="onClick">发送手势识别设置命令</n-button>
|
||||
<n-button type="primary" size="large" @click="onClick">发送手势识别设置命令</n-button>
|
||||
</div>
|
||||
|
||||
<ResetButtonView />
|
||||
@@ -63,7 +63,6 @@ import { ref } from 'vue'
|
||||
import { NSpace, NFormItem, NSlider, NSelect, NButton, useMessage } from 'naive-ui'
|
||||
import ResetButtonView from '../ResetButtonView.vue'
|
||||
import { MAX_DISTANCE, MIN_DISTANCE, timeOutOptions, intervalOptions, eventOptions } from './data'
|
||||
import { useSerialPortStore } from '@/stores/serialPort'
|
||||
|
||||
const model = ref({
|
||||
distance: -300,
|
||||
@@ -74,13 +73,7 @@ const model = ref({
|
||||
})
|
||||
|
||||
const message = useMessage()
|
||||
const serialPort = useSerialPortStore()
|
||||
const onClick = () => {
|
||||
if (!serialPort.isOpen) {
|
||||
message.error('请先连接无线通信模块并打开串口')
|
||||
return
|
||||
}
|
||||
|
||||
const value = model.value
|
||||
if (!value.timeOut) {
|
||||
message.error('请设置超时时间')
|
||||
@@ -105,8 +98,7 @@ const onClick = () => {
|
||||
let cmd = `$GESTE,0,1,${-value.distance},${value.timeOut},5,${value.interval},${value.ltr},${value.rtl}*`
|
||||
cmd += cmd.length
|
||||
cmd += '\r\n'
|
||||
|
||||
serialPort.write(cmd)
|
||||
window.ipcRenderer.send('COM_WRITE',cmd)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,22 +1,23 @@
|
||||
<template>
|
||||
<div class="reset-button-container">
|
||||
<n-button :disabled="!serialPort.isOpen" type="primary" size="large" @click="onResetBtnClick">恢复默认设置</n-button>
|
||||
<n-button type="primary" size="large" @click="onResetBtnClick">恢复默认设置</n-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted } from 'vue'
|
||||
import { NButton } from 'naive-ui'
|
||||
import { useSerialPortStore } from '@/stores/serialPort'
|
||||
|
||||
const serialPort = useSerialPortStore()
|
||||
const onResetBtnClick = () => {
|
||||
if (!serialPort.isOpen) return
|
||||
|
||||
let cmd = `$RECOVERY,1*`
|
||||
cmd += cmd.length
|
||||
cmd += '\r\n'
|
||||
serialPort.write(cmd)
|
||||
window.ipcRenderer.send('COM_WRITE',cmd)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
window.ipcRenderer.send('COM_READY')
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
</template>
|
||||
</n-slider>
|
||||
|
||||
<n-button :disabled="!serialPort.isOpen" type="primary" size="large" secondary @click="onBrightnessBtnClick">发送亮度设置命令</n-button>
|
||||
<n-button type="primary" size="large" secondary @click="onBrightnessBtnClick">发送亮度设置命令</n-button>
|
||||
|
||||
</n-space>
|
||||
</n-card>
|
||||
@@ -29,35 +29,34 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { NSpace, NCard, NGrid, NGi, NP, NSlider, NButton } from 'naive-ui'
|
||||
import { NSpace, NCard, NGrid, NGi, NP, NSlider, NButton, useMessage } from 'naive-ui'
|
||||
import convert from 'color-convert'
|
||||
import ResetButtonView from '../ResetButtonView.vue'
|
||||
import { count, MIN, MAX } from './data'
|
||||
import { useSerialPortStore } from '@/stores/serialPort'
|
||||
|
||||
|
||||
const serialPort = useSerialPortStore()
|
||||
const message = useMessage()
|
||||
|
||||
const onColorInputChange = (color, index) => {
|
||||
if (!serialPort.isOpen) return
|
||||
|
||||
const rgb = convert.hex.rgb(color)
|
||||
|
||||
let cmd = `$LEDRGB,${index},${rgb[0]},${rgb[1]},${rgb[2]}*`
|
||||
cmd += cmd.length
|
||||
cmd += '\r\n'
|
||||
serialPort.write(cmd)
|
||||
window.ipcRenderer.send('COM_WRITE',cmd)
|
||||
}
|
||||
|
||||
const brightness = ref(MIN)
|
||||
const onBrightnessBtnClick = () => {
|
||||
if (!serialPort.isOpen) return
|
||||
|
||||
let cmd = `$LEDBT,${brightness.value}*`
|
||||
cmd += cmd.length
|
||||
cmd += '\r\n'
|
||||
serialPort.write(cmd)
|
||||
window.ipcRenderer.send('COM_WRITE',cmd)
|
||||
}
|
||||
|
||||
const connectErrMsg = (value: Boolean) => {
|
||||
message.error('无法连接到串口设备')
|
||||
}
|
||||
|
||||
window.ipcRenderer.receive('CANNOT_CONNECT',connectErrMsg)
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
|
||||
@@ -16,26 +16,16 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { NSpace, NSelect, useMessage } from 'naive-ui'
|
||||
import { NSpace, NSelect } from 'naive-ui'
|
||||
import ResetButtonView from '../ResetButtonView.vue'
|
||||
import { options } from './data'
|
||||
import { useSerialPortStore } from '@/stores/serialPort'
|
||||
|
||||
const message = useMessage()
|
||||
const serialPort = useSerialPortStore()
|
||||
|
||||
const value = ref(null)
|
||||
const onSelectUpdate = () => {
|
||||
if (!serialPort.isOpen) {
|
||||
message.error('请先连接无线通信模块并打开串口')
|
||||
return
|
||||
}
|
||||
|
||||
let cmd = `$SDEVENT,${value.value}*`
|
||||
cmd += cmd.length
|
||||
cmd += '\r\n'
|
||||
|
||||
serialPort.write(cmd)
|
||||
window.ipcRenderer.send('COM_WRITE',cmd)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user