import{r as i,a2 as v,o as l,j as n,p as f}from"./index-C9R49v6m.js";import{S as g}from"./index-s4x2Se67.js";import{R as j}from"./EyeOutlined-BPx0C749.js";const w="_container_14lhb_1",b="_wrapper_14lhb_12",y="_mainWrapper_14lhb_16",C="_titleWrapper_14lhb_22",N="_title_14lhb_22",S="_titleText_14lhb_33",W="_viewCount_14lhb_37",T="_text_14lhb_46",r={container:w,wrapper:b,mainWrapper:y,titleWrapper:C,title:N,titleText:S,viewCount:W,text:T};function R(){const[e,d]=i.useState(),[a,h]=i.useState([]),[u,p]=i.useState(!1),c=v();i.useEffect(()=>{if(!c)return;const t=c.id;_(Number(t))},[c]);const _=async t=>{var m;p(!0);const o=await l.getDetial(t),s=await l.getVisits(String(t),"article");(m=s==null?void 0:s.data)!=null&&m.length&&(o.viewCount=s.data[0].num),o!=null&&o.file&&h(o.file),d(o),p(!1)},x=(t,o)=>{const s=document.createElement("a");document.body.appendChild(s),s.style="display: none",s.href=t,s.target="_blank",s.download=o,s.click(),window.URL.revokeObjectURL(t),document.body.removeChild(s)};return n.jsx("div",{className:r.container,style:{minHeight:"calc(100vh - 300px)"},children:n.jsx(g,{spinning:u,children:n.jsx("div",{className:r.wrapper,children:n.jsxs("div",{className:r.mainWrapper,children:[n.jsxs("div",{className:r.titleWrapper,children:[n.jsxs("div",{className:r.title,children:[n.jsx("div",{className:r.titleText,children:e==null?void 0:e.title}),n.jsxs("div",{className:r.viewCount,children:[n.jsx(j,{}),(e==null?void 0:e.viewCount)||0]})]}),n.jsxs("div",{className:r.text,children:[e!=null&&e.source?" 来源：".concat(e==null?void 0:e.source):"","   发布时间：",f((e==null?void 0:e.pub_time)||(e==null?void 0:e.createdAt)).format("YYYY-MM-DD")]})]}),n.jsx("div",{style:{color:"#666",fontSize:16,marginBottom:40,marginTop:40,lineHeight:"2em"},dangerouslySetInnerHTML:{__html:e!=null&&e.content?e==null?void 0:e.content:""}}),a!=null&&a.length&&e?n.jsx("div",{style:{marginBottom:40,fontSize:16,color:"var(--primary-color)"},children:a.map(t=>n.jsxs("div",{style:{cursor:"pointer"},onClick:()=>{x(l.getFileUrl(e.id,t.fileName),t==null?void 0:t.name)},children:["附件： ",t.name]}))}):""]})})})})}export{R as default};
