diff --git a/src/render/components/CenterCmp.vue b/src/render/components/CenterCmp.vue index 348cc02..7f9604e 100644 --- a/src/render/components/CenterCmp.vue +++ b/src/render/components/CenterCmp.vue @@ -7,30 +7,34 @@
-
5
-
7
+
+ {{ s }} +
-  北 斗15 +  北 斗{{ bd_satellite_count }}
- 伽 利 略15 + 伽 利 略{{ ga_satellite_count }}
- +
- 10G P S + {{ gp_satellite_count }}G P S
- 17格洛纳斯 + {{ gl_satellite_count }}格洛纳斯
@@ -42,6 +46,28 @@ import Ring from './Ring.vue' import Decoration1 from './Layout/Decoration1.vue' import Decoration5 from './Layout/Decoration5.vue' +import { ref, computed } from 'vue' + +const bd_satellite_count = ref(0) +const gp_satellite_count = ref(0) +const gl_satellite_count = ref(0) +const ga_satellite_count = ref(0) + +const count_str_arr = computed(() => { + return (bd_satellite_count.value + gp_satellite_count.value + gl_satellite_count.value + ga_satellite_count.value).toString().split('') +}) + +const ring = ref(null) +const update = (bd_satellite_length: number, gp_satellite_length: number, gl_satellite_length: number, ga_satellite_length: number) => { + bd_satellite_count.value = bd_satellite_length + gp_satellite_count.value = gp_satellite_length + gl_satellite_count.value = gl_satellite_length + ga_satellite_count.value = ga_satellite_length + + ring.value.update(bd_satellite_length, gp_satellite_length, gl_satellite_length, ga_satellite_length) +} + +defineExpose({ update }) diff --git a/src/render/components/Ring.vue b/src/render/components/Ring.vue index 3a75a32..130e20a 100644 --- a/src/render/components/Ring.vue +++ b/src/render/components/Ring.vue @@ -53,18 +53,18 @@ const option = reactive({ show: false }, data: [ - { value: 15, name: '北 斗' }, - { value: 10, name: 'G P S' }, - { value: 15, name: '格洛纳斯' }, - { value: 17, name: '伽 利 略' } + { value: 0, name: '北 斗' }, + { value: 0, name: 'G P S' }, + { value: 0, name: '格洛纳斯' }, + { value: 0, name: '伽 利 略' } ] } ] }); -let highlightIndex = -1 const ring = ref(null) const COUNT = option.series[0].data.length +let highlightIndex = -1 const highlight = () => { ring.value.dispatchAction({ type: 'downplay', @@ -83,7 +83,12 @@ onMounted(() => { setInterval(highlight, 3000) }) -const update = console.log +const update = (bd_val: number, gp_val: number, gl_val: number, ga_val: number) => { + option.series[0].data[0].value = bd_val + option.series[0].data[1].value = gp_val + option.series[0].data[2].value = gl_val + option.series[0].data[3].value = ga_val +} defineExpose({ update }) diff --git a/src/render/components/ScrollBoardTable.vue b/src/render/components/ScrollBoardTable.vue index 745f921..ade8145 100644 --- a/src/render/components/ScrollBoardTable.vue +++ b/src/render/components/ScrollBoardTable.vue @@ -11,7 +11,7 @@ /> -
+
- + - +
- +
- + - +
@@ -39,12 +39,26 @@ import { ref, onMounted } from 'vue' import { getGSV } from '../api/util' const BDScrollBoardTable = ref(null) -const update = (nmeaStr: string) => { +const GPScrollBoardTable = ref(null) +const GLScrollBoardTable = ref(null) +const GAScrollBoardTable = ref(null) +const centerCmp = ref(null) +const update = (nmeaStr: string) => { const data: any = getGSV(nmeaStr) if (!data) return const { bd, gp, gl, ga } = data BDScrollBoardTable.value.update(bd.GSVArr) + GPScrollBoardTable.value.update(gp.GSVArr) + GLScrollBoardTable.value.update(gl.GSVArr) + GAScrollBoardTable.value.update(ga.GSVArr) + + const bd_satellite_count = getSatelliteCount(bd.GSVArr) + const gp_satellite_count = getSatelliteCount(gp.GSVArr) + const gl_satellite_count = getSatelliteCount(gl.GSVArr) + const ga_satellite_count = getSatelliteCount(ga.GSVArr) + + centerCmp.value.update(bd_satellite_count, gp_satellite_count, gl_satellite_count, ga_satellite_count) } onMounted(() => { if ('ipcRenderer' in window) { @@ -53,4 +67,15 @@ onMounted(() => { ipcRenderer.send('APP_MOUNTED') } }) + +const getSatelliteCount = (GSVArr: Array) => { + if (!GSVArr) return + + let count = 0 + GSVArr.forEach(gsv => { + count += gsv.satellites.length + }); + + return count +}