|
@@ -96,7 +96,7 @@ Page({
|
|
|
async order() {
|
|
|
const currentUser = Parse.User.current();
|
|
|
let ActivityDataquery = new Parse.Query('ActivityData');
|
|
|
- ActivityDataquery.equalTo('user', currentUser.id);
|
|
|
+ // ActivityDataquery.equalTo('user', currentUser.id);
|
|
|
ActivityDataquery.equalTo('company', company);
|
|
|
ActivityDataquery.equalTo('type', 'today');
|
|
|
ActivityDataquery.notEqualTo('isDeleted', true);
|
|
@@ -112,8 +112,11 @@ Page({
|
|
|
ActivityDataquery.lessThanOrEqualTo('createdAt', todayEnd);
|
|
|
ActivityDataquery.include('user');
|
|
|
|
|
|
+ // 根据 steps 字段进行降序排序
|
|
|
+ ActivityDataquery.descending('steps');
|
|
|
+
|
|
|
let r = await ActivityDataquery.find();
|
|
|
- let sharList = r.map(item => {
|
|
|
+ let todayList = r.map(item => {
|
|
|
let itemData = item.toJSON();
|
|
|
// 获取当前时间并格式化
|
|
|
const now = new Date();
|
|
@@ -121,6 +124,15 @@ Page({
|
|
|
itemData.currentTime = formattedTime; // 将当前时间添加到 item 中
|
|
|
return itemData;
|
|
|
});
|
|
|
+ let sharList=[]
|
|
|
+ todayList.forEach((item, index) => {
|
|
|
+ if (item.user.objectId == currentUser.id) {
|
|
|
+ sharList.push({
|
|
|
+ ...item, // 包含用户数据
|
|
|
+ rank: index + 1 // 计算排名(index 从 0 开始,所以加 1)
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
|
|
|
this.setData({
|
|
|
sharList
|