dsdq
This commit is contained in:
parent
4491ed5548
commit
4d2f74c0e1
@ -33,22 +33,23 @@ Page({
|
||||
page: 1,
|
||||
page_size: 30,
|
||||
})
|
||||
const today = new Date()
|
||||
today.setHours(0, 0, 0, 0)
|
||||
const list = res.list.map(item => {
|
||||
const startDate = new Date(item.start_date)
|
||||
const endDate = new Date(item.end_date)
|
||||
const today = new Date();
|
||||
const todayDate = new Date(today.getFullYear(), today.getMonth(), today.getDate());
|
||||
|
||||
if (today > endDate) {
|
||||
item.status = '已结束'
|
||||
} else if (today < startDate) {
|
||||
item.status = '未开始'
|
||||
} else if (today >= startDate && today <= endDate) {
|
||||
item.status = '进行中'
|
||||
const list = res.list.map(item => {
|
||||
const startDate = new Date(item.start_date + 'T00:00:00'); // 将时间设置为午夜
|
||||
const endDate = new Date(item.end_date + 'T00:00:00'); // 将时间设置为午夜
|
||||
if (todayDate > endDate) {
|
||||
item.status = '已结束';
|
||||
} else if (todayDate < startDate) {
|
||||
item.status = '未开始';
|
||||
} else {
|
||||
item.status = '进行中';
|
||||
}
|
||||
item.detail = JSON.parse(item.detail)
|
||||
return item
|
||||
})
|
||||
|
||||
item.detail = JSON.parse(item.detail);
|
||||
return item;
|
||||
});
|
||||
this.setData({
|
||||
list: list
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user