import{d as e,l as a,q as t,a6 as l,x as i,o as s,a as u,f as o,u as n,g as r,F as v,i as c,h as d,e as m,t as g,aO as f,aP as p,aA as y}from"./vendor-edc0678f.js";import{g as h}from"./content-3391292a.js";import{_ as w,a as k,f as _}from"./index-4c745ab9.js";const x={class:"tutorial-page"},C={class:"tutorial-list"},E=["onClick"],I={class:"tutorial-item-info"},L={class:"tutorial-item-title"},T={key:0,class:"tutorial-item-time"},b={key:1,class:"tutorial-item-summary"},j={key:0,class:"tutorial-item-cover"},z=["src","alt"],D={key:2,class:"loading-more"},H={style:{"margin-left":"10px"}},N={key:3,class:"no-more"},O=w({__name:"tutorial",setup(w){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 h({contentType:2,status:"0",languageId:S.language||"en",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 t(()=>{G(),window.addEventListener("scroll",J)}),l(()=>{window.removeEventListener("scroll",J)}),i(()=>S.language,()=>{P.value=1,B.value=!0,G()},{immediate:!1}),(e,a)=>{const t=f,l=p,i=y;return s(),u("div",x,[o(t,{title:n(_)("navbar_tutorial"),"left-arrow":"",onClickLeft:a[0]||(a[0]=a=>e.$router.go(-1)),fixed:"",placeholder:""},null,8,["title"]),r("div",C,[(s(!0),u(v,null,c(q.value,e=>(s(),u("div",{key:e.id,class:"tutorial-item",onClick:a=>{return t=e.id,void O.push("/content/tutorial/".concat(t));var t}},[r("div",I,[r("div",L,g(e.title),1),e.publishTime?(s(),u("div",T,g(K(e.publishTime)),1)):m("",!0),e.summary?(s(),u("div",b,g(e.summary),1)):m("",!0)]),e.coverImage?(s(),u("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):(s(),d(l,{key:0,description:n(_)("utils_noData")},null,8,["description"])),A.value?(s(),d(i,{key:1,class:"loading"})):m("",!0),F.value?(s(),u("div",D,[o(i),r("span",H,g(n(_)("loading")),1)])):m("",!0),!B.value&&q.value.length>0?(s(),u("div",N,g(n(_)("no_more_data")),1)):m("",!0)])}}},[["__scopeId","data-v-a3215cd9"]]);export{O as default};
