forgeplus-react/src/forge/Information/Pages/sourceDetail.jsx

71 lines
2.1 KiB
JavaScript

import React , { useEffect , useState } from 'react';
import { Breadcrumb } from 'antd';
import SourceFile from '../img/sourceFile.png';
import RenderHtml from '../../../components/render-html';
import { getSourceDetail } from '../api';
import { Link } from 'react-router-dom';
import axios from 'axios';
function SourceDetail(props){
const { deptId , sourceid } = props.match.params;
const [ detail , setDetail ] = useState(undefined);
useEffect(()=>{
if(sourceid){
getDetails();
}
},[sourceid])
function getDetails(){
getSourceDetail(sourceid).then(response=>{
if(response){
setDetail(response.data.data);
}
}).catch(error=>{})
}
return(
<div className="boxmain"style={{paddingBottom:"40px"}}>
<Breadcrumb separator=">" style={{paddingTop:"20px"}}>
<Breadcrumb.Item><Link className="primaryColor" to={`/zone/${deptId}/source`}>资源列表</Link></Breadcrumb.Item>
<Breadcrumb.Item>详情页</Breadcrumb.Item>
</Breadcrumb>
{
detail &&
<div className="source_detail_box">
<div className="s_d_title">{detail.name}</div>
{
detail.fileList && detail.fileList.length > 0 &&
<ul className="files_box">
{
detail.fileList.map((i,k)=>{
return(
<li>
<img src={SourceFile} alt="" width="20px" className="mr12"/>
<span className="task-hide">{i.fileOriginName}</span>
<span>{i.fileSizeInfo}</span>
<a href={`/file/open/download/${i.fileId}`} download className="f_b_load primaryColor">下载</a>
</li>
)
})
}
</ul>
}
{ detail.introduction &&
<div style={{padding:"20px 0px"}}>
<RenderHtml
className="source_detail imageLayerParent"
value={detail.introduction}
url={props.history.location}
/>
</div>
}
</div>
}
</div>
)
}
export default SourceDetail;