From db11f03bdaa9eb9d2d4a829a675c031ceaaebc2f Mon Sep 17 00:00:00 2001 From: Dawn_Ocean <1785590531@qq.com> Date: Tue, 19 Mar 2024 22:46:42 +0800 Subject: [PATCH] add place in mainpage --- mock/api.ts | 2 +- src/pages/index/DutyInfo.tsx | 10 +++++++--- src/plain-text/MainPage.ts | 2 +- src/service/dutyInfo.ts | 3 +++ 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/mock/api.ts b/mock/api.ts index 77106c3..7a7bf9a 100644 --- a/mock/api.ts +++ b/mock/api.ts @@ -10,7 +10,7 @@ export default { isInDuty: true, inDutyCnt: 3, currentDuty: '2', - place: '东三-204', + place: '204', }, }, 'GET /user/info': { diff --git a/src/pages/index/DutyInfo.tsx b/src/pages/index/DutyInfo.tsx index 74626a7..c44a2f6 100644 --- a/src/pages/index/DutyInfo.tsx +++ b/src/pages/index/DutyInfo.tsx @@ -12,6 +12,7 @@ export class DutyData { this.currentDuty = '2'; this.offDutyReason = '学园维修'; this.dutyRecoverTime = '下周一'; + this.place = '东三-204'; } isInDuty: boolean; @@ -19,14 +20,17 @@ export class DutyData { currentDuty?: 'off' | '1' | '2' | '3'; offDutyReason?: string; dutyRecoverTime?: string; + place: string; } class Card extends Component { props = { isInDuty: false, + place: '东三-204', }; render(): ReactNode { const inDuty = this.props.isInDuty; + const place = this.props.place; const dc = pt.get().mainPage.dutyCard; const title = inDuty ? dc.inDuty.title : dc.offDuty.title; const iconsrc = inDuty ? tick : cross; @@ -53,7 +57,7 @@ class Card extends Component { fontWeight: 'bold', }} > - {title} + {'[' + place + '] ' + title} @@ -71,7 +75,7 @@ export class DutyInfo extends Component { const od = pt.get().mainPage.dutyCard.offDuty; return ( - + - +