From ee839f3fadece627daec9c4113ba5f5974133b7e Mon Sep 17 00:00:00 2001
From: chenyc <501753378@qq.com>
Date: 星期二, 05 七月 2022 18:03:03 +0800
Subject: [PATCH] up
---
src/views/home/index.vue | 18 ++++++++++++++++--
src/samples/sockteStomp.ts | 23 ++++++++++++++---------
2 files changed, 30 insertions(+), 11 deletions(-)
diff --git a/src/samples/sockteStomp.ts b/src/samples/sockteStomp.ts
index 44dbde3..38460f8 100644
--- a/src/samples/sockteStomp.ts
+++ b/src/samples/sockteStomp.ts
@@ -21,13 +21,16 @@
*/
const writeResult=(resultInfo:any)=>{
if(devices.length>0){
- const deviceInfo=devices.find(de=>{de.deviceName===resultInfo.deviceName})
+ const deviceInfo=devices.find(de=>{
+ return de.deviceName===resultInfo.deviceNumber
+ })
+ console.log('---1-',deviceInfo)
if(deviceInfo!==undefined){
switch(deviceInfo.deviceType){
case '读卡器':
sockteStore().setdkqSockte(
{
- deviceName:resultInfo.deviceName,
+ deviceName:resultInfo.deviceNumber,
type:"读卡器",
result:resultInfo.result,
resultTime:resultInfo.resultTime,
@@ -36,9 +39,10 @@
)
break
case "体重秤":
+ console.log(resultInfo,'体重秤')
sockteStore().setweightSockte(
{
- deviceName:resultInfo.deviceName,
+ deviceName:resultInfo.deviceNumber,
type:"体重秤",
result:resultInfo.result,
resultTime:resultInfo.resultTime,
@@ -49,7 +53,7 @@
case "血压计":
sockteStore().setxyjSockte(
{
- deviceName:resultInfo.deviceName,
+ deviceName:resultInfo.deviceNumber,
type:"血压计",
result:resultInfo.result,
resultTime:resultInfo.resultTime,
@@ -107,12 +111,13 @@
// 订阅结果事件返回函数
const callback = function(message:any) {
- if (message.body) {
+ console.log('接收到数据-----',message.body)
+ if (message.body!==undefined) {
const data=JSON.parse(message.body)
- if(data.deviceName)
- console.log(data,'接收到的数据')
+ console.log(data,"体重数据")
writeResult(data)
- } else {
+ }
+ else {
alert("接收数据异常");
}
};
@@ -148,7 +153,7 @@
if(stompClient!==null){
stompClient.subscribe(`/queue/${clientCode}/${de.deviceName}/result`,callback)
// /queue/{clientCode}/{deviceName}/keepalive
- stompClient.subscribe(`/queue/${clientCode}/${de.deviceName}/keepalive`,callbackState)
+ // stompClient.subscribe(`/queue/${clientCode}/${de.deviceName}/keepalive`,callbackState)
stompClient.send(`/app/device/request/${clientCode}/${de.deviceName}`, {}, JSON.stringify({"deviceNumber":de.deviceName}));
}
diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index 6a67dac..02947a8 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -39,7 +39,7 @@
},10000)
setInterval(function(){
state.Newdate=formatDate(new Date(),"YYYY-mm-dd HH:MM:SS")
- console.log(state.Newdate,'----ss')
+ // console.log(state.Newdate,'----ss')
},1000)
})
return{ ...toRefs(state),isLink,netLink,weightInfo,inputRef,inputChabge
@@ -67,10 +67,16 @@
<img class="imgss" alt="Vue logo" src="@/assets/logo.png" />
</div>
</el-col>
- <el-col :span="12">
+ <el-col :span="6">
<!-- <div> sockte连接状态{{isLink}}</div>
<div> 网络连接状态{{netLink}}</div> -->
<el-input id="inputCode" @change="inputChabge" v-model="inputCode" ref="inputRef" placeholder="" />
+
+ </el-col>
+ <el-col :span="6">
+ <div class="datess">
+ 60
+ </div>
</el-col>
</el-row>
<div class="grid-container">
@@ -175,4 +181,12 @@
background: #c1c2c6;
color: black;
}
+.datess{
+ text-align: right;
+ padding-right: 20px;
+ height: 30px;
+ line-height: 30px;
+ color: red;
+ font-weight: 1000;
+}
</style>
\ No newline at end of file
--
Gitblit v1.8.0