import{d as N,B as M,g as E,j as y,o as c,f as g,F as B,C as G,N as T,u as l,l as t,c as C,D as V,b as $,p as _,a as x,q as z,A as U,O as F,t as s,P as H,E as S,Q as I,_ as A,R as j,i as D,G as O,r as w,h as R,T as q,U as J}from"./index-ongssuUn.js";const Q={class:"group-list-box"},K={class:"group-list-item-left"},W={class:"group-list-item-left-content"},X={class:"grid-container"},Y={class:"group-list-item-right"},Z={class:"name"},ee={class:"icon"},ae={class:"from"},oe={class:"user_id"},te={class:"ator"},se={class:"remark"},ne={class:"tit"},ie={class:"desc"},le={class:"btn-info"},ce=N({name:"GroupListBox",__name:"group-list-box",props:{groupList:{default:[]}},emits:["preview","del"],setup(L,{emit:f}){const h=M(),r=E(),b=f,n=e=>{h.homeGroupList.push({id:I(),mode:e.mode,lock:!!e.locks,name:e.name,icon:e.icon,children:e.children.map(u=>{var v;return{...u,id:I(),children:((v=u.children)==null?void 0:v.map(o=>({...o,id:I()})))??[]}})}),h.$patch({homeGroupIndex:h.homeGroupList.length-1}),S.success(s("添加分组_##_{slot1}_##_成功!",{slot1:e.name})),r.updateBackupsDebounce(["nav_info"])},d=e=>{F.confirm(s("确认删除此分享吗?删除后无法恢复!"),s("温馨提示"),{confirmButtonText:s("确定"),cancelButtonText:s("取消"),draggable:!0,roundButton:!0}).then(async()=>{const u=await H({id:e.id});u.code==0?(S.success(u.msg),b("del",e)):S.error(u.msg)}).catch(()=>{})},m=e=>{b("preview",e)};return(e,u)=>{const v=y("SvgIcon"),o=y("el-button");return c(),g("div",Q,[(c(!0),g(B,null,G(L.groupList,a=>(c(),g("div",{class:T(["group-list-item",l(h).isMobile?"mobile-item":""]),key:a.id},[t("div",K,[t("div",W,[t("div",X,[(c(!0),g(B,null,G(a.children,i=>(c(),C(V,{key:i.id,appData:i,type:"grid",contextmenus:[]},null,8,["appData"]))),128))])])]),t("div",Y,[t("div",Z,[t("div",ee,[$(v,{name:a.icon,color:"#fff",size:16},null,8,["name"])]),t("span",null,_(a.name),1)]),t("div",ae,[t("span",oe,[t("span",null,_(e.$t("作者：")),1),t("span",te,_(a.author),1)])]),t("div",se,[t("span",ne,_(e.$t("描述：")),1),t("span",ie,_(a.info),1)]),t("div",le,[a.author==l(r).userInfo.username?(c(),C(o,{key:0,type:"danger",plain:"",size:"small",round:"",onClick:i=>d(a)},{default:x(()=>[z(_(e.$t("删除")),1)]),_:1},8,["onClick"])):U("",!0),$(o,{type:"primary",plain:"",size:"small",round:"",onClick:i=>m(a)},{default:x(()=>[z(_(e.$t("预览")),1)]),_:1},8,["onClick"]),$(o,{type:"primary",size:"small",round:"",onClick:i=>n(a)},{default:x(()=>[z(_(e.$t("添加")),1)]),_:1},8,["onClick"])])])],2))),128))])}}}),re=A(ce,[["__scopeId","data-v-48187550"]]),de={class:"add-group"},ue={class:"sidebar-scroll"},pe=["onClick"],_e={class:"sidebar-icon"},me={key:0,class:"sidebar-label"},ge={class:"add-group-main"},fe={class:"pagination-box"},he=N({name:"AddGroupContent",__name:"content",setup(L){const f=M(),h=O(()=>[{name:s("官方推荐"),icon:"fa fa-desktop",id:0},{name:s("知识学习"),icon:"fa fa-graduation-cap",id:1},{name:s("软件工具"),icon:"fa fa-internet-explorer",id:2},{name:s("产品设计"),icon:"fa fa-codepen",id:3},{name:s("摸鱼娱乐"),icon:"fa fa-gamepad",id:4},{name:s("影音视听"),icon:"fa fa-music",id:5},{name:s("兴趣技能"),icon:"fa fa-heart-o",id:6},{name:s("技术编程"),icon:"fa fa-code",id:7},{name:s("运动体育"),icon:"fa fa-futbol-o",id:8}]),r=w(0),b=o=>{o.id!=r.value&&(r.value=o.id,e(0))},n=R({total:0,data:[]}),d=w(1),m=w(10),e=async o=>{o==0&&(d.value=1);const a=await q({page:d.value,limit:m.value,type:r.value});if(a.code==0){const i=a.data.data.map(k=>({...k,children:JSON.parse(k.children)}));o==0?(n.data=[],setTimeout(()=>{n.data=i,n.total=a.data.total},10)):(n.data=[...n.data,...i],n.total=a.data.total)}};e(0);const u=o=>{f.handleShowComponent({name:o.name,component:"Folder",type:"component",size:"2x2",id:String(o.id),preview:!0,children:[...o.children]})},v=o=>{n.data=n.data.filter(i=>i.id!=o.id);const a=`/users/group_icon{"page":${d.value},"limit":${m.value},"type":${r.value}}{"page":${d.value},"limit":${m.value},"type":${r.value}}`;J.remove(a)};return(o,a)=>{const i=y("SvgIcon"),k=y("el-empty"),P=y("el-pagination");return c(),g("div",de,[t("div",{class:"add-group-aside",style:j({width:l(f).isMobile?"56px":"140px"})},[t("div",ue,[(c(!0),g(B,null,G(l(h),p=>(c(),g("div",{class:T(["sidebar-item",{"sidebar-item-active":l(r)==p.id}]),key:p.id,onClick:ve=>b(p)},[t("div",_e,[$(i,{name:p.icon,size:16},null,8,["name"])]),l(f).isMobile?U("",!0):(c(),g("span",me,_(p.name),1))],10,pe))),128))])],4),t("div",ge,[l(n).data.length?(c(),C(re,{key:0,groupList:l(n).data,onPreview:u,onDel:v},null,8,["groupList"])):(c(),C(k,{key:1,style:{flex:"1"},description:o.$t("暂无数据")},null,8,["description"])),t("div",fe,[$(P,{"page-size":l(m),"onUpdate:pageSize":a[0]||(a[0]=p=>D(m)?m.value=p:null),"current-page":l(d),"onUpdate:currentPage":a[1]||(a[1]=p=>D(d)?d.value=p:null),layout:l(f).isMobile?"pager":"total, sizes, prev, pager, next, jumper","page-sizes":[10,15,20,30],total:Number(l(n).total),onSizeChange:e,onCurrentChange:e},null,8,["page-size","current-page","layout","total"])])])])}}}),$e=A(he,[["__scopeId","data-v-c9421f66"]]);export{$e as default};
