refactor: split ExpandItem from Mainpage
parent
4d6eca0434
commit
097f6832e3
|
|
@ -0,0 +1,3 @@
|
||||||
|
export default {
|
||||||
|
component: true,
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
import { View } from '@tarojs/components';
|
||||||
|
import { Component, ReactNode } from 'react';
|
||||||
|
import { AtAccordion } from 'taro-ui';
|
||||||
|
|
||||||
|
export class ExpandItem extends Component {
|
||||||
|
state = {
|
||||||
|
open: false,
|
||||||
|
};
|
||||||
|
props = {
|
||||||
|
title: '',
|
||||||
|
content: <View></View>,
|
||||||
|
};
|
||||||
|
|
||||||
|
handleClick(value: boolean) {
|
||||||
|
this.setState({ open: value });
|
||||||
|
}
|
||||||
|
|
||||||
|
render(): ReactNode {
|
||||||
|
return (
|
||||||
|
<View>
|
||||||
|
<AtAccordion
|
||||||
|
open={this.state.open}
|
||||||
|
onClick={this.handleClick.bind(this)}
|
||||||
|
title={this.props.title}
|
||||||
|
>
|
||||||
|
{this.props.content}
|
||||||
|
</AtAccordion>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -3,7 +3,6 @@ import { Component, ReactNode } from 'react';
|
||||||
import Taro from '@tarojs/taro';
|
import Taro from '@tarojs/taro';
|
||||||
import {
|
import {
|
||||||
AtCard,
|
AtCard,
|
||||||
AtAccordion,
|
|
||||||
AtInputNumber,
|
AtInputNumber,
|
||||||
AtButton,
|
AtButton,
|
||||||
AtList,
|
AtList,
|
||||||
|
|
@ -23,6 +22,7 @@ import { getMemberDutyInfo } from '@/service/memberDutyInfo';
|
||||||
import { getUncompletedTicketList } from '@/service/uncompletedTicket';
|
import { getUncompletedTicketList } from '@/service/uncompletedTicket';
|
||||||
import { changeDutyCnt } from '@/service/changeDutyCount';
|
import { changeDutyCnt } from '@/service/changeDutyCount';
|
||||||
import { TicketListItem } from '@/components/TicketListItem/TicketListItem';
|
import { TicketListItem } from '@/components/TicketListItem/TicketListItem';
|
||||||
|
import { ExpandItem } from '@/components/ExpandItem/ExpandItem';
|
||||||
import './index.scss';
|
import './index.scss';
|
||||||
import TitleCard from './TitleCard';
|
import TitleCard from './TitleCard';
|
||||||
import { DutyInfo, DutyData } from './DutyInfo';
|
import { DutyInfo, DutyData } from './DutyInfo';
|
||||||
|
|
@ -47,34 +47,6 @@ function mainPageCard(c: CardContent): JSX.Element {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class ExpandItem extends Component {
|
|
||||||
state = {
|
|
||||||
open: false,
|
|
||||||
};
|
|
||||||
props = {
|
|
||||||
title: '',
|
|
||||||
content: <View></View>,
|
|
||||||
};
|
|
||||||
|
|
||||||
handleClick(value: boolean) {
|
|
||||||
this.setState({ open: value });
|
|
||||||
}
|
|
||||||
|
|
||||||
render(): ReactNode {
|
|
||||||
return (
|
|
||||||
<View>
|
|
||||||
<AtAccordion
|
|
||||||
open={this.state.open}
|
|
||||||
onClick={this.handleClick.bind(this)}
|
|
||||||
title={this.props.title}
|
|
||||||
>
|
|
||||||
{this.props.content}
|
|
||||||
</AtAccordion>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface MainPageState {
|
interface MainPageState {
|
||||||
fixList: Array<TicketListItem>;
|
fixList: Array<TicketListItem>;
|
||||||
rs: RequestState;
|
rs: RequestState;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue