|
@@ -20,7 +20,7 @@ Component({
|
|
|
bottomNavHeight: 0,
|
|
|
contentHeight: 0,
|
|
|
contentpadding: 0,
|
|
|
- navheight:0,
|
|
|
+ navheight: 0,
|
|
|
|
|
|
rows: [{
|
|
|
image: 'https://file-cloud.fmode.cn/qpFbRRSZrO/20241225/r5j1uc041211788.png',
|
|
@@ -73,6 +73,13 @@ Component({
|
|
|
sharList: [],
|
|
|
|
|
|
address: "",
|
|
|
+
|
|
|
+ todayList: [],
|
|
|
+ changetitle: 'today',
|
|
|
+
|
|
|
+ isclick:false,
|
|
|
+
|
|
|
+ rank:'up'
|
|
|
},
|
|
|
lifetimes: {
|
|
|
|
|
@@ -91,10 +98,10 @@ Component({
|
|
|
|
|
|
const contentpadding = (statusBarHeight + customHeight) * 750 / systemInfo.windowWidth;
|
|
|
const contentHeight = (screenHeight - bottomNavHeight - 50 - statusBarHeight - customHeight) * 750 / systemInfo.windowWidth;
|
|
|
- const navheight = (statusBarHeight+customHeight) * 750 / systemInfo.windowWidth;
|
|
|
+ const navheight = (statusBarHeight + customHeight) * 750 / systemInfo.windowWidth;
|
|
|
this.setData({
|
|
|
statusBarHeight,
|
|
|
- screenHeight:(screenHeight-50-bottomNavHeight) * 750 / systemInfo.windowWidth,
|
|
|
+ screenHeight: (screenHeight - 50 - bottomNavHeight) * 750 / systemInfo.windowWidth,
|
|
|
customHeight,
|
|
|
bottomNavHeight,
|
|
|
contentHeight,
|
|
@@ -105,8 +112,8 @@ Component({
|
|
|
this.getWeRunData()
|
|
|
this.gettarget()
|
|
|
|
|
|
- this.Getlocation()
|
|
|
-
|
|
|
+ this.Getlocation()
|
|
|
+ this.gettoday()
|
|
|
},
|
|
|
},
|
|
|
|
|
@@ -212,7 +219,7 @@ Component({
|
|
|
success: (ops) => {
|
|
|
console.log(ops);
|
|
|
|
|
|
- const address = ops.data.result.addressComponent.city;
|
|
|
+ const address = ops.data.result.addressComponent.city;
|
|
|
this.setData({
|
|
|
address: address,
|
|
|
});
|
|
@@ -345,6 +352,119 @@ Component({
|
|
|
console.error("保存数据时出现错误:", error);
|
|
|
}
|
|
|
}
|
|
|
+ },
|
|
|
+
|
|
|
+ change() {
|
|
|
+
|
|
|
+ const titles = ['today', 'weekdday', 'month'];
|
|
|
+ const currentIndex = titles.indexOf(this.data.changetitle);
|
|
|
+ const nextIndex = (currentIndex + 1) % titles.length;
|
|
|
+ this.setData({
|
|
|
+ changetitle: titles[nextIndex]
|
|
|
+ });
|
|
|
+ if (this.data.changetitle == 'today') {
|
|
|
+ this.setData({
|
|
|
+ rank:'up'
|
|
|
+ })
|
|
|
+ this.gettoday()
|
|
|
+ }
|
|
|
+ if (this.data.changetitle == 'weekdday') {
|
|
|
+ this.setData({
|
|
|
+ rank:'up'
|
|
|
+ })
|
|
|
+ console.log('weekdday');
|
|
|
+ }
|
|
|
+ if (this.data.changetitle == 'month') {
|
|
|
+ this.setData({
|
|
|
+ rank:'up'
|
|
|
+ })
|
|
|
+ console.log('month');
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ async gettoday() {
|
|
|
+ const currentUser = Parse.User.current();
|
|
|
+ let ActivityDataquery = new Parse.Query('ActivityData');
|
|
|
+ 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);
|
|
|
+ console.log(todayStart, todayEnd);
|
|
|
+
|
|
|
+ ActivityDataquery.greaterThanOrEqualTo('createdAt', todayStart);
|
|
|
+ ActivityDataquery.lessThanOrEqualTo('createdAt', todayEnd);
|
|
|
+
|
|
|
+
|
|
|
+ ActivityDataquery.descending('steps');
|
|
|
+ ActivityDataquery.include('user');
|
|
|
+
|
|
|
+ try {
|
|
|
+ let P = await ActivityDataquery.find();
|
|
|
+ let todayList = P.map(item => item.toJSON());
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ this.setData({
|
|
|
+ todayList,
|
|
|
+ });
|
|
|
+
|
|
|
+ console.log(this.data.todayList);
|
|
|
+ } catch (error) {
|
|
|
+ console.error('Error fetching today\'s data:', error);
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ changeup(){
|
|
|
+ if(this.data.rank=='up'){
|
|
|
+ this.setData({
|
|
|
+ rank:'down'
|
|
|
+ })
|
|
|
+ if (this.data.changetitle == 'today') {
|
|
|
+ this.setData({
|
|
|
+ todayList:this.data.todayList.reverse(),
|
|
|
+ })
|
|
|
+ console.log('逆序');
|
|
|
+ }
|
|
|
+ if (this.data.changetitle == 'weekdday') {
|
|
|
+ console.log('weekdday逆序');
|
|
|
+ }
|
|
|
+ if (this.data.changetitle == 'month') {
|
|
|
+ console.log('month逆序');
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.setData({
|
|
|
+ rank:'up'
|
|
|
+ })
|
|
|
+ if (this.data.changetitle == 'today') {
|
|
|
+ this.setData({
|
|
|
+ todayList:this.data.todayList.reverse(),
|
|
|
+ })
|
|
|
+ console.log('顺序');
|
|
|
+ }
|
|
|
+ if (this.data.changetitle == 'weekdday') {
|
|
|
+ console.log('weekdday顺序');
|
|
|
+ }
|
|
|
+ if (this.data.changetitle == 'month') {
|
|
|
+ console.log('month顺序');
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
})
|