import{r as a,j as s,F as b,B as u,P as k,R as x,C as p,i as v,l as T,E,a as y}from"./main-BzPVmAp-.js";import{c as P}from"./utils-D2B0dIuM.js";import{S as R,P as L}from"./index-BZ6Sq__j.js";import{C as _}from"./index-7u0Bo8e4.js";import{I as z}from"./index-CUuSmggi.js";import"./index-SGIbgpRk.js";import"./Dropdown-Clv_Pvnt.js";import"./addEventListener-CzbSevz3.js";const{Title:A,Text:O,Paragraph:j}=v,$=({params:o})=>{const[n,c]=a.useState([]),[i,e]=a.useState(0),[t,f]=a.useState(1),[w,l]=a.useState(!1),g=6,d=async()=>{l(!0);const r=await y.post("/literature",{...o,page_number:t,page_size:g});l(!1),c(r.data.items),e(r.data.total)},C=async()=>{l(!0),await y.post("/literature/import"),d(),l(!1)};return a.useEffect(()=>{d()},[t,JSON.stringify(o)]),s.jsxs(s.Fragment,{children:[s.jsxs(b,{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:C,children:s.jsx(u,{color:"cyan",variant:"solid",children:"导入"})})]}),s.jsxs("div",{style:{maxWidth:"1000px",margin:"1rem auto"},children:[s.jsx(R,{spinning:w,children:i!=0?s.jsx(x,{gutter:[16,16],children:n.map(r=>s.jsx(p,{span:24,children:s.jsx(_,{styles:{body:{padding:12}},hoverable:!0,style:{borderRadius:12},children:s.jsxs(x,{gutter:16,children:[r.img&&s.jsx(p,{span:6,children:r.img&&s.jsx(z,{src:r.img,alt:"literature",style:{width:"100%",objectFit:"cover",borderRadius:8}})}),s.jsxs(p,{span:r.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:r.literature_key}),"期刊 ",r.journal||"未知"," 时间 ",r.publish_date||"-",s.jsx("a",{href:r.url,target:"_blank",children:"来源"})]}),s.jsx(j,{style:{marginBottom:8},children:m(r.content||"",r.keywords||[])}),s.jsx(j,{children:m(r.translate||"",r.keywords||[])}),r.keywords&&Array.isArray(r.keywords)&&r.keywords.map((S,h)=>s.jsx(T,{color:P[h],children:S},h))]})]})})},r.id))}):s.jsx(E,{description:"暂无相关资料!"})}),i!=0&&s.jsx("div",{style:{textAlign:"center",marginTop:24},children:s.jsx(L,{current:t,pageSize:g,total:i,onChange:r=>f(r),showSizeChanger:!1})})]})]})};function m(o,n){const c=n.map(e=>e.toLowerCase());return o.split(new RegExp(`(${n.join("|")})`,"gi")).map((e,t)=>c.includes(e.toLowerCase())?s.jsx("span",{style:{color:"red",fontWeight:600},children:e},t):e)}export{$ as default};
