import {
    inject,
    observer
} from 'mobx-react';
import {Authority, Top} from '../../public/valhalla/components/index';

@inject("sensitiveSettingStore")
@observer
export default class Setting extends React.Component {
    componentWillReceiveProps(nextProps) {
        if (this.props.location.key !== nextProps.location.key) {
            this.init()
        }
    }
    componentDidMount() {
        this.init()
    }
    init = () => {
       const{sensitiveSettingStore:{init}} = this.props;
        init();  
    }
    render() {
        const { sensitiveSettingStore: { authorityStore, topStore,formStore:{form},searchGroupProps,comProps } } = this.props;
        return (
            <Authority store={authorityStore}>
                <Top store={topStore}>
                    <div style={{margin:'0 25%'}}>
                        {form.render(searchGroupProps,comProps)}
                    </div>
                </Top>
            </Authority>
        );
    }
}