Commit 999eb0cb authored by Sky's avatar Sky

修改心率最大值显示不正确的bug

parent 79c7247b
...@@ -220,7 +220,7 @@ export default { ...@@ -220,7 +220,7 @@ export default {
params: { params: {
endTotalTime: model.fitTotalDuration, //训练时间 endTotalTime: model.fitTotalDuration, //训练时间
endAverHeartRate: _this.getAverHeartRate(_this.heartRateList), //平均心率 endAverHeartRate: _this.getAverHeartRate(_this.heartRateList), //平均心率
endMaxHeartRate: _this.getMaxHeartRatet(_this.heartRateList), //最高心率 endMaxHeartRate: _this.getMaxHeartRate(_this.heartRateList), //最高心率
endCalorie: model.acCalorie, //消耗心率 endCalorie: model.acCalorie, //消耗心率
} }
}); });
...@@ -399,11 +399,13 @@ export default { ...@@ -399,11 +399,13 @@ export default {
/** /**
*获取最大心率 *获取最大心率
*/ */
getMaxHeartRatet(arr) { getMaxHeartRate(arr) {
if (arr.length > 0) { if (arr.length > 0) {
let max = arr[0]; let max = arr[0];
for (let i = 0; i < arr.length - 1; i++) { for (let i = 0; i < arr.length; i++) {
max = max < arr[i + 1] ? arr[i + 1] : arr if (arr[i] > max) {
max = arr[i];
}
} }
return parseInt(max) return parseInt(max)
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment