import{d as e,l as a,q as l,a6 as s,x as t,o as i,a as n,f as u,u as o,g as r,F as v,i as c,h as d,e as m,t as g,aO as w,aP as f,aA as p}from"./vendor-edc0678f.js";import{g as y}from"./content-3391292a.js";import{_ as h,a as k,f as _}from"./index-4c745ab9.js";const x={class:"news-page"},C={class:"news-list"},E=["onClick"],I={class:"news-item-info"},L={class:"news-item-title"},T={key:0,class:"news-item-time"},b={key:1,class:"news-item-summary"},j={key:0,class:"news-item-cover"},z=["src","alt"],D={key:2,class:"loading-more"},H={style:{"margin-left":"10px"}},N={key:3,class:"no-more"},O=h({__name:"news",setup(h){const O=e(),S=k(),q=a([]),A=a(!1),F=a(!1),P=a(1),Y=a(10),$=a(0),B=a(!0),G=async(e=!1)=>{if(B.value||!e){if(e){if(F.value)return;F.value=!0}else{if(A.value)return;A.value=!0}try{const e=await y({contentType:1,status:"0",languageId:S.language||"zh",pageNum:P.value,pageSize:Y.value});if(e&&200===e.code){const a=e.rows||[];$.value=e.total||0,1===P.value?q.value=a:q.value=[...q.value,...a],B.value=q.value.length<$.value}}catch(a){}finally{A.value=!1,F.value=!1}}},J=()=>{(window.pageYOffset||document.documentElement.scrollTop)+window.innerHeight>=document.documentElement.scrollHeight-100&&(!B.value||F.value||A.value||(P.value++,G(!0)))},K=e=>{if(!e)return"";return new Date(e).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})};return l(()=>{G(),window.addEventListener("scroll",J)}),s(()=>{window.removeEventListener("scroll",J)}),t(()=>S.language,()=>{P.value=1,B.value=!0,G()},{immediate:!1}),(e,a)=>{const l=w,s=f,t=p;return i(),n("div",x,[u(l,{title:o(_)("navbar_news"),"left-arrow":"",onClickLeft:a[0]||(a[0]=a=>e.$router.go(-1)),fixed:"",placeholder:""},null,8,["title"]),r("div",C,[(i(!0),n(v,null,c(q.value,e=>(i(),n("div",{key:e.id,class:"news-item",onClick:a=>{return l=e.id,void O.push("/content/news/".concat(l));var l}},[r("div",I,[r("div",L,g(e.title),1),e.publishTime?(i(),n("div",T,g(K(e.publishTime)),1)):m("",!0),e.summary?(i(),n("div",b,g(e.summary),1)):m("",!0)]),e.coverImage?(i(),n("div",j,[r("img",{src:e.coverImage,alt:e.title},null,8,z)])):m("",!0)],8,E))),128))]),0!==q.value.length||A.value?m("",!0):(i(),d(s,{key:0,description:o(_)("utils_noData")},null,8,["description"])),A.value?(i(),d(t,{key:1,class:"loading"})):m("",!0),F.value?(i(),n("div",D,[u(t),r("span",H,g(o(_)("loading")),1)])):m("",!0),!B.value&&q.value.length>0?(i(),n("div",N,g(o(_)("no_more_data")),1)):m("",!0)])}}},[["__scopeId","data-v-2e0a7ed2"]]);export{O as default};
