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'; import clock from '@/assets/icons/MemberPage/clock.svg'; import wechatUser from '@/wechat'; export class DutyData { constructor() { this.isInDuty = false; this.inDutyCnt = 3; this.currentDuty = '2'; this.otherDutyTime = '9:30-11:30'; this.offDutyReason = '学园维修'; this.dutyRecoverTime = '下周一'; this.place = '东三-204'; } isInDuty: boolean; inDutyCnt?: number; currentDuty?: 'off' | '1' | '2' | '3' | 'others'; otherDutyTime?: string; 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 : wechatUser.getAccess() ? clock : cross; return ( {'[' + place + '] ' + title} ); } } export class DutyInfo extends Component { state: { isLoading: false; isDisable: false; }; 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(); } } }