import React from 'react';
// eslint-disable-next-line no-unused-vars
import { Tabs, Badge, ListView, SearchBar } from 'antd-mobile-v2';
import 'antd-mobile-v2/dist/antd-mobile.css';
// import ExamineMobile from './ExamineMobile';
import commonConfig from '../../utils/config';
import * as commonUtils from '../../utils/utils';
import CommobileBase from '../../mobile/common/CommobileBase';
import CommobileListEvent from './CommobileListEvent';
import styles from '../../routes/mobile/IndexMobile.less';
import NewsMobile from './NewsMobile';
// eslint-disable-next-line no-unused-vars
// import ExamineMobile from './ExamineMobile';
// import CommobileBill from './CommobileBill';
const dataSource = new ListView.DataSource({
rowHasChanged: (row1, row2) => row2,
});
// eslint-disable-next-line no-unused-vars
const tabs = [
{ title: 消息 },
{ title: 待处理 },
{ title: 已处理 },
{ title: 我的申请 },
];
class MessageMobile extends React.Component {
constructor(props) {
super(props);
this.state = {
height: (document.documentElement.clientHeight * 3) / 4,
tabPage: 0,
};
}
componentWillMount() {
/* 获取配置 */
this.props.onSaveState({ searchSolution: [] });
}
onEndReached = async () => {
if ((this.props.slavePagination.current + 1) <= Math.ceil(this.props.slavePagination.total / commonConfig.pageSize)) {
const addState = await this.props.onGetData(this.props.slaveConfig, [], this.props.slavePagination.current + 1, true);
addState.slaveData = this.props.slaveData.concat(addState.slaveData);
this.props.onSaveState({ ...addState });
}
}
onClose = key => () => {
this.setState({
[key]: false,
});
}
/* 页签切换 */
// eslint-disable-next-line no-unused-vars
handleTabClick =(index, tab) => {
this.setState({ tabPage: index });
}
render() {
const { slaveConfig, slaveData: slaveDataOld } = this.props;
const { tabPage } = this.state;
const slaveDataOld2 = slaveDataOld === undefined ? [] : slaveDataOld;
const slaveData = dataSource.cloneWithRows(slaveDataOld2);
const f1 = commonUtils.isEmptyObject(slaveConfig) ? {} : slaveConfig.gdsconfigformslave.filter(item => item.bVisible)[0];
const f2 = commonUtils.isEmptyObject(slaveConfig) ? {} : slaveConfig.gdsconfigformslave.filter(item => item.bVisible)[1];
const f3 = commonUtils.isEmptyObject(slaveConfig) ? {} : slaveConfig.gdsconfigformslave.filter(item => item.bVisible)[2];
const f4 = commonUtils.isEmptyObject(slaveConfig) ? {} : slaveConfig.gdsconfigformslave.filter(item => item.bVisible)[3];
const separator = (sectionID, rowID) => (
);
const row = (rowData, sectionID, rowID) => {
const obj = rowData;
return (
{obj[f1.sName]}
{obj[f2.sName]}
{/*

*/}
{obj[f3.sName]}
{obj[f4.sName]}
);
};
/* 待处理 */
const unNewsProps = {
app: {
...this.props.app,
},
sModelsId: '192116812112116672655865440',
dispatch: this.props.dispatch,
};
/* 已通过 */
const doneNewsProps = {
app: {
...this.props.app,
},
sModelsId: '192116812112116672668106810',
dispatch: this.props.dispatch,
};
/* 我的申请 */
const sendNewsProps = {
app: {
...this.props.app,
},
sModelsId: '192116812112116672733801250',
dispatch: this.props.dispatch,
};
// eslint-disable-next-line no-unused-vars
const examineProps = {
app: {
...this.props.app,
},
sModelsId: '192116812112116672690047620',
sModelType: 'examine',
dispatch: this.props.dispatch,
};
return (
this.handleTabClick(index, tab)}
onTabClick={(tab, index) => { console.log('onTabClick', index, tab); }}
>
{
tabPage === 0 ?
(
{this.props.isLoading ? 'Loading...' : 'Loaded'}
)}
renderRow={row}
renderSeparator={separator}
style={{
height: this.state.height,
overflow: 'auto',
}}
pageSize={commonConfig.pageSize}
onScroll={() => {}}
scrollRenderAheadDistance={500}
onEndReached={this.onEndReached}
onEndReachedThreshold={10}
/>
: '' }
{tabPage === 1 ?
: ''}
{tabPage === 2 ?
: ''}
{tabPage === 3 ?
: ''}
{/* */}
{/*
*/}
{/*
( */}
{/* */}
{/* {this.props.isLoading ? 'Loading...' : 'Loaded'} */}
{/*
)} */}
{/* renderRow={row} */}
{/* renderSeparator={separator} */}
{/* style={{ */}
{/* height: this.state.height, */}
{/* overflow: 'auto', */}
{/* }} */}
{/* pageSize={commonConfig.pageSize} */}
{/* onScroll={() => {}} */}
{/* scrollRenderAheadDistance={500} */}
{/* onEndReached={this.onEndReached} */}
{/* onEndReachedThreshold={10} */}
{/* /> */}
{/* */}
{/*
*/}
{/*
( */}
{/* */}
{/* {this.props.isLoading ? 'Loading...' : 'Loaded'} */}
{/*
)} */}
{/* renderRow={row} */}
{/* renderSeparator={separator} */}
{/* style={{ */}
{/* height: this.state.height, */}
{/* overflow: 'auto', */}
{/* }} */}
{/* pageSize={commonConfig.pageSize} */}
{/* onScroll={() => {}} */}
{/* scrollRenderAheadDistance={500} */}
{/* onEndReached={this.onEndReached} */}
{/* onEndReachedThreshold={10} */}
{/* /> */}
{/* */}
);
}
}
export default CommobileBase(CommobileListEvent(MessageMobile));