import React, { useState, useEffect } from 'react';
import { Col, Row, Button, Modal} from 'antd'
import ZmageImg from '../../../components/ZmageImg/ZmageImg'
import request from '../../../utils/request';
import apis from '../../../services/apis';
import { router } from 'umi';


function body (props) {
  const documentVerifyId = props.location.query.id
  const [data, setData] = useState([])

  useEffect(() => {
    getList()

  }, [])
// , documentVerifyId: documentVerifyId
  function getList (params) {
    // 网路请求
    console.log(props,'1111')
    request({ ...apis.system.documentVerifyDetail, urlData:{ id:documentVerifyId }  }).then(data => {
      console.log('data:', data.imgList)
      setData(data.imgList)
    }).catch(err => {
      // eslint-disable-next-line no-unused-expressions

    })
  }
  
  function onVerify (params) {

    alert(params)
    // 网路请求
    request({ ...apis.system.updateTaPolicy, urlData:{ id:documentVerifyId }, data:  {  verifyStatus: params}  }).then(data => {
    
    }).catch(err => {
      // eslint-disable-next-line no-unused-expressions

    })
  }



  const handleOk =  () => {
    Modal.confirm({
      title: '审核通过后，将给当前用户发放积分 确认审核通过？',
      okText: '确认',
      cancelText: '取消',
      onOk() {
       
        onVerify(2)
      }
    });
  }

  const cancelPage = () =>{
    router.push({
      pathname: '/system/document/list',
    });
  }

  return (
    <>
      <div style={{ background: '#ECECEC', padding: '30px' }}>
        <Row gutter={16}>
          {
            // data.consultant && data.consultant.projects.map((item, _) => <span>{item}</span>)
            data.map((data, inx) => 
              <Col span={6}>
               <ZmageImg style={{ width: '300px', height: '400px' }} src={data.img} />
              </Col>
            )
          }
        </Row>
      </div>
      <div style={{ marginTop: '10px', display: 'flex', justifyContent: 'center' }}>
        <Button type="primary" onClick={()=>handleOk()}>通过</Button>
        &nbsp;&nbsp;&nbsp;&nbsp;
        <Button onClick={()=>onVerify(2)}>不通过</Button>
        &nbsp;&nbsp;&nbsp;&nbsp;
        <Button onClick={cancelPage}>返回</Button>
        
      </div>
     
      
    </>
  )
}

export default body
