var D=Object.defineProperty,T=Object.defineProperties;var z=Object.getOwnPropertyDescriptors;var _=Object.getOwnPropertySymbols;var I=Object.prototype.hasOwnProperty,L=Object.prototype.propertyIsEnumerable;var b=(a,t,s)=>t in a?D(a,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[t]=s,g=(a,t)=>{for(var s in t||(t={}))I.call(t,s)&&b(a,s,t[s]);if(_)for(var s of _(t))L.call(t,s)&&b(a,s,t[s]);return a},x=(a,t)=>T(a,z(t));var u=(a,t,s)=>new Promise((c,m)=>{var i=r=>{try{p(s.next(r))}catch(o){m(o)}},h=r=>{try{p(s.throw(r))}catch(o){m(o)}},p=r=>r.done?c(r.value):Promise.resolve(r.value).then(i,h);p((s=s.apply(a,t)).next())});import V from"./detail-CLPQfK5X.js";import{n as d,b as v,r as f,fI as C,aA as y,W as B,aK as E,ag as F}from"./index-CRmU-Qpi.js";import{u as S,q as R,d as M,g as P}from"./dynamics-yhcp7wZB.js";function O(){const a=d(!0),t=d([]),s=d(!1),c=d({search_name:""}),m=d([{label:"搜索内容",prop:"search_name",type:"input"}]),i=d({total:0,pageSize:10,pageSizes:[10,20,50,100],currentPage:1,background:!0}),h=d([{label:"ID",prop:"id"},{label:"话题标题",prop:"topic_title"},{label:"动态内容",prop:"content"},{label:"动态封面",prop:"createtime",cellRenderer:({row:e})=>v(f("el-image"),{fit:"cover","preview-teleported":!0,src:e.images,"preview-src-list":Array.of(e.images),class:"w-[24px] h-[24px] rounded-full align-middle"},null)},{label:"浏览数",prop:"read_num"},{label:"评论数量",prop:"comment_num"},{label:"打赏总金额",prop:"rewards_num"},{label:"是否置顶",prop:"is_recommend",cellRenderer:({row:e,props:n})=>v(f("el-switch"),{modelValue:e.is_recommend,"onUpdate:modelValue":l=>e.is_recommend=l,onChange:()=>p(e),"active-value":1,"inactive-value":0,"active-text":"置顶","inactive-text":"不置顶","active-color":"#13ce66","inactive-color":"#ff4949"},null)},{label:"是否显示",prop:"show_status",cellRenderer:({row:e,props:n})=>v(f("el-switch"),{modelValue:e.show_status,"onUpdate:modelValue":l=>e.show_status=l,onChange:()=>r(e),"active-value":1,"inactive-value":0,"active-text":"显示","inactive-text":"隐藏","active-color":"#13ce66","inactive-color":"#ff4949"},null)},{label:"创建时间",prop:"createtime"},{label:"操作",fixed:"right",width:"210px",slot:"operation"}]),p=e=>u(this,null,function*(){a.value||C.confirm(`确认要${e.is_recommend===0?"去掉置顶":"置顶"}吗?`,"系统提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning",dangerouslyUseHTMLString:!0,draggable:!0}).then(()=>u(this,null,function*(){const{data:n,code:l}=yield S({id:e.id,type:1,status:e.is_recommend});l&&(y(`已${e.is_recommend===0?"去掉置顶":"置顶"}`,{type:"success"}),o(c.value))})).catch(()=>{e.is_recommend==0?e.is_recommend=1:e.is_recommend=0})}),r=e=>u(this,null,function*(){a.value||C.confirm(`确认要${e.show_status===0?"隐藏":"显示"}吗?`,"系统提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning",dangerouslyUseHTMLString:!0,draggable:!0}).then(()=>u(this,null,function*(){const{data:n,code:l}=yield S({id:e.id,type:2,status:e.show_status});l&&(y(`已${e.show_status===0?"隐藏":"置顶"}`,{type:"success"}),o(c.value))})).catch(()=>{e.show_status==0?e.show_status=1:e.show_status=0})}),o=e=>u(this,null,function*(){a.value=!0,c.value=g({},e);const{data:n,code:l}=yield R(x(g({},e),{page:i.value.currentPage,page_limit:i.value.pageSize}));l&&(t.value=n.lists,i.value.total=n.count,i.value.currentPage=n.page),setTimeout(()=>{a.value=!1},500)});return{searchForm:c,searchLabel:m,onSearch:o,isShow:s,tableList:t,tableLabel:h,pagination:i,handleSizeChange:e=>{i.value.pageSize=e,o(c.value)},handleCurrentChange:e=>{i.value.currentPage=e,o(c.value)},loading:a,handleDelete:e=>u(this,null,function*(){const{code:n}=yield M({id:e.id});n&&(y("已删除这条动态",{type:"success"}),o(c.value))}),viewDetial:e=>u(this,null,function*(){const n=yield P({id:e.id});B(()=>{if(n.code){const l=n.data;E({title:"查看动态详情",props:{userInfo:g({userId:e.id},l)},width:"50%",hideFooter:!0,closeOnClickModal:!1,contentRenderer:()=>F(V),beforeSure:w=>{w()}})}})})}}export{O as useData};