import{aq as R,d as L,r,e as W,l as X,o as p,v as G,w as q,g as y,x as D,a as t,c as f,Q as k,f as w,P as J,n as K,an as M,C as Y,I as Z,p as $,k as aa,_ as ea,__tla as ta}from"./index-04f8d540.js";import{_ as la,__tla as sa}from"./ContentWrap-0137c911.js";import{R as Q,__tla as ca}from"./TabNews-5158c822.js";import ra,{__tla as ua}from"./main-aec36644.js";import na,{__tla as oa}from"./MsgList-2dfa52c5.js";import{g as ia,__tla as _a}from"./index-3e1d22b4.js";import{u as pa,__tla as ma}from"./useMessage-9c37e840.js";let S,x,U,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,V;x=u=>R.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))],V={class:"msg-send"},S=ea(L({name:"WxMsg",__name:"main",props:{userId:{type:Number,required:!0}},setup(u){const A=pa(),I=u,m=r(-1),v=r(!1),b=r(!0),_=r([]),n=W({pageNo:1,pageSize:14,accountId:m}),i=W({nickname:"\u7528\u6237",avatar:"/assets/profile-61ae42a9.jpg",accountId:m}),C=r(!1),e=r({type:Q.Text,accountId:-1,articles:[]}),H=r(null),s=r(null);X(async()=>{var l,c;const a=await ia(I.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,F()});const B=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]],A.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=>R.post({url:"/mp/message/send",data:c}))({userId:I.userId,...e.value});C.value=!1,_.value=[..._.value,a],await P(),(l=H.value)==null||l.clear()},E=()=>{n.pageNo++,O(n,null)},O=async(a,l=null)=>{var g;v.value=!0;let c=await x(Object.assign({pageNo:a.pageNo,pageSize:a.pageSize,userId:I.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)&&(b.value=!1),n.pageNo=a.pageNo,n.pageSize=a.pageSize,n.pageNo===1?await P():o.length!==0&&(await M(),d!==0&&s.value&&(s.value.scrollTop=s.value.scrollHeight-d-100))},F=()=>{O(n)},P=async()=>{await M(),s.value&&(s.value.scrollTop=s.value.scrollHeight)};return(a,l)=>{const c=Y,d=la,o=Z;return p(),G(d,null,{default:q(()=>[y("div",{class:"msg-div",ref_key:"msgDivRef",ref:s},[D(y("div",null,null,512),[[o,t(v)]]),t(v)?k("",!0):(p(),f("div",z,[t(b)?(p(),f("div",{key:0,class:"el-table__empty-block",onClick:E},[...N])):k("",!0),t(b)?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),D((p(),f("div",V,[w(t(ra),{ref_key:"replySelectRef",ref:H,modelValue:t(e),"onUpdate:modelValue":l[0]||(l[0]=g=>J(e)?e.value=g:null)},null,8,["modelValue"]),w(c,{type:"success",class:"send-but",onClick:B},{default:q(()=>[K("\u53D1\u9001(S)")]),_:1})])),[[o,t(C)]])]),_:1})}}}),[["__scopeId","data-v-bcccc5e5"],["__file","D:/zx/mall-newfeifan-zx-business/src/views/mp/components/wx-msg/main.vue"]]),U=Object.freeze(Object.defineProperty({__proto__:null,default:S},Symbol.toStringTag,{value:"Module"}))});export{S as W,va as __tla,x as g,U as m};
