import{ar as q,d as F,r,f as C,m as L,o as p,x as G,w as M,h as y,y as P,a as t,c as f,R as k,g as w,Q as K,q as X,ao as W,D as Y,J as Z,p as $,l as aa,_ as ea,__tla as ta}from"./index-7d5b26d3.js";import{_ as la,__tla as sa}from"./ContentWrap-07931e94.js";import{R as J,__tla as ca}from"./TabNews-de7a08d4.js";import ra,{__tla as ua}from"./main-52d31c01.js";import na,{__tla as oa}from"./MsgList-99d0587d.js";import{g as ia,__tla as _a}from"./index-851bec07.js";import{u as pa,__tla as ma}from"./useMessage-c81eaa5b.js";let S,x,Q,va=Promise.all([(()=>{try{return ta}catch{}})(),(()=>{try{return sa}catch{}})(),(()=>{try{return ca}catch{}})(),(()=>{try{return ua}catch{}})(),(()=>{try{return oa}catch{}})(),(()=>{try{return _a}catch{}})(),(()=>{try{return ma}catch{}})()]).then(async()=>{let h,z,N,T,j,O;x=u=>q.get({url:"/mp/message/page",params:u}),h=u=>($("data-v-bcccc5e5"),u=u(),aa(),u),z={key:0},N=[h(()=>y("span",{class:"el-table__empty-text"},"\u70B9\u51FB\u52A0\u8F7D\u66F4\u591A",-1))],T={key:1,class:"el-table__empty-block"},j=[h(()=>y("span",{class:"el-table__empty-text"},"\u6CA1\u6709\u66F4\u591A\u4E86",-1))],O={class:"msg-send"},S=ea(F({name:"WxMsg",__name:"main",props:{userId:{type:Number,required:!0}},setup(u){const U=pa(),b=u,m=r(-1),v=r(!1),I=r(!0),_=r([]),n=C({pageNo:1,pageSize:14,accountId:m}),i=C({nickname:"\u7528\u6237",avatar:"/assets/profile-61ae42a9.jpg",accountId:m}),R=r(!1),e=r({type:J.Text,accountId:-1,articles:[]}),V=r(null),s=r(null);L(async()=>{var l,c;const a=await ia(b.userId);i.nickname=((l=a.nickname)==null?void 0:l.length)>0?a.nickname:i.nickname,i.avatar=((c=i.avatar)==null?void 0:c.length)>0?a.avatar:i.avatar,m.value=a.accountId,e.value.accountId=a.accountId,E()});const A=async()=>{var l;if(!t(e))return;e.value.type===J.News&&e.value.articles&&e.value.articles.length>1&&(e.value.articles=[e.value.articles[0]],U.success("\u56FE\u6587\u6D88\u606F\u6761\u6570\u9650\u5236\u5728 1 \u6761\u4EE5\u5185\uFF0C\u5DF2\u9ED8\u8BA4\u53D1\u9001\u7B2C\u4E00\u6761"));const a=await(c=>q.post({url:"/mp/message/send",data:c}))({userId:b.userId,...e.value});R.value=!1,_.value=[..._.value,a],await H(),(l=V.value)==null||l.clear()},B=()=>{n.pageNo++,D(n,null)},D=async(a,l=null)=>{var g;v.value=!0;let c=await x(Object.assign({pageNo:a.pageNo,pageSize:a.pageSize,userId:b.userId,accountId:a.accountId},l));const d=((g=s.value)==null?void 0:g.scrollHeight)??0,o=c.list.reverse();_.value=[...o,..._.value],v.value=!1,(o.length<n.pageSize||o.length===0)&&(I.value=!1),n.pageNo=a.pageNo,n.pageSize=a.pageSize,n.pageNo===1?await H():o.length!==0&&(await W(),d!==0&&s.value&&(s.value.scrollTop=s.value.scrollHeight-d-100))},E=()=>{D(n)},H=async()=>{await W(),s.value&&(s.value.scrollTop=s.value.scrollHeight)};return(a,l)=>{const c=Y,d=la,o=Z;return p(),G(d,null,{default:M(()=>[y("div",{class:"msg-div",ref_key:"msgDivRef",ref:s},[P(y("div",null,null,512),[[o,t(v)]]),t(v)?k("",!0):(p(),f("div",z,[t(I)?(p(),f("div",{key:0,class:"el-table__empty-block",onClick:B},[...N])):k("",!0),t(I)?k("",!0):(p(),f("div",T,[...j]))])),w(na,{list:t(_),"account-id":t(m),user:t(i)},null,8,["list","account-id","user"])],512),P((p(),f("div",O,[w(t(ra),{ref_key:"replySelectRef",ref:V,modelValue:t(e),"onUpdate:modelValue":l[0]||(l[0]=g=>K(e)?e.value=g:null)},null,8,["modelValue"]),w(c,{type:"success",class:"send-but",onClick:A},{default:M(()=>[X("\u53D1\u9001(S)")]),_:1})])),[[o,t(R)]])]),_:1})}}}),[["__scopeId","data-v-bcccc5e5"],["__file","D:/zx/mall-newfeifan-zx-business/src/views/mp/components/wx-msg/main.vue"]]),Q=Object.freeze(Object.defineProperty({__proto__:null,default:S},Symbol.toStringTag,{value:"Module"}))});export{S as W,va as __tla,x as g,Q as m};
