From f787bf4f4631b2ecb6bb6b46f52a9c7e3f8f8cc0 Mon Sep 17 00:00:00 2001
From: chenyincheng <501753378@qq.com>
Date: 星期一, 26 十二月 2022 19:30:30 +0800
Subject: [PATCH] up
---
src/samples/sockteStomp.ts | 31 ++++-----------
src/views/login/index.vue | 29 +++-----------
src/samples/node-api.ts | 26 +++----------
electron/main/index.ts | 22 +++++-----
src/App.vue | 5 ++
5 files changed, 36 insertions(+), 77 deletions(-)
diff --git a/electron/main/index.ts b/electron/main/index.ts
index a18aeb8..b1f4295 100644
--- a/electron/main/index.ts
+++ b/electron/main/index.ts
@@ -86,7 +86,7 @@
creatorKoa(win)
win?.webContents.send('getScreenTimeout',store.get('screenTimeout'))
win?.webContents.send('getPcName',store.get('machineName'))
- win?.webContents.send('getConfigData',store.get('clientCode'),store.path)
+ win?.webContents.send('getConfigData',store.get(),store.path)
})
// Make all links open with the browser, not with the application
@@ -149,16 +149,16 @@
"machineName": arg.machineName,
"screenTimeout": arg.screenTimeout,
}
- //对比两端配置文件
- if(JSON.stringify(mode1)!=JSON.stringify(mode2)){
- //更新cofing.json
- console.log('update confing.json')
- store.set(mode2)
- // 重新建立sockte 通讯
- win?.webContents.send('getScreenTimeout',store.get('screenTimeout'))
- win?.webContents.send('getPcName',store.get('machineName'))
- win?.webContents.send('getConfigData',store.get('clientCode'),store.path)
- }
+ // //对比两端配置文件
+ // if(JSON.stringify(mode1)!=JSON.stringify(mode2)){
+ // //更新cofing.json
+ // console.log('update confing.json')
+ // store.set(mode2)
+ // // 重新建立sockte 通讯
+ // win?.webContents.send('getScreenTimeout',store.get('screenTimeout'))
+ // win?.webContents.send('getPcName',store.get('machineName'))
+ // win?.webContents.send('getConfigData',store.get('clientCode'),store.path)
+ // }
})
\ No newline at end of file
diff --git a/src/App.vue b/src/App.vue
index 9bc317e..946379f 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,7 +1,10 @@
<script setup lang="ts">
// This starter template is using Vue 3 <script setup> SFCs
// Check out https://vuejs.org/api/sfc-script-setup.html#script-setup
-import HelloWorld from './components/HelloWorld.vue'
+import { onMounted } from "vue"
+ onMounted(()=>{
+ console.log('app点初始化')
+ })
</script>
<template>
diff --git a/src/samples/node-api.ts b/src/samples/node-api.ts
index 10f8b58..5dbbd94 100644
--- a/src/samples/node-api.ts
+++ b/src/samples/node-api.ts
@@ -37,28 +37,14 @@
ipcRenderer.on('getConfigData',(_event,...args)=>{
console.log("config.json",...args)
if(args!==null){
- if(args[0]===undefined){
- // alert("配置文件没有写入配置,请检查配置文件 文件路径:"+args[2])
- ElMessageBox.prompt('没有设定客户编号,请输入客户编号并保存', '警告', {
- confirmButtonText: '保存',
- showClose:false,
- showCancelButton:false,
- inputErrorMessage: 'Invalid Email',
- })
- .then(({ value }) => {
- const mode={
- clientCode:value,
- machineName:os.hostname(),
- screenTimeout: 60,
- }
- ipcRenderer.send('setConfingData',mode)
- })
-
+ if(args[0]===undefined){
+ console.log('配置文件没有配置')
}
- else if(args.length>0&&args[0].length>0){
- clientCode=args[0]
+ else if(args.length>0&&args[0].clientCode.length>0){
+ clientCode=args[0].clientCode
// 建立sockte 通讯
- creatorClient([],clientCode)
+ deviceList=args[0].deviceList
+ creatorClient(args[0])
}
}
diff --git a/src/samples/sockteStomp.ts b/src/samples/sockteStomp.ts
index eba1a11..9562ab6 100644
--- a/src/samples/sockteStomp.ts
+++ b/src/samples/sockteStomp.ts
@@ -17,7 +17,7 @@
deviceName:string
deviceType:string
}
-
+let config={}
let devices:Array<device>=[]
let clientCode:string=''
/**
@@ -176,32 +176,16 @@
if(stompClient!==null){
// 订阅患者信息事件
stompClient.subscribe(`/queue/patient/info/${pcName}`,PatientCallback)
- // 订阅配置文件事件
+ // 订阅配置文件事件已经弃用 现在不用更新本地配置文件了
// stompClient.subscribe(`/queue/workstation/config/set/${clientCode}/${pcName}`,configCallback)
// 发送配置文件到服务端
- // stompClient.send(`/app/workstation/config/set/${clientCode}/${pcName}`,{},JSON.stringify({"clientCode":clientCode,"machineName":pcName}))
+ stompClient.send(`/app/workstation/config/set/${clientCode}/${pcName}`,{},
+ JSON.stringify(config))
}
// 更新sockte链接状态
sockteStore().setsockteIsLink(true)
console.log(sockteStore().isLink)
- // sockte订阅服务关闭完全有post 来代替
- // if(devices!==undefined &&devices!=null&&devices.length>0){
- // // 更新sockte链接状态
- // sockteStore().setsockteIsLink(true)
- // console.log(sockteStore().isLink)
- // console.log(devices)
- // if(devices!==undefined&&devices!=null &&devices!=null &&devices.length>0){
- // devices.forEach(de=>{
- // if(stompClient!==null){
- // console.log()
- // stompClient.subscribe(`/queue/${clientCode}/${de.deviceName}/result`,callback)
- // stompClient.subscribe(`/queue/${clientCode}/${de.deviceName}/keepalive`,callbackState)
- // stompClient.send(`/app/device/request/${clientCode}/${de.deviceName}`, {}, JSON.stringify({"deviceNumber":de.deviceName}));
- // }
- // })
- // }
- // }
}
const error_callback=function(error:any){
@@ -218,9 +202,10 @@
},60000)
}
// 创建客户端链接
-const creatorClient=(devices2:any,clientCode2:any)=>{
- devices=devices2
- clientCode=clientCode2
+const creatorClient=(configObj:any)=>{
+ config=configObj
+ devices=configObj.deviceList
+ clientCode=configObj.clientCode
console.log(devices,'设备列表','chong')
const socket = new WebSocket('ws://hemobs.icoldchain.cn/broadcast')
stompClient = Stomp.over(socket)
diff --git a/src/views/login/index.vue b/src/views/login/index.vue
index 5242d39..28a1f84 100644
--- a/src/views/login/index.vue
+++ b/src/views/login/index.vue
@@ -2,16 +2,18 @@
<teleport to="body">
<div class="mask">
<el-header class="go">
+ <div>
+ 请把头移动到摄像头能拍到的位置,不要动 !
+ </div>
<div class="box">
<video id="videoCamera" class="canvas" :width="videoWidth" :height="videoHeight" autoPlay></video>
- <canvas id="canvasCamera" class="canvas" :width="videoWidth" :height="videoWidth"></canvas>
+ <canvas id="canvasCamera" class="canvas" :width="300" :height="300"></canvas>
</div>
<div class="footer">
<el-button @click="getCompetence" icon="el-icon-video-camera"> 打开摄像头 </el-button>
<el-button @click="drawImage" icon="el-icon-camera"> 拍照 </el-button>
<el-button @click="stopNavigator" icon="el-icon-switch-button"> 关闭摄像头 </el-button>
<el-button @click="resetCanvas" icon="el-icon-refresh"> 重置 </el-button>
- <el-button @click="$emit('closed')" class="closeBtn">关闭</el-button>
</div>
</el-header>
</div>
@@ -20,11 +22,6 @@
<script lang="ts" setup>
import { ref, reactive, inject, toRefs, nextTick } from "vue";
import { ElMessage, ElMessageBox } from "element-plus";
- const message = inject("$message");
- const config = inject("$CONFIG");
- const tool = inject("$TOOL");
- const api = inject("$API");
-
const loading = ref(false);
const os = ref(false); //控制摄像头开关
let thisVideo = ref("");
@@ -107,7 +104,7 @@
thisCancas = document.getElementById("canvasCamera");
thisContext = thisCancas.getContext("2d");
thisVideo = document.getElementById("videoCamera");
- thisContext.drawImage(thisVideo, 0, 0, 500, 500);
+ thisContext.drawImage(thisVideo, 0, 0, 300, 300);
//获取图片地址
queryParams.imgSrc = thisCancas.toDataURL('image/png');
console.log(queryParams.imgSrc);
@@ -149,22 +146,10 @@
justify-content: space-between;
float: left;
margin-top: 217px;
- }
- .detailed {
- width: 1200px !important;
- height: 800px !important;
- display: block;
- position: absolute;
- left: 50%;
- top: 50%;
- transform: translate(-50%, -50%);
- background-color: white;
+ z-index: 1999;
}
-
- .oText {
- margin-left: 42px;
- }
+
.mask {
position: absolute;
top: 0;
--
Gitblit v1.8.0