import React, { useEffect, useState } from 'react';
import { Descriptions } from 'antd';
import { coscoSupplier } from '../services'
import { useIntl } from 'umi';

const PersonalInfo: React.FC = () => {
  const intl = useIntl();
  const [registerInfo, setRegisterInfo] = useState<any>({ base: {} });

  const fetchData = async () => {
      const { code, data } = await coscoSupplier({}); 
      if (code === 200) {
          setRegisterInfo(data);
      }
  };
  // 个人信息
  useEffect(() => {
    fetchData()
  }, []);

  return (
    <div style={{ padding: '24px 24px 0 0' }}>
      <Descriptions bordered column={2} labelStyle={{ width: '120px' }}>
        <Descriptions.Item label={intl.formatMessage({ id: 'page.workbench.personal.name' })}>{registerInfo.base.name}</Descriptions.Item>
        <Descriptions.Item label={intl.formatMessage({ id: 'page.workbench.personal.gender' })}>{registerInfo.base.gender}</Descriptions.Item>
        <Descriptions.Item label={intl.formatMessage({ id: 'page.workbench.personal.phone' })}>{registerInfo.base.phone}</Descriptions.Item>
        <Descriptions.Item label={intl.formatMessage({ id: 'page.workbench.personal.email' })}>{registerInfo.base.email}</Descriptions.Item>
        <Descriptions.Item label={intl.formatMessage({ id: 'page.workbench.personal.department' })}>{registerInfo.base.department}</Descriptions.Item>
        <Descriptions.Item label={intl.formatMessage({ id: 'page.workbench.personal.position' })}>{registerInfo.base.position}</Descriptions.Item>
        <Descriptions.Item label={intl.formatMessage({ id: 'page.workbench.personal.entryDate' })}>{registerInfo.base.entryDate}</Descriptions.Item>
      </Descriptions>
    </div>
  );
};

export default PersonalInfo;