优化网络连接显示及星座图软件的加载速度
parent
86522ff589
commit
297a9747aa
|
@ -62,7 +62,6 @@ await SerialPort.list().then((ports, err) => {
|
|||
if (ports.length == 0) {
|
||||
console.error('not connect')
|
||||
comreturn = false
|
||||
return
|
||||
}else {
|
||||
const { path, baudRate, dataBits, stopBits, parity } = getSerialPortConstructorArguments(ports)
|
||||
console.log(path, baudRate, dataBits, stopBits, parity)
|
||||
|
|
|
@ -250,9 +250,10 @@ export class MainWindow extends LocalSoftwareWindow {
|
|||
let resport: any
|
||||
|
||||
await comon().then((res:any) => {
|
||||
if(!res.comoptions) {
|
||||
event.sender.send('BURN_PROGRAM_FEEDBACK', { err: new Error('请先连接核心处理模块') } )
|
||||
}else {
|
||||
resport = res.comoptions.path
|
||||
})
|
||||
|
||||
execFile(ESP_TOOL_PATH,
|
||||
['--chip', 'esp32', '--port', resport, '--baud', '921600', '--before', 'default_reset', '--after', 'hard_reset', 'write_flash', '-z', '--flash_mode', 'dio', '--flash_freq', '80m', '--flash_size', 'detect',
|
||||
'0xe000' , BOOT_APP0_BIN_PATH,
|
||||
|
@ -266,6 +267,8 @@ export class MainWindow extends LocalSoftwareWindow {
|
|||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
launchOnlineSoftware(_: IpcMainEvent, param: any) {
|
||||
// TODO: 添加http网址正则表达式验证
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<SerialPortReceivingMessageView class="h-full" />
|
||||
</n-tab-pane>
|
||||
<n-tab-pane display-directive="show:lazy" tab="地图" name="map">
|
||||
<MapView />
|
||||
<component :is="MapComponent"></component>
|
||||
</n-tab-pane>
|
||||
</Tabs>
|
||||
</Layout>
|
||||
|
@ -27,7 +27,7 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, watch } from 'vue'
|
||||
import { ref, defineAsyncComponent, onMounted } from 'vue'
|
||||
import { NTabPane } from 'naive-ui'
|
||||
import { Application } from '@/components/Application'
|
||||
import { CustomTitleBar } from '@/components/CustomTitleBar'
|
||||
|
@ -38,7 +38,6 @@ import { SerialPortReceivingMessageView } from '@/components/SerialPort'
|
|||
import { BasicInfoView } from '@/views/BDDataAnalysisPlatform/BasicInfoView'
|
||||
import { PlanisphereView } from '@/views/BDDataAnalysisPlatform/PlanisphereView'
|
||||
import { SNRView } from '@/views/BDDataAnalysisPlatform/SNRView'
|
||||
import MapView from '@/views/BDDataAnalysisPlatform/MapView.vue'
|
||||
|
||||
import { useNMEAStore, NMEADataSource } from '@/stores/nmea'
|
||||
import { LineBreakParser } from '@/utils/parser'
|
||||
|
@ -55,8 +54,14 @@ const onSerialPortData = (value: Uint8Array) => {
|
|||
}
|
||||
|
||||
const softwareTitle = ref(null)
|
||||
const MapComponent = ref(null)
|
||||
const MapViewComponent = defineAsyncComponent(() => import('@/views/BDDataAnalysisPlatform/MapView.vue'))
|
||||
|
||||
onMounted(() => {
|
||||
softwareTitle.value.title = '北斗数据分析平台'
|
||||
setTimeout(async () => {
|
||||
MapComponent.value = await MapViewComponent
|
||||
}, 1000)
|
||||
})
|
||||
|
||||
window.ipcRenderer.receive('COM_LISTENER', onSerialPortData)
|
||||
|
|
|
@ -1,28 +1,47 @@
|
|||
import { ref } from 'vue'
|
||||
import { defineStore } from 'pinia'
|
||||
import { useMessage } from 'naive-ui'
|
||||
import type { MessageReactive } from 'naive-ui'
|
||||
|
||||
export const useNetworkStore = defineStore('network', () => {
|
||||
const message = useMessage()
|
||||
const isOnLine = ref(window.navigator.onLine)
|
||||
let checkLine
|
||||
let messageReactive: MessageReactive | null = null
|
||||
const createMessage = () => {
|
||||
if (!messageReactive) {
|
||||
messageReactive = message.loading('正在连接中', {
|
||||
duration: 0
|
||||
})
|
||||
}
|
||||
}
|
||||
const removeMessage = () => {
|
||||
if (messageReactive) {
|
||||
messageReactive.destroy()
|
||||
messageReactive = null
|
||||
}
|
||||
}
|
||||
const setCheck = () => {
|
||||
createMessage()
|
||||
checkLine = setTimeout(() => {
|
||||
removeMessage()
|
||||
if(isOnLine.value) {
|
||||
message.success('连接成功')
|
||||
} else {
|
||||
message.error('连接失败')
|
||||
}
|
||||
}, 5000)
|
||||
}, 20000)
|
||||
}
|
||||
window.addEventListener( 'online' , () => {
|
||||
isOnLine.value = true
|
||||
clearTimeout(checkLine)
|
||||
removeMessage()
|
||||
message.success('连接成功')
|
||||
} )
|
||||
window.addEventListener( 'offline', () => {
|
||||
isOnLine.value = false
|
||||
clearTimeout(checkLine)
|
||||
removeMessage()
|
||||
message.error('连接失败')
|
||||
} )
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, watch, onMounted } from 'vue'
|
||||
import { ref, watch } from 'vue'
|
||||
import { NDescriptions, NDescriptionsItem, NTime, useMessage } from 'naive-ui'
|
||||
import { useNMEAStore } from '@/stores/nmea'
|
||||
|
||||
|
@ -38,10 +38,6 @@ const connectErrMsg = (value: Boolean) => {
|
|||
|
||||
window.ipcRenderer.receive('CANNOT_CONNECT',connectErrMsg)
|
||||
|
||||
onMounted(() => {
|
||||
window.ipcRenderer.send('COM_READY')
|
||||
})
|
||||
|
||||
watch(() => nmea.handled, (value) => {
|
||||
if (!value) return
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, watch, onMounted } from 'vue'
|
||||
import { ref, watch } from 'vue'
|
||||
import { Map, MapMarker, lonlat2Position } from '@/components/Map'
|
||||
import { useNMEAStore } from '@/stores/nmea'
|
||||
|
||||
|
@ -14,10 +14,6 @@ const position = ref()
|
|||
|
||||
const mapRef = ref()
|
||||
|
||||
onMounted(() => {
|
||||
window.ipcRenderer.send('COM_READY')
|
||||
})
|
||||
|
||||
watch(() => nmea.handled3, (value) => {
|
||||
if (!value || !nmea.longitude || !nmea.latitude) return
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { watch, onMounted } from "vue"
|
||||
import { watch } from "vue"
|
||||
import { use } from "echarts/core"
|
||||
import { CanvasRenderer } from "echarts/renderers"
|
||||
import { ScatterChart } from "echarts/charts"
|
||||
|
@ -22,10 +22,6 @@ use([
|
|||
PolarComponent
|
||||
])
|
||||
|
||||
onMounted(() => {
|
||||
window.ipcRenderer.send('COM_READY')
|
||||
})
|
||||
|
||||
const nmea = useNMEAStore()
|
||||
watch(() => nmea.handled1, (value) => {
|
||||
if (!value) return
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { watch, onMounted } from "vue"
|
||||
import { watch } from "vue"
|
||||
import { use } from "echarts/core"
|
||||
import { CanvasRenderer } from "echarts/renderers"
|
||||
import { BarChart } from "echarts/charts"
|
||||
|
@ -22,10 +22,6 @@ use([
|
|||
GridComponent
|
||||
])
|
||||
|
||||
onMounted(() => {
|
||||
window.ipcRenderer.send('COM_READY')
|
||||
})
|
||||
|
||||
const nmea = useNMEAStore()
|
||||
watch(() => nmea.handled2, (value) => {
|
||||
if (!value) return
|
||||
|
|
|
@ -39,8 +39,8 @@ const onBurnProgramBtnClick = async (binFileName: string) => {
|
|||
|
||||
dialog.info({
|
||||
title: '系统提示',
|
||||
closable: false,
|
||||
maskClosable: false,
|
||||
closable: true,
|
||||
maskClosable: true,
|
||||
class: 'text-center',
|
||||
content: () => h(
|
||||
NSpin,
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<template>
|
||||
<n-space class="toolbar">
|
||||
<div class="button-background">
|
||||
<n-popover :show="!network.isOnLine" placement="bottom">
|
||||
<template #trigger>
|
||||
<n-button size="large" circle type="info" @click="emit('systemSettings')">
|
||||
<template #icon>
|
||||
<n-icon>
|
||||
|
@ -10,9 +8,6 @@
|
|||
</n-icon>
|
||||
</template>
|
||||
</n-button>
|
||||
</template>
|
||||
请连接网络
|
||||
</n-popover >
|
||||
|
||||
<n-button size="large" circle type="info" @click="emit('quickBurning')">
|
||||
<template #icon>
|
||||
|
@ -42,7 +37,7 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { NSpace, NPopover , NButton, NIcon, useDialog } from 'naive-ui'
|
||||
import { NSpace, NButton, NIcon, useDialog } from 'naive-ui'
|
||||
import {
|
||||
PhoneFilled as Phone,
|
||||
SettingsFilled as Settings,
|
||||
|
|
Loading…
Reference in New Issue