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