|
|
@@ -7,11 +7,12 @@ import React, { Component } from 'react'
|
|
|
import { connect } from 'react-redux'
|
|
|
import CurrencyListItem
|
|
|
from '../../../components/common/currencyListItem/CurrencyListItem'
|
|
|
-import { SearchBar, PullToRefresh, ListView } from 'antd-mobile'
|
|
|
+import { SearchBar, PullToRefresh, ListView, Drawer } from 'antd-mobile'
|
|
|
import './currency-list.less'
|
|
|
import UasIcon from '../../../configs/iconfont.conig'
|
|
|
import LoadingMore from '../../../components/common/loading/LoadingMore'
|
|
|
import ReactDOM from 'react-dom'
|
|
|
+import { Prompt } from 'react-router-dom'
|
|
|
|
|
|
const currencyArray = [
|
|
|
[{}, {}, {}, {}, {}, {}],
|
|
|
@@ -48,6 +49,7 @@ class CurrencyList extends Component {
|
|
|
this.setState({
|
|
|
height: hei,
|
|
|
refreshing: false,
|
|
|
+ filterOpen: false,
|
|
|
listDataSource: this.state.listDataSource.cloneWithRows(
|
|
|
currencyArray),
|
|
|
})
|
|
|
@@ -58,23 +60,30 @@ class CurrencyList extends Component {
|
|
|
}
|
|
|
|
|
|
render () {
|
|
|
- const { listDataSource, height, hasNextPage } = this.state
|
|
|
+ const { listDataSource, height, hasNextPage, filterOpen } = this.state
|
|
|
|
|
|
const refreshLayout = this.getRefreshLayout()
|
|
|
- const listItems = []
|
|
|
- currencyArray.forEach((parentItem, parentIndex) => {
|
|
|
- listItems.push(<CurrencyListItem rowList={parentItem}/>)
|
|
|
- })
|
|
|
+ const filterLayout = this.getFilterLayout()
|
|
|
return (
|
|
|
<div className='currency-list-root'>
|
|
|
+ <Prompt message={this.handlePrompt}/>
|
|
|
+ <Drawer
|
|
|
+ sidebar={filterLayout}
|
|
|
+ onOpenChange={this.onFilterOpen}
|
|
|
+ open={filterOpen}
|
|
|
+ position={'right'}
|
|
|
+ className='currency-list-content-filter-root'
|
|
|
+ />
|
|
|
<div className='currency-list-search-root'>
|
|
|
<SearchBar
|
|
|
className='currency-list-search-search'
|
|
|
placeholder={'搜索'}
|
|
|
/>
|
|
|
+
|
|
|
<UasIcon
|
|
|
className='currency-list-search-filter'
|
|
|
- type={'uas-search-filter'}/>
|
|
|
+ type={'uas-search-filter'}
|
|
|
+ onClick={this.onFilterOpen}/>
|
|
|
</div>
|
|
|
<ListView
|
|
|
ref={el => this.lv = el}
|
|
|
@@ -96,9 +105,6 @@ class CurrencyList extends Component {
|
|
|
onEndReached={hasNextPage ? this.loadDataList : null}
|
|
|
pageSize={mPageSize}
|
|
|
/>
|
|
|
- <div className='currency-list-content-root'>
|
|
|
- {listItems}
|
|
|
- </div>
|
|
|
<UasIcon
|
|
|
type={'uas-add-doc'}
|
|
|
className='com-hover-button'
|
|
|
@@ -122,6 +128,13 @@ class CurrencyList extends Component {
|
|
|
/>
|
|
|
}
|
|
|
|
|
|
+ getFilterLayout = () => {
|
|
|
+ return (
|
|
|
+ <div
|
|
|
+ className='currency-list-content-filter-content'>筛选条件</div>
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
loadDataList = () => {
|
|
|
this.setState({
|
|
|
refreshing: false,
|
|
|
@@ -133,6 +146,23 @@ class CurrencyList extends Component {
|
|
|
onItemClick = () => {
|
|
|
this.props.history.push('/currencyDetail')
|
|
|
}
|
|
|
+
|
|
|
+ onFilterOpen = () => {
|
|
|
+ this.setState({
|
|
|
+ filterOpen: !this.state.filterOpen,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ handlePrompt = (location) => {
|
|
|
+ if (this.state.filterOpen) {
|
|
|
+ this.setState({
|
|
|
+ filterOpen: !this.state.filterOpen,
|
|
|
+ })
|
|
|
+ return false
|
|
|
+ } else {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
let mapStateToProps = (state) => ({})
|