import{ap as P,d as L,r,f as R,B as Q,o as p,l as F,w as W,g as y,C as q,a as t,c as f,a2 as k,i as w,y as K,j as X,am as A,J as Y,N as Z,ac as $,ad as aa,_ as ea,__tla as ta}from"./index-2c56227b.js";import{_ as la,__tla as sa}from"./ContentWrap-f1610353.js";import{R as B,__tla as ca}from"./TabNews-a02bda41.js";import ra,{__tla as ua}from"./main-38095b0f.js";import na,{__tla as oa}from"./MsgList-95a78064.js";import{g as ia,__tla as _a}from"./index-b613add5.js";import{u as pa,__tla as ma}from"./useMessage-96878a4a.js";let N,S,D,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,O;S=u=>P.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))],O={class:"msg-send"},N=ea(L({name:"WxMsg",__name:"main",props:{userId:{type:Number,required:!0}},setup(u){const E=pa(),I=u,m=r(-1),v=r(!1),b=r(!0),_=r([]),n=R({pageNo:1,pageSize:14,accountId:m}),i=R({nickname:"\u7528\u6237",avatar:"/assets/profile-61ae42a9.jpg",accountId:m}),T=r(!1),e=r({type:B.Text,accountId:-1,articles:[]}),V=r(null),s=r(null);Q(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,U()});const G=async()=>{var l;if(!t(e))return;e.value.type===B.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(c=>P.post({url:"/mp/message/send",data:c}))({userId:I.userId,...e.value});T.value=!1,_.value=[..._.value,a],await M(),(l=V.value)==null||l.clear()},J=()=>{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: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 M():o.length!==0&&(await A(),d!==0&&s.value&&(s.value.scrollTop=s.value.scrollHeight-d-100))},U=()=>{C(n)},M=async()=>{await A(),s.value&&(s.value.scrollTop=s.value.scrollHeight)};return(a,l)=>{const c=Y,d=la,o=Z;return p(),F(d,null,{default:W(()=>[y("div",{class:"msg-div",ref_key:"msgDivRef",ref:s},[q(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:J},[...x])):k("",!0),t(b)?k("",!0):(p(),f("div",j,[...H]))])),w(na,{list:t(_),"account-id":t(m),user:t(i)},null,8,["list","account-id","user"])],512),q((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:G},{default:W(()=>[X("\u53D1\u9001(S)")]),_:1})])),[[o,t(T)]])]),_:1})}}}),[["__scopeId","data-v-bcccc5e5"],["__file","E:/GAOHP_2023/mall/newfeifan-front/yudao-ui-admin-vue3/src/views/mp/components/wx-msg/main.vue"]]),D=Object.freeze(Object.defineProperty({__proto__:null,default:N},Symbol.toStringTag,{value:"Module"}))});export{N as W,va as __tla,S as g,D as m};
