import{az as R,d as L,r as c,x as W,b as Q,o as p,A as F,B as D,C as y,k as P,a as t,c as f,D as b,f as N,a2 as G,E as J,n as q,K as X,Z as Y,M as $,N as aa,__tla as ea}from"./index-92ad187a.js";import{_ as ta,__tla as la}from"./ContentWrap.vue_vue_type_script_setup_true_lang-c7ede7df.js";import{R as A,__tla as sa}from"./TabNews-edcbd2d2.js";import ra,{__tla as ca}from"./main-bac3c171.js";import ua,{__tla as na}from"./MsgList-0c2e528d.js";import{g as oa,__tla as _a}from"./index-07d35dd2.js";import{u as ia,__tla as pa}from"./useMessage-d9788660.js";import{_ as da}from"./_plugin-vue_export-helper-1b428a4d.js";let S,w,B,ma=Promise.all([(()=>{try{return ea}catch{}})(),(()=>{try{return la}catch{}})(),(()=>{try{return sa}catch{}})(),(()=>{try{return ca}catch{}})(),(()=>{try{return na}catch{}})(),(()=>{try{return _a}catch{}})(),(()=>{try{return pa}catch{}})()]).then(async()=>{let h,z,x,j,M,T;w=u=>R.get({url:"/mp/message/page",params:u}),h=u=>($("data-v-d01ad444"),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"},M=[h(()=>y("span",{class:"el-table__empty-text"},"\u6CA1\u6709\u66F4\u591A\u4E86",-1))],T={class:"msg-send"},S=da(L({name:"WxMsg",__name:"main",props:{userId:{type:Number,required:!0}},setup(u){const E=ia(),k=u,d=c(-1),m=c(!1),I=c(!0),i=c([]),n=W({pageNo:1,pageSize:14,accountId:d}),_=W({nickname:"\u7528\u6237",avatar:"/assets/profile-61ae42a9.jpg",accountId:d}),V=c(!1),e=c({type:A.Text,accountId:-1,articles:[]}),C=c(null),s=c(null);Q(async()=>{var l,r;const a=await oa(k.userId);_.nickname=((l=a.nickname)==null?void 0:l.length)>0?a.nickname:_.nickname,_.avatar=((r=_.avatar)==null?void 0:r.length)>0?a.avatar:_.avatar,d.value=a.accountId,e.value.accountId=a.accountId,Z()});const K=async()=>{var l;if(!t(e))return;e.value.type===A.News&&e.value.articles&&e.value.articles.length>1&&(e.value.articles=[e.value.articles[0]],E.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(r=>R.post({url:"/mp/message/send",data:r}))({userId:k.userId,...e.value});V.value=!1,i.value=[...i.value,a],await O(),(l=C.value)==null||l.clear()},U=()=>{n.pageNo++,H(n,null)},H=async(a,l=null)=>{var g;m.value=!0;let r=await w(Object.assign({pageNo:a.pageNo,pageSize:a.pageSize,userId:k.userId,accountId:a.accountId},l));const v=((g=s.value)==null?void 0:g.scrollHeight)??0,o=r.list.reverse();i.value=[...o,...i.value],m.value=!1,(o.length<n.pageSize||o.length===0)&&(I.value=!1),n.pageNo=a.pageNo,n.pageSize=a.pageSize,n.pageNo===1?await O():o.length!==0&&(await q(),v!==0&&s.value&&(s.value.scrollTop=s.value.scrollHeight-v-100))},Z=()=>{H(n)},O=async()=>{await q(),s.value&&(s.value.scrollTop=s.value.scrollHeight)};return(a,l)=>{const r=X,v=ta,o=Y;return p(),F(v,null,{default:D(()=>[y("div",{class:"msg-div",ref_key:"msgDivRef",ref:s},[P(y("div",null,null,512),[[o,t(m)]]),t(m)?b("",!0):(p(),f("div",z,[t(I)?(p(),f("div",{key:0,class:"el-table__empty-block",onClick:U},x)):b("",!0),t(I)?b("",!0):(p(),f("div",j,M))])),N(ua,{list:t(i),"account-id":t(d),user:t(_)},null,8,["list","account-id","user"])],512),P((p(),f("div",T,[N(t(ra),{ref_key:"replySelectRef",ref:C,modelValue:t(e),"onUpdate:modelValue":l[0]||(l[0]=g=>G(e)?e.value=g:null)},null,8,["modelValue"]),N(r,{type:"success",class:"send-but",onClick:K},{default:D(()=>[J("\u53D1\u9001(S)")]),_:1})])),[[o,t(V)]])]),_:1})}}}),[["__scopeId","data-v-d01ad444"]]),B=Object.freeze(Object.defineProperty({__proto__:null,default:S},Symbol.toStringTag,{value:"Module"}))});export{S as W,ma as __tla,w as g,B as m};
