diff --git a/miniprogram/components/journal-list/index.ts b/miniprogram/components/journal-list/index.ts index 338ade4..622395b 100644 --- a/miniprogram/components/journal-list/index.ts +++ b/miniprogram/components/journal-list/index.ts @@ -1,5 +1,6 @@ // components/journal-list/index.ts import config from "../../config/index"; +import { JournalPage, JournalPageType } from "../../types/Journal"; import Time from "../../utils/Time"; export type JournalListItem = { @@ -14,11 +15,7 @@ interface JournalListData { list: JournalListItem[]; isFetching: boolean; isFinished: boolean; - page: { - index: number; - size: number; - type?: string; - }; + page: JournalPage; } Component({ @@ -45,8 +42,8 @@ Component({ isFinished: false, page: { index: 0, - size: 20, - type: undefined + size: 16, + type: JournalPageType.PREVIEW } }, observers: { @@ -55,12 +52,12 @@ Component({ this.fetch(); } }, - 'type': function(type: string) { + 'type': function() { this.setData({ page: { index: 0, - size: 20, - type + size: 16, + type: JournalPageType.PREVIEW }, list: [], isFinished: false diff --git a/miniprogram/pages/index/index.ts b/miniprogram/pages/index/index.ts index 4fa6d4f..d3c782d 100644 --- a/miniprogram/pages/index/index.ts +++ b/miniprogram/pages/index/index.ts @@ -1,6 +1,7 @@ // index.ts import config from "../../config/index" +import { JournalPage, JournalPageType } from "../../types/Journal"; interface IndexData { key: string; @@ -25,9 +26,10 @@ Page({ header: { Key: this.data.key }, - data: { + data: { index: 0, - size: 1 + size: 1, + type: JournalPageType.PREVIEW }, success: (resp) => { const data = resp.data as any; @@ -36,8 +38,10 @@ Page({ wx.switchTab({ url: "/pages/main/journal/index", }) - } else { + } else if (data.code === 40100) { wx.showToast({ title: "密码错误", icon: "error" }); + } else { + wx.showToast({ title: "服务异常", icon: "error" }); } }, fail: () => wx.showToast({ title: "验证失败", icon: "error" }) diff --git a/miniprogram/pages/main/journal/index.ts b/miniprogram/pages/main/journal/index.ts index 44226e0..4ed079b 100644 --- a/miniprogram/pages/main/journal/index.ts +++ b/miniprogram/pages/main/journal/index.ts @@ -3,7 +3,7 @@ import Time from "../../../utils/Time"; import config from "../../../config/index" import Events from "../../../utils/Events"; -import { QueryPage } from "../../../types/Model"; +import { JournalPage, JournalPageType } from "../../../types/Journal"; export type Journal = { date: string; @@ -25,7 +25,7 @@ export enum JournalItemType { } interface JournalData { - page: QueryPage; + page: JournalPage; list: Journal[]; dateFilterMin: number; dateFilterMax: number; @@ -42,6 +42,7 @@ Page({ page: { index: 0, size: 8, + type: JournalPageType.NORMAL, likeMap: { type: "NORMAL" } @@ -66,7 +67,8 @@ Page({ page: { index: 0, size: 8, - likeMap: { + type: JournalPageType.NORMAL, + equealsExample: { type: "NORMAL" } }, @@ -175,7 +177,8 @@ Page({ page: { index: this.data.page.index + 1, size: 8, - likeMap: { + type: JournalPageType.NORMAL, + equealsExample: { type: "NORMAL" } }, diff --git a/miniprogram/types/Journal.ts b/miniprogram/types/Journal.ts new file mode 100644 index 0000000..541a46e --- /dev/null +++ b/miniprogram/types/Journal.ts @@ -0,0 +1,11 @@ +import { QueryPage } from "./Model"; + +export type JournalPage = { + type: JournalPageType; +} & QueryPage; + +export enum JournalPageType { + + NORMAL = "NORMAL", + PREVIEW = "PREVIEW" +} \ No newline at end of file diff --git a/miniprogram/types/Model.ts b/miniprogram/types/Model.ts index a032ef1..ef4c8f9 100644 --- a/miniprogram/types/Model.ts +++ b/miniprogram/types/Model.ts @@ -17,7 +17,8 @@ export type QueryPage = { index: number; size: number; 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 {