修复北斗授时的bug以及为字体设计新增显示到LED屏的功能

This commit is contained in:
2023-10-16 13:55:56 +08:00
parent a292e1aca6
commit 5120201397
11 changed files with 183 additions and 51 deletions

View File

@@ -20,7 +20,7 @@
<n-space vertical>
<div>
<n-text v-if="!hasFont">字库未创建,请先创建字库</n-text>
<n-text v-if="!hasFont">{{ fontmsg }}</n-text>
<n-radio-group v-else v-model:value="fontLibrarySelected" name="radiogroup">
<n-space>
@@ -39,23 +39,31 @@
<script setup lang="ts">
import { ref, watch, onMounted } from 'vue'
import { NSpace, NGrid, NGi, NInput, NRadioGroup, NRadio, NText, NButton } from 'naive-ui'
import { NSpace, NGrid, NGi, NInput, NRadioGroup, NRadio, NText, NButton, useMessage } from 'naive-ui'
import { LEDPanelView } from './LEDPanelView'
import { hasIpcRenderer } from '@/utils'
const itemStyle = { textAlign: 'center', flex: '1 1 50%'}
const message = useMessage()
const itemStyle = { textAlign: 'center', flex: '1 1 50%' }
const count = 8
const hasFont = ref(false)
const fontmsg = ref('字库未创建,请先创建字库后重启软件')
const chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', '.', '-']
const onlyAllow = (value: string) => !value || chars.indexOf(value) >= 0
const ledPanelViewRef = ref()
const inputValues = ref(new Array(count).fill(null))
for (let i = 0; i < count; i++) {
watch(
() => inputValues.value[i],
value => {
const { data } = window.ipcRenderer.sendSync('LOAD_FONT_LIBRARY')
if (!data) return
fontLibrary = JSON.parse(data)
hasFont.value = true
if (!value) {
ledPanelViewRef.value.clearArea(i)
} else {
@@ -86,6 +94,7 @@ onMounted(() => {
const onClearBtnClick = () => {
inputValues.value.fill(null)
ledPanelViewRef.value.clearAll()
}
</script>