PageSourceSearch

https://nickz.ai/assets/js/Focus-CFel6QPj.js

js nickz.ai collected 2026-10-05 14:20:53 UTC 4,881 bytes, 1 lines download raw bytes

1import{u as e,i as s,r as a,j as t,L as r}from"./vendor-react-DejgYtBM.js";import{u as i,Y as l,A as n,s as c,v as o,w as d}from"./index-BeIIFw6E.js";import{B as x,l as m,E as h,I as g,b as p,f as j,O as u}from"./vendor-semi-D8d7bTtM.js";import{A as f,r as y}from"./articleUtils-CS9XG6di.js";import{J as b,N as v,O as w,A as N,E as k,Q as z}from"./vendor-icons-EJvJ5X-w.js";import"./vendor-motion-Chfy_MiU.js";import"./marked.esm-B28mcIGu.js";import"./purify.es-Bm-lHtoJ.js";import"./vendor-highlight-CaHTjBxz.js";const{Title:S}=j,C=()=>{const{t:j}=i(),C=e(),{articleId:I}=s(),[_,E]=a.useState([]),[$,A]=a.useState(null),[M,T]=a.useState(!0),[L,O]=a.useState(1);a.useEffect(()=>{(async()=>{T(!0);try{const e=await n.get("/api/news?size=100"),{success:s,data:a,message:t}=e.data;s?E(a||[]):c(t||j("加载文章失败"))}catch(e){c(e.message||j("加载文章失败"))}finally{T(!1)}})()},[]),a.useEffect(()=>{if(!_.length)return;const e=I?parseInt(I,10):NaN;if(!Number.isFinite(e))return;const s=_.find(s=>s.id===e);s&&A(s)},[I,_]);const P=!!$,Y=Math.ceil(_.length/10),B=_.slice(10*(L-1),10*L);return t.jsx("div",{className:"px-4 py-8",children:t.jsxs("div",{className:"w-full max-w-7xl mx-auto",children:[P?t.jsxs("div",{className:"mb-6 flex items-center justify-between gap-4",children:[t.jsx(x,{theme:"borderless",icon:t.jsx(b,{size:16}),onClick:()=>{A(null),C("/news/focus",{replace:!0})},className:"!text-gray-500 hover:!text-blue-600",children:j("返回列表")}),t.jsx(x,{size:"small",theme:"light",icon:t.jsx(v,{size:14}),onClick:async()=>{if(!$?.id)return;const e=`${window.location.origin}/news/${$.id}`;await o(e)?d(j("已复制")):c(j("复制失败"))},children:j("复制链接")})]}):t.jsx("div",{className:"max-w-3xl mx-auto mb-3 flex justify-end",children:t.jsx(r,{to:"/news",children:t.jsx(x,{theme:"light",size:"large",icon:t.jsx(w,{size:18}),className:"!px-5 !font-medium !shadow-sm hover:!shadow-md",children:j("展示模式")})})}),M?t.jsx("div",{className:"flex justify-center items-center py-20",children:t.jsx(m,{size:"large"})}):0===_.length?t.jsx(h,{image:t.jsx(p,{style:{width:200,height:200}}),darkModeImage:t.jsx(g,{style:{width:200,height:200}}),title:j("暂无文章"),description:j("还没有发布任何文章"),className:"py-20"}):P?t.jsxs("div",{className:"max-w-3xl mx-auto",children:[t.jsx(S,{heading:3,className:"!mb-4",children:$.title}),t.jsxs("div",{className:"flex flex-wrap items-center gap-4 mb-6 pb-4 border-b border-gray-100 dark:border-gray-700",children:[t.jsxs("span",{className:"flex items-center gap-1.5 text-sm text-gray-400",children:[t.jsx(N,{size:14}),l($.created_at)]}),t.jsxs("span",{className:"flex items-center gap-1.5 text-sm text-gray-400",children:[t.jsx(k,{size:14}),$.views," ",j("次浏览")]})]}),t.jsx("div",{className:f,dangerouslySetInnerHTML:{__html:y($.content||"")}})]}):t.jsxs("div",{className:"max-w-3xl mx-auto",children:[t.jsx("div",{className:"space-y-3",children:B.map(e=>{const s=function(e="",s=120){const a=e.replace(/```[\s\S]*?```/g,"").replace(/`[^`]*`/g,"").replace(/!\[[^\]]*\]\([^)]*\)/g,"").replace(/\[[^\]]*\]\([^)]*\)/g,"$1").replace(/<[^>]+>/g,"").replace(/#{1,6}\s/g,"").replace(/[*_~>]/g,"").replace(/\s+/g," ").trim();return a.length>s?a.slice(0,s)+"…":a}(e.content);return t.jsx("div",{onClick:()=>(e=>{A(e),C(`/news/focus/${e.id}`,{replace:!0})})(e),className:"group bg-white dark:bg-gray-800 rounded-2xl px-6 py-5 cursor-pointer\n                      shadow-sm hover:shadow-md transition-all border border-gray-100 dark:border-gray-700\n                      hover:border-blue-200 dark:hover:border-blue-700",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-gray-100\n                          group-hover:text-blue-600 dark:group-hover:text-blue-400\n                          transition-colors leading-snug mb-2 line-clamp-2",children:e.title}),s&&t.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 leading-relaxed line-clamp-2 mb-3",children:s}),t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsxs("span",{className:"flex items-center gap-1 text-xs text-gray-400",children:[t.jsx(N,{size:12}),l(e.created_at).split(" ")[0]]}),t.jsxs("span",{className:"flex items-center gap-1 text-xs text-gray-400",children:[t.jsx(k,{size:12}),e.views," ",j("次浏览")]})]})]}),t.jsx(z,{size:18,className:"text-gray-300 group-hover:text-blue-400 dark:text-gray-600\n                          dark:group-hover:text-blue-500 flex-shrink-0 mt-1 transition-colors"})]})},e.id)})}),Y>1&&t.jsx("div",{className:"mt-6 flex justify-center",children:t.jsx(u,{total:_.length,pageSize:10,
1currentPage:L,onPageChange:e=>{O(e),window.scrollTo({top:0,behavior:"smooth"})},showSizeChanger:!1})})]})]})})};export{C as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.