This commit is contained in:
2023-11-09 11:02:59 +08:00
parent 50f8c9d8e4
commit 28d363d0eb
17 changed files with 133 additions and 146 deletions

View File

@ -94,8 +94,6 @@
}, },
], ],
timeindex: 0, timeindex: 0,
socketOpen: false,
timer: null,
datalist: null, datalist: null,
datalisttwo: null, datalisttwo: null,
pie_opts: { pie_opts: {
@ -156,12 +154,6 @@
// } // }
this.getServerData() this.getServerData()
}, },
destroyed() {
clearInterval(this.timer);
if (this.socketOpen == true) {
uni.closeSocket();
}
},
watch: { watch: {
echartData: { echartData: {
handler() { handler() {
@ -169,18 +161,6 @@
}, },
deep: true deep: true
}, },
current(newValue, oldValue) {
if (newValue != 0) {
clearInterval(this.timer);
if (this.socketOpen == true) {
uni.closeSocket();
}
} else {
setTimeout(() => {
this.scoket()
}, 800)
}
}
}, },
methods: { methods: {
taptimeindex(index) { taptimeindex(index) {
@ -233,78 +213,6 @@
}, 500) }, 500)
} }
}, },
scoket() {
var SOCKETURL = 'ws://112.7.50.34:9002/webSocket/' + uni.getStorageSync('userinfo').cardNo
const that = this
uni.closeSocket()
this.socketOpen = false
try {
uni.connectSocket({
url: SOCKETURL
})
uni.onSocketOpen(res => {
console.log('webScoket连接已打开', res);
that.socketOpen = true
that.reset()
})
uni.onSocketError(err => {
console.log('webScoket连接打开失败', err);
if (err && err.code != 1000) {
setTimeout(() => {
that.socketOpen = true
uni.connectSocket({
url: SOCKETURL
})
}, 3 * 1000)
}
})
uni.onSocketClose(err => {
console.log('webScoket连接关闭', err);
if (err && err.code !== 1000) {
setTimeout(() => {
that.socketOpen = true
uni.connectSocket({
url: SOCKETURL
})
}, 3 * 1000)
}
})
uni.onSocketMessage(res => {
console.log("webScoket监听收到的信息", res);
// that.newsList.push({
// senderName: that.currentItem.senderName,
// content: JSON.parse(res.data).message
// })
this.$emit('websocket-message');
this.$forceUpdate()
})
} catch (e) {
console.log(e);
}
},
//
reset() {
let that = this
var SOCKETURL = 'ws://112.7.50.34:9002/webSocket/' + uni.getStorageSync('userinfo').cardNo
clearInterval(that.timer);
that.timer = setInterval(() => {
uni.sendSocketMessage({
data: 'ping',
success(res) {
console.log('正在发送心跳');
},
fail(err) {
console.log('心跳发送失败,重新连接...');
_socketOpen = true
uni.connectSocket({
url: SOCKETURL
})
}
})
}, 60000)
},
} }
} }
</script> </script>

View File

@ -51,7 +51,6 @@
/* */ /* */
"mp-weixin": { "mp-weixin": {
"appid": "wxccb16a452ab5e4b4", "appid": "wxccb16a452ab5e4b4",
"__usePrivacyCheck__": true,
"setting": { "setting": {
"urlCheck": false, "urlCheck": false,
"postcss": true, "postcss": true,

View File

@ -52,7 +52,7 @@
left: 10%; left: 10%;
width: 80%; width: 80%;
height: 68rpx; height: 68rpx;
background-color: #55d0df; background-color: #4AC4AB;
margin: 0 auto; margin: 0 auto;
border-radius: 10rpx; border-radius: 10rpx;
margin-bottom: 30rpx; margin-bottom: 30rpx;

View File

@ -76,7 +76,7 @@
.Rescind { .Rescind {
width: 50%; width: 50%;
height: 100rpx; height: 100rpx;
color: #55d0df; color: #4AC4AB;
border-left: 0.5rpx solid #f6f6f6; border-left: 0.5rpx solid #f6f6f6;
} }
} }

View File

@ -366,8 +366,7 @@
}, },
methods: { methods: {
info() { info() {
// userinfo.cardNo, recordlast(uni.getStorageSync('userinfo').cardNo).then(res => {
recordlast('370882199909092123').then(res => {
res.data.forEach(e => { res.data.forEach(e => {
e.type == '1' ? this.dataone = e : '' e.type == '1' ? this.dataone = e : ''
e.type == '2' ? this.datatwo = e : '' e.type == '2' ? this.datatwo = e : ''
@ -401,4 +400,4 @@
<style lang="scss"> <style lang="scss">
@import './Physicalexamination.scss'; @import './Physicalexamination.scss';
</style> </style>

View File

@ -89,8 +89,7 @@
bmi: (this.weight / ((this.height / 100) * (this.height / 100))).toFixed(2), bmi: (this.weight / ((this.height / 100) * (this.height / 100))).toFixed(2),
height: this.height, height: this.height,
weight: this.weight, weight: this.weight,
// identity: uni.getStorageSync('userinfo').cardNo identity: uni.getStorageSync('userinfo').cardNo,
identity: '370882199909092123',
measureTime: this.timetext, measureTime: this.timetext,
} }
savebmi(data).then(res => { savebmi(data).then(res => {
@ -127,7 +126,7 @@
width: 60%; width: 60%;
height: 98rpx; height: 98rpx;
margin: 60rpx auto; margin: 60rpx auto;
background-color: #55d0df; background-color: #4AC4AB;
border-radius: 10rpx; border-radius: 10rpx;
border: solid 0rpx #0c0c0c; border: solid 0rpx #0c0c0c;
color: #ffffff; color: #ffffff;
@ -233,4 +232,4 @@
} }
} }
} }
</style> </style>

View File

@ -92,8 +92,7 @@
ldl: this.ldl, ldl: this.ldl,
tc: this.tc, tc: this.tc,
tg: this.tg, tg: this.tg,
// identity: uni.getStorageSync('userinfo').cardNo identity: uni.getStorageSync('userinfo').cardNo,
identity: '370882199909092123',
measureTime: this.timetext, measureTime: this.timetext,
} }
savebf(data).then(res => { savebf(data).then(res => {
@ -138,7 +137,7 @@
width: 60%; width: 60%;
height: 98rpx; height: 98rpx;
margin: 60rpx auto; margin: 60rpx auto;
background-color: #55d0df; background-color: #4AC4AB;
border-radius: 10rpx; border-radius: 10rpx;
border: solid 0rpx #0c0c0c; border: solid 0rpx #0c0c0c;
color: #ffffff; color: #ffffff;
@ -244,4 +243,4 @@
} }
} }
} }
</style> </style>

View File

@ -70,8 +70,7 @@
let data = { let data = {
pulse: this.pulse, pulse: this.pulse,
spo2: this.spo2, spo2: this.spo2,
// identity: uni.getStorageSync('userinfo').cardNo identity: uni.getStorageSync('userinfo').cardNo,
identity: '370882199909092123',
measureTime: this.timetext, measureTime: this.timetext,
} }
savebo(data).then(res => { savebo(data).then(res => {
@ -116,7 +115,7 @@
width: 60%; width: 60%;
height: 98rpx; height: 98rpx;
margin: 60rpx auto; margin: 60rpx auto;
background-color: #55d0df; background-color: #4AC4AB;
border-radius: 10rpx; border-radius: 10rpx;
border: solid 0rpx #0c0c0c; border: solid 0rpx #0c0c0c;
color: #ffffff; color: #ffffff;
@ -222,4 +221,4 @@
} }
} }
} }
</style> </style>

View File

@ -60,8 +60,7 @@
let data = { let data = {
hr: this.hr, hr: this.hr,
uploadType: 1, uploadType: 1,
// identity: uni.getStorageSync('userinfo').cardNo identity: uni.getStorageSync('userinfo').cardNo,
identity: '370882199909092123',
measureTime: this.timetext, measureTime: this.timetext,
} }
savehr(data).then(res => { savehr(data).then(res => {
@ -106,7 +105,7 @@
width: 60%; width: 60%;
height: 98rpx; height: 98rpx;
margin: 60rpx auto; margin: 60rpx auto;
background-color: #55d0df; background-color: #4AC4AB;
border-radius: 10rpx; border-radius: 10rpx;
border: solid 0rpx #0c0c0c; border: solid 0rpx #0c0c0c;
color: #ffffff; color: #ffffff;
@ -212,4 +211,4 @@
} }
} }
} }
</style> </style>

View File

@ -81,8 +81,7 @@
dbp: this.dbp, dbp: this.dbp,
sbp: this.sbp, sbp: this.sbp,
hr: this.hr, hr: this.hr,
// identity: uni.getStorageSync('userinfo').cardNo identity: uni.getStorageSync('userinfo').cardNo,
identity: '370882199909092123',
measureTime: this.timetext, measureTime: this.timetext,
uploadType: 1, uploadType: 1,
} }
@ -128,7 +127,7 @@
width: 60%; width: 60%;
height: 98rpx; height: 98rpx;
margin: 60rpx auto; margin: 60rpx auto;
background-color: #55d0df; background-color: #4AC4AB;
border-radius: 10rpx; border-radius: 10rpx;
border: solid 0rpx #0c0c0c; border: solid 0rpx #0c0c0c;
color: #ffffff; color: #ffffff;

View File

@ -58,8 +58,7 @@
submit() { submit() {
if (this.timetext && this.temp) { if (this.timetext && this.temp) {
let data = { let data = {
// identity: uni.getStorageSync('userinfo').cardNo identity: uni.getStorageSync('userinfo').cardNo,
identity: '370882199909092123',
measureTime: this.timetext, measureTime: this.timetext,
temp: this.temp, temp: this.temp,
} }
@ -105,7 +104,7 @@
width: 60%; width: 60%;
height: 98rpx; height: 98rpx;
margin: 60rpx auto; margin: 60rpx auto;
background-color: #55d0df; background-color: #4AC4AB;
border-radius: 10rpx; border-radius: 10rpx;
border: solid 0rpx #0c0c0c; border: solid 0rpx #0c0c0c;
color: #ffffff; color: #ffffff;
@ -203,4 +202,4 @@
} }
} }
} }
</style> </style>

View File

@ -39,8 +39,7 @@
return { return {
data: { data: {
deviceType: undefined, deviceType: undefined,
// identity: uni.getStorageSync('userinfo').cardNo, identity: uni.getStorageSync('userinfo').cardNo,
identity: '370882199909092123',
sn: '', sn: '',
bindTime: undefined, // bindTime: undefined, //
state: 1, state: 1,
@ -116,7 +115,7 @@
width: 60%; width: 60%;
height: 98rpx; height: 98rpx;
margin: 60rpx auto; margin: 60rpx auto;
background-color: #55d0df; background-color: #4AC4AB;
border-radius: 10rpx; border-radius: 10rpx;
border: solid 0rpx #0c0c0c; border: solid 0rpx #0c0c0c;
color: #ffffff; color: #ffffff;
@ -150,8 +149,8 @@
height: 60rpx; height: 60rpx;
background-color: #ffffff; background-color: #ffffff;
border-radius: 10rpx; border-radius: 10rpx;
border: solid 1rpx #55d0df; border: solid 1rpx #4AC4AB;
color: #55d0df; color: #4AC4AB;
} }
} }
@ -191,9 +190,9 @@
.left { .left {
width: 8rpx; width: 8rpx;
height: 32rpx; height: 32rpx;
background-color: #55d0df; background-color: #4AC4AB;
border-radius: 4rpx; border-radius: 4rpx;
} }
} }
} }
</style> </style>

View File

@ -45,16 +45,36 @@
import { import {
savebg savebg
} from '@/api/examinationapi/add.js' } from '@/api/examinationapi/add.js'
import {
bound,
} from '@/api/examinationapi/add.js'
export default { export default {
data() { data() {
return { return {
uploadType: undefined,
number: '', number: '',
timetext: this.formatDate(Date.now()), timetext: this.formatDate(Date.now()),
measureTime: this.formatDate(Date.now()), measureTime: this.formatDate(Date.now()),
bucketchoice: 1, bucketchoice: 1,
timeoutObj: null,
socketOpen: false,
SOCKETURL: '',
// ws://112.6.122.71:8009/fd/webSocket/{sn}
// ws://218.58.213.15:8009/fd/webSocket/{sn}
}; };
}, },
onLoad(options) {}, onLoad(options) {
bound(uni.getStorageSync('userinfo').cardNo).then(res => {
if (res.code == 200) {
res.data.forEach(e => {
if (e.deviceType == 2) {
this.SOCKETURL = `ws://112.6.122.71:8009/fd/webSocket/${e.sn}`
this.scoket();
}
})
}
})
},
methods: { methods: {
timeconfirm(time) { timeconfirm(time) {
this.timetext = time this.timetext = time
@ -83,9 +103,8 @@
bg: this.number, bg: this.number,
bucket: this.bucketchoice, bucket: this.bucketchoice,
measureTime: this.measureTime, measureTime: this.measureTime,
uploadType: 1, uploadType: this.uploadType ? this.uploadType : 1,
// identity: uni.getStorageSync('userinfo').cardNo identity: uni.getStorageSync('userinfo').cardNo
identity: '370882199909092123'
} }
savebg(data).then(res => { savebg(data).then(res => {
if (res.code == 200) { if (res.code == 200) {
@ -100,8 +119,80 @@
}, 1000) }, 1000)
} }
}) })
},
scoket() {
const that = this
this.socketOpen = false
try {
uni.connectSocket({
url: that.SOCKETURL
})
uni.onSocketOpen(res => {
console.log('webScoket连接已打开', res);
that.socketOpen = true
that.reset()
})
uni.onSocketError(err => {
console.log('webScoket连接打开失败', err);
if (err && err.code != 1000) {
setTimeout(() => {
that.socketOpen = true
uni.connectSocket({
url: that.SOCKETURL
})
}, 3 * 1000)
}
})
uni.onSocketClose(err => {
console.log('webScoket连接关闭', err);
if (err && err.code !== 1000) {
setTimeout(() => {
that.socketOpen = true
uni.connectSocket({
url: that.SOCKETURL
})
}, 3 * 1000)
}
})
uni.onSocketMessage(res => {
console.log("webScoket监听收到的信息", res);
this.uploadType = 2
this.number = JSON.parse(res.data).fbg
this.$forceUpdate()
})
} catch (e) {
console.log(e);
}
},
//
reset() {
let that = this
clearInterval(that.timeoutObj);
that.timeoutObj = setInterval(() => {
uni.sendSocketMessage({
data: 'ping',
success(res) {
console.log('正在发送心跳');
},
fail(err) {
console.log('心跳发送失败,重新连接...');
console.log(this.SOCKETURL)
that.socketOpen = true
uni.connectSocket({
url: this.SOCKETURL
})
}
})
}, 60000)
},
},
onUnload() {
if (this.socketOpen) {
uni.closeSocket();
} }
} },
} }
</script> </script>
@ -225,4 +316,4 @@
} }
} }
} }
</style> </style>

View File

@ -35,8 +35,7 @@
}, },
methods: { methods: {
getbindDeviceList() { getbindDeviceList() {
// uni.getStorageSync('userinfo').cardNo bound(uni.getStorageSync('userinfo').cardNo).then(res => {
bound('370882199909092123').then(res => {
if (res.code == 200) { if (res.code == 200) {
this.deviceList = res.data this.deviceList = res.data
} }
@ -53,8 +52,7 @@
remark: e.remark, remark: e.remark,
id: e.id, id: e.id,
bindTime: e.bindTime, bindTime: e.bindTime,
// identity: uni.getStorageSync('userinfo').cardNo, identity: uni.getStorageSync('userinfo').cardNo,
identity: '370882199909092123',
sn: e.sn, sn: e.sn,
unbindTime: that.timeFormat(), unbindTime: that.timeFormat(),
state: 0, state: 0,
@ -162,4 +160,4 @@
} }
} }
} }
</style> </style>

View File

@ -93,8 +93,7 @@
let userinfo = uni.getStorageSync('userinfo'); let userinfo = uni.getStorageSync('userinfo');
var obj = { var obj = {
label: Number(this.tabindex) + 1, label: Number(this.tabindex) + 1,
// identity: userinfo.cardNo, identity: userinfo.cardNo,
identity: '370882199909092123',
type: this.type, type: this.type,
} }
record(obj).then(res => { record(obj).then(res => {
@ -120,4 +119,4 @@
::v-deep .u-tabs { ::v-deep .u-tabs {
background-color: #F7F5F5 !important; background-color: #F7F5F5 !important;
} }
</style> </style>

View File

@ -701,7 +701,7 @@
} }
.sendBox { .sendBox {
background-color: #55d0df7d; background-color: #4AC4AB;
padding: 18rpx 20rpx; padding: 18rpx 20rpx;
border-radius: 0 0 10rpx 10rpx; border-radius: 0 0 10rpx 10rpx;
font-size: 34rpx; font-size: 34rpx;
@ -764,4 +764,4 @@
bottom: 38rpx; bottom: 38rpx;
} }
} }
</style> </style>

View File

@ -684,7 +684,7 @@
} }
.sendBox { .sendBox {
background-color: #55d0df7d; background-color: #4AC4AB;
padding: 18rpx 20rpx; padding: 18rpx 20rpx;
border-radius: 0 0 10rpx 10rpx; border-radius: 0 0 10rpx 10rpx;
font-size: 34rpx; font-size: 34rpx;
@ -747,4 +747,4 @@
bottom: 38rpx; bottom: 38rpx;
} }
} }
</style> </style>