import{a2 as e,e as t,T as s,a,o as i,h as n,w as o,i as l,W as c,k as r,F as d,l as u,A as p,j as m,t as _,N as g,y as f,z as h,d as y,b as x,a9 as b,ar as j,r as w,ap as k,x as T,n as v,p as L,f as D,g as I,s as C,as as O,B as N,at as z,au as B,S as A,a7 as P,an as S,m as J,O as R}from"./index-Cg3FU-dV.js";import{_ as W}from"./uni-load-more.CjvUHfTb.js";import{_ as $,a as q}from"./uni-row.DfI4R5V8.js";import{_ as E,a as F}from"./uni-list.B5vvSfhy.js";import{d as H}from"./index.D_hliqYM.js";import{_ as M}from"./_plugin-vue_export-helper.BCo6x5W8.js";import{e as Q}from"./index.Dozy1JgX.js";import{g as Y}from"./index.vG6WzeDr.js";import{d as Z}from"./dropDown.CwWwzzIM.js";import{f as G}from"./schedule.ky61dGSO.js";import"./uni-icons.D_sy4NxH.js";/* empty css */import"./uni-badge.AEsViQRE.js";import"./uni-nav-bar.BXgu2eq7.js";/* empty css *//* empty css *//* empty css */import"./moment.BD7_iMEL.js";const K=M({__name:"longPressBox",props:{position:{type:Object,default:()=>({})},meus:{type:Array,default:()=>[]}},emits:["change"],setup(y,{expose:x,emit:b}){const j=y,{position:w,meus:k}=e(j),T=b,v=t({show:!1});return s(w,((e,t)=>{Object.keys(e).length}),{immediate:!0,deep:!0}),x({openLong:()=>{v.show=!0}}),(e,t)=>{const s=f,y=h;return a(v).show?(i(),n(y,{key:0,class:"long-box",onClick:t[0]||(t[0]=e=>a(v).show=!1)},{default:o((()=>[l(y,{class:"long-box-content",style:c({top:a(w).bottom+"px"})},{default:o((()=>[(i(!0),r(d,null,u(a(k),((e,t)=>(i(),n(y,{class:"drop-down-list-item",key:"meus"+t,onClick:t=>(e=>{T("change",e)})(e)},{default:o((()=>[l(s,{class:p(["iconfont",e.icon])},null,8,["class"]),l(s,null,{default:o((()=>[m(_(e.name),1)])),_:2},1024)])),_:2},1032,["onClick"])))),128))])),_:1},8,["style"])])),_:1})):g("",!0)}}},[["__scopeId","data-v-36fef1a3"]]),U=M(y({__name:"info",setup(e){const s=x();b((e=>{e.id&&(y.where.cate_id=e.id,j({title:e.title}),te())}));const c=t([{name:"全部已读",id:2,icon:"icon-danchuang-quanbuyidu"},{name:"全部删除",id:1,icon:"icon-shanchu"}]),y=t({listData:[],where:{cate_id:"",page:1,limit:10,is_read:""},emptyTitle:"暂无消息内容~",scrollTop:0,status:"more",contentText:{contentdown:null,contentrefresh:"",contentnomore:"没有更多数据了"},firstLoading:!1,loading:!1,listLoading:!1,positionObj:{},longIndex:-1,ifLongtap:!0,templateType:["business_approval"],urlTemplateType:["daily_remind"],selectedType:["delete","recall"],rightIcon:[{type:1,icon:"icon-gengduo1",types:"icon"}]}),M=()=>{if(y.loading||!y.listLoading)return!1;y.status="loading",y.where.page++,te()},U=e=>e.image?"":0===e.is_read?"p1":"p0",V=w(null),X=()=>{V.value.openDropdown()},ee=e=>{1===e.id?C("你确定要删除全部消息吗","删除提醒").then((()=>{de({cate_id:y.where.cate_id},!0)})).catch((()=>{})):C("你确定要全部标记已读吗").then((()=>{se(1,{cate_id:y.where.cate_id},-1,!0)})).catch((()=>{}))},te=(e=!1)=>{y.loading=!0,k(y.where).then((t=>{e&&(y.listData=[]),y.listData.unshift(...t.data.list);const s=Math.ceil(t.data.messageNum/y.where.limit);y.listLoading=!(y.listData.length<=0||y.where.page>=s),y.listData.length>0&&ie(),y.status="more",y.loading=!1})).catch((e=>{T.error(e.message),y.loading=!1,y.status="more"}))},se=(e,t,s,a=!1)=>{O(e,t).then((()=>{a?(T.success("批量标记成功"),y.where.page=1,te(!0)):y.listData[s].is_read=1})).catch((()=>{}))},ae=N(),ie=()=>{v((()=>{let e=0;const t=L().in(ae);y.firstLoading?(t.selectAll(".item-list-click").fields({size:!0,rect:!0},(()=>{})),t.exec((t=>{const s=t[0];s.length>0&&s.forEach((t=>{e+=t.height})),y.scrollTop=e}))):(t.select(".notice-content-list").fields({size:!0,rect:!0},(()=>{})),t.exec((e=>{y.scrollTop=e[0].height}))),y.firstLoading=!0}))},ne=w(null),oe=e=>{if(y.ifLongtap){y.longIndex=e;const t=L().in(ae);t.select(`#items${e}`).fields({size:!0,rect:!0},(()=>{})),t.exec((e=>{y.positionObj=e[0],ne.value.openLong()}))}},le=()=>{y.ifLongtap=!0},ce=()=>{y.ifLongtap=!1},re=()=>{const e=[y.listData[y.longIndex].id];de(e)},de=(e,t=!1)=>{z(e).then((e=>{T.success(e.message),t?B("/pages/notice/index"):y.listData.splice(y.longIndex,1)})).catch((e=>{T.error(e.message)}))};return(e,t)=>{const x=h,b=D(I("uni-load-more"),W),j=f,w=R,k=D(I("uni-col"),$),v=D(I("uni-row"),q),L=D(I("uni-list-item"),E),C=D(I("uni-list"),F),O=A;return i(),n(x,{class:"notice-list"},{default:o((()=>[l(x,{class:"cr-position-header"},{default:o((()=>[l(x,{class:"status_bar"}),l(H,{"default-title":a(y).defaultTitle,"is-right":!0,"right-data":a(y).rightIcon,onHandleNarItem:X},null,8,["default-title","right-data"])])),_:1}),l(x,{class:"notice-content pl10"},{default:o((()=>[a(y).listData.length>0?(i(),n(O,{key:0,"scroll-top":a(y).scrollTop,class:"notice-content-view",onScrolltoupper:M,"scroll-y":"true"},{default:o((()=>[l(x,{class:"notice-content-list pr10"},{default:o((()=>[a(y).listLoading?(i(),n(b,{key:0,iconType:"circle",status:a(y).status,"show-text":!1,"content-text":a(y).contentText},null,8,["status","content-text"])):g("",!0),l(C,{border:!1},{default:o((()=>[(i(!0),r(d,null,u(a(y).listData,((e,t)=>(i(),n(L,{id:"items"+t,key:"items"+t,class:p(t[l(x,{class:"note-list-time",onLongpress:P((e=>oe(t)),["prevent"]),onTouchend:le,onTouchmove:ce},{default:o((()=>[l(j,null,{default:o((()=>[m(_(a(G)(e.created_at,!0)),1)])),_:2},1024)])),_:2},1032,["onLongpress"]),l(x,{class:"notice-list",onClick:a=>((e,t,a)=>{if(S(e.id,1).then((()=>{e.is_handle=1})).catch((e=>{T.error(e.message)})),0===e.is_read&&se(1,{ids:[e.id]},a),!t.uni_url||y.selectedType.includes(t.action))return!1;s.commit("setiINoticeJumpPage",!0),J(t.uni_url)})(e,e.buttons[0],t),onLongpress:P((e=>oe(t)),["prevent"]),onTouchend:le,onTouchmove:ce},{default:o((()=>[l(x,{class:"notice-list-item"},{default:o((()=>[l(x,{class:"notice-list-item-left"},{default:o((()=>[e.image?(i(),n(w,{key:0,class:"image",src:e.image,mode:""},null,8,["src"])):g("",!0),0===e.is_read?(i(),n(x,{key:1,class:p(["unread",e.image?"unread-1":"unread-2"])},null,8,["class"])):g("",!0),l(x,{class:p(["notice-list-item-right-top",U(e)])},{default:o((()=>[m(_(e.title),1)])),_:2},1032,["class"])])),_:2},1024),l(x,{class:"notice-list-item-right"},{default:o((()=>[l(x,{class:"notice-list-item-right-bottom"},{default:o((()=>[m(_(e.message),1)])),_:2},1024)])),_:2},1024)])),_:2},1024),e.buttons.length>0?(i(),n(v,{key:0,class:"item-list-button"},{default:o((()=>[l(k,{span:20},{default:o((()=>[m(_(e.buttons[0].title),1)])),_:2},1024),l(k,{span:4,class:"text-right"},{default:o((()=>[!a(y).selectedType.includes(e.buttons[0].action)&&e.buttons[0].uni_url?(i(),n(j,{key:0,class:"iconfont icon-jinru-copy"})):g("",!0)])),_:2},1024)])),_:2},1024)):g("",!0)])),_:2},1032,["onClick","onLongpress"])])),_:2},1032,["id","class"])))),128))])),_:1})])),_:1})])),_:1},8,["scroll-top"])):(i(),n(a(Q),{key:1,index:5,title:a(y).emptyTitle},null,8,["title"]))])),_:1}),l(K,{ref_key:"longPressBoxRef",ref:ne,meus:a(c),position:a(y).positionObj,onChange:re},null,8,["meus","position"]),l(Y),l(Z,{ref_key:"dropDownRef",ref:V,"list-data":a(c),onBtnClick:ee},null,8,["list-data"])])),_:1})}}}),[["__scopeId","data-v-225a62b6"]]);export{U as default};