You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.3 KiB
45 lines
1.3 KiB
import React, { useEffect, useState } from 'react'
|
|
import Left from './left'
|
|
import Right from './right'
|
|
import { connect } from 'react-redux'
|
|
import { getdaolutongji } from '../../../actions/example'
|
|
import { getHighways, getRoadMaintenances } from './action'
|
|
|
|
|
|
const Conserve = (props) => {
|
|
|
|
const [roadData, setRoadData] = useState()
|
|
const [highwaysData, setHighwaysData] = useState()
|
|
const [roadMaintenances, setRoadMaintenances] = useState()
|
|
|
|
const [loading, setLoading] = useState(true)
|
|
const { dispatch } = props
|
|
useEffect(() => {
|
|
dispatch(getdaolutongji()).then(res => {
|
|
setLoading(false)
|
|
setRoadData(res.payload.data || {})
|
|
})
|
|
dispatch(getHighways()).then(res =>{
|
|
setHighwaysData(res.payload.data || [])
|
|
})
|
|
dispatch(getRoadMaintenances()).then(res =>{
|
|
setRoadMaintenances(res.payload.data || [])
|
|
})
|
|
}, [])
|
|
|
|
return (
|
|
<div style={{ display: 'flex', width: '100%', height: '100%', justifyContent: 'space-between' }}>
|
|
<Left roadData={roadData} loading={loading} />
|
|
<Right highwaysData={highwaysData} roadMaintenances={roadMaintenances}/>
|
|
</div>
|
|
)
|
|
}
|
|
function mapStateToProps(state) {
|
|
|
|
// const { auth } = state;
|
|
|
|
return {
|
|
|
|
}
|
|
}
|
|
export default connect(mapStateToProps)(Conserve)
|