import React, { Component } from 'react'
import { Card } from 'antd'
import Container from 'components/container'
import { api } from 'common/api'
import ReactJson from 'react-json-view'

export default class detail extends Component {
    state = {
        loading: false,
        record: null,
    }

    componentDidMount() {
        // 获取详细数据
        const { id } = this.props.param
        if (id) {
            api.houseQueryDetail({ id }).then(({ data }) => {
                this.setState({
                    record: data,
                    loading: false,
                })
            })
        }
    }

    render() {
        return (
            <Container>
                <Card>
                    <ReactJson src={this.state.record} />
                </Card>
            </Container>
        )
    }
}
