From 84e14a34a082e00aa2d47a64ee36398088c12aec Mon Sep 17 00:00:00 2001
From: chenyc <501753378@qq.com>
Date: 星期五, 16 九月 2022 14:37:51 +0800
Subject: [PATCH] 添加http服务功能、取消网络和sockte链接检查
---
src/samples/node-api.ts | 41 ++++++++++++++++++++++++++++++++++++-----
1 files changed, 36 insertions(+), 5 deletions(-)
diff --git a/src/samples/node-api.ts b/src/samples/node-api.ts
index cd7aa76..0e2db2f 100644
--- a/src/samples/node-api.ts
+++ b/src/samples/node-api.ts
@@ -1,40 +1,71 @@
-import { lstat } from 'fs/promises'
+
import { cwd } from 'process'
import { ipcRenderer } from 'electron'
import {creatorClient} from './sockteStomp'
import {sockteStore} from '@/stores/sockteInfo'
+import { patientInfoStore } from '@/stores/patient'
+import os from 'os'
// import internetAvailable from "internet-available"
var internetAvailable = require("internet-available")
+import { ElMessage, ElMessageBox } from 'element-plus'
+import { on } from 'events'
+
let deviceList=[]
let clientCode=''
// 主进程发送消息到渲染进程
ipcRenderer.on('main-process-message', (_event, ...args) => {
console.log('[Receive Main-process message]:', ...args)
})
-// 重主进程获取配置项
+// 主进程获取配置项完成sockte注册和httpshu
ipcRenderer.on('getConfigData',(_event,...args)=>{
console.log("config.json",...args)
if(args[0]===undefined){
- alert("配置文件没有写入配置,请检查配置文件 文件路径:"+args[2])
+ // alert("配置文件没有写入配置,请检查配置文件 文件路径:"+args[2])
+ ElMessageBox.prompt('没有设定客户编号,请输入客户编号并保存', '警告', {
+ confirmButtonText: '保存',
+ showClose:false,
+ showCancelButton:false,
+ inputErrorMessage: 'Invalid Email',
+ })
+ .then(({ value }) => {
+ const mode={
+ clientCode:value,
+ machineName:os.hostname(),
+ screenTimeout: 300,
+ devices:[]
+ }
+ ipcRenderer.send('setConfingData',mode)
+ })
+
}
else if(args.length>0&&args[0].length>0){
clientCode=args[0]
deviceList=args[1]
// 建立sockte 通讯
creatorClient(deviceList,clientCode)
+
}
})
-
+ipcRenderer.on("getScreenTimeout",(_event,args)=>{
+ if(args!==undefined){
+ patientInfoStore().setViewNumber(args)
+ }
+})
+ipcRenderer.on("getPcName",(_event,arg)=>{
+ if(arg!==undefined){
+ sockteStore().setPcName(arg)
+ }
+})
setInterval(function(){
// 检查网络状态
internetAvailable({
domainName: "baidu.com",
host: '114.114.114.114'
}).then(()=>{
- console.log('网路已连接')
sockteStore().setnetLink(true)
}).catch(()=>{
sockteStore().setnetLink(false)
console.log("网路链接失败")
})
},10000)
+
--
Gitblit v1.8.0