fix journal list sort
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
// components/journal-list/index.ts
|
||||
import config from "../../config/index";
|
||||
import { JournalPage, JournalPageType } from "../../types/Journal";
|
||||
import { OrderType } from "../../types/Model";
|
||||
import Time from "../../utils/Time";
|
||||
import Toolkit from "../../utils/Toolkit";
|
||||
|
||||
@ -58,7 +59,10 @@ Component<JournalListData, {}, {}, ComponentInstance>({
|
||||
page: {
|
||||
index: 0,
|
||||
size: 16,
|
||||
type: JournalPageType.PREVIEW
|
||||
type: JournalPageType.PREVIEW,
|
||||
orderMap: {
|
||||
createdAt: OrderType.DESC
|
||||
}
|
||||
},
|
||||
searchValue: ""
|
||||
},
|
||||
@ -111,7 +115,10 @@ Component<JournalListData, {}, {}, ComponentInstance>({
|
||||
size: 16,
|
||||
type: JournalPageType.PREVIEW,
|
||||
equalsExample,
|
||||
likeExample
|
||||
likeExample,
|
||||
orderMap: {
|
||||
createdAt: OrderType.DESC
|
||||
}
|
||||
},
|
||||
list: [],
|
||||
isFinished: false
|
||||
@ -137,7 +144,6 @@ Component<JournalListData, {}, {}, ComponentInstance>({
|
||||
return;
|
||||
}
|
||||
const result = list.map((journal: any) => {
|
||||
// 获取第一张缩略图
|
||||
const firstThumb = journal.items.find((item: any) => item.attachType === "THUMB");
|
||||
return {
|
||||
id: journal.id,
|
||||
@ -150,7 +156,13 @@ Component<JournalListData, {}, {}, ComponentInstance>({
|
||||
this.setData({
|
||||
page: {
|
||||
...this.data.page,
|
||||
index: this.data.page.index + 1
|
||||
index: this.data.page.index + 1,
|
||||
type: JournalPageType.PREVIEW,
|
||||
equalsExample: this.data.page.equalsExample,
|
||||
likeExample: this.data.page.likeExample,
|
||||
orderMap: {
|
||||
createdAt: OrderType.DESC
|
||||
}
|
||||
},
|
||||
list: this.data.list.concat(result),
|
||||
isFinished: list.length < this.data.page.size
|
||||
@ -210,7 +222,10 @@ Component<JournalListData, {}, {}, ComponentInstance>({
|
||||
size: 16,
|
||||
type: JournalPageType.PREVIEW,
|
||||
equalsExample,
|
||||
likeExample
|
||||
likeExample,
|
||||
orderMap: {
|
||||
createdAt: OrderType.DESC
|
||||
}
|
||||
},
|
||||
isFetching: false,
|
||||
isFinished: false
|
||||
|
||||
@ -4,6 +4,7 @@ import Time from "../../../utils/Time";
|
||||
import config from "../../../config/index"
|
||||
import Events from "../../../utils/Events";
|
||||
import { JournalPage, JournalPageType } from "../../../types/Journal";
|
||||
import { OrderType } from "../../../types/Model";
|
||||
|
||||
export type Journal = {
|
||||
date: string;
|
||||
@ -45,6 +46,9 @@ Page({
|
||||
type: JournalPageType.NORMAL,
|
||||
likeMap: {
|
||||
type: "NORMAL"
|
||||
},
|
||||
orderMap: {
|
||||
createdAt: OrderType.DESC
|
||||
}
|
||||
},
|
||||
list: [],
|
||||
@ -70,6 +74,9 @@ Page({
|
||||
type: JournalPageType.NORMAL,
|
||||
equalsExample: {
|
||||
type: "NORMAL"
|
||||
},
|
||||
orderMap: {
|
||||
createdAt: OrderType.DESC
|
||||
}
|
||||
},
|
||||
list: [],
|
||||
@ -174,6 +181,9 @@ Page({
|
||||
type: JournalPageType.NORMAL,
|
||||
equalsExample: {
|
||||
type: "NORMAL"
|
||||
},
|
||||
orderMap: {
|
||||
createdAt: OrderType.DESC
|
||||
}
|
||||
},
|
||||
list: this.data.list.concat(result),
|
||||
|
||||
Reference in New Issue
Block a user