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