<!--pages/chat-room/chat-room.wxml-->
<scroll-view scroll-y="true" class="chat-room">
    <view class="otherItem" bindtap="into_groups">
        <image src="{{imgPath}}/chat-group.png"></image>
        <text>群组</text>
    </view>
    <view class="chat" wx:for="{{arr}}" wx:key="i" data-item="{{item}}" catchtap="into_chatRoom" bindlongtap="del_chat">
        <image class="photo" src="{{ (item.chatType == 'groupchat' || item.chatType == 'chatRoom') ? imgPath + '/chat-group2.png' : (item.info.from == item.username ? item.info.fromInfo.avatarurl : item.info.toInfo.avatarurl) || imgPath + '/chat-user.png'}}" mode="cover"></image>
        <view class="item-row">
            <text class="chat-name">{{(item.chatType == 'groupchat' || item.chatType == 'chatRoom' || item.groupName) ? item.groupName : (item.info.from == item.username ? item.info.fromInfo.nickname : item.info.toInfo.nickname || item.username)}}</text>
            <text class="chat-time">{{item.time}}</text>
            <text class="chat-content" wx:if="{{item.msg.data[0].data}}">{{item.msg.data[0].data}}</text>
            <text class="chat-content" wx:if="{{item.msg.type == 'img'}}">[图片]</text>
            <text class="chat-content" wx:if="{{item.msg.type == 'audio'}}">[语音]</text>
            <text class="chat-content" wx:if="{{item.msg.type == 'video'}}">[视频]</text>
            <text class="unread-num" wx:if="{{item.unReadCount > 0 || item.unReadCount == '99+'}}">{{item.unReadCount}}</text>
        </view>
    </view>
    <view wx:if="{{arr.length == 0}}" class="chat_noChat">
        当前没有历史聊天，添加一个好友开始聊天吧
    </view>
</scroll-view>

<!-- bug: margin-bottom 不生效 需要加一个空标签-->
<view style="height: 1px;"></view>

<view class="mask" bindtap="close_mask" wx:if="{{show_mask}}"></view>

<view class="scan-jion-group" bindtap="scanJoinGroup">
    <text>扫一扫</text>
    <text>加入群聊</text>
</view>