<!-- pages/wechat2/wechat2.wxml -->
<view class='news' bindtap="closeEmotionVisible">
    <view class="historycon">
        <scroll-view scroll-y="{{ true }}" scroll-into-view="{{scrollid}}" scroll-with-animation="{{true}}" style="height:{{scrollHeight}}" class="history">
            <!-- 历史记录部分start -->
            <view wx:if="{{historyList.length > 0}}">
                <view class="historyText">历史消息</view>
                <block wx:for="{{historyList}}" wx:key="index">
                    <!-- 正常消息 左 -->
                    <view wx:if="{{item.type==1 && item.messageType == 0}}" id="historyscrollid{{index}}">
                        <view>
                            <text class='chat-time' style="display:none;">{{item.date}}</text>
                        </view>
                        <view class='other-record'>
                            <image class='other-head-img' src='{{item.senderHeadPortrait}}'></image>
                            <view class='other-record-content-triangle'></view>
                            <view class='other-record-content' style="user-select:text!important;-webkit-user-select:text">
                                <text selectable="{{true}}" user-select='true'>{{item.content}}</text>
                                <!-- <view class="msg-isRead left">{{ item.isRead ? '已读' : '未读' }}</view> -->
                            </view>
                        </view>
                    </view>
                    <!-- 正常消息 右 -->
                    <view id="historyscrollid{{index}}" wx:elif="{{item.type==0 && item.messageType == 0}}">
                        <view>
                            <text class='chat-time' style="display:none;">{{item.date}}</text>
                        </view>
                        <view class='own-record'>
                            <view class='own-record-content' style="user-select:text!important;-webkit-user-select:text">
                                <text selectable="{{true}}" user-select='true'>{{item.content}}</text>
                                <view class="msg-isRead right">
                                    {{ item.isRead ? '已读' : '未读' }}
                                </view>
                            </view>
                            <view class='own-record-content-triangle'></view>
                            <image class='own-head-img' src='{{item.senderHeadPortrait}}'></image>
                        </view>
                    </view>
                    <!-- 发送图片 左 -->
                    <view wx:elif="{{item.type==1 && item.messageType == 2}}" id="historyscrollid{{index}}">
                        <view>
                            <text class='chat-time' style="display:none;">{{item.date}}</text>
                        </view>
                        <view class='other-record'>
                            <image class='other-head-img' src='{{item.senderHeadPortrait}}'></image>
                            <view class='other-record-content-triangle'></view>
                            <view class='other-record-content'>
                                <image class='content-img' src="{{ mangerUrl + item.content }}" data-url="{{ mangerUrl + item.content }}" bindtap="viewImg" mode="widthFix"></image>
                                <!-- <view class="msg-isRead left">{{ item.isRead ? '已读' : '未读' }}</view> -->
                            </view>
                        </view>
                    </view>
                    <!-- 发送图片 右 -->
                    <view id="historyscrollid{{index}}" wx:elif="{{item.type==0 && item.messageType == 2}}">
                        <view>
                            <text class='chat-time' style="display:none;">{{item.date}}</text>
                        </view>
                        <view class='own-record'>
                            <view class='own-record-content' style="user-select:text!important;-webkit-user-select:text">
                                <image class='content-img' src="{{ mangerUrl + item.content }}" data-url="{{ mangerUrl + item.content }}" bindtap="viewImg" mode="widthFix"></image>
                                <view class="msg-isRead right">
                                    {{ item.isRead ? '已读' : '未读' }}
                                </view>
                            </view>
                            <view class='own-record-content-triangle'></view>
                            <image class='own-head-img' src='{{item.senderHeadPortrait}}'></image>
                        </view>
                    </view>
                    <!-- 由你发起沟通详情 -->
                    <view wx:else class="product-item-view" bindtap="goDetails" data-value="{{ item.transactionId }}">
                        <view class="content-view">
                            <view class="product-info-item">{{ item.object.info }}</view>
                            <view class="product-send-time">{{ item.date }} 由{{ receiveMemberId != item.sender ? '对方':'你' }}发起沟通</view>
                        </view>
                    </view>
                </block>
                <view class="historyText" id="lastHistoryText">以上为历史消息</view>
            </view>
            <!-- 历史记录部分end -->
            <view wx:if="{{ newsList.length == 0}}" id="scrollid0"></view>
            <block wx:for="{{newsList}}" wx:key="index">
                <!-- 正常消息 左 -->
                <view wx:if="{{item.type==1 && item.messageType == 0}}" id="scrollid{{index}}">
                    <view>
                        <text class='chat-time' style="display:none;">{{item.date}}</text>
                    </view>
                    <view class='other-record'>
                        <image class='other-head-img' src='{{receivebaseInfo.avatar}}'></image>
                        <view class='other-record-content-triangle'></view>
                        <view class='other-record-content' style="user-select:text!important;-webkit-user-select:text">
                            <text selectable="{{true}}">{{item.message}}</text>
                            <!-- <view class="msg-isRead left">{{ item.isRead ? '已读' : '未读' }}</view> -->
                        </view>
                    </view>
                </view>
                <!-- 正常消息 右 -->
                <view id="scrollid{{index}}" wx:elif="{{item.type==0 && item.messageType == 0}}">
                    <view>
                        <text class='chat-time' style="display:none;">{{item.date}}</text>
                    </view>
                    <view class='own-record'>
                        <view class='own-record-content' style="user-select:text!important;-webkit-user-select:text">
                            <text selectable="{{true}}" user-select='true'>{{item.message}}</text>
                            <view class="msg-isRead right">{{ item.isRead ? '已读' : '未读' }}</view>
                        </view>
                        <view class='own-record-content-triangle'></view>
                        <image class='own-head-img' src='{{sendAvatar}}'></image>
                    </view>
                </view>
                <!-- 图片消息 左 -->
                <view wx:elif="{{item.type==1 && item.messageType == 2}}" id="scrollid{{index}}">
                    <view>
                        <text class='chat-time' style="display:none;" user-select='true'>{{item.date}}</text>
                    </view>
                    <view class='other-record'>
                        <image class='other-head-img' src='{{receivebaseInfo.avatar}}'></image>
                        <view class='other-record-content-triangle'></view>
                        <view class='other-record-content'>
                            <image class='content-img' src="{{ mangerUrl + item.message }}" data-url="{{ mangerUrl + item.message }}" bindtap="viewImg" mode="widthFix"></image>
                            <!-- <view class="msg-isRead left">{{ item.isRead ? '已读' : '未读' }}</view> -->
                        </view>
                    </view>
                </view>
                <!-- 图片消息 右 -->
                <view id="scrollid{{index}}" wx:elif="{{item.type==0 && item.messageType == 2}}">
                    <view>
                        <text class='chat-time' style="display:none;">{{item.date}}</text>
                    </view>
                    <view class='own-record'>
                        <view class='own-record-content'>
                            <image class='content-img' src="{{ mangerUrl + item.message }}" data-url="{{ mangerUrl + item.message }}" bindtap="viewImg" mode="widthFix"></image>
                            <view class="msg-isRead right">{{ item.isRead ? '已读' : '未读' }}</view>
                        </view>
                        <view class='own-record-content-triangle'></view>
                        <image class='own-head-img' src='{{sendAvatar}}'></image>
                    </view>
                </view>
                <!-- 由你发起沟通详情 -->
                <view wx:else class="product-item-view" bindtap="goDetails" data-value="{{ item.transactionId }}">
                    <view class="content-view">
                        <view class="product-info-item">{{ item.object.info }}</view>
                        <view class="product-send-time">{{ item.date }} 由{{ receiveMemberId != item.sender ? '对方':'你' }}发起沟通</view>
                    </view>
                </view>
            </block>
            <view id="sendmessage"></view>
        </scroll-view>

    </view>
</view>
<view class="sendmessage">
    <view class="send-message">
        <input class="chat-input" type="text" bindinput="bindChange" confirm-type="send" value='{{input}}' cursor-spacing="16px" hold-keyboard="{{true}}" placeholder="" bindconfirm="send" focus="{{inputShowed}}" />
        <image class="expression-msg-img" src="/images/home/expression-msg-icon.png" bind:tap="emotionChange" />
        <image class="img-msg-img" src="/images/home/img-msg-icon.png" bindtap="upImg" />
    </view>
    <view class="faces-view-dialog clearfix" wx:if="{{emotionVisible}}">
        <view class="emotions-item fl" wx:for="{{connectemoji}}" wx:key="index" bindtap="addemotion" data-index="{{index}}">
            {{item}}
        </view>
    </view>
    <!-- <view class="emotions" wx:if="{{emotionVisible}}">
        <view class="emotions-item" wx:for="{{connectemoji}}" wx:key="index" bindtap="addemotion" data-index="{{index}}">
            {{item}}
        </view>
    </view> -->
</view>