main-a835c6f0.js 3.6 KB

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