|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="content">
|
|
<div class="content">
|
|
|
<div class="top" :style="{backgroundColor:bgColor}">
|
|
<div class="top" :style="{backgroundColor:bgColor}">
|
|
|
- <span class="watchState">{{watchText}}</span>
|
|
|
|
|
|
|
+ <span class="watchState">{{watchText}} {{battery}}</span>
|
|
|
<div class="toprow">
|
|
<div class="toprow">
|
|
|
<div class="lt">
|
|
<div class="lt">
|
|
|
<div class="activeLevel">
|
|
<div class="activeLevel">
|
|
@@ -96,7 +96,9 @@
|
|
|
{'normalJump':activeLevel > 30 && activeLevel <= 90},
|
|
{'normalJump':activeLevel > 30 && activeLevel <= 90},
|
|
|
{'fastJump':activeLevel > 90},
|
|
{'fastJump':activeLevel > 90},
|
|
|
{'slowJump':activeLevel < 30},
|
|
{'slowJump':activeLevel < 30},
|
|
|
- ]">{{heartRate}}</em>
|
|
|
|
|
|
|
+ ]"
|
|
|
|
|
+ :style="{bottom:parseInt(screenHeight - 30) +'px'}"
|
|
|
|
|
+ >{{heartRate}}</em>
|
|
|
</div>
|
|
</div>
|
|
|
<mu-dialog title="" width="600" max-width="80%" :esc-press-close="true"
|
|
<mu-dialog title="" width="600" max-width="80%" :esc-press-close="true"
|
|
|
:overlay-close="true" :open.sync="openAlert">
|
|
:overlay-close="true" :open.sync="openAlert">
|
|
@@ -120,13 +122,16 @@
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
import LineExample from '../components/LineExample'
|
|
import LineExample from '../components/LineExample'
|
|
|
-
|
|
|
|
|
|
|
+ import {
|
|
|
|
|
+ SchoolTimeQueryByDate,
|
|
|
|
|
+ } from '../api/getApiRes.js'
|
|
|
export default {
|
|
export default {
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
dataLabels: [],
|
|
dataLabels: [],
|
|
|
dataDatasets: [],
|
|
dataDatasets: [],
|
|
|
watchText: '',
|
|
watchText: '',
|
|
|
|
|
+ battery: '',
|
|
|
userHead: 'http://xhead.beswell.com/flyhead.png',
|
|
userHead: 'http://xhead.beswell.com/flyhead.png',
|
|
|
watchState: false,//false
|
|
watchState: false,//false
|
|
|
bgColor: '#028FE1',
|
|
bgColor: '#028FE1',
|
|
@@ -158,22 +163,7 @@
|
|
|
},
|
|
},
|
|
|
mounted() {
|
|
mounted() {
|
|
|
this.getBodyInfo();
|
|
this.getBodyInfo();
|
|
|
- // test
|
|
|
|
|
- // this.begin = new Date('2021-02-04 16:13:01');
|
|
|
|
|
- // this.dataLabels = ['', '', '', '', '', '', '', '', ''];
|
|
|
|
|
- // this.heartLine = [65];
|
|
|
|
|
- // let heartRate = 0;
|
|
|
|
|
- // this.timer = setInterval(() => {
|
|
|
|
|
- // heartRate = parseInt(Math.random()*100+70);
|
|
|
|
|
- // this.heartRate = heartRate;
|
|
|
|
|
- // this.activeState = true;
|
|
|
|
|
- // this.watchState = true;
|
|
|
|
|
- // this.dataLabels.push('');
|
|
|
|
|
- // this.heartLine.push(heartRate);
|
|
|
|
|
- // this.calcCalorie(heartRate);
|
|
|
|
|
- // this.calcActLevel(heartRate);
|
|
|
|
|
- // this.DrawHeartLine(this.heartLine, this.dataLabels)
|
|
|
|
|
- // },1000);
|
|
|
|
|
|
|
+ this.init();
|
|
|
},
|
|
},
|
|
|
watch: {
|
|
watch: {
|
|
|
activeLevel(val) {
|
|
activeLevel(val) {
|
|
@@ -207,18 +197,65 @@
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ init() {
|
|
|
|
|
+ let that = this;
|
|
|
|
|
+ // 页面初始化操作
|
|
|
|
|
+ document.addEventListener('plusready', function (e) {
|
|
|
|
|
+ plus.bluetooth.onBLECharacteristicValueChange(function (e) {
|
|
|
|
|
+ console.log(e.characteristicId);
|
|
|
|
|
+ if (e.characteristicId == '00002A19-0000-1000-8000-00805F9B34FB') {
|
|
|
|
|
+ // 获取电量
|
|
|
|
|
+ var value = that.buffer2hexPower(e.value);
|
|
|
|
|
+ that.battery = value + '%';
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 成功获取心跳
|
|
|
|
|
+ that.heartRate = parseInt(that.parseHeartRate(e.value).heartRate);
|
|
|
|
|
+ that.watchText = '心率带已连接';
|
|
|
|
|
+ that.activeState = true;
|
|
|
|
|
+ // 运动强度计算
|
|
|
|
|
+ that.calcActLevel(that.heartRate);
|
|
|
|
|
+ that.openAlert = false;//关闭弹窗
|
|
|
|
|
+ that.watchState = true;//关闭连接按钮
|
|
|
|
|
+ // 卡路里计算
|
|
|
|
|
+ that.calcCalorie(that.heartRate);
|
|
|
|
|
+ if (that.heartLine.length > 30) {
|
|
|
|
|
+ that.heartLine.unshift();
|
|
|
|
|
+ that.dataLabels.unshift();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ that.heartLine.push(that.heartRate);
|
|
|
|
|
+ that.dataLabels.push('');
|
|
|
|
|
+ }
|
|
|
|
|
+ that.DrawHeartLine(that.heartLine, that.dataLabels);
|
|
|
|
|
+ // that.reportInfo();
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ buffer2hexPower(value) {
|
|
|
|
|
+ var t = '';
|
|
|
|
|
+ if (value) {
|
|
|
|
|
+ var v = new Uint8Array(value);
|
|
|
|
|
+ for (var i in v) {
|
|
|
|
|
+ // t += '0x' + v[i].toString(16) + ' ';
|
|
|
|
|
+ t += v[i].toString(10) + ' ';
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ t = '无效值';
|
|
|
|
|
+ }
|
|
|
|
|
+ return t;
|
|
|
|
|
+ },
|
|
|
connectWatch() {
|
|
connectWatch() {
|
|
|
// 打开蓝牙适配器
|
|
// 打开蓝牙适配器
|
|
|
let that = this;
|
|
let that = this;
|
|
|
plus.bluetooth.openBluetoothAdapter({
|
|
plus.bluetooth.openBluetoothAdapter({
|
|
|
success: function (e) {
|
|
success: function (e) {
|
|
|
- that.Toast('蓝牙适配器打开成功!','success');
|
|
|
|
|
|
|
+ that.Toast('蓝牙适配器打开成功!', 'success');
|
|
|
that.openAlert = true;
|
|
that.openAlert = true;
|
|
|
that.searchWatch();
|
|
that.searchWatch();
|
|
|
return e
|
|
return e
|
|
|
},
|
|
},
|
|
|
fail: function (e) {
|
|
fail: function (e) {
|
|
|
- that.Toast('打开失败! 请确认蓝牙开关已开启','error');
|
|
|
|
|
|
|
+ that.Toast('打开失败! 请确认蓝牙开关已开启', 'error');
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
@@ -232,13 +269,13 @@
|
|
|
plus.bluetooth.startBluetoothDevicesDiscovery({
|
|
plus.bluetooth.startBluetoothDevicesDiscovery({
|
|
|
// services: ['heart_rate'],//ios不支持
|
|
// services: ['heart_rate'],//ios不支持
|
|
|
success: function (e) {
|
|
success: function (e) {
|
|
|
- that.Toast('开始搜索成功!','success');
|
|
|
|
|
|
|
+ that.Toast('开始搜索成功!', 'success');
|
|
|
plus.bluetooth.onBluetoothDeviceFound(function (e) {
|
|
plus.bluetooth.onBluetoothDeviceFound(function (e) {
|
|
|
let devices = e.devices;
|
|
let devices = e.devices;
|
|
|
for (let i in devices) {
|
|
for (let i in devices) {
|
|
|
let device = devices[i];
|
|
let device = devices[i];
|
|
|
// localName CL831
|
|
// localName CL831
|
|
|
- if (device.localName.includes('CL831')) {
|
|
|
|
|
|
|
+ if (device.localName.indexOf('CL831') != -1) {
|
|
|
console.log(JSON.stringify(device));
|
|
console.log(JSON.stringify(device));
|
|
|
that.watchs.push(device)
|
|
that.watchs.push(device)
|
|
|
}
|
|
}
|
|
@@ -253,12 +290,12 @@
|
|
|
},
|
|
},
|
|
|
choiceWatch(w) {
|
|
choiceWatch(w) {
|
|
|
let that = this;
|
|
let that = this;
|
|
|
- that.Toast('连接心率带' + w.localName + '中...','success');
|
|
|
|
|
|
|
+ that.Toast('连接心率带' + w.localName + '中...', 'success');
|
|
|
// 建立连接
|
|
// 建立连接
|
|
|
plus.bluetooth.createBLEConnection({
|
|
plus.bluetooth.createBLEConnection({
|
|
|
deviceId: w.deviceId,
|
|
deviceId: w.deviceId,
|
|
|
success: function (e) {
|
|
success: function (e) {
|
|
|
- that.Toast('连接成功!','success');
|
|
|
|
|
|
|
+ that.Toast('连接成功!', 'success');
|
|
|
// 渲染完毕再执行这个,所以才能没有延时的更改
|
|
// 渲染完毕再执行这个,所以才能没有延时的更改
|
|
|
// 需要一个回调等待5S
|
|
// 需要一个回调等待5S
|
|
|
clearTimeout(that.timer); //清除延迟执行
|
|
clearTimeout(that.timer); //清除延迟执行
|
|
@@ -274,12 +311,11 @@
|
|
|
},
|
|
},
|
|
|
getServices(w) {
|
|
getServices(w) {
|
|
|
let that = this;
|
|
let that = this;
|
|
|
- that.Toast('获取蓝牙设备服务:');
|
|
|
|
|
- console.log(w.deviceId);
|
|
|
|
|
|
|
+ that.Toast('获取蓝牙设备服务:', 'success');
|
|
|
plus.bluetooth.getBLEDeviceServices({
|
|
plus.bluetooth.getBLEDeviceServices({
|
|
|
deviceId: w.deviceId,
|
|
deviceId: w.deviceId,
|
|
|
success: function (e) {
|
|
success: function (e) {
|
|
|
- that.Toast('获取服务成功!','success');
|
|
|
|
|
|
|
+ that.Toast('获取服务成功!', 'success');
|
|
|
// 获取服务的特征值
|
|
// 获取服务的特征值
|
|
|
// console.log('服务的特征值' + w.advertisServiceUUIDs[0]);
|
|
// console.log('服务的特征值' + w.advertisServiceUUIDs[0]);
|
|
|
var HEARTuuid = "0000180D-0000-1000-8000-00805F9B34FB";//HEART RATE
|
|
var HEARTuuid = "0000180D-0000-1000-8000-00805F9B34FB";//HEART RATE
|
|
@@ -287,10 +323,9 @@
|
|
|
that.getBatteryCharacteristics(w.deviceId, Batteryuuid);
|
|
that.getBatteryCharacteristics(w.deviceId, Batteryuuid);
|
|
|
clearTimeout(that.timer); //清除延迟执行
|
|
clearTimeout(that.timer); //清除延迟执行
|
|
|
that.timer = setTimeout(() => { //设置延迟执行
|
|
that.timer = setTimeout(() => { //设置延迟执行
|
|
|
- // 获取服务
|
|
|
|
|
|
|
+ // 获取心跳服务
|
|
|
that.getCharacteristics(w.deviceId, HEARTuuid);
|
|
that.getCharacteristics(w.deviceId, HEARTuuid);
|
|
|
- }, 5000);
|
|
|
|
|
-
|
|
|
|
|
|
|
+ }, 3000);
|
|
|
},
|
|
},
|
|
|
fail: function (e) {
|
|
fail: function (e) {
|
|
|
console.log('获取服务失败! ' + JSON.stringify(e));
|
|
console.log('获取服务失败! ' + JSON.stringify(e));
|
|
@@ -309,13 +344,17 @@
|
|
|
serviceId: serviceId,
|
|
serviceId: serviceId,
|
|
|
success: function (e) {
|
|
success: function (e) {
|
|
|
let characteristics = e.characteristics;
|
|
let characteristics = e.characteristics;
|
|
|
- that.Toast('获取特征值成功! ' + characteristics.length,'success');
|
|
|
|
|
|
|
+ that.Toast('获取特征值成功! ' + characteristics.length, 'success');
|
|
|
|
|
+ console.log('获取特征值成功! ' + characteristics.length, 'success');
|
|
|
|
|
+ console.log('特征值列表: ' + JSON.stringify(characteristics));
|
|
|
plus.bluetooth.notifyBLECharacteristicValueChange({ //监听数据变化
|
|
plus.bluetooth.notifyBLECharacteristicValueChange({ //监听数据变化
|
|
|
deviceId: deviceId,
|
|
deviceId: deviceId,
|
|
|
serviceId: serviceId,
|
|
serviceId: serviceId,
|
|
|
characteristicId: chaaracterUuid,
|
|
characteristicId: chaaracterUuid,
|
|
|
success: function (e) {
|
|
success: function (e) {
|
|
|
- that.onValuesChange();
|
|
|
|
|
|
|
+ console.log('---> 获取心跳服务' + JSON.stringify(e));
|
|
|
|
|
+ console.log('---> notifyBLECharacteristicValueChange ' + chaaracterUuid + ' success.');
|
|
|
|
|
+ //that.onValuesChange();
|
|
|
},
|
|
},
|
|
|
fail: function (e) {
|
|
fail: function (e) {
|
|
|
that.Toast('notifyBLECharacteristicValueChange failed! ' + JSON.stringify(e));
|
|
that.Toast('notifyBLECharacteristicValueChange failed! ' + JSON.stringify(e));
|
|
@@ -334,21 +373,22 @@
|
|
|
let chaaracterUuid = '00002A19-0000-1000-8000-00805F9B34FB';
|
|
let chaaracterUuid = '00002A19-0000-1000-8000-00805F9B34FB';
|
|
|
let characteristicId = null;
|
|
let characteristicId = null;
|
|
|
that.begin = new Date();
|
|
that.begin = new Date();
|
|
|
|
|
+ that.readValue(deviceId, serviceId, chaaracterUuid);
|
|
|
plus.bluetooth.getBLEDeviceCharacteristics({
|
|
plus.bluetooth.getBLEDeviceCharacteristics({
|
|
|
deviceId: deviceId,
|
|
deviceId: deviceId,
|
|
|
serviceId: serviceId,
|
|
serviceId: serviceId,
|
|
|
success: function (e) {
|
|
success: function (e) {
|
|
|
- let characteristics = e.characteristics;
|
|
|
|
|
- that.Toast('获取特征值成功! ' + characteristics.length,'success');
|
|
|
|
|
|
|
+ var characteristics = e.characteristics;
|
|
|
|
|
+ that.Toast('获取心率带服务成功! ' + characteristics.length, 'success');
|
|
|
plus.bluetooth.notifyBLECharacteristicValueChange({ //监听数据变化
|
|
plus.bluetooth.notifyBLECharacteristicValueChange({ //监听数据变化
|
|
|
deviceId: deviceId,
|
|
deviceId: deviceId,
|
|
|
serviceId: serviceId,
|
|
serviceId: serviceId,
|
|
|
characteristicId: chaaracterUuid,
|
|
characteristicId: chaaracterUuid,
|
|
|
success: function (e) {
|
|
success: function (e) {
|
|
|
- that.onBatteryValuesChange();
|
|
|
|
|
|
|
+ console.log('notifyBLECharacteristicValueChange' + JSON.stringify(e));
|
|
|
},
|
|
},
|
|
|
fail: function (e) {
|
|
fail: function (e) {
|
|
|
- that.Toast('notifyBLECharacteristicValueChange failed! ' + JSON.stringify(e));
|
|
|
|
|
|
|
+ that.Toast('notifyBLECharacteristicValueChange失败! ' + JSON.stringify(e));
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
@@ -358,63 +398,25 @@
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
- // readValue(deviceId, serviceId, characteristicId) {
|
|
|
|
|
- // let that = this;
|
|
|
|
|
- // plus.bluetooth.readBLECharacteristicValue({
|
|
|
|
|
- // deviceId: deviceId,
|
|
|
|
|
- // serviceId: serviceId,
|
|
|
|
|
- // characteristicId: characteristicId,
|
|
|
|
|
- // success: function (e) {
|
|
|
|
|
- // that.Toast('读取数据成功!');
|
|
|
|
|
- // that.Toast(e);
|
|
|
|
|
- // console.log("读取数据成功" + e);
|
|
|
|
|
- // },
|
|
|
|
|
- // fail: function (e) {
|
|
|
|
|
- // that.Toast('读取数据失败! ' + JSON.stringify(e));
|
|
|
|
|
- // }
|
|
|
|
|
- // });
|
|
|
|
|
- // },
|
|
|
|
|
- // 获取基础身体数据
|
|
|
|
|
- getBodyInfo() {
|
|
|
|
|
- // todo
|
|
|
|
|
- },
|
|
|
|
|
- onValuesChange() {
|
|
|
|
|
|
|
+ readValue(deviceId, serviceId, characteristicId) {
|
|
|
let that = this;
|
|
let that = this;
|
|
|
- // todo 提出来,放在init里 有值就监听
|
|
|
|
|
- // 监听低功耗蓝牙设备的特征值变化
|
|
|
|
|
- plus.bluetooth.onBLECharacteristicValueChange(function (e) {
|
|
|
|
|
- console.log('onBLECharacteristicValueChange: ' + JSON.stringify(e));
|
|
|
|
|
- console.log('e.value: ' + JSON.stringify(e.value));
|
|
|
|
|
- console.log('---> parseHeartRate() = ' + that.parseHeartRate(e.value).heartRate);
|
|
|
|
|
- // 成功获取心跳
|
|
|
|
|
- that.heartRate = parseInt(that.parseHeartRate(e.value).heartRate);
|
|
|
|
|
- that.watchText = '心率带已连接';
|
|
|
|
|
- that.activeState = true;
|
|
|
|
|
- // 运动强度计算
|
|
|
|
|
- that.calcActLevel(that.heartRate);
|
|
|
|
|
- that.openAlert = false;//关闭弹窗
|
|
|
|
|
- that.watchState = true;//关闭连接按钮
|
|
|
|
|
- // 卡路里计算
|
|
|
|
|
- that.calcCalorie(that.heartRate);
|
|
|
|
|
- if (that.heartLine.length > 30) {
|
|
|
|
|
- that.heartLine.unshift();
|
|
|
|
|
- that.dataLabels.unshift();
|
|
|
|
|
- } else {
|
|
|
|
|
- that.heartLine.push(that.heartRate);
|
|
|
|
|
- that.dataLabels.push('');
|
|
|
|
|
|
|
+ plus.bluetooth.readBLECharacteristicValue({
|
|
|
|
|
+ deviceId: deviceId,
|
|
|
|
|
+ serviceId: serviceId,
|
|
|
|
|
+ characteristicId: characteristicId,
|
|
|
|
|
+ success: function (e) {
|
|
|
|
|
+ console.log("读取电量数据成功" + JSON.stringify(e));
|
|
|
|
|
+ },
|
|
|
|
|
+ fail: function (e) {
|
|
|
|
|
+ that.Toast('读取电量数据失败! ' + JSON.stringify(e));
|
|
|
}
|
|
}
|
|
|
- that.DrawHeartLine(that.heartLine,that.dataLabels);
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
- onBatteryValuesChange() {
|
|
|
|
|
- let that = this;
|
|
|
|
|
- // 监听低功耗蓝牙设备的特征值变化
|
|
|
|
|
- plus.bluetooth.onBLECharacteristicValueChange(function (e) {
|
|
|
|
|
- console.log('onBLECharacteristicValueChange: ' + JSON.stringify(e));
|
|
|
|
|
- console.log('Battery: ' + e.value);
|
|
|
|
|
- // console.log('---> Battery () = ' + that.parseHeartRate(e.value).heartRate);
|
|
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
+ // 获取基础身体数据
|
|
|
|
|
+ getBodyInfo() {
|
|
|
|
|
+ // todo
|
|
|
|
|
+ }
|
|
|
|
|
+ ,
|
|
|
parseHeartRate(data) {
|
|
parseHeartRate(data) {
|
|
|
var data = new DataView(data);
|
|
var data = new DataView(data);
|
|
|
const flags = data.getUint8(0);
|
|
const flags = data.getUint8(0);
|
|
@@ -447,17 +449,20 @@
|
|
|
result.rrIntervals = rrIntervals;
|
|
result.rrIntervals = rrIntervals;
|
|
|
}
|
|
}
|
|
|
return result;
|
|
return result;
|
|
|
- },
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ ,
|
|
|
// 活动强度计算公式
|
|
// 活动强度计算公式
|
|
|
calcActLevel(heartRate) {
|
|
calcActLevel(heartRate) {
|
|
|
let sum = 170 - this.age;
|
|
let sum = 170 - this.age;
|
|
|
this.activeLevel = parseInt((heartRate / sum) * 100);
|
|
this.activeLevel = parseInt((heartRate / sum) * 100);
|
|
|
- },
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ ,
|
|
|
// 持续时间
|
|
// 持续时间
|
|
|
calcHoldTime(curTime) {
|
|
calcHoldTime(curTime) {
|
|
|
let res = parseInt(curTime.getTime() - this.begin.getTime()) / 1000;
|
|
let res = parseInt(curTime.getTime() - this.begin.getTime()) / 1000;
|
|
|
return parseInt(res)
|
|
return parseInt(res)
|
|
|
- },
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ ,
|
|
|
// 计算卡路里
|
|
// 计算卡路里
|
|
|
calcCalorie(heartRate) {
|
|
calcCalorie(heartRate) {
|
|
|
let that = this;
|
|
let that = this;
|
|
@@ -471,33 +476,38 @@
|
|
|
calorieNoVo2 = ((-20.4022 + (0.4472 * heartRate) + (0.1263 * that.weight) + (0.074 * that.age)) / 4.184) / 60 * 1;
|
|
calorieNoVo2 = ((-20.4022 + (0.4472 * heartRate) + (0.1263 * that.weight) + (0.074 * that.age)) / 4.184) / 60 * 1;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- that.cal = that.cal + calorieNoVo2;
|
|
|
|
|
|
|
+ that.cal = that.cal + calorieNoVo2;
|
|
|
// 计算CK
|
|
// 计算CK
|
|
|
that.calcCk(that.cal);
|
|
that.calcCk(that.cal);
|
|
|
that.calcSportCal(calorieNoVo2, curTime)
|
|
that.calcSportCal(calorieNoVo2, curTime)
|
|
|
- },
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ ,
|
|
|
// 计算CK
|
|
// 计算CK
|
|
|
calcCk(cal) {
|
|
calcCk(cal) {
|
|
|
this.ck = parseFloat(cal / this.weight).toFixed(2);
|
|
this.ck = parseFloat(cal / this.weight).toFixed(2);
|
|
|
- },
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ ,
|
|
|
// 计算运动卡路里
|
|
// 计算运动卡路里
|
|
|
calcSportCal(calorieNoVo2) {
|
|
calcSportCal(calorieNoVo2) {
|
|
|
let bmrMSjDaily = (10.00 * this.weight) + (6.25 * this.height) - (5.00 * this.age) + 5.00;
|
|
let bmrMSjDaily = (10.00 * this.weight) + (6.25 * this.height) - (5.00 * this.age) + 5.00;
|
|
|
let BmrMSjRmrcb = parseFloat((bmrMSjDaily * 1.1) / 24);
|
|
let BmrMSjRmrcb = parseFloat((bmrMSjDaily * 1.1) / 24);
|
|
|
let calorieNoVo2Pure = (calorieNoVo2 - BmrMSjRmrcb / 3600 * 1);
|
|
let calorieNoVo2Pure = (calorieNoVo2 - BmrMSjRmrcb / 3600 * 1);
|
|
|
this.sportCal = this.sportCal + calorieNoVo2Pure;
|
|
this.sportCal = this.sportCal + calorieNoVo2Pure;
|
|
|
- },
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ ,
|
|
|
// 绘制心电图
|
|
// 绘制心电图
|
|
|
DrawHeartLine(heartLine, dataLabels) {
|
|
DrawHeartLine(heartLine, dataLabels) {
|
|
|
this.dataLabels = dataLabels;
|
|
this.dataLabels = dataLabels;
|
|
|
this.dataDatasets = heartLine;
|
|
this.dataDatasets = heartLine;
|
|
|
this.calcMaxHr(heartLine);
|
|
this.calcMaxHr(heartLine);
|
|
|
this.calcAveHr(heartLine);
|
|
this.calcAveHr(heartLine);
|
|
|
- },
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ ,
|
|
|
// 最大心率
|
|
// 最大心率
|
|
|
calcMaxHr(heartLine) {
|
|
calcMaxHr(heartLine) {
|
|
|
this.heartMax = Math.max(...heartLine);
|
|
this.heartMax = Math.max(...heartLine);
|
|
|
- },
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ ,
|
|
|
// 平均心率
|
|
// 平均心率
|
|
|
calcAveHr(heartLine) {
|
|
calcAveHr(heartLine) {
|
|
|
var sum = 0;
|
|
var sum = 0;
|
|
@@ -506,6 +516,23 @@
|
|
|
}
|
|
}
|
|
|
this.heartAverage = parseInt(sum / heartLine.length);
|
|
this.heartAverage = parseInt(sum / heartLine.length);
|
|
|
},
|
|
},
|
|
|
|
|
+ // 上报信息
|
|
|
|
|
+ reportInfo() {
|
|
|
|
|
+ // todo
|
|
|
|
|
+ let that = this;
|
|
|
|
|
+ let param = {
|
|
|
|
|
+ token: localStorage.token,
|
|
|
|
|
+ regionid: regionid,
|
|
|
|
|
+ };
|
|
|
|
|
+ let postdata = qs.stringify(param);
|
|
|
|
|
+ SchoolTimeQueryByDate(postdata).then(res => {
|
|
|
|
|
+ let json = res;
|
|
|
|
|
+ if (json.Code == 0) {
|
|
|
|
|
+ } else {
|
|
|
|
|
+ that.$message.error(json.Memo);
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
filters: {
|
|
filters: {
|
|
|
parseLevel: function (value) {
|
|
parseLevel: function (value) {
|
|
@@ -518,14 +545,17 @@
|
|
|
return '弱'
|
|
return '弱'
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- },
|
|
|
|
|
- parseToInt:function (val) {
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ ,
|
|
|
|
|
+ parseToInt: function (val) {
|
|
|
return parseInt(val)
|
|
return parseInt(val)
|
|
|
- },
|
|
|
|
|
- parseToFix2:function (val) {
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ ,
|
|
|
|
|
+ parseToFix2: function (val) {
|
|
|
return parseFloat(val).toFixed(2)
|
|
return parseFloat(val).toFixed(2)
|
|
|
}
|
|
}
|
|
|
- },
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ ,
|
|
|
components: {
|
|
components: {
|
|
|
LineExample
|
|
LineExample
|
|
|
}
|
|
}
|
|
@@ -551,7 +581,7 @@
|
|
|
line-height: 20px;
|
|
line-height: 20px;
|
|
|
color: #fff;
|
|
color: #fff;
|
|
|
text-align: center;
|
|
text-align: center;
|
|
|
- margin-top: 10px;
|
|
|
|
|
|
|
+ margin-top: 20px;
|
|
|
margin-bottom: 10px;
|
|
margin-bottom: 10px;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -999,12 +1029,11 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/deep/ .mu-dialog {
|
|
/deep/ .mu-dialog {
|
|
|
- background-color: rgba(0, 0, 0, 0.75);
|
|
|
|
|
|
|
+ background-color: rgba(0, 0, 0, 0.85);
|
|
|
color: #fff;
|
|
color: #fff;
|
|
|
border-radius: 20px;
|
|
border-radius: 20px;
|
|
|
background-size: 100%;
|
|
background-size: 100%;
|
|
|
background-origin: content-box;
|
|
background-origin: content-box;
|
|
|
- filter: blur(0.5px);
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/deep/ .mu-dialog p {
|
|
/deep/ .mu-dialog p {
|