点标注设置新增时的默认样式;增加后端数据存储文件路径设置

This commit is contained in:
zh
2025-11-19 10:36:20 +08:00
parent 44b3fbef50
commit ff2bfca6a9
29 changed files with 996 additions and 675 deletions

View File

@ -13,6 +13,8 @@ const http = require("http");
const yaml = require("js-yaml");
let Store = require('electron-store')
Store.initRenderer();
const store = new Store()
process.on('unhandledRejection', (reason) => {
console.error('主进程异步异常:', reason);
@ -128,6 +130,10 @@ function createWindow(): void {
})
let ymlBatPath = process.env.NODE_ENV === 'development' ? path.resolve(app.getAppPath(), 'resources', 'java', 'app', 'application.yml') : path.join(process.resourcesPath, 'app.asar.unpacked', 'resources', 'java', 'app', 'application.yml')
ymlBatPath = process.platform === 'win32' ? ymlBatPath.replace(/^(\w:)/, '/$1') : ymlBatPath
let ymlPath = ymlBatPath.substring(1, 200)
const ymlContent = yaml.load(fs.readFileSync(ymlPath, 'utf8'));
ymlContent.server.path = path.dirname(store.path)
fs.writeFileSync(ymlPath, yaml.dump(ymlContent));
ipcMain.on("getIniConfig", (event, option) => {
let ymlPath = ymlBatPath.substring(1, 200)
console.log("iniPath", ymlPath);
@ -152,7 +158,7 @@ function createWindow(): void {
// 监听启动页完成的消息
ipcMain.on('splash-completed', () => {
// 启动页进度条已完成,可以关闭启动页并显示主窗口
if(isSeverInit) {
if (isSeverInit) {
mainWindow.webContents.send('program-init')
}
isAppInit = true
@ -415,8 +421,6 @@ function createWindow(): void {
"1300",
"-y",
"730",
"-rtsp_transport",
"tcp",
obj.url,
],
{
@ -428,6 +432,9 @@ function createWindow(): void {
console.log("out");
console.log(err);
e.sender.send("openFFPlayOut", err);
if (obj.id) {
e.sender.send("openFFPlayOut_" + obj.id, err, obj.id);
}
});
/* .on("stdout", function(err, m) {
@ -502,7 +509,7 @@ function windowAllClosed() {
setTimeout(() => {
if (isQuitting) {
console.log('清理脚本执行超时,强制退出');
cleanupProcess.kill(); // 终止卡住的脚本
// cleanupProcess.kill(); // 终止卡住的脚本
forceQuit();
}
}, 3000); // 3秒超时
@ -579,7 +586,7 @@ if (!gotTheLock) {
// }
// console.log(`批处理输出: ${stdout}`);
// });
const batProcess = spawn('cmd.exe', ['/c', startBatPath.substring(1, 200)]);
// 实时监听标准输出stdout
batProcess.stdout.on('data', (data) => {
@ -587,10 +594,10 @@ if (!gotTheLock) {
let string = data.toString().trim()
// console.log(`批处理输出: ${string}`);
// 临时处理:应用启动失败或项目文档地址出现时,认为服务初始化完成;后续需后端配合
if(string.indexOf('APPLICATION FAILED TO START') !== -1 || string.indexOf('项目文档地址') !== -1) {
if(!isSeverInit) {
if (string.indexOf('APPLICATION FAILED TO START') !== -1 || string.indexOf('项目文档地址') !== -1) {
if (!isSeverInit) {
isSeverInit = true
if(isAppInit) {
if (isAppInit) {
mainWindow.webContents.send('program-init')
}
}