import React, { useEffect } from 'react';
import { message, Spin } from 'antd';
import { getURLInformation, isEmpty } from '@/utils/CommonUtils';
import { history } from 'umi';
const Loading: React.FC<{}> = () => {
    /**
     * 寻找商机中转页
     */

    useEffect(() => {
        //获取必要参数
        //项目编号
        const number = getURLInformation('ebpProjectNumber') === null ? '' : getURLInformation('ebpProjectNumber');
        //菜单类型
        const type = getURLInformation('type') === null ? '' : getURLInformation('type');
        if (isEmpty(type)) {
            message.error('缺少必要参数，请重试');
        } else {
            let params = {}
            isEmpty(number) ? null : params['number'] = number
            if (type == 'procurement_mode_1' || type == 'procurement_mode_2') {//招标类
                history.push({ pathname: '/Bid/FindBusiness', query: { ...params } });
            } else if (type == 'procurement_mode_5' || type == 'procurement_mode_6') {//谈判类
                history.push({ pathname: '/Negotiation/FindBusiness', query: { ...params } });
            } else if (type == 'procurement_mode_4') {//招募类
                history.push({ pathname: '/Recruit/FindBusiness', query: { ...params } });
            } else if (type == 'procurement_mode_3') {//比选类
                history.push({ pathname: '/Comparison/FindBusiness', query: { ...params } });
            } else {
                message.error('参数错误，请联系管理员');
            }
        }
    }, []);

    return (
        <div
            style={{
                textAlign: 'center',
                height: '100%',
                background: 'rgba(0,0,0,.05)',
                position: 'relative',
            }}
        >
            <div style={{ position: 'absolute', left: '50%', top: '48%' }}>
                <Spin tip="Loading..." />
            </div>
        </div>
    );
};
export default Loading;
