update Page obj
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
// 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 Time from "../../utils/Time";
|
import Time from "../../utils/Time";
|
||||||
|
|
||||||
export type JournalListItem = {
|
export type JournalListItem = {
|
||||||
@ -14,11 +15,7 @@ interface JournalListData {
|
|||||||
list: JournalListItem[];
|
list: JournalListItem[];
|
||||||
isFetching: boolean;
|
isFetching: boolean;
|
||||||
isFinished: boolean;
|
isFinished: boolean;
|
||||||
page: {
|
page: JournalPage;
|
||||||
index: number;
|
|
||||||
size: number;
|
|
||||||
type?: string;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Component({
|
Component({
|
||||||
@ -45,8 +42,8 @@ Component({
|
|||||||
isFinished: false,
|
isFinished: false,
|
||||||
page: {
|
page: {
|
||||||
index: 0,
|
index: 0,
|
||||||
size: 20,
|
size: 16,
|
||||||
type: undefined
|
type: JournalPageType.PREVIEW
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
observers: {
|
observers: {
|
||||||
@ -55,12 +52,12 @@ Component({
|
|||||||
this.fetch();
|
this.fetch();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'type': function(type: string) {
|
'type': function() {
|
||||||
this.setData({
|
this.setData({
|
||||||
page: {
|
page: {
|
||||||
index: 0,
|
index: 0,
|
||||||
size: 20,
|
size: 16,
|
||||||
type
|
type: JournalPageType.PREVIEW
|
||||||
},
|
},
|
||||||
list: [],
|
list: [],
|
||||||
isFinished: false
|
isFinished: false
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
// index.ts
|
// index.ts
|
||||||
|
|
||||||
import config from "../../config/index"
|
import config from "../../config/index"
|
||||||
|
import { JournalPage, JournalPageType } from "../../types/Journal";
|
||||||
|
|
||||||
interface IndexData {
|
interface IndexData {
|
||||||
key: string;
|
key: string;
|
||||||
@ -25,9 +26,10 @@ Page({
|
|||||||
header: {
|
header: {
|
||||||
Key: this.data.key
|
Key: this.data.key
|
||||||
},
|
},
|
||||||
data: {
|
data: <JournalPage> {
|
||||||
index: 0,
|
index: 0,
|
||||||
size: 1
|
size: 1,
|
||||||
|
type: JournalPageType.PREVIEW
|
||||||
},
|
},
|
||||||
success: (resp) => {
|
success: (resp) => {
|
||||||
const data = resp.data as any;
|
const data = resp.data as any;
|
||||||
@ -36,8 +38,10 @@ Page({
|
|||||||
wx.switchTab({
|
wx.switchTab({
|
||||||
url: "/pages/main/journal/index",
|
url: "/pages/main/journal/index",
|
||||||
})
|
})
|
||||||
} else {
|
} else if (data.code === 40100) {
|
||||||
wx.showToast({ title: "密码错误", icon: "error" });
|
wx.showToast({ title: "密码错误", icon: "error" });
|
||||||
|
} else {
|
||||||
|
wx.showToast({ title: "服务异常", icon: "error" });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fail: () => wx.showToast({ title: "验证失败", icon: "error" })
|
fail: () => wx.showToast({ title: "验证失败", icon: "error" })
|
||||||
|
|||||||
@ -3,7 +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";
|
import { JournalPage, JournalPageType } from "../../../types/Journal";
|
||||||
|
|
||||||
export type Journal = {
|
export type Journal = {
|
||||||
date: string;
|
date: string;
|
||||||
@ -25,7 +25,7 @@ export enum JournalItemType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface JournalData {
|
interface JournalData {
|
||||||
page: QueryPage;
|
page: JournalPage;
|
||||||
list: Journal[];
|
list: Journal[];
|
||||||
dateFilterMin: number;
|
dateFilterMin: number;
|
||||||
dateFilterMax: number;
|
dateFilterMax: number;
|
||||||
@ -42,6 +42,7 @@ Page({
|
|||||||
page: {
|
page: {
|
||||||
index: 0,
|
index: 0,
|
||||||
size: 8,
|
size: 8,
|
||||||
|
type: JournalPageType.NORMAL,
|
||||||
likeMap: {
|
likeMap: {
|
||||||
type: "NORMAL"
|
type: "NORMAL"
|
||||||
}
|
}
|
||||||
@ -66,7 +67,8 @@ Page({
|
|||||||
page: {
|
page: {
|
||||||
index: 0,
|
index: 0,
|
||||||
size: 8,
|
size: 8,
|
||||||
likeMap: {
|
type: JournalPageType.NORMAL,
|
||||||
|
equealsExample: {
|
||||||
type: "NORMAL"
|
type: "NORMAL"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -175,7 +177,8 @@ Page({
|
|||||||
page: {
|
page: {
|
||||||
index: this.data.page.index + 1,
|
index: this.data.page.index + 1,
|
||||||
size: 8,
|
size: 8,
|
||||||
likeMap: {
|
type: JournalPageType.NORMAL,
|
||||||
|
equealsExample: {
|
||||||
type: "NORMAL"
|
type: "NORMAL"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
11
miniprogram/types/Journal.ts
Normal file
11
miniprogram/types/Journal.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import { QueryPage } from "./Model";
|
||||||
|
|
||||||
|
export type JournalPage = {
|
||||||
|
type: JournalPageType;
|
||||||
|
} & QueryPage;
|
||||||
|
|
||||||
|
export enum JournalPageType {
|
||||||
|
|
||||||
|
NORMAL = "NORMAL",
|
||||||
|
PREVIEW = "PREVIEW"
|
||||||
|
}
|
||||||
@ -17,7 +17,8 @@ export type QueryPage = {
|
|||||||
index: number;
|
index: number;
|
||||||
size: number;
|
size: number;
|
||||||
orderMap?: { [key: string]: OrderType };
|
orderMap?: { [key: string]: OrderType };
|
||||||
likeMap?: { [key: string]: string | undefined | null };
|
equealsExample?: { [key: string]: string | undefined | null };
|
||||||
|
likeExample?: { [key: string]: string | undefined | null };
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum OrderType {
|
export enum OrderType {
|
||||||
|
|||||||
Reference in New Issue
Block a user