<wxs src="../../../../../../filters/filter.wxs" module="filter"></wxs>
<view class="container">
<scroll-view  class="message-list-container" scroll-y="true"   scroll-into-view="{{jumpAim}}" refresher-enabled="{{true}}" bindrefresherrefresh="refresh" refresher-triggered="{{triggered}}" lower-threshold="200"  bindscrolltolower="scrollHandler">
    <view class="no-message" wx:if="{{isCompleted}}">没有更多啦</view>
    <!-- <text style="display: none;">{{filter.toS(messageList[messageList.length-1])}}</text> -->
    <view class="t-message" wx:if="{{conversation.type !== '@TIM#SYSTEM'}}" wx:for="{{messageList}}" wx:key="index"  data-index ='{{index}}'  hidden="{{!(item.payload.data && (filter.formateText(item.payload.data).message_type!=20) || item.type!='TIMCustomElem') || filter.formateText(item.payload.data).message_type==16 || filter.formateText(item.payload.data).message_type==14}}">
         <view class="time-pop-mask" data-value="{{item.time}}" wx:if="{{showMessageTime}}">
             <view class="showmessagetime" wx:if="{{item.isShowTime}}">
             <text class="time"  wx:if="{{!item.isDeleted && !item.isRevoked}}">{{messageTime}} </text> 
             </view>
         </view>
          <view class="time-pop-mask" data-value="{{item.time}}" wx:if="{{showMessageHistoryTime}}">
             <view class="showmessagetime" wx:if="{{item.isShowHistoryTime && !item.isShowTime && !item.isShowMoreHistoryTime}}">
             <text class="time"  wx:if="{{!item.isDeleted && !item.isRevoked}}">{{messageHistoryTime}} </text> 
             </view>
         </view>
         <view class="time-pop-mask"   wx:if="{{item.isShowMoreHistoryTime}}">
             <view class="showmessagetime">
             <text class="time">{{newArr[item.ID]}} </text> 
             </view>
         </view>
    <RevokeMessage wx:if="{{item.isRevoked}}" message="{{item}}" isMine="{{item.flow === 'out'}}" bind:resendMessage="resendMessage"/>
        <view class="t-message-item"   wx:if="{{!item.isDeleted && !item.isRevoked }}" bindtap="handleEditToggleAvatar" >
            <view wx:if="{{Show}}" catchtap="handleEditToggleAvatar">
            <view class="label-pop"  wx:if="{{messageID === concat.connect('ID-',item.ID) && item.type!='TIMCustomElem'}}" class="{{item.flow === 'out' ? 'label-self-body' : 'label-recieve-body'}}" >
                <view class="label-pop-mask" >
                    <view class="copymessage" wx:if="{{item.type === 'TIMTextElem'|| item.type === 'TIMFaceElem'}}" catchtap="copyMessage" > <text>复制</text>
                    </view>
                    <!-- <view class="deletemessage" catchtap="deleteMessage" > <text> 删除</text>
                    </view> -->
                    <!-- <view  class="revokemessage" wx:if="{{item.flow === 'out'}}" bindtap="revokeMessage"><text> ｜撤回</text> 
                    </view>-->
                </view>
                </view>
            </view>
            <TipMessage  wx:if="{{item.type === 'TIMGroupTipElem'}}" message="{{item}}"/>
            <view  wx:if="{{item.type !== 'TIMGroupTipElem'}}"   class="{{item.flow === 'out' ? 't-self-message':'t-recieve-message'}} {{item.type=='TIMCustomElem'?'custom_center':''}}" >
           
                <image class="t-message-avatar" wx:if="{{(item.flow === 'in' && item.type!='TIMCustomElem') || (item.flow === 'in' && item.type=='TIMCustomElem' && filter.formateText(item.payload.data).message_type==7) || (item.flow === 'in'  && item.type=='TIMCustomElem'  && filter.formateText(item.payload.data).message_type==12) || (item.flow === 'in' && item.type=='TIMCustomElem' && !item.cloudCustomData)}}" src="{{item.avatar || img_host+'/doctor_avatar.png'}}" data-value="{{item}}" bindtap="getMemberProfile" />
                <view class="read-receipts" wx:if="{{conversation.type === 'C2C' && item.flow==='out' }}">
                    <view wx:if="{{item.isPeerRead}}" >已读</view>
                    <view wx:else>未读</view>
                </view>
                 <view wx:if="{{item.flow === 'out' && item.ID === errorMessageID || item.status === 'fail'}}" class="t-message-error-box">
                 <image class="t-message-error" wx:if="{{showMessageError}}" src='../../../../static/images/tuikit-msg-error.png' bindtap="ResendMessage" />
                </view>
                <view  class="{{item.flow === 'out' ? 't-self-message-body':'t-recieve-message-body'}}"  catch:longpress="handleLongPress" data-index='{{index}}'  data-value='{{item}}' id="{{concat.concat(conversation.type,'ID-',item.ID)}}" message-value="{{item}}" >
                    <TextMessage wx:if="{{item.type === 'TIMTextElem'}}" message="{{item}}" isMine="{{item.flow === 'out'}}" />
                    <ImageMessage wx:if="{{item.type === 'TIMImageElem'}}" message="{{item}}" isMine="{{item.flow === 'out'}}" />
                    <VideoMessage  wx:if="{{item.type === 'TIMVideoFileElem'}}" message="{{item}}" isMine="{{item.flow === 'out'}}"/>
                    <AudioMessage wx:if="{{item.type === 'TIMSoundElem'}}"  message="{{item}}" data-index ='{{index}}' messageList="{{messageList}}" bind:closeAudio="closeAudio" id="audio{{item.ID}}" isMine="{{item.flow === 'out'}}"/>
                    <CustomMessage style="width:100vw" bind:popComment="popComment"  wx:if="{{item.type === 'TIMCustomElem' && filter.formateText(item.payload.data).message_type!=6 && filter.formateText(item.payload.data).message_type!=11 && filter.formateText(item.payload.data).message_type!=20 && filter.formateText(item.payload.data).message_type!==0 &&  filter.formateText(item.payload.data).message_type!=14}}" message="{{item}}" isMine="{{item.flow === 'out'}}" bindtap="handleJumpLink" data-value = "{{item}}" class="{{(item.type === 'TIMCustomElem' && filter.formateText(item.payload.data).message_type==2)?'custom'+filter.formateText(item.payload.data).data.order_inquiry_id:''}}" patient_data="{{filter.formateText(item.cloudCustomData).patient_family_data}}"/>
                    <FaceMessage wx:if="{{item.type === 'TIMFaceElem'}}" message="{{item}}" isMine="{{item.flow === 'out'}}"/>
                    <FileMessage wx:if="{{item.type === 'TIMFileElem'}}" message="{{item}}" isMine="{{item.flow === 'out'}}"/>
                    <MergerMessage wx:if="{{item.type === 'TIMRelayElem'}}"  message="{{item}}" isMine="{{item.flow === 'out'}}"/>
                </view>
                <image class="t-message-avatar" wx:if="{{(item.flow === 'out' && item.type!='TIMCustomElem') || (item.flow=== 'out' && item.type=='TIMCustomElem' && filter.formateText(item.payload.data).message_type==10) || (item.flow=== 'out' && item.type=='TIMCustomElem' && filter.formateText(item.payload.data).message_type==12) || (item.flow === 'out' && item.type=='TIMCustomElem' && !item.cloudCustomData)}}"  src="{{item.avatar || 'https://img.applets.igandanyiyuan.com/applet/patient/static/patient_avatar.png'}}"  data-value="{{item}}" bindtap="getMemberProfile"/>
            </view>
        </view>
    </view>
    <view class="t-message" wx:if="{{conversation.type === '@TIM#SYSTEM'}}"  wx:for="{{messageList}}" wx:key="index" id="{{filterSystemMessageID}}" data-value="{{item.ID}}">
        <SystemMessage  message="{{item}}" bind:changeSystemMessageList="changeSystemMessageList"></SystemMessage>
    </view>
</scroll-view>
</view>
<view wx:if="{{showDownJump}}" bindtap="handleJumpNewMessage" style="display: none;">
    <view class="new-message-item" > 
    <view class="new-message-box">
    <image class="icon-left" src="../../../static/assets/down.svg"/>
    <text>{{showNewMessageCount.length}}条新消息</text>
    </view>
    </view>
</view>
<view wx:if="{{showUpJump}}" bindtap="handleJumpUnreadMessage" >
    <view class="unread-message-item" > 
    <view class="unread-message-box">
    <image class="icon-left" src="../../../static/assets/up.svg"/>
    <text wx:if="{{isLostsOfUnread}}"> 99+条未读</text>
    <text wx:else> {{unreadCount}}条未读</text>
    </view>
    </view>
</view>
<wxs src = './concat.wxs' module = 'concat'/>