2 lines
18 KiB
JavaScript
2 lines
18 KiB
JavaScript
|
import{u as t,s as a,_ as e,a as s,r as l,b as n,o as c,c as i,w as o,n as u,d,F as r,e as m,f as g,g as f,h as p,i as h,t as _,j as b,k as x,l as C,m as y,$ as k,p as I,q as T,v,x as w,y as S,z as j,A as P,B as N}from"./index-22d2df30.js";import{e as L,_ as M}from"./emoji.c33868a4.js";import{r as A}from"./uni-app.es.06715d18.js";import{s as B}from"./status.1eeec7ff.js";import W from"./pages-contacts-index.fbcd4de6.js";import{s as $}from"./scan.9bf28f6f.js";const q=t(a);const D=e({name:"message-list",props:{msgs:{type:Array,default:function(){return[]}},btnWidth:{type:Number,default:320}},components:{statusPoint:B},data:()=>({msgsIn:[],damping:.29,moveIndex:-1,x:0,oX:0,scY:!0,btnWidthpx:160,touchStart:!1,modalName:null,listTouchStart:0,listTouchDirection:null,emojiMap:[],chatStatus:!0,paddingB:0,appSetting:q.appSetting,globalConfig:q.globalConfig}),created:function(){this.init(this.msgs),this.btnWidthpx=-1*s(this.btnWidth)+2;let t=[];L.forEach((function(a){let e=a.children;e.length>0&&e.forEach((function(a){let e=a.name,s=a.src;t[e]=s}))})),this.emojiMap=t,this.paddingB=this.inlineTools},watch:{msgs:function(t){this.init(t)}},methods:{init:function(t){this.moveIndex=-1,this.msgsIn=t.filter((t=>t.lastContent))},scrolltolower:function(){},emojiToHtml(t){if(!t)return;let a=this.emojiMap;return t.replace(/\[!(\w+)\]/gi,(function(t,e){var s=e;return a[s]?'<img class=\'mr-5\' style="width:18px;height:18px" emoji-name="'.concat(e,'" src="').concat(a[s],'" />'):"[!".concat(e,"]")}))},ListTouchStart(t){this.listTouchStart=t.touches[0].pageX},ListTouchMove(t){let a=t.touches[0].pageX-this.listTouchStart;Math.abs(a)>100&&a<0?this.listTouchDirection="left":this.listTouchDirection="right"},ListTouchEnd(t){"left"==this.listTouchDirection?(this.modalName=t.currentTarget.dataset.target,this.chatStatus=!1):this.modalName=null,this.listTouchDirection=null},openChat(t,a){this.chatStatus?this.$emit("itemTap",t,a):this.chatStatus=!0},from_time(t){return this.$util.timeFormat(t)},btnTap(t,a){this.$emit("btnTap",t,a)}}},[["render",function(t,a,e,s,C,y){const k=b,I=l("Tags"),T=l("statusPoint"),v=x,w=A(n("mp-html"),M),S=l("Empty");return c(),i(k,{class:"im-message-list"},{default:o((()=>[C.msgsIn.length>0?(c(),i(k,{key:0,class:"cu-list menu-avatar",style:u({paddingBottom:C.paddingB+"px"})},{default:o((()=>[(c(!0),d(r,null,m(C.msgsIn,((t,a)=>(c(),i(k,{class:g(["cu-item",[C.modalName=="move-box-"+a?"move-cur":"",1==t.is_top?"top-contacts":"",0==t.is_group?"third":"second"]]),key:a,onTouchstart:y.ListTouchStart,onTouchmove:y.ListTouchMove,onTouchend:y.ListTouchEnd,onClick:e=>y.openChat(a,t),"data-target":"move-box-"+a},{default:o((()=>[f(k,{class:g(["cu-avatar lg",C.appSetting.circleAvatar?"round":"radius"]),style:u([{backgroundImage:"url("+t.avatar+")"}])},null,8,["class","style"]),f(k,{class:"content"},{default:o((()=>[f(k,{class:"c-333"},{default:o((()=>[1==t.is_group?(c(),i(I,{key:0,text:"群聊",size:"mini"})):p("",!0),t.is_online&&0==t.is_group&&1==C.globalConfig.chatInfo.online?(c(),i(T,{key:1,type:"success"})):p("",!0),f(k,{class:"text-overflow f-16",style:{width:"80%"}},{default:o((()=>[h(_(t.displayName),1)])),_:2},1024)])),_:2},1024),f(k,{class:"im-flex im-justify-content-start im-align-items-start pt-5",style:{height:"50rpx",overflow:"hidden"}},{default:o((()=>[f(k,{class:"text-gray text-sm"},{default:o((()=>[t.unread>0&&0==t.is_notice?(c(),i(v,{key:0},{default:o((()=>[h("["+_(t.unread)+"条未读] ",1)])),_:2},1024)):p("",!0)])),_:2},1024),f(w,{content:y.emojiToHtml(t.lastContent),class:"im-flex text-gray text-sm text-overflow no-click"},null,8,["content"])])),_:2},1024)])),_:2},1024),f(k,{class:"action"},{default:o((()=>[f(k,{class:"text-grey text-xs"},{default:o((()=>[h(_(y.from_time(t.lastSendTime)),1)])),_:2},1024),t.unread>0&&t.is_notice?(c(),i(k,{key:0,class:"cu-tag round bg-red sm"},{default:o((()=>[h(_(t.unread),1)])),_:2},1024)):p("",!0),0==t.is_notice?(c(),i(k,{key:1,class:"c-999"},{default:o((()=>[f(v,{class:"cuIcon-musicforbidfill"})])),_:1})):p("",!0)])),_:2},1024),f(k,{class:g(["move",0==t.is_group?"third":"second"])},{
|