diff --git a/.prettierignore b/.prettierignore index d0266ae..0cc4d0b 100644 --- a/.prettierignore +++ b/.prettierignore @@ -8,4 +8,5 @@ node_modules/ .swc .husky .prettierignore -.env.* \ No newline at end of file +.env.* +**/*.svg \ No newline at end of file diff --git a/src/assets/icons/MainPage/cross.svg b/src/assets/icons/MainPage/cross.svg new file mode 100644 index 0000000..35ab54d --- /dev/null +++ b/src/assets/icons/MainPage/cross.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/icons/MainPage/tick.svg b/src/assets/icons/MainPage/tick.svg new file mode 100644 index 0000000..e31ad61 --- /dev/null +++ b/src/assets/icons/MainPage/tick.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/pages/index/DutyInfo.tsx b/src/pages/index/DutyInfo.tsx index e33cf5b..4e3daac 100644 --- a/src/pages/index/DutyInfo.tsx +++ b/src/pages/index/DutyInfo.tsx @@ -1,6 +1,9 @@ import { Component, ReactNode } from 'react'; -import { View } from '@tarojs/components'; +import { View, Image } from '@tarojs/components'; +import { AtTimeline } from 'taro-ui'; import pt from '@/plain-text'; +import tick from '@/assets/icons/MainPage/tick.svg'; +import cross from '@/assets/icons/MainPage/cross.svg'; export class DutyData { constructor() { @@ -18,6 +21,45 @@ export class DutyData { dutyRecoverTime: string; // from backend } +class Card extends Component { + props = { + isInDuty: false, + }; + render(): ReactNode { + const inDuty = this.props.isInDuty; + const dc = pt.get().mainPage.dutyCard; + const title = inDuty ? dc.inDuty.title : dc.offDuty.title; + const iconsrc = inDuty ? tick : cross; + return ( + + + + + {title} + + + + ); + } +} + export class DutyInfo extends Component { props = { data: new DutyData(), @@ -28,9 +70,13 @@ export class DutyInfo extends Component { const od = pt.get().mainPage.dutyCard.offDuty; return ( - {od.title} - {od.reason(data.offDutyReason)} - {od.recoverTime(data.dutyRecoverTime)} + + ); } @@ -40,9 +86,13 @@ export class DutyInfo extends Component { const id = pt.get().mainPage.dutyCard.inDuty; return ( - {id.title} - {id.currentDutyText(data.currentDuty)} - {id.inDutyCnt(data.inDutyCnt)} + + ); } diff --git a/src/plain-text/MainPage.ts b/src/plain-text/MainPage.ts index 584b483..e804739 100644 --- a/src/plain-text/MainPage.ts +++ b/src/plain-text/MainPage.ts @@ -28,8 +28,8 @@ export interface MainPageText { } export const mainPageZhCn: MainPageText = { - mainTitleLine: '您好,这里是E志者协会。', - subTitleLine: '维修请移步`东三-204`实验室。', + mainTitleLine: '您好,这里是E志者协会', + subTitleLine: '维修请至【东三-204】实验室', cardTitle: { dutyInfo: '204值班情况', stepInfo: '维修步骤',