import React, { useState, useEffect } from 'react';
import styles from './index.less';
import { Input ,Menu,Table,Space,Pagination,Tooltip, Button,Form,Upload } from 'antd';

import { Link, useIntl, connect, Dispatch } from 'umi';

import Line from '../../components/Line/Line';
import BackButton from '../../components/BackButton/BackButton';
import TitleGet from '../../components/TitleGet/TitleGet';
import TableShow from '../../components/TableShow/TableShow';

import { getCookie } from '@/utils/method';
import PictureOptions from '@/components/PictureOptions/PictureOptions';

const Guard = (props:any) => {

  const { dispatch, CommunityList,token} = props;
  const tosCommunityget = (values: any) => { dispatch({ type: 'Init/tosCommunityget', playload: values }) };  
  const [page, setPage] = useState({ token: "" })
  
  useEffect(() => {
    tosCommunityget(null)
    setPage({ token: getCookie("token") });
  }, []); 

  const onFinish = (values:any) => {
    console.log(values)
  }
  const uploadButton = (
    <div>
      <div className="ant-upload-text">Upload</div>
    </div>
  );
  return (
    <div className={styles.base}>
    
        <TitleGet title={"Version 1.2.4"} />
        <p>
          token:{page.token}
          name:{getCookie("name")}
          phone:{getCookie("phone")}
        </p>
      {
      /* <Form name="basic" onFinish={onFinish}>
        <Form.Item name="">
        <PictureOptions               
                  data={{
                    userToken: token,
                    imageType: 'categoriesImageName',
                    extends: "extend",
                      }} />
      </Form.Item>
      <Form.Item ><Button type="primary" htmlType="submit">Submit</Button></Form.Item>
      </Form> */
      }

      {/* <TableShow /> */}
      {/* <div>{token}</div>
      <Line /> */}
      
    </div>
  );
};

function mapStateToProps(state:any) {
  const { CommunityList } = state.Init;  
  const { token } = state.login;  
  return {
    CommunityList,
    token
  };
}

export default connect(mapStateToProps)(Guard);
