import{ap as O,d as Q,r,f as W,B as Z,o as p,l as A,w as D,g as y,C as P,a as t,c as f,a2 as b,i as w,y as E,j as F,am as U,J as K,N as Y,ac as $,ad as aa,_ as ea,__tla as ta}from"./index-8c6726e5.js";import{_ as la,__tla as sa}from"./ContentWrap-1defc267.js";import{R as q,__tla as ca}from"./TabNews-2e3cca1c.js";import ra,{__tla as ua}from"./main-4ba22798.js";import na,{__tla as oa}from"./MsgList-967d69ae.js";import{g as ia,__tla as _a}from"./index-976d674f.js";import{u as pa,__tla as ma}from"./useMessage-9f6930df.js";let N,S,B,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,x,j,H,R;S=u=>O.get({url:"/mp/message/page",params:u}),h=u=>($("data-v-bcccc5e5"),u=u(),aa(),u),z={key:0},x=[h(()=>y("span",{class:"el-table__empty-text"},"\u70B9\u51FB\u52A0\u8F7D\u66F4\u591A",-1))],j={key:1,class:"el-table__empty-block"},H=[h(()=>y("span",{class:"el-table__empty-text"},"\u6CA1\u6709\u66F4\u591A\u4E86",-1))],R={class:"msg-send"},N=ea(Q({name:"WxMsg",__name:"main",props:{userId:{type:Number,required:!0}},setup(u){const J=pa(),k=u,m=r(-1),v=r(!1),I=r(!0),_=r([]),n=W({pageNo:1,pageSize:14,accountId:m}),i=W({nickname:"\u7528\u6237",avatar:"/assets/profile-61ae42a9.jpg",accountId:m}),T=r(!1),e=r({type:q.Text,accountId:-1,articles:[]}),V=r(null),s=r(null);Z(async()=>{var l,c;const a=await ia(k.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,L()});const X=async()=>{var l;if(!t(e))return;e.value.type===q.News&&e.value.articles&&e.value.articles.length>1&&(e.value.articles=[e.value.articles[0]],J.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=>O.post({url:"/mp/message/send",data:c}))({userId:k.userId,...e.value});T.value=!1,_.value=[..._.value,a],await M(),(l=V.value)==null||l.clear()},G=()=>{n.pageNo++,C(n,null)},C=async(a,l=null)=>{var g;v.value=!0;let c=await S(Object.assign({pageNo:a.pageNo,pageSize:a.pageSize,userId:k.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 M():o.length!==0&&(await U(),d!==0&&s.value&&(s.value.scrollTop=s.value.scrollHeight-d-100))},L=()=>{C(n)},M=async()=>{await U(),s.value&&(s.value.scrollTop=s.value.scrollHeight)};return(a,l)=>{const c=K,d=la,o=Y;return p(),A(d,null,{default:D(()=>[y("div",{class:"msg-div",ref_key:"msgDivRef",ref:s},[P(y("div",null,null,512),[[o,t(v)]]),t(v)?b("",!0):(p(),f("div",z,[t(I)?(p(),f("div",{key:0,class:"el-table__empty-block",onClick:G},[...x])):b("",!0),t(I)?b("",!0):(p(),f("div",j,[...H]))])),w(na,{list:t(_),"account-id":t(m),user:t(i)},null,8,["list","account-id","user"])],512),P((p(),f("div",R,[w(t(ra),{ref_key:"replySelectRef",ref:V,modelValue:t(e),"onUpdate:modelValue":l[0]||(l[0]=g=>E(e)?e.value=g:null)},null,8,["modelValue"]),w(c,{type:"success",class:"send-but",onClick:X},{default:D(()=>[F("\u53D1\u9001(S)")]),_:1})])),[[o,t(T)]])]),_:1})}}}),[["__scopeId","data-v-bcccc5e5"],["__file","/Users/RuHu.Xu/Desktop/mall-newfeifan-zx-admin/src/views/mp/components/wx-msg/main.vue"]]),B=Object.freeze(Object.defineProperty({__proto__:null,default:N},Symbol.toStringTag,{value:"Module"}))});export{N as W,va as __tla,S as g,B as m};
