Authored by 邱骏

活动改为按id倒序排列

... ... @@ -18,9 +18,13 @@ class ActDailyCheckInModel extends global.yoho.BaseModel {
let length = await this.client.llenAsync(TABLE_NAME);
return this.client.lrangeAsync(TABLE_NAME, 0, length - 1).then(acts => {
return acts.filter(act => act).map(act => {
return JSON.parse(act);
let finalResult = [];
acts.filter(act => act).map(act => {
finalResult.unshift(JSON.parse(act)); // 向前插入,使数组倒序
});
return finalResult;
});
}
... ...
... ... @@ -33,7 +33,7 @@ class DailyCheckInModel extends global.yoho.BaseModel {
};
}
if (idx) {
if (idx || idx === 0) {
return this.client.lrangeAsync(TABLE_NAME, idx, idx).then(act => {
return JSON.parse(act[0]);
});
... ...
... ... @@ -13,6 +13,12 @@
return {
columns1: [
{
title: 'ID',
key: 'id',
align: 'center',
width: 80
},
{
title: '活动ID',
key: 'encryptedId',
align: 'center'
... ... @@ -25,7 +31,7 @@
{
title: '开始时间',
key: 'startTime',
width: 200,
width: 180,
align: 'center',
render: (h, {row}) => {
return h('span', {}, moment(row.startTime * 1000).format('YYYY-MM-DD'));
... ... @@ -34,7 +40,7 @@
{
title: '结束时间',
key: 'endTime',
width: 200,
width: 180,
align: 'center',
render: (h, {row}) => {
return h('span', {}, moment(row.endTime * 1000).format('YYYY-MM-DD'));
... ... @@ -143,4 +149,8 @@
margin-bottom: 10px;
}
th .ivu-table-cell {
padding: 0
}
</style>
... ...