// import React from 'react'
import { useEffect } from 'react'
import { useNavigate } from 'react-router-dom'
import { useLocation } from 'react-router-dom'
import './detail.less'
import { GetDownloadUrl } from '../../request/api'
import {
  Button,
} from 'antd-mobile'
import pen from '@/static/images/Detail/pen.png'
import center from '@/static/images/Detail/center.png'
import file from '@/static/images/Detail/file.png'
export default function Detail() {
  const nav = useNavigate()
  const location = useLocation();
  const item = location.state;
  useEffect(() => {
    // 获取token
    let token = sessionStorage.getItem('token')
    if (!token) {
      nav('/login')
    }
    if (!item) {
      // 如果没有接收到item，可以导航回列表页或者显示错误信息
      nav('/list');

    }
    console.log(item);
    console.log(GetDownloadUrl( item.id));
    
  }, [])
  return (
    <div className='detailBox'>
      <div className='formBox'>
        <div className='useImg'></div>
        <div className='bookimg'></div>
        <div className='projName'>
          {item.projName}
        </div>
        <div className='peopleName'>
          产权所属者：{item.apply.authorName}
        </div>
        <div className='timeBox'>
          <div className='timeImg'>
          </div>
          <div>
            {item.apply.projDevCompleteDate}
          </div>
        </div>
        <div className='downBox'>
          <div className='done'>
            <div className='penImge'>
              <img src={pen} style={{ width: '100%', height: '100%' }} alt="" />
            </div>
            <div className='doneName'>申请表</div>
          </div>
          <div className='done'>
            <div className='centerImge'>
              <img src={center} style={{ width: '100%', height: '100%' }} alt="" />
            </div>
            <div className='doneName'>操作手册</div>
          </div>
          <div className='done'>
            <div className='fileImge'>
              <img src={file} style={{ width: '100%', height: '100%' }} alt="" />
            </div>
            <div className='doneName'>源代码</div>
          </div>
        </div>
        <div className='downAllBtn'>
          <div className='doneImg'></div>
          <div >全部</div>
        </div>
      </div>
      <Button className='detailBtn'
      >
        使用电脑端打开体验全部功能
      </Button>
    </div>
  )
}
