import{r as t,j as s,aE as S,B as u,aY as k,y as v,t as x,C as g,v as T,I as E,ac as L,aH as R,aI as _,aZ as z,a as y}from"./index-s57B3ha7.js";const{Title:A,Text:P,Paragraph:j}=L,F=({params:o})=>{const[n,i]=t.useState([]),[c,e]=t.useState(0),[r,m]=t.useState(1),[w,l]=t.useState(!1),p=6,d=async()=>{l(!0);const a=await y.post("/literature",{...o,page_number:r,page_size:p});l(!1),i(a.data.items),e(a.data.total)},b=async()=>{l(!0),await y.post("/literature/import"),d(),l(!1)};return t.useEffect(()=>{d()},[r,JSON.stringify(o)]),s.jsxs(s.Fragment,{children:[s.jsxs(S,{justify:"flex-end",gap:"small",children:[s.jsx(u,{color:"cyan",variant:"solid",onClick:d,children:"刷新"}),s.jsx(k,{title:"Are you sure to import literature?",onConfirm:b,children:s.jsx(u,{color:"cyan",variant:"solid",children:"导入"})})]}),s.jsxs("div",{style:{maxWidth:"1000px",margin:"1rem auto"},children:[s.jsx(v,{spinning:w,children:s.jsx(x,{gutter:[16,16],children:n.map(a=>s.jsx(g,{span:24,children:s.jsx(T,{styles:{body:{padding:12}},hoverable:!0,style:{borderRadius:12},children:s.jsxs(x,{gutter:16,children:[a.img&&s.jsx(g,{span:6,children:a.img&&s.jsx(E,{src:a.img,alt:"literature",style:{width:"100%",objectFit:"cover",borderRadius:8}})}),s.jsxs(g,{span:a.img?18:24,children:[s.jsxs(A,{level:5,style:{marginBottom:4,marginTop:0},children:[s.jsx("span",{style:{display:"block",color:"gray",fontSize:"0.5rem"},children:a.literature_key}),"期刊 ",a.journal||"未知"," 时间 ",a.publish_date||"-",s.jsx("a",{href:a.url,target:"_blank",children:"来源"})]}),s.jsx(j,{style:{marginBottom:8},children:f(a.content||"",a.keywords||[])}),s.jsx(j,{children:f(a.translate||"",a.keywords||[])}),a.keywords&&Array.isArray(a.keywords)&&a.keywords.map((C,h)=>s.jsx(R,{color:_[h],children:C},h))]})]})})},a.id))})}),c!=0&&s.jsx("div",{style:{textAlign:"center",marginTop:24},children:s.jsx(z,{current:r,pageSize:p,total:c,onChange:a=>m(a),showSizeChanger:!1})})]})]})};function f(o,n){const i=n.map(e=>e.toLowerCase());return o.split(new RegExp(`(${n.join("|")})`,"gi")).map((e,r)=>i.includes(e.toLowerCase())?s.jsx("span",{style:{color:"red",fontWeight:600},children:e},r):e)}export{F as default};
