import React, { useState, useEffect,useRef} from 'react';
import { Input ,Tabs,Table,Result, Button} from 'antd';
const { TabPane } = Tabs;

import {connect,history} from 'umi';


import { RA } from '@/utils/method';
const module="User"
const ResultPage = (props:any) => {

  const { dispatch, Data } = props;
  const formRef = useRef(null)

  const [resultTime, setResultTime] = useState(3);

  function loop(i:number) {
    if (i < 4) {
      console.log(i)

      setResultTime(4-i)
      setTimeout(function(){loop(++i)},1000)
    } else {
      setResultTime(0)
      history.go(-1)
    }
  }
 

  useEffect(()=>{    
    loop(1)
  },[])
  const backPage = () => {
    
  }
  return (
    <div style={{ width: "100%", minWidth: 1020, padding: 34, backgroundColor: "#ffffff" }}> 
            <Result
          status="success"
          title="Successfully submit the file!"
          subTitle={<p>server has been handled it ,Wait for <strong>{resultTime}</strong> seconds to return automatically.</p>}
          extra={[
            <Button type="primary" key="ok" onClick={backPage}>Ok</Button>, <Button key="back" onClick={backPage}>Back</Button>
          ]}
        />  
    </div>
  );
};

function map(state:any) {
  const { Data} = state[module]
  return { Data}
}
export default connect(map)(ResultPage);