This commit is contained in:
2023-10-23 09:53:46 +08:00
parent 23d70e3f3a
commit 7bfad8624e
6 changed files with 272 additions and 35 deletions

View File

@ -93,3 +93,37 @@ export function recordlast(identity) {
}
})
}
//设备列表
export function bound(identity) {
return request({
url: `/fd/device/bound/${identity}`,
method: 'get',
header: {
Authorization: 'Bearer' + ' ' + uni.getStorageSync('token')
}
})
}
//解绑
export function unbind(data) {
return request({
url: `/fd/device/unbind`,
method: 'post',
data,
header: {
Authorization: 'Bearer' + ' ' + uni.getStorageSync('token')
}
})
}
//添加设备
export function binding(data) {
return request({
url: `/fd/device/binding`,
method: 'post',
data,
header: {
Authorization: 'Bearer' + ' ' + uni.getStorageSync('token')
}
})
}

View File

@ -4,6 +4,12 @@
},
"pages": [ //pageshttps://uniapp.dcloud.io/collocation/pages
{
"path": "pages/homepage/homepage",
"style": {
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}, {
"path": "pages/myinformation/myinformation",
"style": {
"enablePullDownRefresh": false,
@ -17,14 +23,7 @@
"enablePullDownRefresh": false
}
},
{
"path": "pages/homepage/homepage",
"style": {
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}, {
"path": "pages/startup/startup",
"style": {
"navigationStyle": "custom",
@ -599,6 +598,12 @@
"navigationBarTitleText": "记录心率",
"enablePullDownRefresh": false
}
}, {
"path": "devicelist/devicelist",
"style": {
"navigationBarTitleText": "设备列表",
"enablePullDownRefresh": false
}
}
]
}],

View File

@ -86,11 +86,8 @@
onShow() {
uni.setStorageSync("region", 1)
this.userinfo = uni.getStorageSync('userinfo');
if (this.userinfo) {
this.patientName = this.userinfo.patientName
console.log(this.patientName,'000')
checkSignApply(this.userinfo.cardNo).then(res => {
if (res.data.code != 0) {
this.checkSign = true
@ -100,7 +97,6 @@
})
} else {
this.patientName = ''
}
},
methods: {

View File

@ -387,7 +387,7 @@
},
goaddequipment() {
uni.navigateTo({
url: "/pagesC/addequipment/addequipment"
url: "/pagesC/devicelist/devicelist"
})
},
gohealthdata(index) {

View File

@ -19,29 +19,37 @@
</view>
</view>
<view class="types">
<view @tap='data.deviceType=0' :class="data.deviceType==0?'type':'type2'">血压计</view>
<view @tap='data.deviceType=1' :class="data.deviceType==1?'type':'type2'">血糖仪</view>
<view @tap='data.deviceType=1' :class="data.deviceType==1?'type':'type2'">血压计</view>
<view @tap='data.deviceType=2' :class="data.deviceType==2?'type':'type2'">血糖仪</view>
<view @tap='data.deviceType=3' :class="data.deviceType==3?'type':'type2'">动态血压仪</view>
</view>
<view class="submit" @click="submit">
保存
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>
// import { bindDevice } from '@/service/api/api.js'
import {
binding
} from '@/api/examinationapi/add.js'
export default {
data() {
return {
type: 1,
data: {
deviceType: 0,
identity: uni.getStorageSync('userInfo').identity,
signNo: uni.getStorageSync('signInfo').signNo,
sn: ''
deviceType: undefined,
// identity: uni.getStorageSync('userinfo').cardNo,
identity: '370882199909092123',
sn: '',
bindTime: undefined, //
state: 1,
}
};
},
onLoad() {
this.data.bindTime = this.timeFormat()
},
methods: {
scanning() {
const that = this
@ -52,20 +60,49 @@
}
})
},
timeFormat() {
let time = parseInt(new Date().getTime() / 1000)
time = time * 1000 //
var x = new Date(time)
var z = {
y: x.getFullYear(),
M: x.getMonth() + 1,
d: x.getDate(),
h: x.getHours(),
m: x.getMinutes(),
s: x.getSeconds(),
}
if (z.M < 10) {
z.M = '0' + z.M
}
if (z.d < 10) {
z.d = '0' + z.d
}
if (z.h < 10) {
z.h = '0' + z.h
}
if (z.m < 10) {
z.m = '0' + z.m
}
if (z.s < 10) {
z.s = '0' + z.s
}
return z.y + '-' + z.M + '-' + z.d + ' ' + z.h + ':' + z.m + ':' + z.s
},
submit() {
// bindDevice(this.data).then(res => {
// if(res.data.code == '1') {
// uni.showToast({
// title: '',
// duration: 1000
// })
// setTimeout(function() {
// uni.navigateBack({
// delta: 1
// })
// }, 1000);
// }
// })
binding(this.data).then(res => {
if (res.code == 200) {
this.$refs.uToast.show({
title: '绑定成功',
type: 'success',
})
setTimeout(function() {
uni.navigateBack({
delta: 1
})
}, 2000);
}
})
}
}
}

View File

@ -0,0 +1,165 @@
<template>
<view class="devicelist">
<view class="title" v-if="deviceList.length != 0">已绑定设备</view>
<view class="title" style="text-align: center;" v-else>暂无绑定设备</view>
<template v-for="(item, index) in deviceList">
<view class="devices" :key="index">
<text v-if="item.deviceType == 1">血压计</text>
<text v-else-if="item.deviceType == 2">血糖仪</text>
<text v-else>动态血压计</text>
<text style="margin-left: -30rpx; font-size: 26rpx;">SN: {{ item.sn }}</text>
<view class="delbind" @click="delbind(item)">解绑</view>
</view>
</template>
<view class="addbtn" @click="addequipment">
<text>添加设备</text>
<image src="http://112.7.50.34:8001/static/addicon.png"></image>
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>
import {
bound,
unbind
} from '@/api/examinationapi/add.js'
export default {
data() {
return {
deviceList: []
}
},
onShow() {
this.getbindDeviceList()
},
methods: {
getbindDeviceList() {
// uni.getStorageSync('userinfo').cardNo
bound('370882199909092123').then(res => {
if (res.code == 200) {
this.deviceList = res.data
}
})
},
delbind(e) {
const that = this
uni.showModal({
title: '提示',
content: '确定解绑此设备吗?',
success(res) {
if (res.confirm) {
const data = {
remark: e.remark,
id: e.id,
bindTime: e.bindTime,
// identity: uni.getStorageSync('userinfo').cardNo,
identity: '370882199909092123',
sn: e.sn,
unbindTime: that.timeFormat(),
state: 0,
deviceType: e.deviceType,
}
unbind(data).then(respone => {
if (respone.code == 200) {
that.$refs.uToast.show({
title: '解绑成功',
type: 'success',
})
that.getbindDeviceList()
}
})
}
}
})
},
timeFormat() {
let time = parseInt(new Date().getTime() / 1000)
time = time * 1000 //
var x = new Date(time)
var z = {
y: x.getFullYear(),
M: x.getMonth() + 1,
d: x.getDate(),
h: x.getHours(),
m: x.getMinutes(),
s: x.getSeconds(),
}
if (z.M < 10) {
z.M = '0' + z.M
}
if (z.d < 10) {
z.d = '0' + z.d
}
if (z.h < 10) {
z.h = '0' + z.h
}
if (z.m < 10) {
z.m = '0' + z.m
}
if (z.s < 10) {
z.s = '0' + z.s
}
return z.y + '-' + z.M + '-' + z.d + ' ' + z.h + ':' + z.m + ':' + z.s
},
addequipment() {
uni.navigateTo({
url: "/pagesC/addequipment/addequipment"
})
}
}
}
</script>
<style lang="scss" scoped>
.devicelist {
padding: 20rpx;
.title {
color: #333;
}
.devices {
border: 2rpx solid #ccc;
border-radius: 10rpx;
margin: 20rpx 0;
padding: 30rpx 20rpx;
color: #333;
display: flex;
align-items: center;
justify-content: space-between;
text {
font-size: 36rpx;
margin-left: 15rpx;
}
view {
border: 1px solid #4AC4AB;
padding: 8rpx 40rpx;
border-radius: 10rpx;
color: #4AC4AB;
}
}
.addbtn {
height: 170rpx;
display: flex;
flex-direction: column;
justify-content: space-evenly;
align-items: center;
background: #4AC4AB;
color: #fff;
border-radius: 15rpx;
font-size: 36rpx;
padding: 10rpx 0;
margin-top: 50rpx;
image {
width: 50rpx;
height: 50rpx;
}
}
}
</style>