import { Component, ReactNode } from 'react'; 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() { this.isInDuty = false; this.inDutyCnt = 3; this.currentDuty = '2'; this.offDutyReason = '学园维修'; this.dutyRecoverTime = '下周一'; } isInDuty: boolean; inDutyCnt?: number; currentDuty?: 'off' | '1' | '2' | '3'; offDutyReason?: string; dutyRecoverTime?: string; } 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(), }; offDutyContent(): ReactNode { const data = this.props.data; const od = pt.get().mainPage.dutyCard.offDuty; return ( ); } inDutyContent(): ReactNode { const data = this.props.data; const id = pt.get().mainPage.dutyCard.inDuty; return ( ); } render(): ReactNode { if (this.props.data.isInDuty) { return this.inDutyContent(); } else { return this.offDutyContent(); } } }