"use strict";var e=require("../common/vendor.js"),t=require("../api/article.js"),o=require("../uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js");require("../common/request.js");const l={components:{Menu:()=>"../components/Menu.js"},mixins:[o.MescrollMixin],data:()=>({top:null,cates:[],cateId:0,keyword:"",mescroll:null,downOption:{use:!0,auto:!1},upOption:{onScroll:!1,use:!0,page:{pae:0,size:10},noMoreSize:10,textNoMore:"已经到底了",empty:{icon:"https://cos.his.cdwjyyh.com/fs/20240423/cf4a86b913a04341bb44e34bb4d37aa2.png",tip:"暂无数据"}},dataList:[]}),onShow(){this.getArticleCateList()},methods:{menuClick(e){this.cateId=e.cateId,this.mescroll.resetUpScroll()},doSearch(){this.mescroll.resetUpScroll()},getArticleCateList(){var o=this;t.getArticleCateList({}).then((t=>{if(200==t.code){this.cates=t.data;var l=e.index.createSelectorQuery().in(o);setTimeout((function(){l.select(".top-content").boundingClientRect((e=>{e&&(console.log("View height:",e.height+"px"),o.top=e.height+"px")})).exec()}),500)}else e.index.showToast({icon:"none",title:"请求失败"})}),(e=>{}))},mescrollInit(e){this.mescroll=e},downCallback(e){e.resetUpScroll()},upCallback(o){var l=this,i={keyword:this.keyword,cateId:this.cateId,pageNum:o.num,pageSize:o.size};t.getArticleList(i).then((t=>{200==t.code?(1==o.num?l.dataList=t.data.list:l.dataList=l.dataList.concat(t.data.list),l.mescroll.endBySize(t.data.list.length,t.data.total)):(e.index.showToast({icon:"none",title:"请求失败"}),l.dataList=null,l.mescroll.endErr())}))},choseCate(e){this.cateId=e.cateId,this.mescroll.resetUpScroll()},showDetail(t){e.index.navigateTo({url:"./articleDetails?articleId="+t.articleId})}}};if(!Array){(e.resolveComponent("Menu")+e.resolveComponent("mescroll-body"))()}Math;var i=e._export_sfc(l,[["render",function(t,o,l,i,s,a){return e.e({a:e.o(((...e)=>a.doSearch&&a.doSearch(...e))),b:s.keyword,c:e.o((e=>s.keyword=e.detail.value)),d:s.cates.length>0},s.cates.length>0?{e:e.o(a.menuClick),f:e.p({list:s.cates})}:{},{g:null!=s.top},null!=s.top?{h:e.f(s.dataList,((t,o,l)=>({a:e.t(t.title),b:e.t(t.views),c:e.t(t.publishTime),d:t.imageUrl,e:o,f:e.o((e=>a.showDetail(t)),o)}))),i:e.sr("mescrollRef","9b5e0930-1"),j:e.o(a.mescrollInit),k:e.o(a.downCallback),l:e.o(a.upCallback),m:e.p({top:s.top,down:s.downOption,up:s.upOption})}:{})}]]);wx.createPage(i);
