|
@@ -308,7 +308,7 @@ Page({
|
|
|
});
|
|
|
|
|
|
// 每30秒调用一次getWeRunData
|
|
|
- if (that.data.totalSeconds % 30 === 0) {
|
|
|
+ if (that.data.totalSeconds % 4 === 0) {
|
|
|
that.getWeRunData(); // 调用获取微信步数的函数
|
|
|
}
|
|
|
|
|
@@ -480,9 +480,11 @@ Page({
|
|
|
}
|
|
|
// 计算卡路里
|
|
|
const calorie = this.getCalorie(60, totalDistance); // 假设体重为60kg
|
|
|
-
|
|
|
- const pace = parseFloat(Number((totalDistance / (this.data.totalSeconds / 3600)).toFixed(2))); // 配速(km/h)
|
|
|
-
|
|
|
+ let pace =0
|
|
|
+ if(res.speed>0){
|
|
|
+ pace = parseFloat(Number((res.speed*3.6).toFixed(2))); // 配速(km/h)
|
|
|
+ console.log(pace);
|
|
|
+ }
|
|
|
console.log('总距离', totalDistance, '段距离', distance, '总卡路里', calorie, '配速', pace);
|
|
|
// 更新状态
|
|
|
this.setData({
|