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,
socketOpen: false,
timer: null,
datalist: null,
datalisttwo: null,
pie_opts: {
@ -156,12 +154,6 @@
// }
this.getServerData()
},
destroyed() {
clearInterval(this.timer);
if (this.socketOpen == true) {
uni.closeSocket();
}
},
watch: {
echartData: {
handler() {
@ -169,18 +161,6 @@
},
deep: true
},
current(newValue, oldValue) {
if (newValue != 0) {
clearInterval(this.timer);
if (this.socketOpen == true) {
uni.closeSocket();
}
} else {
setTimeout(() => {
this.scoket()
}, 800)
}
}
},
methods: {
taptimeindex(index) {
@ -233,78 +213,6 @@
}, 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>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -45,16 +45,36 @@
import {
savebg
} from '@/api/examinationapi/add.js'
import {
bound,
} from '@/api/examinationapi/add.js'
export default {
data() {
return {
uploadType: undefined,
number: '',
timetext: this.formatDate(Date.now()),
measureTime: this.formatDate(Date.now()),
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: {
timeconfirm(time) {
this.timetext = time
@ -83,9 +103,8 @@
bg: this.number,
bucket: this.bucketchoice,
measureTime: this.measureTime,
uploadType: 1,
// identity: uni.getStorageSync('userinfo').cardNo
identity: '370882199909092123'
uploadType: this.uploadType ? this.uploadType : 1,
identity: uni.getStorageSync('userinfo').cardNo
}
savebg(data).then(res => {
if (res.code == 200) {
@ -100,8 +119,80 @@
}, 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>
@ -225,4 +316,4 @@
}
}
}
</style>
</style>

View File

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

View File

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

View File

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

View File

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