diff --git a/assets/common.scss b/assets/common.scss index 753b17bb..dd862154 100644 --- a/assets/common.scss +++ b/assets/common.scss @@ -120,7 +120,7 @@ .nolist { padding: 15px; - width: 100%; + width: calc(100% - 30px); text-align: center; image { diff --git a/pages.json b/pages.json index e0124a7b..346e3117 100644 --- a/pages.json +++ b/pages.json @@ -266,7 +266,7 @@ } }, { - "path": "pages/devices/devices", + "path": "pages/devices/search", "style": { "navigationBarTitleText": "蓝牙搜索", "enablePullDownRefresh": false, @@ -300,6 +300,45 @@ } } } + }, + { + "path": "pages/devices/PCV02", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false + } + }, + { + "path": "pages/business/addDevice", + "style": { + "navigationBarTitleText": "设备列表", + "enablePullDownRefresh": false, + "app-plus": { + "titleNView": { + "backgroundImage": "linear-gradient(to right, #477EFF, #39D9C9)" + } + } + } + }, + { + "path": "pages/business/search", + "style": { + "navigationBarTitleText": "搜索设备", + "enablePullDownRefresh": false, + "app-plus": { + "titleNView": { + "backgroundImage": "linear-gradient(to right, #477EFF, #39D9C9)" + } + } + } + }, + { + "path" : "pages/devices/PCT01", + "style" : + { + "navigationBarTitleText" : "", + "enablePullDownRefresh" : false + } } ], "globalStyle": { diff --git a/pages/body/body.vue b/pages/body/body.vue index b0a20067..37903e0f 100644 --- a/pages/body/body.vue +++ b/pages/body/body.vue @@ -6,12 +6,190 @@ 曲线 - - + + + {{info?info.record_time:''}} + + + + {{item.name}} + {{item.value}}{{item.unit}} + + + + + {{infoListTop.desc}} + + + + + + + {{ite.text}} + {{ite.max_val}} + + + + + + + + + + + 暂无数据,请手动添加~ + + + + 身体得分:{{info?info.score_value:0}}分 + 身体类型:{{info?info.body_type_value:'无'}} + + + + + + 手动记录 + + + + 连接设备 + + + + 其他数据 + + + + + + + {{item.desc}} + + + + + + + {{ite.text}} + {{ite.max_val}} + + + + + 标准值:{{item.list[0].max_val}}kcal + + + + + + + + + + 此测量数据仅供参考,不可代替医学专业测试! + + + + - - + + + + + + + ~ + + + + + + + + {{item.title}} + + + + + + + + + + + + 暂无数据,请手动添加~ + + + + + + + + + 历史记录 + + + + 数据对比 + + + + + + {{userInfo.target_current?userInfo.target_current.target_weight:0}}kg + + 目标体重 + + + + + {{userInfo.target_current?Math.abs(userInfo.target_current.cumulative_weight):0}}kg + + 累计增重 + 累计减重 + + + + {{userInfo.target_current?userInfo.target_current.initial_weight:0}}kg + + 初始体重 + + + + + {{userInfo.target_current?userInfo.target_current.cumulative_day:0}} + + 减重天数 + + + + + @@ -20,17 +198,40 @@ import { mapState } from "vuex"; - import report from "./components/report.vue" - import charts from "./components/charts.vue" + import record from '@/components/manuallyAdd/record.vue'; + import firstweight from '@/components/target/firstweight.vue'; + import qiunDataCharts from '@/uni_modules/qiun-data-charts/components/qiun-data-charts/qiun-data-charts.vue'; export default { data() { return { active: 1, - acd_id: "", + acd_id: 2, + isdevice: false, + infoList: [], + infoListTop: {}, + ind: 0, + active1: 0, + startTime: "", + endTime: "", + lineData: {}, + handTrue: true, } }, computed: { - ...mapState(['user']), + ...mapState(['user', "MeasureResult", "Trend"]), + weightList() { + let that = this + that.showbox(0) + return that.Trend + }, + userInfo() { + return this.user + }, + info() { + let that = this + that.infoListTop = that.MeasureResult ? that.MeasureResult.top_list[0] : {} + return that.MeasureResult + }, endDate() { return this.$tools.getDate("start") }, @@ -39,11 +240,14 @@ }, }, components: { - report, - charts + record, + firstweight, + qiunDataCharts, }, - onShow() { + onLoad(options) { let that = this + that.acd_id = options.acd_id + that.isdevice = options.device that.$store.dispatch("getResult", { aud_id: uni.getStorageSync('userid') }) @@ -52,13 +256,95 @@ s_time: that.startDate, e_time: that.endDate }) - }, - onLoad(options) { - let that = this - that.acd_id = options.acd_id + console.log("11111", options) }, methods: { - + // 历史数据删除时重新加载接口 + reload() { + let that = this + console.log('重新加载'); + this.$nextTick(() => { + that.$store.dispatch("getResult", { + aud_id: uni.getStorageSync('userid') + }) + that.$store.dispatch("GetBodyTrendList", { + aud_id: uni.getStorageSync('userid'), + s_time: that.startDate, + e_time: that.endDate + }) + }) + }, + showbox(index) { + let that = this + that.handTrue = false + that.$nextTick(function() { + that.handTrue = true + that.lineData = that.weightList.length ? that.weightList[index].line : {} + }) + that.active1 = index + }, + //开始 + handStartTimeH(e) { + let that = this + if (that.endTime) { + if (Date.parse(e) > Date.parse(that.endTime)) { + that.$tools.msg("请选择正确的时间") + return + } + } else { + if (Date.parse(e) > Date.parse(that.endDate)) { + that.$tools.msg("请选择正确的时间") + return + } + } + that.startTime = e + let endtime = that.endTime ? that.endTime : that.endDate + that.$store.dispatch("GetBodyTrendList", { + aud_id: that.user.id, + s_time: that.startTime, + e_time: that.endTime ? that.endTime : that.endDate + }) + that.showbox(0) + }, + // 结束 + handEndTimeH(e) { + let that = this + if (that.startTime) { + if (Date.parse(e) < Date.parse(that.startTime)) { + that.$tools.msg("请选择正确的时间") + return + } + } else { + if (Date.parse(e) < Date.parse(that.startDate)) { + that.$tools.msg("请选择正确的时间") + return + } + } + that.endTime = e + let startTime = that.startTime ? that.startTime : that.startDate + that.$store.dispatch("GetBodyTrendList", { + aud_id: uni.getStorageSync('userid'), + s_time: startTime, + e_time: that.endTime + }) + that.showbox(0) + }, + handleClick(ind) { + this.ind = ind + this.$store.commit("changeFirst", true); + }, + // 报告 + handlerRecord() { + this.$store.commit('changeRecord', true) + }, + handleToggleTop(item) { + this.infoListTop = item + }, + navTo(url) { + uni.navigateTo({ + url: url + }) + }, } } @@ -93,4 +379,358 @@ background: $maincolor; } } + + // 曲线 + .charts { + .boxTime { + display: flex; + justify-content: center; + align-items: center; + background-color: #fff; + border-radius: 10px 10px 0 0; + + .one { + width: 80%; + display: flex; + line-height: 25px; + justify-content: space-between; + align-items: center; + } + } + + .box { + width: 100%; + padding: 0; + margin: 0; + display: flex; + flex-wrap: wrap; + border-radius: 0 0 10px 10px; + justify-content: space-between; + + .listC { + background-color: #fff; + + .name { + width: 20%; + padding: 0 15px; + font-size: 14px; + text-align: center; + border-radius: 5px; + height: 30px; + line-height: 30px; + } + + .active2 { + color: #fff; + background: $maincolor; + } + + } + + .blockC { + clear: both; + width: 100%; + height: 250px; + background-color: #fff; + border-radius: 0 0 10px 10px; + padding-bottom: 15px; + } + } + + .gridList { + margin: 0px !important; + width: 100% !important; + + .data { + .item { + display: block !important + } + } + + } + } + + // 报告 + .report { + .box { + padding: 10px; + background-color: #fff; + border-radius: 10px; + margin-bottom: 10px; + + .time { + color: #999; + padding-bottom: 15px; + width: 100%; + } + + .item2 { + width: 100%; + display: flex; + flex-wrap: wrap; + justify-content: space-between; + + .item2_data { + width: 33%; + + .data { + width: 100%; + text-align: center; + border-right: 1PX solid #f7f7f7; + } + + text { + font-size: 20px !important; + font-weight: bold; + } + } + } + } + + .box2 { + height: 50px; + line-height: 50px; + border-radius: 10px; + display: flex; + padding: 0 10px; + justify-content: space-between; + margin-bottom: 10px; + background-color: #fff; + } + + .info { + width: 100%; + display: flex; + justify-content: space-between; + + .item { + color: #fff; + width: 45%; + height: 50px; + background: $maincolor; + text-align: center; + border-radius: 10px; + display: flex; + justify-content: center; + align-items: center; + + text { + width: 30px; + height: 30px; + border-radius: 50%; + margin-right: 10px; + display: inline-block; + background-color: #fff; + } + } + } + + .myinfoPage { + width: 100%; + background: #fff; + margin-top: 10px; + padding-bottom: 15px; + border-radius: 10px; + + .box1 { + display: flex; + flex-wrap: wrap; + border-radius: 10px; + font-size: 14px; + position: relative; + margin: 0px 15px 0; + padding-bottom: 10px; + + .list { + width: 100%; + color: #666; + padding: 0; + line-height: 50px; + // display: flex; + // justify-content: space-between; + // align-items: center; + // flex-wrap: wrap; + + image, + .t-icon { + width: 18px !important; + height: 18px; + border: 2px solid #c7c7c7; + background-color: #c7c7c7; + border-radius: 50%; + margin-right: 5px; + } + + .block { + width: 100%; + display: flex; + justify-content: space-between; + align-items: center; + color: #666; + position: relative; + + .level, + .val { + width: 25%; + } + + .name { + width: 40%; + display: flex; + align-items: center; + } + + .icon { + width: 20px; + text-align: right; + display: flex; + + image { + width: 20px; + height: 20px; + } + } + } + } + } + } + + .desc { + line-height: 20px; + text-align: left; + width: calc(100%-20px); + height: auto; + border-radius: 5px; + font-size: 12px; + color: #999; + padding: 10px; + background: #f7f7f7; + + + .statuevue { + height: 35px; + position: relative; + width: 100% !important; + margin: 20px auto 10px; + + .bi { + display: flex; + justify-content: space-between; + width: auto; + padding-top: 10px; + + .peobox { + position: absolute; + right: 0; + top: -1px; + + .xx { + width: 5px; + height: 5px; + border-radius: 50%; + background: #fff; + position: absolute; + z-index: 9; + border: 2px solid #1b2086; + top: 9px; + } + } + } + + .item { + position: relative; + margin: 0; + flex: 1; + height: 5px; + color: #666; + font-size: 12px; + + .span1 { + width: 100%; + text-align: center; + position: absolute; + top: -23px; + } + + .span { + margin-top: 8px; + position: absolute; + right: -8px; + } + } + } + } + + .yuanxing { + display: inline-block; + background: #f19601; + width: 8px; + height: 12px; + margin-right: 5px; + font-size: 32rpx; + } + + .btnf { + font-size: 13px; + border-radius: 5px; + height: 22px; + margin: 0 10px 0 0; + line-height: 22px; + color: #fff; + font-weight: 400; + width: 44px !important; + text-align: center !important; + float: right; + } + + .tivon { + display: flex; + justify-content: center; + align-content: center; + align-items: center; + + .bianji { + width: 20px; + height: 20px; + margin-left: 5px; + } + } + + .box1 :last-child.list { + .val { + width: 25% !important; + } + } + + + .kcalClass { + width: 100%; + text-align: center; + font-size: 16px; + line-height: 55px; + margin: -20px auto; + } + + .yichang { + background: #ffe4be; + color: #ff4239; + padding: 5px; + text-align: center; + border-radius: 5px; + margin: 0 15px 10px; + } + + + /deep/.uni-collapse-item { + width: 100% !important; + } + + /deep/.uni-collapse-item__title-arrow { + margin-right: 0 !important; + } + + /deep/.uni-collapse-item__wrap-content.uni-collapse-item--border { + border-bottom-width: 0 + } + } \ No newline at end of file diff --git a/pages/body/components/charts.vue b/pages/body/components/charts.vue deleted file mode 100644 index 41ddf9e8..00000000 --- a/pages/body/components/charts.vue +++ /dev/null @@ -1,271 +0,0 @@ - - - - \ No newline at end of file diff --git a/pages/body/components/report.vue b/pages/body/components/report.vue deleted file mode 100644 index 80e4816c..00000000 --- a/pages/body/components/report.vue +++ /dev/null @@ -1,428 +0,0 @@ - - - - - \ No newline at end of file diff --git a/pages/business/addDevice.vue b/pages/business/addDevice.vue new file mode 100644 index 00000000..d068f4c7 --- /dev/null +++ b/pages/business/addDevice.vue @@ -0,0 +1,75 @@ + + + + + \ No newline at end of file diff --git a/pages/business/business.vue b/pages/business/business.vue index 8183fd03..ec413600 100644 --- a/pages/business/business.vue +++ b/pages/business/business.vue @@ -1,22 +1,147 @@ + + .list { + width: 100%; + + + .item { + width: calc(100% - 20px); + padding: 5px 10px; + display: flex; + align-items: center; + justify-content: space-between; + border-radius: 10px; + background-color: #fff; + margin-bottom: 10px; + + .left { + width: 80%; + display: flex; + align-items: center; + + image { + width: 60px; + height: 60px; + } + + .name { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + text-align: center; + + text { + width: 100%; + display: block; + text-align: left; + margin-top: 10px; + } + } + } + + .bing { + width: auto; + float: right; + background-color: #dfdfdf; + border-radius: 10px; + padding: 5px 10px; + } + + } + } + \ No newline at end of file diff --git a/pages/business/search.vue b/pages/business/search.vue new file mode 100644 index 00000000..b9b55baf --- /dev/null +++ b/pages/business/search.vue @@ -0,0 +1,366 @@ + + + + + \ No newline at end of file diff --git a/pages/devices/G02.vue b/pages/devices/G02.vue index 721d2d8c..a4a6e5e7 100644 --- a/pages/devices/G02.vue +++ b/pages/devices/G02.vue @@ -20,7 +20,7 @@ 测量结果提示 - 本次测量身高为:{{height}} + 本次测量身高为:{{height}}{{unit}} 上次测量体重为:kg @@ -56,7 +56,13 @@ ...mapState(["user", "isConnected", "isBluetoothTyle"]), info() { return this.user - } + }, + endDate() { + return this.$tools.getDate("start") + }, + startDate() { + return this.$tools.GetDateStr(-90); + }, }, onUnload: function() { let that = this @@ -138,7 +144,7 @@ if (!device.name && !device.localName) { return } - if (device.name.indexOf("WSD") !== -1) { + if (device.name.indexOf("G02") !== -1) { let value = that.$tools.ab2hex(device.advertisData, "") let type = value.substring(22, 24) let num = value.substring(28, 29) @@ -167,7 +173,7 @@ device.macAddr = that.$tools.ab2hex(tempMac, ':').toUpperCase() that.deviceId = device.deviceId that.macAddr = device.macAddr - that.height = data + that.unit + that.height = data that.stopblue = false return } @@ -210,17 +216,24 @@ return } that.$model.getmeasurefunit({ - imp: that.imp, + adc: 0, weight: that.weight, - ecode: that.macAddr, height: that.height, - familyid: that.info.id + aud_id: that.info.id }).then(res => { that.isHeight = false if (res.code == 0) { - that.$store.dispatch("getUserInfo", { - familyid: that.info.id - }); + that.$store.dispatch('getUserInfo', { + aud_id: uni.getStorageSync('userid') + }) + that.$store.dispatch("getResult", { + aud_id: uni.getStorageSync('userid') + }) + that.$store.dispatch("GetBodyTrendList", { + aud_id: uni.getStorageSync('userid'), + s_time: that.startDate, + e_time: that.endDate + }) that.$tools.msg("测量成功") } else { that.$tools.msg("测量失败") diff --git a/pages/devices/PCT01.vue b/pages/devices/PCT01.vue new file mode 100644 index 00000000..8183fd03 --- /dev/null +++ b/pages/devices/PCT01.vue @@ -0,0 +1,22 @@ + + + + + diff --git a/pages/devices/PCV02.vue b/pages/devices/PCV02.vue new file mode 100644 index 00000000..bea17465 --- /dev/null +++ b/pages/devices/PCV02.vue @@ -0,0 +1,637 @@ + + + + + \ No newline at end of file diff --git a/pages/devices/devices.vue b/pages/devices/search.vue similarity index 86% rename from pages/devices/devices.vue rename to pages/devices/search.vue index af23437e..083aaea5 100644 --- a/pages/devices/devices.vue +++ b/pages/devices/search.vue @@ -10,8 +10,8 @@ - - {{item.macAddr}} + + {{item.name}} @@ -36,7 +36,8 @@ issearch: false, //是否重新搜索 isdevTip: false, //是否有提示 devicesList: [], - devList: [] + devList: [], + id: 0 } }, computed: { @@ -44,6 +45,7 @@ }, onLoad(options) { that = this + that.id = options ? options.id : 0 that.openBluetoothAdapter() that.onBLEConnectionStateChange() uni.onBluetoothAdapterStateChange(function(res) { @@ -92,7 +94,7 @@ startBluetoothDeviceDiscovery() { let that = this uni.startBluetoothDevicesDiscovery({ - allowDuplicatesKey: false, //是否允许重复上报同一设备 + allowDuplicatesKey: true, //是否允许重复上报同一设备 success: res => { that.onBluetoothDeviceFound(); }, @@ -106,7 +108,7 @@ var that = this; uni.onBluetoothDeviceFound(res => { res.devices.forEach(device => { - if (device.name.indexOf("WSD") != -1) { + if (device.name.indexOf("G02") != -1) { console.log("G02", device) clearTimeout(myTime); let buff = device.advertisData.slice(3, 9) @@ -116,6 +118,26 @@ that.handleDevice(device) return; } + if (device.name.indexOf("PC") != -1) { + console.log("肺活量", device) + clearTimeout(myTime); + let buff = device.advertisData.slice(-6) + device.mac = new Uint8Array(buff) // 保存广播数据中的mac地址,这是由于iOS不直接返回mac地址 + let tempMac = Array.from(device.mac) + device.macAddr = that.$tools.ab2hex(tempMac, ':').toUpperCase() + that.handleDevice(device) + return; + } + if (device.name.indexOf("YPC") != -1) { + console.log("device333333", device.name, device) + clearTimeout(myTime); + let buff = device.name.slice(7, 19) + device.macAddr = that.$tools.str2Num(buff) + if (device.macAddr != "") { + that.handleDevice(device) + } + return + } }) }); that.handleMyTime() @@ -124,13 +146,13 @@ let that = this const foundDevices = that.devicesList const idx = that.$tools.inArray(foundDevices, "deviceId", device.deviceId) - that.deviceId = device.deviceId; + that.deviceId = device.macAddr; console.log("111", idx, device, ) if (idx === -1) { that.devicesList.push(device); - // if (device.macAddr != "") { - // that.handleDevType(device.macAddr) - // } + if (device.macAddr != "") { + that.handleDevType(device.macAddr) + } } }, handleMyTime() { @@ -161,7 +183,8 @@ handleDevType(sn) { that = this that.$model.getdevdetail({ - sn: sn, + mac: sn, + acd_id: that.id }).then(res => { console.log("排查返回", res) if (res.code == 0) { @@ -172,15 +195,14 @@ }, handleWeight(item) { let that = this - that.Unload = true - // bletype 0:未找到,1:透传,2:广播 clearTimeout(myTime); + that.Unload = true console.log("跳转测量", item) - // if (item.bletype != 2) { - // that.stopBluetoothDevicesDiscovery() - // } + if (item.bluetooth_type == '透传') { + that.stopBluetoothDevicesDiscovery() + } uni.redirectTo({ - url: '/pages/devices/G02' + url: item.page_measure + '?deviceId=' + that.deviceId }) }, // 监听蓝牙连接状态 diff --git a/pages/history/history.vue b/pages/history/history.vue index b6c2eb5a..ad5ed990 100644 --- a/pages/history/history.vue +++ b/pages/history/history.vue @@ -1,8 +1,7 @@