From 76c523770a033a63c99145a525572d51782be1fe Mon Sep 17 00:00:00 2001
From: chenyc <501753378@qq.com>
Date: 星期五, 01 九月 2023 11:55:12 +0800
Subject: [PATCH] 添加白屏处理

---
 imgs/1693286128018.png          |    0 
 src/samples/deviceApi/yaoHua.ts |   55 +++++++++++++++++++++++++++
 electron/main/index.ts          |   13 ++++++
 log.txt                         |    1 
 4 files changed, 69 insertions(+), 0 deletions(-)

diff --git a/electron/main/index.ts b/electron/main/index.ts
index 7b6eb70..bd0a2ad 100644
--- a/electron/main/index.ts
+++ b/electron/main/index.ts
@@ -64,7 +64,10 @@
   
   win = new BrowserWindow({
     title: 'Main window',
+    transparent: true,
+    frame:false,
     fullscreen: true,// 开启默认全屏
+    kiosk: true,
     autoHideMenuBar:store.get('debug'), //关闭菜单栏
     webPreferences: {
       preload: splash,
@@ -103,6 +106,8 @@
 })
 
 
+
+
 app.on('second-instance', () => {
   if (win) {
     // 如果用户试图打开另一个窗口,则将焦点放在主窗口上
@@ -110,6 +115,14 @@
     win.focus()
   }
 })
+app.on('render-process-gone',(e,w,d)=>{
+  logger.info(`${new Date()}渲染进程被杀死${d.reason}\n`)
+  // 基于我在开发的程序本身的设定,此处重启应用就可以了
+  app.relaunch({args: process.argv.slice(1).concat(['--relaunch'])});
+  // 尝试关闭所有窗口
+  app.quit();
+})
+
 
 app.on('activate', () => {
   const allWindows = BrowserWindow.getAllWindows()
diff --git a/imgs/1693286128018.png b/imgs/1693286128018.png
new file mode 100644
index 0000000..f88bfbf
--- /dev/null
+++ b/imgs/1693286128018.png
Binary files differ
diff --git a/log.txt b/log.txt
new file mode 100644
index 0000000..ad0c919
--- /dev/null
+++ b/log.txt
@@ -0,0 +1 @@
+Fri Sep 01 2023 11:13:41 GMT+0800 (中国标准时间)渲染进程被杀死killed
diff --git a/src/samples/deviceApi/yaoHua.ts b/src/samples/deviceApi/yaoHua.ts
new file mode 100644
index 0000000..5a17553
--- /dev/null
+++ b/src/samples/deviceApi/yaoHua.ts
@@ -0,0 +1,55 @@
+// 欧姆龙 HBP-9030 115200 
+import { ElMessage } from 'element-plus'
+const { SerialPort } = require('serialport')
+const { DelimiterParser } = require('@serialport/parser-delimiter')
+const { ByteLengthParser } = require('@serialport/parser-byte-length')
+import {sockteStore} from '@/stores/sockteInfo'
+
+
+const initPort=(path:String,baudRate:Number)=>{
+    console.log('初始化打开耀华体重秤端口')
+    const serialport  = new SerialPort({ path, baudRate }, (err: any) => {
+        if (err) {
+            console.log(err)
+            ElMessage({
+                message: '耀华体重秤端口打开失败!',
+                type: 'error',
+            })
+            console.log(err)
+        }else{
+            ElMessage({
+                message: '耀华体重秤端口打开成功',
+                type: 'success',
+            })
+        } 
+    })
+    serialport.on("close",(err: any)=>{
+        console.log('耀华体重秤端口异常端口链接断开')
+        console.log(err)
+    })
+    // 解析分割数据流
+    const parser = serialport.pipe(new ByteLengthParser({ length: 14*4-1 }))
+    parser.on('data', (value: string | any[])=>{
+        console.log(value.toString())
+        const str=value.toString()
+        const list=str.split(',')
+        console.log(list)
+        if(list.length===11){
+
+            sockteStore().setxyjSockte(
+              {
+                  deviceName:'HBP-9030',
+                  type:"血压计",
+                  result:list[7]+','+list[8]+','+list[9],
+                  resultTime:new Date().toString(),
+                  state:2
+              }
+          )
+        }
+        
+    })
+}
+
+export {
+    initPort,
+}

--
Gitblit v1.8.0