<template>
  <div class="chatBox" :class="{'active': drawer}" :style="{'bottom':bottom+'px'}">
    <div class="menuTrainListBtn" @click="clickBtn">
      <!-- <i class="el-icon-more" /> -->
      <p style="margin: 0;">会</p>
      <p style="margin: 0;">话</p>
    </div>
    <div class="chat-box-main">
      <template v-if="!conversitionId && userRole !== 'AUDIENCE' && !commonConversation">
        <div class="chat-box-header">
          <div class="chat-box-header-title">
            <el-input v-model="queryMember" size="small" placeholder="请输入搜索人员">
              <el-button slot="append" icon="el-icon-search" />
            </el-input>
          </div>
          <div class="chat-setting" @click="handleSetting()">
            <i class="el-icon-s-tools" />
          </div>
          <div v-if="!commonConversation" class="chat-setting" @click="goCommonConversation">
            <el-tooltip effect="dark" content="公共会话" placement="top-start">
              <i class="el-icon-chat-line-round" />
            </el-tooltip>
          </div>
          <div v-if="conversitionId && commonConversation" class="chat-setting" @click="cancelCommonConversation">
            <el-tooltip effect="dark" content="私有会话" placement="top-start">
              <i class="el-icon-chat-round" />
            </el-tooltip>
          </div>
        </div>
        <div class="chat-box-content">
          <el-tree
            ref="tree"
            :data="treeData"
            :props="defaultProps"
            node-key="id"
            default-expand-all
            show-checkbox
            :filter-node-method="filterNode"
            style="margin: 10px;overflow-y: auto;height: 100%;margin-right: 0;"
            @node-click="handleNodeClick"
            @check-change="handleCheckChange"
          >
            <span :id="data.id" slot-scope="{ node, data }">
              <span style="font-size: 14px">{{ data.label + (data.userId? '(' + (simulationUsers[data.userId]||{}).nickName + ')': '') }}</span>
            </span>
          </el-tree>
        </div>
        <div class="chat-box-footer">
          <div style="width: 400px;font-size: 14px;">{{ userString }}</div>
          <el-button size="mini" type="primary" class="chat-box-footer-create" :loading="createLoading" @click="createCoversition()">创建会话</el-button>
        </div>
      </template>
      <template v-else>
        <div class="chat-box-header">
          <div class="chat-setting" @click="handleSetting()">
            <i class="el-icon-s-tools" />
          </div>
          <div v-if="!conversitionId && userRole !== 'AUDIENCE'" class="chat-setting" @click="cancelCommonConversation">
            <el-tooltip effect="dark" content="成员列表" placement="top-start">
              <i class="el-icon-s-custom" />
            </el-tooltip>
          </div>
          <div v-if="!commonConversation" class="chat-setting" @click="goCommonConversation">
            <el-tooltip effect="dark" content="公共会话" placement="top-start">
              <i class="el-icon-chat-line-round" />
            </el-tooltip>
          </div>
          <div v-if="conversitionId && commonConversation" class="chat-setting" @click="cancelCommonConversation">
            <el-tooltip effect="dark" content="私有会话" placement="top-start">
              <i class="el-icon-chat-round" />
            </el-tooltip>
          </div>
        </div>
        <div class="chat-box-content">
          <chat-content
            ref="chatContent"
            :project="project"
            :is-answering="IsAnswering"
            :conversition-id="conversitionId"
            :conversition-member-list="conversitionMemberList"
            :message-list="messageList"
            :my-member-id="myMemberId"
            :simulation-users="simulationUsers"
            :common-conversation="commonConversation"
            :user-role="userRole"
            @changeMessageList="changeMessageList"
          />
          <div v-if="recordSending" class="chat_record_tip">
            <div id="record_progress_bar" :style="'width:'+100/60*seconds+'%'" />
            <div class="record_icon" />
            <div class="record_tip_text">正在录音...</div>
            <div class="record_tip_confirm" @click="stopRecording()">确定</div>
            <div class="record_tip_cancle" @click="cancleRecording()">取消</div>
          </div>
          <chat-member-list ref="chatMemberList" :conversition-member-list="conversitionMemberList" :simulation-users="simulationUsers" />
        </div>
        <div class="chat-box-footer">
          <div class="chat-box-footer-tool" />
          <el-button v-if="isButtonShow && !commonConversation" size="mini" type="danger" class="chat-box-footer-quit" :loading="quitLoading" @click="quitConversition()">退出会话</el-button>
          <el-button v-if="isButtonShow && !commonConversation" class="chat-box-footer-send" size="mini" type="primary" :disabled="recordSending" @click="startRecording()">发送语音</el-button>
        </div>
      </template>
    </div>
    <chat-setting ref="chatSetting" :form="form" @setSetting="setSetting" />
  </div>
</template>
<script>
import ChatSetting from './chatSetting';
import ChatContent from './chatContent';
import ChatMemberList from './chatMemberList';
import RecordRTC from 'recordrtc';
import {sendSimulationConversition, startConversition, overSimulationConversition, getAllConversition} from '@/api/chat';
import { getSessionStorage } from '@/utils/auth';
export default {
    name: 'ChatBox',
    components:{
        ChatSetting,
        ChatContent,
        ChatMemberList
    },
    props: {
        group: {
            type: String,
            required: true
        },
        userRole: {
            type: String,
            required: true
        }
    },
    data() {
        return {
            drawer: false,
            bottom:15,
            recordSending:false,
            commonConversation: false,
            seconds:0,
            inter:null,
            recorders: null,
            microphone:null,
            createLoading:false,
            form:{
                language:'zh',
                sex:'1'
            },
            treeData: [],
            defaultProps: {
                children: 'children',
                label: 'label'
            },
            queryMember: '',
            activeTrains: [],
            firstClick: true,
            memberData: {},
            simulationUsers: {},
            userString: '',
            memberIdList: [],
            quitLoading: false,
            conversitionMemberList: [],
            commonMemberList: [],
            messageList: [],
            commonMessageList: [],
            temData: [],
            conversitionStateMap:{},
            myMemberId: ''
        };
    },
    computed:{
        isButtonShow() {
            return this.userRole != 'AUDIENCE';
        },
        project() {
            return getSessionStorage('project');
        },
        IsAnswering() {
            return !(this.$route.path.includes('refereeJsxtDisplay'));
        },
        userId() {
            return this.$store.state.user.id;
        },
        conversitionId() {
            return (this.conversitionStateMap[this.myMemberId] || {conversitionId:''}).conversitionId;
        },
        privateMemberList() {
            return (this.conversitionStateMap[this.myMemberId] || {privateMemberList: []}).privateMemberList;
        },
        privateMessageList() {
            return (this.conversitionStateMap[this.myMemberId] || {privateMessageList: []}).privateMessageList;
        }
    },
    watch:{
        queryMember(val) {
            if (this.$refs.tree) {
                this.$refs.tree.filter(val);
            }
        },
        conversitionId(val) {
            if (val) {
                this.conversitionMemberList = this.privateMemberList;
                this.messageList = [...this.privateMessageList];
            }
        },
        userRole(val) {
            if (val === 'AUDIENCE') {
                this.goCommonConversation();
                this.myMemberId = '';
            } else {
                this.myMemberId = (this.simulationUsers[this.userId] || {}).memberId;
            }
        },
        '$store.state.map.mapViewLoadedCount':function(val) {
            const object = document.querySelector('.menuButton');
            if (object) {
                const objectBottom = object.offsetHeight || 0;
                this.bottom = objectBottom + 15;
            } else {
                this.bottom = 15;
            }
            this.isAudienceInitData();
        },
        '$store.state.training.prdType': function(val) {
            this.$nextTick(() => {
                const object = document.querySelector('.menuButton');
                if (object) {
                    const objectBottom = object.offsetHeight || 0;
                    this.bottom = objectBottom + 15;
                } else {
                    this.bottom = 15;
                }
            });
        },
        '$store.state.socket.createConversition':function(val) {
            val.memberList.forEach(member => {
                this.$set(this.conversitionStateMap, member.memberId, {conversitionId: val.id, privateMemberList: val.memberList, privateMessageList: []});
            });
        },
        '$store.state.map.activeTrainListChange': function (val) { // 按计划行车的列车列表更新标识
            this.activeTrains = [];
            const activeTrainList = this.$store.state.map.activeTrainList;
            if (activeTrainList && activeTrainList.length) {
                activeTrainList.forEach(groupNumber => {
                    this.activeTrains.push(groupNumber);
                });
            }
            if (this.$refs.tree) {
                this.$refs.tree.filter(this.queryMember);
            }
        },
        '$store.state.training.simulationUserList': {
            handler(val, o) {
                this.simulationUsers = {};
                if (val && val.length) {
                    val.forEach(user => {
                        this.simulationUsers[user.userId] = user;
                    });
                    this.myMemberId = this.simulationUsers[this.userId].memberId;
                }
            },
            deep: true
        },
        '$store.state.socket.exitConversition': function (val) {
            for (const memberId in this.conversitionStateMap) {
                if (memberId == val.memberId) {
                    this.conversitionStateMap[memberId].conversitionId = '';
                    this.conversitionStateMap[memberId].privateMemberList = [];
                    this.conversitionStateMap[memberId].privateMessageList = [];
                } else if ( this.conversitionStateMap[memberId].conversitionId == val.id ) {
                    const mList = [];
                    this.conversitionStateMap[memberId].privateMemberList.forEach(member => {
                        if (member.memberId != val.memberId) {
                            mList.push(member);
                        }
                    });
                    this.conversitionStateMap[memberId].privateMemberList = mList;
                }
            }
        },
        '$store.state.training.memberList': function (val) {
            if (val && val.length) {
                this.memberData = this.$store.state.training.memberData;
                const dispatcherList = [];
                const electricDispatcherList = [];
                const depotDispatcherList = [];
                const stationSupervisorList = [];
                const driverList = [];
                const maintainerList = [];
                val.forEach(item => {
                    const device = this.$store.getters['map/getDeviceByCode'](item.deviceCode);
                    switch (item.type) {
                    case 'DISPATCHER':
                        this.memberData[item.id].label = '行调' + (item.name || '');
                        dispatcherList.push(this.memberData[item.id]);
                        break;
                    case 'ELECTRIC_DISPATCHER':
                        electricDispatcherList.push(this.memberData[item.id]);
                        break;
                    case 'DEPOT_DISPATCHER':
                        this.memberData[item.id].label = '车辆段';
                        depotDispatcherList.push(this.memberData[item.id]);
                        break;
                    case 'STATION_SUPERVISOR':
                        this.memberData[item.id].label = '值班员-' + device.name;
                        stationSupervisorList.push(this.memberData[item.id]);
                        break;
                    case 'DRIVER':
                        this.memberData[item.id].label = '司机-列车' + item.deviceCode;
                        driverList.push(this.memberData[item.id]);
                        break;
                    case 'MAINTAINER':
                        this.memberData[item.id].label = '通号' + (item.name || '');
                        maintainerList.push(this.memberData[item.id]);
                        break;
                    }
                });
                this.treeData = [{
                    label: '行调',
                    id: 'dispatcher',
                    type: 'role',
                    children: dispatcherList
                }, {
                    label: '车站值班员',
                    id: 'stationSupervisor',
                    type: 'role',
                    children: stationSupervisorList
                }, {
                    label: '司机',
                    id: 'driver',
                    type: 'role',
                    children: driverList
                }, {
                    label: '通号',
                    id: 'maintainer',
                    type: 'role',
                    children: maintainerList
                }, {
                    label: '车辆段',
                    id: 'depotDispatcher',
                    type: 'role',
                    children: depotDispatcherList
                }];
                this.temData = [...dispatcherList, ...stationSupervisorList, ...driverList, ...maintainerList, ...depotDispatcherList];
                this.initCommonMemberList();
                this.$nextTick(() => {
                    if (this.$refs.tree) {
                        this.$refs.tree.filter(this.queryMember);
                    }
                });
            }
        },
        '$store.state.socket.simulationReset': function () {
            this.conversitionStateMap = {};
        }
    },
    mounted() {
        this.firstClick = true;
    },
    methods:{
        clickBtn() {
            if (this.drawer) {
                this.drawer = false;
            } else {
                this.drawer = true;
                this.$nextTick(() => {
                    if (this.$refs.tree) {
                        this.$refs.tree.filter(this.queryMember);
                    }
                });
            }
        },
        setSetting(data) {
            this.form = data;
        },
        createCoversition() {
            if (this.memberIdList.length) {
                this.createLoading = true;
                startConversition(this.group, this.memberIdList).then(resp => {
                    this.messageList = [];
                    this.memberIdList = [];
                    this.userString = '';
                    // this.$message.success('创建会话成功！');
                    this.createLoading = false;
                }).catch((error) => {
                    this.$message.error(error.code == '3005' ? '创建会话失败:仿真会话成员忙线中！' : '创建仿真失败！');
                    this.createLoading = false;
                });
            } else {
                this.userString = '群聊列表为空, 请选择人员';
            }
        },
        coverName(inviteUser) {
            const member = this.$store.state.training.memberData[inviteUser.creatorId];
            if (member.userId) {
                const user = this.simulationUsers[member.userId];
                return member.label + '(' + user.nickName + ')';
            } else {
                return member.label;
            }
        },
        // 语音录制开始
        startRecording() {
            const that = this;
            if (!this.recordSending && !this.recorders && !this.microphone) {
                this.$refs.chatSetting.doClose();
                const StereoAudioRecorder = RecordRTC.StereoAudioRecorder;
                navigator.getUserMedia(
                    { audio: true } // 只启用音频
                    , function (stream) {
                        that.microphone = stream;
                        that.recorders = new RecordRTC(that.microphone, {
                            type: 'audio',
                            recorderType: StereoAudioRecorder,
                            numberOfAudioChannels: 1,
                            bitsPerSecond:256000,
                            desiredSampRate: 16000
                        });
                        that.recorders.startRecording();
                        that.recordSending = true;
                        that.inter = setInterval(() => {
                            if (that.seconds < 60) {
                                that.seconds++;
                            } else {
                                clearInterval(that.inter);
                            }
                        }, 1000);
                    }, function (error) {
                        switch (error.code || error.name) {
                        case 'PERMISSION_DENIED':
                        case 'PermissionDeniedError':
                            that.$message({
                                showClose: true,
                                message: '用户拒绝提供信息',
                                type: 'error'
                            });
                            break;
                        case 'NOT_SUPPORTED_ERROR':
                        case 'NotSupportedError':
                            that.$message({
                                showClose: true,
                                message: '浏览器不支持硬件设备',
                                type: 'error'
                            });
                            break;
                        case 'MANDATORY_UNSATISFIED_ERROR':
                        case 'MandatoryUnsatisfiedError':
                            that.$message({
                                showClose: true,
                                message: '无法发现指定的硬件设备',
                                type: 'error'
                            });
                            break;
                        default:
                            that.$message({
                                showClose: true,
                                message: '无法打开麦克风',
                                type: 'error'
                            });
                            break;
                        }
                    }
                );
            }
        },
        cancleRecording() {
            if (this.microphone) {
                clearInterval(this.inter);
                this.seconds = 0;
                this.microphone.stop();
                this.microphone = null;
                this.recordSending = false;
                this.recorders = null;
            }
        },
        // 停止录制
        stopRecording() {
            const that = this;
            this.recorders.stopRecording(function(blobURL) {
                clearInterval(that.inter);
                that.seconds = 0;
                const blob = that.recorders.getBlob();
                const fd = new FormData();
                fd.append('file', blob);
                sendSimulationConversition(that.group, that.conversitionId, fd)
                    .then((data) => {
                    })
                    .catch(error => {
                        console.log(error);
                    });
                if (that.microphone) {
                    that.microphone.stop();
                    that.microphone = null;
                    that.recordSending = false;
                    that.recorders = null;
                }
            });
        },
        handleSetting() {
            this.$refs.chatSetting.doShow();
        },
        handleNodeClick() {

        },
        handleCheckChange() {
            const memberList = this.$refs.tree.getCheckedKeys();
            this.userString = '';
            this.memberIdList = [];
            if (memberList && memberList.length) {
                memberList.forEach(memberId => {
                    const member = this.memberData[memberId];
                    if (member && member.type === 'DRIVER' && !this.activeTrains.includes(member.deviceCode)) {
                        return;
                    }
                    if (member && member.userId) {
                        this.memberIdList.push(member.id);
                        this.userString += ((this.userString ? ',' : '') + member.label + '(' + this.simulationUsers[member.userId].nickName + ')');
                    } else if (member) {
                        this.userString += ((this.userString ? ',' : '') + member.label);
                        this.memberIdList.push(member.id);
                    }
                });
            }
        },
        filterNode(value, data) {
            let flag = false;
            if (this.memberData[data.id] && this.memberData[data.id].nickName) {
                flag = this.memberData[data.id].nickName.indexOf(value) !== -1;
            }
            let driverNoShow = true;
            if (data.type && data.type === 'DRIVER' && !this.activeTrains.includes(data.deviceCode)) {
                driverNoShow = false;
            }
            return (data.label.indexOf(value) !== -1 || flag) && driverNoShow;
        },
        quitConversition() {
            this.quitLoading = true;
            overSimulationConversition(this.group, this.conversitionId).then(resp => {
                this.conversitionMemberList = [];
                this.messageList = [];
                this.quitLoading = false;
                this.$nextTick(() => {
                    this.$refs.tree && this.$refs.tree.filter(this.queryMember);
                });
            }).catch(() => {
                this.$message.error('退出会话失败！');
                this.quitLoading = false;
            });
        },
        sortByMessageTime(message1, message2) {
            const time1 = new Date(message1.time).valueOf();
            const time2 = new Date(message2.time).valueOf();
            return time1 - time2;
        },
        isAudienceInitData() {
            getAllConversition(this.group).then(resp => {
                const messages = [];
                if (resp.data && resp.data.length) {
                    resp.data.forEach(conversation => {
                        (conversation.messageList || []).forEach(message => {
                            const member = this.memberData[message.memberId];
                            message.src = `/audio/${message.audioPath}`;
                            message.members = conversation.memberList;
                            if (member) {
                                message.self = this.$store.state.userId == member.userId;
                            }
                            messages.push(message);
                        });
                        const tempMessageList = [];
                        !conversation.over && conversation.messageList.forEach(message => {
                            message.src = `/audio/${message.audioPath}`;
                            tempMessageList.push(message);
                        });
                        !conversation.over && conversation.memberList.forEach(member => {
                            this.conversitionStateMap[member.memberId] = {
                                conversationId: conversation.id,
                                privateMemberList: conversation.memberList,
                                privateMessageList: tempMessageList
                            };
                        });
                    });
                }
                this.commonMessageList = messages.sort(this.sortByMessageTime);
                this.initCommonMemberList();
            });
        },
        initCommonMemberList() {
            const temDispatcherList = [];
            const temStationSupervisorList = [];
            const temMaintainerList = [];
            const temDriverList = [];
            const temDepotDispatcherList = [];
            this.$store.state.training.memberList.forEach(item =>{
                switch (item.type) {
                case 'DISPATCHER':
                    temDispatcherList.push({memberId: item.id, connect:true });
                    break;
                case 'STATION_SUPERVISOR':
                    temStationSupervisorList.push({memberId: item.id, connect:true });
                    break;
                case 'MAINTAINER':
                    temMaintainerList.push({memberId: item.id, connect:true });
                    break;
                case 'DRIVER':
                    temDriverList.push({memberId: item.id, connect:true });
                    break;
                case 'DEPOT_DISPATCHER':
                    temDepotDispatcherList.push({memberId: item.id, connect:true });
                    break;
                }
            });
            this.commonMemberList = [...temDispatcherList, ...temStationSupervisorList, ...temMaintainerList, ...temDriverList, ...temDepotDispatcherList];
            if (this.userRole === 'AUDIENCE' || this.commonConversation) {
                this.conversitionMemberList = [];
                this.messageList = [...this.commonMessageList];
                this.conversitionMemberList = this.commonMemberList;
            }
        },
        changeMessageList(data) {
            this.commonMessageList.push(data.message);
            // if (this.conversitionStateMap[data.message.memberId]) {
            //     this.conversitionStateMap[data.message.memberId].privateMessageList.push(data.message);
            // }
            if (this.conversitionStateMap[data.message.memberId]) {
                (this.conversitionStateMap[data.message.memberId].privateMemberList || []).forEach(member => {
                    this.conversitionStateMap[member.memberId] && this.conversitionStateMap[member.memberId].privateMessageList.push(data.message);
                });
            }
            if (this.commonConversation) {
                this.messageList.push(data.message);
            } else if (!this.commonConversation && this.conversitionId === data.id) {
                this.messageList.push(data.message);
            }
        },
        goCommonConversation() {
            !this.commonConversation && this.$refs.chatContent && this.$refs.chatContent.conversationChange();
            this.commonConversation = true;
            this.conversitionMemberList = this.commonMemberList;
            this.messageList = [...this.commonMessageList];
        },
        cancelCommonConversation() {
            this.commonConversation && this.$refs.chatContent && this.$refs.chatContent.conversationChange();
            this.commonConversation = false;
            this.conversitionMemberList = this.privateMemberList;
            this.messageList = [...this.privateMessageList];
            this.$nextTick(() => {
                this.$refs.tree && this.$refs.tree.filter(this.queryMember);
            });
        },
        clearAllData() {
            this.recordSending = false;
            this.inter = null;
            this.recorders = null;
            this.microphone = null;
            this.treeData = [];
            this.conversitionMemberList = [];
            this.messageList = [];
        },
        resetCoversition() {
            // 剧本重置清空公有会话
            this.commonMessageList = [];
            this.conversitionStateMap = {};
        }
    }
};
</script>
<style lang="scss" scoped>
.chatBox {
	position: absolute;
    left: 0;
	top: calc((100% - 400px) / 2);
    height: 400px;
	width: 503px;
	transform: translateX(-503px);
	transition: all 0.4s;
	z-index: 9;
	&.active{
		transform: translateX(0px);
	}
}
.menuTrainListBtn {
    background: #fff;
    text-align: center;
    border-radius: 0px 6px 6px 0px;
    position: absolute;
    top: 45%;
    z-index: 2;
	transform: translateX(502px);
    cursor: pointer;
	z-index: 9;
	display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    justify-content: center;
	padding: 7px 4px;
	.el-icon-more{
		font-size: 20px;
		margin-top: 9px;
		transform-origin: 50% 50%;
		transform: rotate(90deg);
		margin-left:0px;
	}
}
.chat-box-header{
    width: 100%;
    height: 40px;
    border-bottom: 1px #dedede solid;
	.chat-box-header-title{
		font-size: 15px;
		margin-left: 15px;
		display: inline-block;
		margin-top: 5px;
		width: 70%;
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
	}
}

.chat-box-content{
    width: 100%;
    height: 300px;
    border-bottom: 1px #dedede solid;
    position: relative;
}

.chat-box-footer{
    display: inline-block;
    width: 100%;
	height: 50px;
	overflow-y: auto;
}
.chat-setting{
    float: right;
    line-height: 40px;
    margin-right: 10px;
    cursor: pointer;
    font-size: 16px;
}
.chat-createGroup{
    float: right;
    line-height: 40px;
    margin-right: 10px;
    cursor: pointer;
    font-size: 16px;
    position: relative;
}
.chat-box-footer-tool{
    width: 100%;
    height: 17px;
}
.chat-box-footer-send{
    background: #36a2fd;
    width: 65px;
    font-size: 12px;
    padding: 5px 0px 4px 0px;
    text-align: center;
    border-radius: 3px;
    color: #fff;
    float: right;
    margin-right: 10px;
    margin-bottom: 10px;
    cursor: pointer;
}
.chat-box-footer-quit{
	width: 65px;
	font-size: 12px;
	padding: 5px 0px 4px 0px;
	text-align: center;
	border-radius: 3px;
	color: #fff;
	margin-left: 10px;
	margin-bottom: 10px;
	cursor: pointer;
}
.minimality {
    float: right;
    line-height: 40px;
    margin-right: 10px;
    cursor: pointer;
    font-size:16px;
}
.chat-box-main{
    position: absolute;
    width: 100%;
    left: 0;
    height: 100%;
    top: 0;
    border-right: 1px #dedede solid;
    z-index: 4;
    background: #fff;
    border-radius: 5px;
    left: 0;
    font-size:0;
}
.chat-box-footer-create{
    width: 65px;
    font-size: 12px;
    padding: 5px 0px 4px 0px;
    text-align: center;
    border-radius: 3px;
    color: #fff;
    position: absolute;
	right: 5px;
	bottom: 5px;
    margin-right: 10px;
    margin-top: 10px;
    cursor: pointer;
}
.showMembers{
    float: right;
    line-height: 40px;
    margin-right: 10px;
    cursor: pointer;
    font-size: 17px;
}
#record_progress_bar{
    height: 100%;
    position: absolute;
    background: #bbe5f5;
}
.chat_record_tip{
    height: 28px;
    display: inline-block;
    background: #dfe6ee;
    width: 370px;
    font-size: 13px;
    border-top: 1px #d8dce5 solid;
    position: absolute;
    bottom: 0;
    left: 0;
}
.record_icon{
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #25d825;
    border-radius: 10px;
    left: 7px;
    margin-right: 0px;
    box-shadow: -1px 0px 3px #6d6d6d;
    border: 1px #28d228 solid;
    position: absolute;
    top: 10px;
}
.record_tip_text{
    display: inline-block;
    font-size: 12px;
    margin-left: 3px;
    // padding: 8px 0px 6px 0px;
    position: absolute;
    top: 8px;
    left:20px
}
.record_tip_confirm{
    position: absolute;
    right: 63px;
    padding: 3px 0px 2px 0px;
    border: 1px #a2a5aa solid;
    border-radius: 5px;
    width: 45px;
    text-align: center;
    font-size: 12px;
    top: 4px;
    background: #eeeeee;
    cursor: pointer;
}
.record_tip_cancle{
    position: absolute;
    right: 10px;
    padding: 3px 0px 2px 0px;
    border: 1px #a2a5aa solid;
    border-radius: 5px;
    width: 45px;
    text-align: center;
    font-size: 12px;
    top: 4px;
    background: #eeeeee;
    cursor: pointer;
}
.chat-box-footer-send.disbled{
    cursor: no-drop;
}

</style>
