Compare commits
8 Commits
Author | SHA1 | Date |
---|---|---|
|
7bc9959465 | |
|
d06c66ad39 | |
|
78e1b7128a | |
|
342712f219 | |
|
5e1003f95a | |
|
cedf6b613d | |
|
98fdd6a489 | |
|
e23a4bc500 |
|
@ -1,8 +0,0 @@
|
|||
import Store from 'electron-store'
|
||||
|
||||
const store = new Store()
|
||||
const set = (key, val) => store.set(key, val)
|
||||
|
||||
const get = (key) => store.get(key)
|
||||
|
||||
export default {set, get}
|
|
@ -1,58 +0,0 @@
|
|||
<template>
|
||||
<vc-viewer :shouldAnimate="true" :showCredit="false" :infoBox="false" @ready="onViewerReady">
|
||||
<vc-layer-imagery>
|
||||
<vc-provider-imagery-singletile :url="earth" />
|
||||
</vc-layer-imagery>
|
||||
|
||||
<vc-entity :show="show" :position="position">
|
||||
<vc-graphics-billboard :image="pin" :verticalOrigin="1" />
|
||||
</vc-entity>
|
||||
</vc-viewer>
|
||||
</template>
|
||||
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { reactive, computed } from 'vue'
|
||||
import { getPosition } from '../api/util'
|
||||
import pin from '../assets/pin.png'
|
||||
import earth from '../assets/earth.jpg'
|
||||
|
||||
const position = reactive({ lng: NaN, lat: NaN })
|
||||
const show = computed(() => {
|
||||
const { lng, lat } = position
|
||||
|
||||
if (isNaN(lng) || lng > 180 || lng < -180) return false
|
||||
if (isNaN(lat) || lat > 90 || lat < -90 ) return false
|
||||
|
||||
return true
|
||||
})
|
||||
|
||||
// 设置地球自转动画效果
|
||||
const onViewerReady = ({ Cesium, viewer }) => {
|
||||
const { JulianDate, Cartesian3 } = Cesium
|
||||
const { clock, scene } = viewer
|
||||
|
||||
let prev = clock.currentTime
|
||||
clock.onTick.addEventListener(() => {
|
||||
const current = clock.currentTime
|
||||
|
||||
const interval = JulianDate.toDate(current) - JulianDate.toDate(prev)
|
||||
prev = current
|
||||
|
||||
scene.camera.rotate(
|
||||
Cartesian3.UNIT_Z,
|
||||
(Math.PI / (24 * 60 * 60)) * interval * 1,
|
||||
);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const update = (nmea) => {
|
||||
const newPosition = getPosition(nmea)
|
||||
if (!newPosition) return
|
||||
|
||||
Object.assign(position, newPosition)
|
||||
}
|
||||
|
||||
defineExpose({ update })
|
||||
</script>
|
|
@ -1,15 +0,0 @@
|
|||
import { createApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
|
||||
import 'vue-cesium/dist/index.css'
|
||||
import { VcViewer, VcEntity, VcLayerImagery, VcProviderImagerySingletile, VcGraphicsBillboard } from 'vue-cesium'
|
||||
|
||||
import './main.css'
|
||||
|
||||
const cesiumPath = (process.env.NODE_ENV === 'development' ? './node_modules/cesium/Build/Cesium/Cesium.js': './Cesium/Cesium.js')
|
||||
|
||||
const app = createApp(App)
|
||||
// 局部引入VueCesium
|
||||
app.use(VcViewer).use(VcEntity).use(VcLayerImagery).use(VcProviderImagerySingletile).use(VcGraphicsBillboard)
|
||||
app.config.globalProperties.$VueCesium = { cesiumPath }
|
||||
app.mount('#app')
|
File diff suppressed because it is too large
Load Diff
|
@ -2,41 +2,47 @@
|
|||
"name": "beidou-satellite-data-monitor",
|
||||
"description": "beidou-satellite-data-monitor",
|
||||
"author": "hwasmart",
|
||||
"version": "5.5.9",
|
||||
"version": "5.6.0",
|
||||
"main": "dist/main/app.js",
|
||||
"scripts": {
|
||||
"install": "electron-rebuild",
|
||||
"dev": "vite",
|
||||
"dev": "vite --port=3000",
|
||||
"build": "vite build",
|
||||
"serve": "vite preview",
|
||||
"electron:dev": "cross-env NODE_ENV=development electron index.js",
|
||||
"electron:build": "rimraf dist && vite build && tsc -p tsconfig.electron.json && electron-builder"
|
||||
},
|
||||
"dependencies": {
|
||||
"@serialport/bindings": "^9.2.9",
|
||||
"@serialport/parser-inter-byte-timeout": "^12.0.0",
|
||||
"cesium": "^1.88.0",
|
||||
"conf": "^13.0.1",
|
||||
"echarts": "^5.1.0",
|
||||
"electron-store": "^8.0.0",
|
||||
"nmea": "http://git.hwasmart.com/bd_group/node-nmea.git",
|
||||
"serialport": "10.0.0",
|
||||
"serialport": "^12.0.0",
|
||||
"through": "^2.3.8",
|
||||
"vue": "^3.2.26",
|
||||
"vue-cesium": "3.0.2-beta.13",
|
||||
"vue-cesium": "^v3.2.8",
|
||||
"vue-echarts": "^6.0.0-rc.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.5.4",
|
||||
"@vitejs/plugin-vue": "^1.1.5",
|
||||
"@vue/compiler-sfc": "^3.2.26",
|
||||
"autoprefixer": "^10.2.5",
|
||||
"cross-env": "^7.0.3",
|
||||
"electron": "^13.6.3",
|
||||
"electron-builder": "^22.10.5",
|
||||
"electron": "^19.0.3",
|
||||
"electron-builder": "^25.0.5",
|
||||
"electron-rebuild": "2.3.5",
|
||||
"postcss": "^8.2.10",
|
||||
"rimraf": "^3.0.2",
|
||||
"rollup-plugin-copy": "^3.4.0",
|
||||
"tailwindcss": "^2.1.1",
|
||||
"ts-node": "^9.1.1",
|
||||
"typescript": "^4.2.3",
|
||||
"vite": "^2.0.5"
|
||||
"typescript": "^5.5.4",
|
||||
"vite": "^2.0.5",
|
||||
"vite-plugin-electron": "^0.28.7",
|
||||
"vite-plugin-electron-renderer": "^0.14.5"
|
||||
},
|
||||
"build": {
|
||||
"appId": "hwasmart.id",
|
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 72 KiB |
|
@ -1,16 +1,16 @@
|
|||
import { app, screen, globalShortcut, BrowserWindow, ipcMain, dialog } from 'electron'
|
||||
import { join } from "path"
|
||||
import config from './config'
|
||||
import config from './config.js'
|
||||
import './load-serialport'
|
||||
import { keyword } from './KeyWord'
|
||||
|
||||
const child_process = require('child_process')
|
||||
const crypto = require('crypto')
|
||||
import child_process from 'child_process'
|
||||
import crypto from 'crypto'
|
||||
|
||||
function queryPass(passPath: string, passValue: string) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
try {
|
||||
child_process.exec(`reg query ${passPath} /v ${passValue}`, (error: Error, stdout: string, stderr: string) => {
|
||||
child_process.exec(`reg query ${passPath} /v ${passValue}`, (error: Error | null, stdout: string, stderr: string) => {
|
||||
if (error) {
|
||||
reject(error)
|
||||
return
|
||||
|
@ -26,7 +26,7 @@ function queryPass(passPath: string, passValue: string) {
|
|||
function queryKey(keyPath: string, keyValue: string) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
try {
|
||||
child_process.exec(`reg query ${keyPath} /v ${keyValue}`, (error: Error, stdout: string, stderr: string) => {
|
||||
child_process.exec(`reg query ${keyPath} /v ${keyValue}`, (error: Error | null, stdout: string, stderr: string) => {
|
||||
if (error) {
|
||||
reject(error)
|
||||
return
|
||||
|
@ -121,44 +121,18 @@ const getDisplayOrigin = (display: any) => {
|
|||
return origin
|
||||
}
|
||||
|
||||
var windows:Array<BrowserWindow> = [];
|
||||
|
||||
function createWindow(option: any, url: any) {
|
||||
const win = new BrowserWindow(option)
|
||||
|
||||
if (URl_REGEX.test(url)) {
|
||||
win.loadURL(url)
|
||||
} else {
|
||||
win.loadFile(url)
|
||||
}
|
||||
|
||||
const isWindows = process.platform === 'win32';
|
||||
let needsFocusFix = false;
|
||||
let triggeringProgrammaticBlur = false;
|
||||
|
||||
//弹出警报窗口后 input获取不到焦点
|
||||
win.on('blur', (event: any) => {
|
||||
if(!triggeringProgrammaticBlur) {
|
||||
needsFocusFix = true;
|
||||
}
|
||||
})
|
||||
|
||||
win.on('focus', (event: any) => {
|
||||
if(isWindows && needsFocusFix) {
|
||||
needsFocusFix = false;
|
||||
triggeringProgrammaticBlur = true;
|
||||
//弹出弹窗后重新聚焦导致windows任务栏显示,重新隐藏底部windows任务栏
|
||||
win.minimize(); //最小化函数
|
||||
win.restore(); //取消最小化函数(从最小化窗口还原函数)
|
||||
setTimeout(function () {
|
||||
win.blur(); //失去焦点函数
|
||||
win.focus(); //获取焦点函数
|
||||
setTimeout(function () {
|
||||
triggeringProgrammaticBlur = false;
|
||||
}, 100);
|
||||
}, 100);
|
||||
}
|
||||
})
|
||||
|
||||
if(process.env.NODE_ENV === 'development') win.webContents.openDevTools()
|
||||
windows.push(win);
|
||||
}
|
||||
|
||||
ipcMain.on('CLOSE', (event) => {
|
||||
const res = dialog.showMessageBox({
|
||||
|
@ -173,13 +147,15 @@ function createWindow(option: any, url: any) {
|
|||
|
||||
res.then((data)=>{
|
||||
if(data.response == 0){
|
||||
win.close()
|
||||
windows.forEach((key:BrowserWindow) => {
|
||||
key.close();
|
||||
});
|
||||
windows = [];
|
||||
}else{
|
||||
console.log('not close software')
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
launch()
|
|
@ -0,0 +1,10 @@
|
|||
// import Store from 'electron-store'
|
||||
const Store = require('electron-store')
|
||||
|
||||
const store = new Store()
|
||||
const set = (key, val) => store.set(key, val)
|
||||
|
||||
const get = (key) => store.get(key)
|
||||
|
||||
// export default {set, get}
|
||||
module.exports = { set, get }
|
|
@ -1,6 +1,6 @@
|
|||
import SerialPort from 'serialport'
|
||||
import InterByteTimeout from '@serialport/parser-inter-byte-timeout'
|
||||
import config from './config'
|
||||
import { SerialPort } from 'serialport'
|
||||
import { InterByteTimeoutParser } from '@serialport/parser-inter-byte-timeout'
|
||||
import config from './config.js'
|
||||
import sendMsg from './ipcRendererManager'
|
||||
import NMEAHandler from './api/NMEAHandler'
|
||||
|
||||
|
@ -10,7 +10,6 @@ const getSerialPortConstructorArguments = (ports) => {
|
|||
ports = ports.filter((port) => port.path != 'COM1')
|
||||
if (ports.length == 0) return
|
||||
|
||||
// console.log(ports, '=====================')
|
||||
const serialport = config.get('serialport')
|
||||
const path = ( serialport && serialport.path ) ? serialport.path : ports[0].path
|
||||
const baudRate = ( serialport && serialport.baudRate ) ? serialport.baudRate : DEFAULT_BAUDRATE
|
||||
|
@ -27,9 +26,8 @@ const openSerialport = (ports) => {
|
|||
|
||||
const { path, baudRate } = constructorArguments
|
||||
|
||||
// console.log(path, baudRate, '++++++++++++++===');
|
||||
const serialPort = new SerialPort(path, { baudRate })
|
||||
const parser = serialPort.pipe(new InterByteTimeout({interval: 300}))
|
||||
const serialPort = new SerialPort({ path, baudRate })
|
||||
const parser = serialPort.pipe(new InterByteTimeoutParser({interval: 300}))
|
||||
|
||||
NMEAHandler.on('received' , (nmeaStr) => {
|
||||
sendMsg('NMEA_RECEIVED', nmeaStr)
|
|
@ -15,6 +15,9 @@
|
|||
<div class="text-center w-1/2 ml-auto">
|
||||
<BaseInfoView ref="baseInfoViewInstance" />
|
||||
</div>
|
||||
<div class="text-white fixed bottom-0 right-0">
|
||||
北斗卫星数据监测展示互动系统V1.0
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.3 MiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
@ -6,26 +6,10 @@
|
|||
<div class="label">经 度:</div>
|
||||
<div class="content">{{ baseInfo.longitude ? baseInfo.longitude : '' }}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="label">经度度分:</div>
|
||||
<div class="content">{{ baseInfo.longitude ? longitudeD + ' ' + longitudeM : '' }}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="label">经度分秒:</div>
|
||||
<div class="content">{{ baseInfo.longitude ? longitudeD + ' ' + longitudeM + ' ' + longitudeS : '' }}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="label">纬 度:</div>
|
||||
<div class="content">{{ baseInfo.latitude ? baseInfo.latitude : '' }}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="label">纬度度分:</div>
|
||||
<div class="content">{{ baseInfo.latitude ? latitudeD + ' ' + latitudeM : '' }}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="label">纬度分秒:</div>
|
||||
<div class="content">{{ baseInfo.latitude ? latitudeD + ' ' + latitudeM + ' ' + latitudeS : '' }}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="label">海 拔:</div>
|
||||
<div class="content">{{ baseInfo.altitude }}</div>
|
|
@ -0,0 +1,56 @@
|
|||
<template>
|
||||
<vc-config-provider :cesiumPath="cesiumPath">
|
||||
<vc-viewer :shouldAnimate="true" :showCredit="false" :infoBox="false" @ready="onViewerReady">
|
||||
<vc-layer-imagery>
|
||||
<vc-imagery-provider-singletile :url="earth" />
|
||||
</vc-layer-imagery>
|
||||
|
||||
<vc-entity :show="show" :position="position">
|
||||
<vc-graphics-billboard :image="pin" :verticalOrigin="1" />
|
||||
</vc-entity>
|
||||
</vc-viewer>
|
||||
</vc-config-provider>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { reactive, computed } from "vue";
|
||||
import { getPosition } from "../api/util";
|
||||
import pin from "../assets/pin.png";
|
||||
import earth from "../assets/earth.jpg";
|
||||
|
||||
const cesiumPath = (process.env.NODE_ENV === 'development' ? './node_modules/cesium/Build/Cesium/Cesium.js': './Cesium/Cesium.js')
|
||||
const position = reactive({ lng: NaN, lat: NaN });
|
||||
const show = computed(() => {
|
||||
const { lng, lat } = position;
|
||||
|
||||
if (isNaN(lng) || lng > 180 || lng < -180) return false;
|
||||
if (isNaN(lat) || lat > 90 || lat < -90) return false;
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
// 设置地球自转动画效果
|
||||
const onViewerReady = ({ Cesium, viewer }) => {
|
||||
const { JulianDate, Cartesian3 } = Cesium;
|
||||
const { clock, scene } = viewer;
|
||||
|
||||
let prev = clock.currentTime;
|
||||
clock.onTick.addEventListener(() => {
|
||||
const current = clock.currentTime;
|
||||
|
||||
const interval = JulianDate.toDate(current) - JulianDate.toDate(prev);
|
||||
prev = current;
|
||||
|
||||
scene.camera.rotate(Cartesian3.UNIT_Z, (Math.PI / (24 * 60 * 60)) * interval * 1);
|
||||
});
|
||||
};
|
||||
|
||||
const update = (nmea) => {
|
||||
const newPosition = getPosition(nmea);
|
||||
if (!newPosition) return;
|
||||
|
||||
Object.assign(position, newPosition);
|
||||
};
|
||||
|
||||
defineExpose({ update });
|
||||
</script>
|
|
@ -47,7 +47,7 @@ const option = reactive({
|
|||
inverse: true,
|
||||
axisLine: {show: false},
|
||||
axisTick: {show: false},
|
||||
axisLabel: {color: 'white'}
|
||||
axisLabel: {color: 'white', fontSize: '12'},
|
||||
},
|
||||
series: [{
|
||||
type: 'bar',
|
|
@ -0,0 +1,11 @@
|
|||
import { createApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
|
||||
import 'vue-cesium/dist/index.css'
|
||||
import { VcConfigProvider, VcViewer, VcEntity, VcLayerImagery, VcImageryProviderSingletile, VcGraphicsBillboard } from 'vue-cesium'
|
||||
|
||||
import './main.css'
|
||||
|
||||
const app = createApp(App)
|
||||
app.use(VcConfigProvider).use(VcViewer).use(VcEntity).use(VcLayerImagery).use(VcImageryProviderSingletile).use(VcGraphicsBillboard)
|
||||
app.mount('#app')
|
|
@ -7,7 +7,9 @@
|
|||
"resolveJsonModule": true,
|
||||
"esModuleInterop": true,
|
||||
"allowJs": true,
|
||||
"outDir": "dist/main"
|
||||
"outDir": "dist/main",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": [
|
||||
"src/main/app.ts",
|
|
@ -10,8 +10,12 @@
|
|||
"esModuleInterop": true,
|
||||
"lib": ["esnext", "dom"],
|
||||
"types": ["vite/client"],
|
||||
// ---------------------- //
|
||||
"noImplicitAny": false
|
||||
"noImplicitAny": false,
|
||||
"useDefineForClassFields": true,
|
||||
"noEmit": true,
|
||||
"isolatedModules": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": ["src/render/**/*.ts", "src/render/**/*.d.ts", "src/render/**/*.tsx", "src/render/**/*.vue"],
|
||||
"exclude": ["src/app.ts"]
|
|
@ -11,11 +11,14 @@ const publicDir = join(__dirname, 'public')
|
|||
export default defineConfig({
|
||||
publicDir,
|
||||
base: './',
|
||||
plugins: [vue(),copy({
|
||||
plugins: [
|
||||
vue(),
|
||||
copy({
|
||||
targets: [
|
||||
{ src: './node_modules/cesium/Build/Cesium', dest: publicDir }, //编译时,执行Cesium库的拷贝
|
||||
]
|
||||
})],
|
||||
})
|
||||
],
|
||||
build: {
|
||||
outDir,
|
||||
emptyOutDir: true,
|
Loading…
Reference in New Issue