update Page obj
This commit is contained in:
@ -3,6 +3,7 @@
|
|||||||
import Time from "../../../utils/Time";
|
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 { QueryPage } from "../../../types/Model";
|
||||||
|
|
||||||
export type Journal = {
|
export type Journal = {
|
||||||
date: string;
|
date: string;
|
||||||
@ -24,12 +25,7 @@ export enum JournalItemType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface JournalData {
|
interface JournalData {
|
||||||
page: {
|
page: QueryPage;
|
||||||
index: number;
|
|
||||||
size: number;
|
|
||||||
type: string;
|
|
||||||
orderMap?: object;
|
|
||||||
}
|
|
||||||
list: Journal[];
|
list: Journal[];
|
||||||
dateFilterMin: number;
|
dateFilterMin: number;
|
||||||
dateFilterMax: number;
|
dateFilterMax: number;
|
||||||
@ -46,9 +42,8 @@ Page({
|
|||||||
page: {
|
page: {
|
||||||
index: 0,
|
index: 0,
|
||||||
size: 8,
|
size: 8,
|
||||||
type: "NORMAL",
|
likeMap: {
|
||||||
orderMap: {
|
type: "NORMAL"
|
||||||
createdAt: "DESC"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
list: [],
|
list: [],
|
||||||
@ -71,9 +66,8 @@ Page({
|
|||||||
page: {
|
page: {
|
||||||
index: 0,
|
index: 0,
|
||||||
size: 8,
|
size: 8,
|
||||||
type: "NORMAL",
|
likeMap: {
|
||||||
orderMap: {
|
type: "NORMAL"
|
||||||
createdAt: "DESC"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
list: [],
|
list: [],
|
||||||
@ -181,9 +175,8 @@ Page({
|
|||||||
page: {
|
page: {
|
||||||
index: this.data.page.index + 1,
|
index: this.data.page.index + 1,
|
||||||
size: 8,
|
size: 8,
|
||||||
type: "NORMAL",
|
likeMap: {
|
||||||
orderMap: {
|
type: "NORMAL"
|
||||||
createdAt: "DESC"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
list: this.data.list.concat(result),
|
list: this.data.list.concat(result),
|
||||||
|
|||||||
@ -1,17 +1,13 @@
|
|||||||
// pages/main/portfolio/index.ts
|
// pages/main/portfolio/index.ts
|
||||||
|
|
||||||
import config from "../../../config/index";
|
import config from "../../../config/index";
|
||||||
|
import { QueryPage } from "../../../types/Model";
|
||||||
import Events from "../../../utils/Events";
|
import Events from "../../../utils/Events";
|
||||||
import Time from "../../../utils/Time";
|
import Time from "../../../utils/Time";
|
||||||
import { Journal, JournalItemType } from "../journal/index";
|
import { Journal, JournalItemType } from "../journal/index";
|
||||||
|
|
||||||
interface IPortfolioData {
|
interface IPortfolioData {
|
||||||
page: {
|
page: QueryPage;
|
||||||
index: number;
|
|
||||||
size: number;
|
|
||||||
type: string;
|
|
||||||
orderMap?: object;
|
|
||||||
}
|
|
||||||
list: Journal[];
|
list: Journal[];
|
||||||
isFetching: boolean;
|
isFetching: boolean;
|
||||||
isFinished: boolean;
|
isFinished: boolean;
|
||||||
@ -23,9 +19,8 @@ Page({
|
|||||||
page: {
|
page: {
|
||||||
index: 0,
|
index: 0,
|
||||||
size: 8,
|
size: 8,
|
||||||
type: "PORTFOLIO",
|
likeMap: {
|
||||||
orderMap: {
|
type: "PORTFOLIO"
|
||||||
createdAt: "DESC"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
list: [],
|
list: [],
|
||||||
@ -39,9 +34,8 @@ Page({
|
|||||||
page: {
|
page: {
|
||||||
index: 0,
|
index: 0,
|
||||||
size: 8,
|
size: 8,
|
||||||
type: "PORTFOLIO",
|
likeMap: {
|
||||||
orderMap: {
|
type: "PORTFOLIO"
|
||||||
createdAt: "DESC"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
list: [],
|
list: [],
|
||||||
@ -111,9 +105,8 @@ Page({
|
|||||||
page: {
|
page: {
|
||||||
index: this.data.page.index + 1,
|
index: this.data.page.index + 1,
|
||||||
size: 8,
|
size: 8,
|
||||||
type: "PORTFOLIO",
|
likeMap: {
|
||||||
orderMap: {
|
type: "PORTFOLIO"
|
||||||
createdAt: "DESC"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
list: this.data.list.concat(result),
|
list: this.data.list.concat(result),
|
||||||
|
|||||||
43
miniprogram/types/Model.ts
Normal file
43
miniprogram/types/Model.ts
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
// 基本实体模型
|
||||||
|
export type Model = {
|
||||||
|
id?: number;
|
||||||
|
|
||||||
|
createdAt?: number;
|
||||||
|
updatedAt?: number;
|
||||||
|
deletedAt?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Response = {
|
||||||
|
code: number;
|
||||||
|
msg?: string;
|
||||||
|
data: object;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type QueryPage = {
|
||||||
|
index: number;
|
||||||
|
size: number;
|
||||||
|
orderMap?: { [key: string]: OrderType };
|
||||||
|
likeMap?: { [key: string]: string | undefined | null };
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum OrderType {
|
||||||
|
ASC = "ASC",
|
||||||
|
DESC = "DESC"
|
||||||
|
}
|
||||||
|
|
||||||
|
export type QueryPageResult<T> = {
|
||||||
|
total: number;
|
||||||
|
list: T[];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 携带验证码的请求体
|
||||||
|
export type CaptchaData<T> = {
|
||||||
|
from: string;
|
||||||
|
captcha: string;
|
||||||
|
data: T;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type KeyValue<T> = {
|
||||||
|
key: string;
|
||||||
|
value: T;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user