|
@@ -1,4 +1,6 @@
|
|
// nova-werun/pages/home/share/index.js
|
|
// nova-werun/pages/home/share/index.js
|
|
|
|
+const Parse = getApp().Parse;
|
|
|
|
+const company = getApp().globalData.company;
|
|
Page({
|
|
Page({
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -13,6 +15,8 @@ Page({
|
|
contentHeight: 0, // 可用内容高度
|
|
contentHeight: 0, // 可用内容高度
|
|
contentHeight2: 0,
|
|
contentHeight2: 0,
|
|
contentpadding: 0, //顶部padding高度
|
|
contentpadding: 0, //顶部padding高度
|
|
|
|
+
|
|
|
|
+ sharList: [],
|
|
},
|
|
},
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -37,6 +41,7 @@ Page({
|
|
contentpadding,
|
|
contentpadding,
|
|
contentHeight
|
|
contentHeight
|
|
});
|
|
});
|
|
|
|
+ this.order()
|
|
},
|
|
},
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -87,5 +92,39 @@ Page({
|
|
onShareAppMessage: function () {
|
|
onShareAppMessage: function () {
|
|
|
|
|
|
},
|
|
},
|
|
-
|
|
|
|
|
|
+ //获取当天运动数据
|
|
|
|
+ async order() {
|
|
|
|
+ const currentUser = Parse.User.current();
|
|
|
|
+ let ActivityDataquery = new Parse.Query('ActivityData');
|
|
|
|
+ ActivityDataquery.equalTo('user', currentUser.id);
|
|
|
|
+ ActivityDataquery.equalTo('company', company);
|
|
|
|
+ ActivityDataquery.equalTo('type', 'today');
|
|
|
|
+ ActivityDataquery.notEqualTo('isDeleted', true);
|
|
|
|
+
|
|
|
|
+ // 获取今天的日期
|
|
|
|
+ const today = new Date();
|
|
|
|
+ const todayStart = new Date(today.getFullYear(), today.getMonth(), today.getDate()); // 今天的开始时间
|
|
|
|
+ const todayEnd = new Date(todayStart);
|
|
|
|
+ todayEnd.setHours(23, 59, 59, 999); // 今天的结束时间
|
|
|
|
+
|
|
|
|
+ // 在查询条件中添加对 createdAt 的限制
|
|
|
|
+ ActivityDataquery.greaterThanOrEqualTo('createdAt', todayStart);
|
|
|
|
+ ActivityDataquery.lessThanOrEqualTo('createdAt', todayEnd);
|
|
|
|
+ ActivityDataquery.include('user');
|
|
|
|
+
|
|
|
|
+ let r = await ActivityDataquery.find();
|
|
|
|
+ let sharList = r.map(item => {
|
|
|
|
+ let itemData = item.toJSON();
|
|
|
|
+ // 获取当前时间并格式化
|
|
|
|
+ const now = new Date();
|
|
|
|
+ const formattedTime = `${now.getFullYear()}/${String(now.getMonth() + 1).padStart(2, '0')}/${String(now.getDate()).padStart(2, '0')} ${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}`;
|
|
|
|
+ itemData.currentTime = formattedTime; // 将当前时间添加到 item 中
|
|
|
|
+ return itemData;
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ this.setData({
|
|
|
|
+ sharList
|
|
|
|
+ });
|
|
|
|
+ console.log(this.data.sharList);
|
|
|
|
+ },
|
|
})
|
|
})
|