import{K as e,L as t,M as a,b as s,e as i,w as l,y as r,z as o,_ as n,N as u,q as d,G as c,j as p,k as h,g as b,O as m,v as g,Q as f,a0 as _,l as y,a6 as v,d as w,r as S,n as x,Z as C,a7 as $,h as k,a8 as L,a9 as R,aa as T,ab as B,F as N,$ as j}from"./index-f6e54d8f.js";import{_ as z}from"./_plugin-vue_export-helper.1b428a4d.js";import{_ as P}from"./uni-icons.7467b650.js";import{u as D,_ as W}from"./useLayout.9cce4498.js";import{_ as H}from"./uni-popup.1c525271.js";import"./Loading.7fe45b05.js";import"./u-loading-icon.3bd3dc6a.js";import"./Search.vue_vue_type_script_setup_true_lang.fed60e7a.js";import"./u-icon.de9898cd.js";const V=z({name:"u-badge",mixins:[t,{props:{isDot:{type:Boolean,default:e.badge.isDot},value:{type:[Number,String],default:e.badge.value},modelValue:{type:[Number,String],default:e.badge.modelValue},show:{type:Boolean,default:e.badge.show},max:{type:[Number,String],default:e.badge.max},type:{type:String,default:e.badge.type},showZero:{type:Boolean,default:e.badge.showZero},bgColor:{type:[String,null],default:e.badge.bgColor},color:{type:[String,null],default:e.badge.color},shape:{type:String,default:e.badge.shape},numberType:{type:String,default:e.badge.numberType},offset:{type:Array,default:e.badge.offset},inverted:{type:Boolean,default:e.badge.inverted},absolute:{type:Boolean,default:e.badge.absolute}}},a],computed:{boxStyle:()=>({}),badgeStyle(){const e={};if(this.color&&(e.color=this.color),this.bgColor&&!this.inverted&&(e.backgroundColor=this.bgColor),this.absolute&&(e.position="absolute",this.offset.length)){const t=this.offset[0],a=this.offset[1]||t;e.top=uni.$u.addUnit(t),e.right=uni.$u.addUnit(a)}return e},showValue(){switch(this.numberType){case"overflow":return Number(this.value)>Number(this.max)?this.max+"+":this.value;case"ellipsis":return Number(this.value)>Number(this.max)?"...":this.value;case"limit":return Number(this.value)>999?Number(this.value)>=9999?Math.floor(this.value/1e4*100)/100+"w":Math.floor(this.value/1e3*100)/100+"k":this.value;default:return Number(this.value)}}}},[["render",function(e,t,a,p,h,b){const m=c;return e.show&&(0!==Number(e.value)||e.showZero||e.isDot)?(s(),i(m,{key:0,class:n([[e.isDot?"u-badge--dot":"u-badge--not-dot",e.inverted&&"u-badge--inverted","horn"===e.shape&&"u-badge--horn",`u-badge--${e.type}${e.inverted?"--inverted":""}`],"u-badge"]),style:u([e.$u.addStyle(e.customStyle),b.badgeStyle])},{default:l((()=>[r(o(e.isDot?"":b.showValue),1)])),_:1},8,["class","style"])):d("v-if",!0)}],["__scopeId","data-v-a7ace528"]]);const M=z({name:"u-tabs",mixins:[t,a,{props:{duration:{type:Number,default:e.tabs.duration},list:{type:Array,default:e.tabs.list},lineColor:{type:String,default:e.tabs.lineColor},activeStyle:{type:[String,Object],default:e.tabs.activeStyle},inactiveStyle:{type:[String,Object],default:e.tabs.inactiveStyle},lineWidth:{type:[String,Number],default:e.tabs.lineWidth},lineHeight:{type:[String,Number],default:e.tabs.lineHeight},lineBgSize:{type:String,default:e.tabs.lineBgSize},itemStyle:{type:[String,Object],default:e.tabs.itemStyle},scrollable:{type:Boolean,default:e.tabs.scrollable},current:{type:[Number,String],default:e.tabs.current},keyName:{type:String,default:e.tabs.keyName}}}],data:()=>({firstTime:!0,scrollLeft:0,scrollViewWidth:0,lineOffsetLeft:0,tabsRect:{left:0},innerCurrent:0,moving:!1}),watch:{current:{immediate:!0,handler(e,t){e!==this.innerCurrent&&(this.innerCurrent=e,this.$nextTick((()=>{this.resize()})))}},list(){this.$nextTick((()=>{this.resize()}))}},computed:{textStyle(){return e=>{const t={},a=e===this.innerCurrent?uni.$u.addStyle(this.activeStyle):uni.$u.addStyle(this.inactiveStyle);return this.list[e].disabled&&(t.color="#c8c9cc"),uni.$u.deepMerge(a,t)}},propsBadge:()=>uni.$u.props.badge},async mounted(){this.init()},emits:["click","change"],methods:{setLineLeft(){const e=this.list[this.innerCurrent];if(!e)return;let t=this.list.slice(0,this.innerCurrent).reduce(((e,t)=>e+t.rect.width),0);const a=uni.$u.getPx(this.lineWidth);this.lineOffsetLeft=t+(e.rect.width-a)/2,this.firstTime&&setTimeout((()=>{this.firstTime=!1}),10)},animation(e,t=0){},clickHandler(e,t){this.$emit("click",{...e,index:t}),e.disabled||(this.innerCurrent=t,this.resize(),this.$emit("change",{...e,index:t}))},init(){uni.$u.sleep().then((()=>{this.resize()}))},setScrollLeft(){const e=this.list[this.innerCurrent],t=this.list.slice(0,this.innerCurrent).reduce(((e,t)=>e+t.rect.width),0),a=uni.$u.sys().windowWidth;let s=t-(this.tabsRect.width-e.rect.width)/2-(a-this.tabsRect.right)/2+this.tabsRect.left/2;s=Math.min(s,this.scrollViewWidth-this.tabsRect.width),this.scrollLeft=Math.max(0,s)},resize(){0!==this.list.length&&Promise.all([this.getTabsRect(),this.getAllItemRect()]).then((([e,t=[]])=>{this.tabsRect=e,this.scrollViewWidth=0,t.map(((e,t)=>{this.scrollViewWidth+=e.width,this.list[t].rect=e})),this.setLineLeft(),this.setScrollLeft()}))},getTabsRect(){return new Promise((e=>{this.queryRect("u-tabs__wrapper__scroll-view").then((t=>e(t)))}))},getAllItemRect(){return new Promise((e=>{const t=this.list.map(((e,t)=>this.queryRect(`u-tabs__wrapper__nav__item-${t}`,!0)));Promise.all(t).then((t=>e(t)))}))},queryRect(e,t){return new Promise((t=>{this.$uGetRect(`.${e}`).then((e=>{t(e)}))}))}}},[["render",function(e,t,a,d,w,S){const x=c,C=p(h("u-badge"),V),$=y,k=v;return s(),i($,{class:"u-tabs"},{default:l((()=>[b($,{class:"u-tabs__wrapper"},{default:l((()=>[m(e.$slots,"left",{},void 0,!0),b($,{class:"u-tabs__wrapper__scroll-view-wrapper"},{default:l((()=>[b(k,{"scroll-x":e.scrollable,"scroll-left":w.scrollLeft,"scroll-with-animation":"",class:"u-tabs__wrapper__scroll-view","show-scrollbar":!1,ref:"u-tabs__wrapper__scroll-view"},{default:l((()=>[b($,{class:"u-tabs__wrapper__nav",ref:"u-tabs__wrapper__nav"},{default:l((()=>[(s(!0),g(f,null,_(e.list,((t,a)=>(s(),i($,{class:n(["u-tabs__wrapper__nav__item",[`u-tabs__wrapper__nav__item-${a}`,t.disabled&&"u-tabs__wrapper__nav__item--disabled"]]),key:a,onClick:e=>S.clickHandler(t,a),ref_for:!0,ref:`u-tabs__wrapper__nav__item-${a}`,style:u([e.$u.addStyle(e.itemStyle),{flex:e.scrollable?"":1}])},{default:l((()=>[b(x,{class:n([[t.disabled&&"u-tabs__wrapper__nav__item__text--disabled"],"u-tabs__wrapper__nav__item__text"]),style:u([S.textStyle(a)])},{default:l((()=>[r(o(t[e.keyName]),1)])),_:2},1032,["class","style"]),b(C,{show:!(!t.badge||!(t.badge.show||t.badge.isDot||t.badge.value)),isDot:t.badge&&t.badge.isDot||S.propsBadge.isDot,value:t.badge&&t.badge.value||S.propsBadge.value,max:t.badge&&t.badge.max||S.propsBadge.max,type:t.badge&&t.badge.type||S.propsBadge.type,showZero:t.badge&&t.badge.showZero||S.propsBadge.showZero,bgColor:t.badge&&t.badge.bgColor||S.propsBadge.bgColor,color:t.badge&&t.badge.color||S.propsBadge.color,shape:t.badge&&t.badge.shape||S.propsBadge.shape,numberType:t.badge&&t.badge.numberType||S.propsBadge.numberType,inverted:t.badge&&t.badge.inverted||S.propsBadge.inverted,customStyle:"margin-left: 4px;"},null,8,["show","isDot","value","max","type","showZero","bgColor","color","shape","numberType","inverted"])])),_:2},1032,["onClick","style","class"])))),128)),b($,{class:"u-tabs__wrapper__nav__line",ref:"u-tabs__wrapper__nav__line",style:u([{width:e.$u.addUnit(e.lineWidth),transform:`translate(${w.lineOffsetLeft}px)`,transitionDuration:`${w.firstTime?0:e.duration}ms`,height:e.$u.addUnit(e.lineHeight),background:e.lineColor,backgroundSize:e.lineBgSize}])},null,8,["style"])])),_:1},512)])),_:1},8,["scroll-x","scroll-left"])])),_:1}),m(e.$slots,"right",{},void 0,!0)])),_:3})])),_:3})}],["__scopeId","data-v-f370370e"]]),O=z(w({__name:"index",setup(e){const t=S([{name:"校园活动",type:"campus"},{name:"班级活动",type:"class"},{name:"校外活动",type:"offCampus"},{name:"学生实践",type:"practice"}]),a=S(0),m=S(null),w=S(44),z=S("500px"),V=S([{id:null,name:"全部状态"},{id:"upcoming",name:"未开始"},{id:"ongoing",name:"进行中"},{id:"ended",name:"已结束"}]),O=S([{id:null,name:"全部类型"},{id:"lecture",name:"讲座"},{id:"workshop",name:"工作坊"},{id:"competition",name:"竞赛"},{id:"outing",name:"外出活动"}]),Z=S(V.value[0]),F=S(O.value[0]),A=S(null),U=S(null),I=x((()=>{switch(U.value){case"status":return V.value;case"type":return O.value;default:return[]}})),q=x((()=>{switch(U.value){case"status":return"选择状态";case"type":return"选择类型";default:return"选择选项"}})),G=e=>{var t,a;switch(U.value){case"status":return(null==(t=Z.value)?void 0:t.id)===e.id;case"type":return(null==(a=F.value)?void 0:a.id)===e.id;default:return!1}},[Q,{reload:J,setParam:K}]=D({api:async e=>{const a=e.page||1,s=e.pageSize||10,i=e.type||"campus";console.log(`Fetching activities for type: ${i}, page: ${a}`);const l=Array.from({length:40}).map(((e,s)=>{var i;const l=40*(a-1)+s+1,r=t.value[l%t.value.length].type;return{id:l,title:`${(null==(i=t.value.find((e=>e.type===r)))?void 0:i.name)||"活动"} #${l}: ${"campus"===r?"五育融合促发展":"class"===r?"温故知新 决胜千里":"offCampus"===r?"探索自然奥秘":"编程实践周"}`,imageUrl:`/static/base/placeholder/list-thumb-${l%4+1}.jpg`,views:100+13*l%500,likes:50+7*l%300,comments:10+3*l%100,type:r}})).filter((e=>e.type===i)),r=l.length,o=l.slice((a-1)*s,a*s);return new Promise((e=>{setTimeout((()=>{e({message:"成功",resultCode:200,rows:o,total:r})}),350)}))},componentProps:{}}),E=e=>{const s="number"==typeof e?e:e.index;a.value=s;const i=t.value[s].type;console.log("Tab changed to:",i),K({type:i})};return C((()=>{K({type:t.value[a.value].type}),$((()=>{var e;const t=null==(e=L())?void 0:e.proxy;t&&R().in(t).select(".content-section").boundingClientRect((e=>{e&&"object"==typeof e&&"bottom"in e?R().in(t).select(".u-tabs").boundingClientRect((t=>{if(t&&"object"==typeof t&&"height"in t){w.value=t.height||44;const a=T().windowTop||0,s=e.top||0,i=T().windowHeight-a-s-w.value;z.value=`${Math.max(200,i)}px`,console.log("Calculated Tabs Height:",w.value,"List Height:",z.value)}else{console.warn("Could not get valid boundingClientRect for .u-tabs",t);const e=T().windowHeight,a=B(444);z.value=e-a-w.value+"px"}})).exec():console.warn("Could not get valid boundingClientRect for .content-section",e)})).exec()}))})),(e,S)=>{const x=N,C=y,$=p(h("u-tabs"),M),L=c,R=p(h("uni-icons"),P),T=p(h("BasicListLayout"),W),B=v,D=p(h("uni-popup"),H);return s(),g(f,null,[d(" Removed BasicListLayout wrapper for more custom layout "),b(C,{class:"home-page"},{default:l((()=>[d(" 1. Banner Section "),b(C,{class:"banner-section"},{default:l((()=>[b(x,{class:"banner-image",src:"/zhxy-jsd/static/base/placeholder/home-banner.png",mode:"widthFix"})])),_:1}),d(" 3. Tab Navigation & List "),b(C,{class:"content-section"},{default:l((()=>[d(" u-tabs component for tab navigation "),b($,{list:t.value,current:a.value,onChange:E,lineColor:"#447ade",activeStyle:{color:"#303133",fontWeight:"bold"},inactiveStyle:{color:"#606266"},itemStyle:"padding-left: 15px; padding-right: 15px; height: 44px;"},null,8,["list","current"]),d(" List powered by BasicListLayout, now nested "),b(T,{ref_key:"listLayoutRef",ref:m,onRegister:k(Q),"show-nav-bar":!1,fixed:!1,topAbs:0,useVirtualList:!1,offsetTop:w.value,style:u([{height:z.value},{"border-top":"1rpx solid #eee"}])},{default:l((({list:e})=>[b(C,{class:"list-container"},{default:l((()=>[(s(!0),g(f,null,_(e,(e=>(s(),i(C,{class:"list-item",key:e.id,onClick:t=>(e=>{console.log("Navigating to detail for item:",e.id,"Type:",e.type),j({url:`./detail?id=${e.id}&type=${e.type}`})})(e)},{default:l((()=>[b(x,{class:"item-thumbnail",src:e.imageUrl||"/static/base/placeholder/placeholder-thumb.png",mode:"aspectFill"},null,8,["src"]),b(C,{class:"item-content"},{default:l((()=>[b(L,{class:"item-title"},{default:l((()=>[r(o(e.title),1)])),_:2},1024),b(C,{class:"item-meta"},{default:l((()=>[b(C,{class:"meta-item"},{default:l((()=>[b(R,{type:"eye",size:"14",color:"#999"}),b(L,null,{default:l((()=>[r(o(e.views||0),1)])),_:2},1024)])),_:2},1024),b(C,{class:"meta-item"},{default:l((()=>[b(R,{type:"hand-up",size:"14",color:"#999"}),b(L,null,{default:l((()=>[r(o(e.likes||0),1)])),_:2},1024)])),_:2},1024),b(C,{class:"meta-item"},{default:l((()=>[b(R,{type:"chatbubble",size:"14",color:"#999"}),b(L,null,{default:l((()=>[r(o(e.comments||0),1)])),_:2},1024)])),_:2},1024)])),_:2},1024)])),_:2},1024)])),_:2},1032,["onClick"])))),128))])),_:2},1024)])),_:1},8,["onRegister","offsetTop","style"])])),_:1}),d(" Filter Popup (Reused) "),b(D,{ref_key:"filterPopupRef",ref:A,type:"bottom","background-color":"#fff"},{default:l((()=>[b(C,{class:"popup-content"},{default:l((()=>[b(C,{class:"popup-header"},{default:l((()=>[b(L,null,{default:l((()=>[r(o(k(q)),1)])),_:1}),b(R,{type:"closeempty",size:"20",onClick:e.closeFilterPopup},null,8,["onClick"])])),_:1}),b(B,{"scroll-y":"",class:"popup-options"},{default:l((()=>[(s(!0),g(f,null,_(k(I),(t=>(s(),i(C,{class:n(["option-item",{active:G(t)}]),key:t.id,onClick:a=>e.selectFilterOption(t)},{default:l((()=>[r(o(t.name),1)])),_:2},1032,["class","onClick"])))),128))])),_:1})])),_:1})])),_:1},512)])),_:1})],2112)}}}),[["__scopeId","data-v-0502d5cf"]]);export{O as default};