|
|
@@ -256,6 +256,7 @@
|
|
|
} else {
|
|
|
// 页面初始化操作
|
|
|
document.addEventListener('plusready', function (e) {
|
|
|
+ that.setWakelock();
|
|
|
plus.bluetooth.onBLECharacteristicValueChange(function (e) {
|
|
|
if (e.characteristicId == '00002A19-0000-1000-8000-00805F9B34FB') {
|
|
|
// 获取电量
|
|
|
@@ -272,12 +273,11 @@
|
|
|
that.watchState = true;//关闭连接按钮并显示当前课程名
|
|
|
// 卡路里计算
|
|
|
that.calcCalorie(that.heartRate);
|
|
|
+ that.heartLine.push(that.heartRate);
|
|
|
+ that.dataLabels.push('');
|
|
|
if (that.heartLine.length > 30) {
|
|
|
- that.heartLine = that.heartLine.concat();
|
|
|
- that.dataLabels = that.dataLabels.concat();
|
|
|
- } else {
|
|
|
- that.heartLine.push(that.heartRate);
|
|
|
- that.dataLabels.push('');
|
|
|
+ that.heartLine.shift();
|
|
|
+ that.dataLabels.shift();
|
|
|
}
|
|
|
that.DrawHeartLine(that.heartLine, that.dataLabels);
|
|
|
}
|
|
|
@@ -285,6 +285,16 @@
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
+ // 屏幕常亮
|
|
|
+ setWakelock() {
|
|
|
+ plus.device.setWakelock(true);
|
|
|
+ console.log('屏幕常量已开启');
|
|
|
+ },
|
|
|
+ // 震动
|
|
|
+ vibrate() {
|
|
|
+ let milliseconds = 500;
|
|
|
+ plus.device.vibrate(milliseconds)
|
|
|
+ },
|
|
|
showConsole() {
|
|
|
let vconDom = document.getElementById('__vconsole');
|
|
|
this.toggleClass(vconDom, 'show')
|
|
|
@@ -308,7 +318,7 @@
|
|
|
obj.className = obj.className.replace(reg, ' ');
|
|
|
}
|
|
|
},
|
|
|
- // 生成心率数据
|
|
|
+ // 测试 生成心率数据
|
|
|
mockCreateDate() {
|
|
|
let that = this;
|
|
|
clearInterval(this.timermockCreateDate);
|
|
|
@@ -324,12 +334,12 @@
|
|
|
that.watchState = true;//关闭连接按钮
|
|
|
// 卡路里计算
|
|
|
that.calcCalorie(that.heartRate);
|
|
|
- if (that.heartLine.length > 30) {
|
|
|
+
|
|
|
+ that.heartLine.push(that.heartRate);
|
|
|
+ that.dataLabels.push('');
|
|
|
+ if (that.heartLine.length > 3) {
|
|
|
that.heartLine.shift();
|
|
|
that.dataLabels.shift();
|
|
|
- } else {
|
|
|
- that.heartLine.push(that.heartRate);
|
|
|
- that.dataLabels.push('');
|
|
|
}
|
|
|
that.DrawHeartLine(that.heartLine, that.dataLabels);
|
|
|
}, 1000);
|
|
|
@@ -349,7 +359,7 @@
|
|
|
that.duId = parseInt(json.DuInfo.DuId);
|
|
|
that.DpName = json.DuInfo.DpName;
|
|
|
console.log('that.duId:' + that.duId);
|
|
|
- if(that.InClass == 1){
|
|
|
+ if (that.InClass == 1) {
|
|
|
that.AddHrSensorsUpdate(that.sn);
|
|
|
}
|
|
|
} else {
|
|
|
@@ -487,6 +497,8 @@
|
|
|
success: function (e) {
|
|
|
console.log('---> 获取心跳服务' + JSON.stringify(e));
|
|
|
console.log('---> notifyBLECharacteristicValueChange ' + chaaracterUuid + ' success.');
|
|
|
+ // 服务获取成功,震动提示
|
|
|
+ // that.vibrate();
|
|
|
//that.onValuesChange();
|
|
|
},
|
|
|
fail: function (e) {
|
|
|
@@ -617,7 +629,7 @@
|
|
|
,
|
|
|
// 活动强度计算公式
|
|
|
calcActLevel(heartRate) {
|
|
|
- let actLevel = (heartRate - this.peaceHeart) / (208-0.7*this.age - this.peaceHeart) *100;
|
|
|
+ let actLevel = (heartRate - this.peaceHeart) / (208 - 0.7 * this.age - this.peaceHeart) * 100;
|
|
|
actLevel = actLevel > 100 ? 100 : actLevel < 0 ? 0 : actLevel;
|
|
|
this.activeLevel = parseInt(actLevel);
|
|
|
},
|