|
@@ -89,7 +89,7 @@ Page({
|
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
|
onShow: function () {
|
|
|
- if (!this.data.isRunning) {
|
|
|
+ if (!this.data.isRunning&&!this.data.isstop) {
|
|
|
this.startTimer();
|
|
|
}
|
|
|
},
|
|
@@ -323,10 +323,6 @@ Page({
|
|
|
this.setData({
|
|
|
isRunning: false // 设置为未运行状态
|
|
|
});
|
|
|
- const pace = (this.data.distance / (this.data.totalSeconds / 3600)).toFixed(2); // 配速(km/h)
|
|
|
- this.setData({
|
|
|
- pace: pace
|
|
|
- });
|
|
|
},
|
|
|
formatTime: function (seconds) {
|
|
|
const hours = Math.floor(seconds / 3600);
|
|
@@ -534,9 +530,13 @@ Page({
|
|
|
|
|
|
// 计算卡路里
|
|
|
const calorie = this.getCalorie(60, totalDistance); // 假设体重为60kg
|
|
|
- console.log('总距离',totalDistance,'段距离',distance,'总卡路里',calorie);
|
|
|
+
|
|
|
+ const pace = parseFloat(Number((totalDistance / (this.data.totalSeconds / 3600)).toFixed(2))); // 配速(km/h)
|
|
|
+
|
|
|
+ console.log('总距离',totalDistance,'段距离',distance,'总卡路里',calorie,'配速',pace);
|
|
|
// 更新状态
|
|
|
this.setData({
|
|
|
+ pace,
|
|
|
distance: totalDistance,
|
|
|
calorie: calorie,
|
|
|
latitude: res.latitude,
|