(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-fd683798"],{"06c2":function(e,t,s){"use strict";s("53bd")},"077f":function(e,t,s){},"0d88":function(e,t,s){},"13fd":function(e,t,s){ /*! * * js-audio-recorder - js audio recorder plugin * * @version v1.0.7 * @homepage https://github.com/2fps/recorder * @author 2fps (https://www.zhuyuntao.cn) * @license MIT * */ !function(t,s){e.exports=s()}(0,(function(){return function(e){var t={};function s(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,s),n.l=!0,n.exports}return s.m=e,s.c=t,s.d=function(e,t,i){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(s.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)s.d(i,n,function(t){return e[t]}.bind(null,n));return i},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="",s(s.s=1)}([function(e,t,s){"use strict";function i(e,t,s){for(var i=0;it?t:s,h=o,l=new ArrayBuffer(44+e.byteLength),c=new DataView(l),d=n,u=0;i(c,u,"RIFF"),u+=4,c.setUint32(u,36+e.byteLength,a),i(c,u+=4,"WAVE"),i(c,u+=4,"fmt "),u+=4,c.setUint32(u,16,a),u+=4,c.setUint16(u,1,a),u+=2,c.setUint16(u,d,a),u+=2,c.setUint32(u,r,a),u+=4,c.setUint32(u,d*r*(h/8),a),u+=4,c.setUint16(u,d*(h/8),a),u+=2,c.setUint16(u,h,a),i(c,u+=2,"data"),u+=4,c.setUint32(u,e.byteLength,a),u+=4;for(var m=0;m44&&r.default.play(e.buffer)},t.prototype.getPlayTime=function(){return r.default.getPlayTime()},t.prototype.pausePlay=function(){!this.isrecording&&this.isplaying&&(this.isplaying=!1,this.onpauseplay&&this.onpauseplay(),r.default.pausePlay())},t.prototype.resumePlay=function(){this.isrecording||this.isplaying||(this.isplaying=!0,this.onresumeplay&&this.onresumeplay(),r.default.resumePlay())},t.prototype.stopPlay=function(){this.isrecording||(this.isplaying=!1,this.onstopplay&&this.onstopplay(),r.default.stopPlay())},t.prototype.destroy=function(){return r.default.destroyPlay(),this.destroyRecord()},t.prototype.getRecordAnalyseData=function(){return this.getAnalyseData()},t.prototype.getPlayAnalyseData=function(){return r.default.getAnalyseData()},t.prototype.getPCM=function(){this.stop();var e=this.getData();return e=a.compress(e,this.inputSampleRate,this.outputSampleRate),a.encodePCM(e,this.oututSampleBits,this.littleEdian)},t.prototype.getPCMBlob=function(){return new Blob([this.getPCM()])},t.prototype.downloadPCM=function(e){void 0===e&&(e="recorder");var t=this.getPCMBlob();o.downloadPCM(t,e)},t.prototype.getWAV=function(){var e=this.getPCM();return a.encodeWAV(e,this.inputSampleRate,this.outputSampleRate,this.config.numChannels,this.oututSampleBits,this.littleEdian)},t.prototype.getWAVBlob=function(){return new Blob([this.getWAV()],{type:"audio/wav"})},t.prototype.downloadWAV=function(e){void 0===e&&(e="recorder");var t=this.getWAVBlob();o.downloadWAV(t,e)},t.prototype.download=function(e,t,s){o.download(e,t,s)},t.prototype.getChannelData=function(){var e=this.getPCM(),t=e.byteLength,s=this.littleEdian,i={left:null,right:null};if(2===this.config.numChannels){var n=new DataView(new ArrayBuffer(t/2)),o=new DataView(new ArrayBuffer(t/2));if(16===this.config.sampleBits)for(var a=0;awindow.innerHeight-e&&(this.pos.y=window.innerHeight-e),this.pos.x>window.innerWidth-t&&(this.pos.x=window.innerWidth-t)}}},a=o,r=(s("6afe"),s("c08c")),h=Object(r["a"])(a,i,n,!1,null,"1a55e596",null);t["a"]=h.exports},"3f94":function(e,t,s){"use strict";s.r(t);var i=function(){var e=this,t=e._self._c;return t("el-container",{staticClass:"chat-page"},[t("resizable-aside",{attrs:{"default-width":260,"min-width":200,"max-width":500,"storage-key":"chat-aside-width"}},[t("div",{staticClass:"header"},[t("el-input",{staticClass:"search-text",attrs:{size:"small",placeholder:"搜索"},model:{value:e.searchText,callback:function(t){e.searchText=t},expression:"searchText"}},[t("i",{staticClass:"el-icon-search el-input__icon",attrs:{slot:"prefix"},slot:"prefix"})])],1),e.loading?t("div",{directives:[{name:"loading",rawName:"v-loading",value:!0,expression:"true"}],staticClass:"chat-loading",attrs:{"element-loading-text":"消息接收中...","element-loading-spinner":"el-icon-loading","element-loading-background":"#F9F9F9","element-loading-size":"24"}}):t("el-scrollbar",{staticClass:"chat-items"},e._l(e.chatStore.chats,(function(s,i){return t("div",{key:i},[t("chat-item",{directives:[{name:"show",rawName:"v-show",value:!s.delete&&s.showName&&s.showName.includes(e.searchText),expression:"!chat.delete && chat.showName && chat.showName.includes(searchText)"}],attrs:{chat:s,index:i,active:s===e.chatStore.activeChat},on:{delete:function(t){return e.onDelItem(i)},top:function(t){return e.onTop(i)},dnd:function(t){return e.onDnd(s)}},nativeOn:{click:function(t){return e.onActiveItem(i)}}})],1)})),0)],1),t("el-container",[e.chatStore.activeChat?t("chat-box",{attrs:{chat:e.chatStore.activeChat}}):e._e()],1)],1)},n=[],o=function(){var e=this,t=e._self._c;return t("div",{staticClass:"chat-item",class:e.active?"active":"",on:{contextmenu:function(t){return t.preventDefault(),e.showRightMenu(t)}}},[t("div",{staticClass:"chat-left"},[t("head-image",{attrs:{url:e.chat.headImage,name:e.chat.showName,size:42,id:"PRIVATE"==e.chat.type?e.chat.targetId:0,isShowUserInfo:!1,online:e.online}}),t("div",{directives:[{name:"show",rawName:"v-show",value:!e.chat.isDnd&&e.chat.unreadCount>0,expression:"!chat.isDnd && chat.unreadCount > 0"}],staticClass:"unread-text"},[e._v(e._s(e.chat.unreadCount))])],1),t("div",{staticClass:"chat-right"},[t("div",{staticClass:"chat-name"},[t("div",{staticClass:"chat-name-text"},[t("div",[e._v(e._s(e.chat.showName))]),"GROUP"==e.chat.type?t("el-tag",{attrs:{type:"primary",size:"mini"}},[e._v("群")]):e._e()],1),t("div",{staticClass:"chat-time-text"},[e._v(e._s(e.showTime))])]),t("div",{staticClass:"chat-content"},[t("div",{staticClass:"chat-at-text"},[e._v(e._s(e.atText))]),t("div",{directives:[{name:"show",rawName:"v-show",value:e.isShowSendName,expression:"isShowSendName"}],staticClass:"chat-send-name"},[e._v(e._s(e.chat.sendNickName+": "))]),t("div",{staticClass:"chat-content-text",domProps:{innerHTML:e._s(e.$emo.transform(e.$str.html2Escape(e.chat.lastContent),"emoji-small"))}}),e.chat.isDnd?t("div",{staticClass:"icon iconfont icon-dnd"}):e._e()])]),t("right-menu",{ref:"rightMenu",on:{select:e.onSelectMenu}})],1)},a=[],r=(s("cae4"),s("4036")),h=s("3f51"),l={name:"chatItem",components:{HeadImage:r["a"],RightMenu:h["a"]},data(){return{}},props:{chat:{type:Object},active:{type:Boolean}},methods:{showRightMenu(e){this.$refs.rightMenu.open(e,this.menuItems)},onSelectMenu(e){this.$emit(e.key.toLowerCase(),this.msgInfo)}},computed:{isShowSendName(){if(!this.chat.sendNickName)return!1;let e=this.chat.messages.length;if(0==e)return!1;let t=this.chat.messages[e-1];return this.$msgType.isNormal(t.type)},showTime(){return this.$date.toTimeText(this.chat.lastSendTime,!0)},atText(){return this.chat.atMe?"[有人@我]":this.chat.atAll?"[@全体成员]":""},menuItems(){let e=[];return e.push({key:"TOP",name:"置顶"}),this.chat.isDnd?e.push({key:"DND",name:"新消息提醒"}):e.push({key:"DND",name:"消息免打扰"}),e.push({key:"DELETE",name:"删除聊天",color:"#F56C6C"}),e},online(){if("PRIVATE"==this.chat.type){let e=this.friendStore.findFriend(this.chat.targetId);return e&&e.online}return!1}}},c=l,d=(s("bdb4"),s("c08c")),u=Object(d["a"])(c,o,a,!1,null,"cce7da22",null),m=u.exports,p=function(){var e=this,t=e._self._c;return t("div",{staticClass:"chat-box",on:{click:function(t){return e.closeRefBox()},mousemove:function(t){return e.readedMessage()}}},[t("el-container",[t("el-header",{attrs:{height:"50px"}},[t("span",[e._v(e._s(e.title))]),t("span",{directives:[{name:"show",rawName:"v-show",value:e.isGroup,expression:"isGroup"}],staticClass:"btn-side el-icon-more",attrs:{title:"群聊信息"},on:{click:function(t){e.showSide=!e.showSide}}})]),t("el-main",{staticStyle:{padding:"0"}},[t("el-container",[t("el-container",{staticClass:"content-box"},[t("el-main",{staticClass:"im-chat-main",attrs:{id:"chatScrollBox"},on:{scroll:e.onScroll}},[t("div",{staticClass:"im-chat-box"},e._l(e.showMessages,(function(s,i){return t("div",{key:e.showMinIdx+i},[t("chat-message-item",{attrs:{mine:s.sendId==e.mine.id,headImage:e.headImage(s),showName:e.showName(s),msgInfo:s,groupMembers:e.groupMembers},on:{call:function(t){return e.onCall(s.type)},resend:e.onResendMessage,delete:e.deleteMessage,recall:e.recallMessage}})],1)})),0)]),e.isInBottom?e._e():t("div",{staticClass:"scroll-to-bottom",on:{click:e.scrollToBottom}},[e._v(" "+e._s(e.newMessageSize>0?e.newMessageSize+"条新消息":"回到底部")+" ")]),t("el-footer",{staticClass:"im-chat-footer",attrs:{height:"220px"}},[t("div",{staticClass:"chat-tool-bar"},[t("div",{ref:"emotion",staticClass:"icon iconfont icon-emoji",attrs:{title:"表情"},on:{click:function(t){return t.stopPropagation(),e.showEmotionBox()}}}),t("div",{attrs:{title:"发送图片"}},[t("file-upload",{attrs:{action:"/image/upload",maxSize:5242880,fileTypes:["image/jpeg","image/png","image/jpg","image/webp","image/gif"]},on:{before:e.onImageBefore,success:e.onImageSuccess,fail:e.onImageFail}},[t("i",{staticClass:"el-icon-picture-outline"})])],1),t("div",{attrs:{title:"发送文件"}},[t("file-upload",{ref:"fileUpload",attrs:{action:"/file/upload",maxSize:10485760},on:{before:e.onFileBefore,success:e.onFileSuccess,fail:e.onFileFail}},[t("i",{staticClass:"el-icon-wallet"})])],1),t("div",{directives:[{name:"show",rawName:"v-show",value:e.isGroup&&e.memberSize<=500,expression:"isGroup && memberSize <= 500"}],staticClass:"icon iconfont icon-receipt",class:e.isReceipt?"chat-tool-active":"",attrs:{title:"回执消息"},on:{click:e.onSwitchReceipt}}),t("div",{staticClass:"el-icon-microphone",attrs:{title:"发送语音"},on:{click:function(t){return e.showRecordBox()}}}),t("div",{directives:[{name:"show",rawName:"v-show",value:e.isPrivate,expression:"isPrivate"}],staticClass:"el-icon-phone-outline",attrs:{title:"语音通话"},on:{click:function(t){return e.showPrivateVideo("voice")}}}),t("div",{directives:[{name:"show",rawName:"v-show",value:e.isGroup,expression:"isGroup"}],staticClass:"el-icon-phone-outline",attrs:{title:"语音通话"},on:{click:function(t){return e.onGroupVideo()}}}),t("div",{directives:[{name:"show",rawName:"v-show",value:e.isPrivate,expression:"isPrivate"}],staticClass:"el-icon-video-camera",attrs:{title:"视频通话"},on:{click:function(t){return e.showPrivateVideo("video")}}}),t("div",{staticClass:"el-icon-chat-dot-round",attrs:{title:"聊天记录"},on:{click:function(t){return e.showHistoryBox()}}})]),t("div",{staticClass:"send-content-area"},[t("ChatInput",{ref:"chatInputEditor",attrs:{ownerId:e.group.ownerId,"group-members":e.groupMembers},on:{submit:e.sendMessage}}),t("div",{staticClass:"send-btn-area"},[t("el-button",{attrs:{type:"primary",icon:"el-icon-s-promotion"},on:{click:function(t){return e.notifySend()}}},[e._v("发送")])],1)],1)])],1),e.showSide?t("el-aside",{staticClass:"side-box",attrs:{width:"320px"}},[t("chat-group-side",{attrs:{group:e.group,groupMembers:e.groupMembers},on:{reload:function(t){return e.loadGroup(e.group.id)}}})],1):e._e()],1)],1),t("emotion",{ref:"emoBox",on:{emotion:e.onEmotion}}),t("chat-record",{attrs:{visible:e.showRecord},on:{close:e.closeRecordBox,send:e.onSendRecord}}),t("group-member-selector",{ref:"rtcSel",attrs:{group:e.group},on:{complete:e.onInviteOk}}),t("rtc-group-join",{ref:"rtcJoin",attrs:{groupId:e.group.id}}),t("chat-history",{attrs:{visible:e.showHistory,chat:e.chat,friend:e.friend,group:e.group,groupMembers:e.groupMembers},on:{close:e.closeHistoryBox}})],1)],1)},f=[],g=(s("2df5"),s("8dc0"),s("6345"),s("6ace"),s("f3b6"),s("7e02"),s("b357"),s("afa8"),s("da0d"),s("47d3"),function(){var e=this,t=e._self._c;return t("div",{staticClass:"chat-group-side"},[t("div",{directives:[{name:"show",rawName:"v-show",value:!e.group.quit,expression:"!group.quit"}],staticClass:"search"},[t("el-input",{attrs:{placeholder:"搜索群成员",size:"small"},model:{value:e.searchText,callback:function(t){e.searchText=t},expression:"searchText"}},[t("i",{staticClass:"el-icon-search el-input__icon",attrs:{slot:"prefix"},slot:"prefix"})])],1),t("el-scrollbar",{directives:[{name:"show",rawName:"v-show",value:!e.group.quit,expression:"!group.quit"}],ref:"scrollbar",style:"height: "+e.scrollHeight+"px"},[t("div",{staticClass:"member-list"},[t("div",{staticClass:"member-tools"},[t("div",{staticClass:"tool-btn",attrs:{title:"邀请好友进群聊"},on:{click:function(t){return e.onInvite()}}},[t("i",{staticClass:"el-icon-plus"})]),t("div",{staticClass:"tool-text"},[e._v("邀请")]),t("add-group-member",{ref:"addGroupMember",attrs:{groupId:e.group.id,members:e.groupMembers},on:{reload:function(t){return e.$emit("reload")}}})],1),e.isOwner?t("div",{staticClass:"member-tools"},[t("div",{staticClass:"tool-btn",attrs:{title:"选择成员移出群聊"},on:{click:function(t){return e.onRemove()}}},[t("i",{staticClass:"el-icon-minus"})]),t("div",{staticClass:"tool-text"},[e._v("移除")]),t("group-member-selector",{ref:"removeSelector",attrs:{title:"选择成员进行移除",group:e.group},on:{complete:e.onRemoveComplete}})],1):e._e(),e._l(e.showMembers,(function(s,i){return t("div",{key:s.id},[ie.userId),s={groupId:this.group.id,userIds:t};this.$http({url:"/group/members/remove",method:"delete",data:s}).then(()=>{this.$emit("reload"),this.$message.success(`您移除了${t.length}位成员`)})},loadGroupMembers(){this.$http({url:"/group/members/"+this.group.id,method:"get"}).then(e=>{this.groupMembers=e})},onSaveGroup(){let e=this.group;this.$http({url:"/group/modify",method:"put",data:e}).then(e=>{this.editing=!this.editing,this.groupStore.updateGroup(e),this.$emit("reload"),this.$message.success("修改成功")})},onQuit(){this.$confirm("退出群聊后将不再接受群里的消息,确认退出吗?","确认退出?",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(()=>{this.$http({url:"/group/quit/"+this.group.id,method:"delete"}).then(()=>{this.groupStore.removeGroup(this.group.id),this.chatStore.removeGroupChat(this.group.id)})})},onScroll(e){const t=e.target;t.scrollTop+t.clientHeight>=t.scrollHeight-30&&this.showMaxIdxe.userId==this.group.ownerId);return e&&e.showNickName},isOwner(){return this.group.ownerId==this.mine.id},showMembers(){return this.groupMembers.filter(e=>!e.quit&&e.showNickName.includes(this.searchText))},scrollHeight(){return Math.min(400,80+this.showMembers.length/5*80)}},mounted(){let e=this.$refs.scrollbar.$el.querySelector(".el-scrollbar__wrap");e.addEventListener("scroll",this.onScroll)}},b=S,x=(s("9a67"),Object(d["a"])(b,g,v,!1,null,"dfe91602",null)),C=x.exports,M=function(){var e=this,t=e._self._c;return t("div",{staticClass:"chat-message-item"},[e.msgInfo.type==e.$enums.MESSAGE_TYPE.TIP_TEXT?t("div",{staticClass:"message-tip"},[e._v(" "+e._s(e.msgInfo.content)+" ")]):e.msgInfo.type==e.$enums.MESSAGE_TYPE.TIP_TIME?t("div",{staticClass:"message-tip"},[e._v(" "+e._s(e.$date.toTimeText(e.msgInfo.sendTime))+" ")]):e.isNormal?t("div",{staticClass:"message-normal",class:{"message-mine":e.mine}},[t("div",{staticClass:"head-image"},[t("head-image",{attrs:{name:e.showName,size:38,url:e.headImage,id:e.msgInfo.sendId}})],1),t("div",{staticClass:"content"},[t("div",{directives:[{name:"show",rawName:"v-show",value:1==e.mode&&e.msgInfo.groupId&&!e.msgInfo.selfSend,expression:"mode == 1 && msgInfo.groupId && !msgInfo.selfSend"}],staticClass:"message-top"},[t("span",[e._v(e._s(e.showName))])]),t("div",{directives:[{name:"show",rawName:"v-show",value:2==e.mode,expression:"mode == 2"}],staticClass:"message-top"},[t("span",[e._v(e._s(e.showName))]),t("span",[e._v(e._s(e.$date.toTimeText(e.msgInfo.sendTime)))])]),t("div",{staticClass:"message-bottom",on:{contextmenu:function(t){return t.preventDefault(),e.showRightMenu(t)}}},[t("div",{ref:"chatMsgBox",staticClass:"message-content-wrapper"},[e.isTextMessage?t("span",{staticClass:"message-text",domProps:{innerHTML:e._s(e.htmlText)}}):e.msgInfo.type==e.$enums.MESSAGE_TYPE.IMAGE?t("div",{staticClass:"message-image",on:{click:function(t){return e.showFullImageBox()}}},[t("img",{style:e.imageStyle,attrs:{src:e.contentData.thumbUrl,loading:"lazy"}})]):e.msgInfo.type==e.$enums.MESSAGE_TYPE.FILE?t("div",{staticClass:"message-file"},[t("div",{directives:[{name:"loading",rawName:"v-loading",value:e.sending,expression:"sending"}],staticClass:"chat-file-box"},[t("div",{staticClass:"chat-file-info"},[t("el-link",{staticClass:"chat-file-name",attrs:{underline:!0,target:"_blank",type:"primary",href:e.contentData.url,download:e.contentData.name}},[e._v(e._s(e.contentData.name))]),t("div",{staticClass:"chat-file-size"},[e._v(e._s(e.fileSize))])],1),e._m(0)])]):e.msgInfo.type==e.$enums.MESSAGE_TYPE.AUDIO?t("div",{staticClass:"message-voice",on:{click:function(t){return e.onPlayVoice()}}},[t("audio",{attrs:{controls:"",src:JSON.parse(e.msgInfo.content).url}})]):e._e(),e.sending?t("div",{directives:[{name:"loading",rawName:"v-loading",value:"true",expression:"'true'"}],staticClass:"sending",attrs:{title:"发送中"}}):e.sendFail?t("div",{staticClass:"send-fail el-icon-warning",attrs:{title:"发送失败"},on:{click:e.onSendFail}}):e._e()]),e.isAction?t("div",{staticClass:"chat-action message-text"},[e.msgInfo.type==e.$enums.MESSAGE_TYPE.ACT_RT_VOICE?t("span",{staticClass:"iconfont icon-chat-voice",attrs:{title:"重新呼叫"},on:{click:function(t){return e.$emit("call")}}}):e._e(),e.msgInfo.type==e.$enums.MESSAGE_TYPE.ACT_RT_VIDEO?t("span",{staticClass:"iconfont icon-chat-video",attrs:{title:"重新呼叫"},on:{click:function(t){return e.$emit("call")}}}):e._e(),t("span",[e._v(e._s(e.msgInfo.content))])]):e._e(),e.isAction||!e.msgInfo.selfSend||e.isGroupMessage?e._e():t("div",{staticClass:"message-status"},[e.msgInfo.status==e.$enums.MESSAGE_STATUS.READED?t("span",{staticClass:"chat-readed"},[e._v("已读")]):t("span",{staticClass:"chat-unread"},[e._v("未读")])]),t("div",{directives:[{name:"show",rawName:"v-show",value:e.msgInfo.receipt,expression:"msgInfo.receipt"}],staticClass:"chat-receipt",on:{click:e.onShowReadedBox}},[e.msgInfo.receiptOk?t("span",{staticClass:"icon iconfont icon-ok",attrs:{title:"全体已读"}}):t("span",[e._v(e._s(e.msgInfo.readedCount)+"人已读")])])])])]):e._e(),t("right-menu",{ref:"rightMenu",on:{select:e.onSelectMenu}}),t("chat-group-readed",{ref:"chatGroupReadedBox",attrs:{msgInfo:e.msgInfo,groupMembers:e.groupMembers}})],1)},T=[function(){var e=this,t=e._self._c;return t("div",{staticClass:"chat-file-icon"},[t("span",{staticClass:"el-icon-document",attrs:{type:"primary"}})])}],E=function(){var e=this,t=e._self._c;return t("div",{directives:[{name:"show",rawName:"v-show",value:e.show,expression:"show"}]},[t("div",{staticClass:"chat-group-readed-mask",on:{click:function(t){return t.target!==t.currentTarget?null:e.close()}}},[t("div",{staticClass:"chat-group-readed",style:{left:e.pos.x+"px",top:e.pos.y+"px"},on:{click:function(e){e.preventDefault()}}},[t("el-tabs",{attrs:{type:"border-card",stretch:!0}},[t("el-tab-pane",{attrs:{label:`已读(${e.readedMembers.length})`}},[t("virtual-scroller",{staticClass:"scroll-box",attrs:{items:e.readedMembers},scopedSlots:e._u([{key:"default",fn:function({item:e}){return[t("chat-group-member",{attrs:{member:e}})]}}])})],1),t("el-tab-pane",{attrs:{label:`未读(${e.unreadMembers.length})`}},[t("virtual-scroller",{staticClass:"scroll-box",attrs:{items:e.unreadMembers},scopedSlots:e._u([{key:"default",fn:function({item:e}){return[t("chat-group-member",{attrs:{member:e}})]}}])})],1)],1),t("div",{directives:[{name:"show",rawName:"v-show",value:e.msgInfo.selfSend,expression:"msgInfo.selfSend"}],staticClass:"arrow-right",style:{top:e.pos.arrowY+"px"}},[t("div",{staticClass:"arrow-right-inner"})]),t("div",{directives:[{name:"show",rawName:"v-show",value:!e.msgInfo.selfSend,expression:"!msgInfo.selfSend"}],staticClass:"arrow-left",style:{top:e.pos.arrowY+"px"}},[t("div",{staticClass:"arrow-left-inner"})])],1)])])},R=[],N=s("7aa4"),_=function(){var e=this,t=e._self._c;return t("div",{staticClass:"chat-group-member",class:e.active?"active":"",style:{height:e.height+"px"}},[t("div",{staticClass:"member-avatar"},[t("head-image",{attrs:{size:e.headImageSize,name:e.member.showNickName,url:e.member.headImage}})],1),t("div",{staticClass:"name",style:{"line-height":e.height+"px"}},[t("div",[e._v(e._s(e.member.showNickName))])])])},A=[],$={name:"groupMember",components:{HeadImage:r["a"]},data(){return{}},props:{member:{type:Object,required:!0},height:{type:Number,default:50},active:{type:Boolean,default:!1}},computed:{headImageSize(){return Math.ceil(.75*this.height)}}},P=$,k=(s("dd55"),Object(d["a"])(P,_,A,!1,null,"4f43a40b",null)),B=k.exports,O={name:"chatGroupReaded",components:{ChatGroupMember:B,VirtualScroller:N["a"]},data(){return{show:!1,pos:{x:0,y:0,arrowY:0},readedMembers:[],unreadMembers:[]}},props:{groupMembers:{type:Array},msgInfo:{type:Object}},methods:{close(){this.show=!1},open(e){this.show=!0,this.pos.arrowY=200,this.msgInfo.selfSend?this.pos.x=e.left-310:this.pos.x=e.right+20,this.pos.y=e.top+e.height/2-215,this.pos.y<0&&(this.pos.arrowY+=this.pos.y,this.pos.y=0),this.loadReadedUser()},loadReadedUser(){this.readedMembers=[],this.unreadMembers=[],this.$http({url:"/message/group/findReadedUsers",method:"get",params:{groupId:this.msgInfo.groupId,messageId:this.msgInfo.id}}).then(e=>{this.groupMembers.forEach(t=>{t.userId==this.msgInfo.sendId||t.quit||(e.find(e=>t.userId==e)?this.readedMembers.push(t):this.unreadMembers.push(t))});let t={id:this.msgInfo.id,groupId:this.msgInfo.groupId,readedCount:this.readedMembers.length},s={type:"GROUP",targetId:this.msgInfo.groupId};this.chatStore.updateMessage(t,s)})}}},D=O,G=(s("fc9b"),Object(d["a"])(D,E,R,!1,null,"c04af944",null)),U=G.exports,L={name:"messageItem",components:{HeadImage:r["a"],RightMenu:h["a"],ChatGroupReaded:U},props:{mode:{type:Number,default:1},mine:{type:Boolean,required:!0},headImage:{type:String,required:!0},showName:{type:String,required:!0},msgInfo:{type:Object,required:!0},groupMembers:{type:Array},menu:{type:Boolean,default:!0}},data(){return{audioPlayState:"STOP"}},methods:{onSendFail(){this.$emit("resend",this.msgInfo)},showFullImageBox(){let e=JSON.parse(this.msgInfo.content).originUrl;e&&this.$eventBus.$emit("openFullImage",e)},onPlayVoice(){this.audio||(this.audio=new Audio),this.audio.src=JSON.parse(this.msgInfo.content).url,this.audio.play(),this.onPlayVoice="RUNNING"},showRightMenu(e){this.$refs.rightMenu.open(e,this.menuItems)},onSelectMenu(e){this.$emit(e.key.toLowerCase(),this.msgInfo)},onShowReadedBox(){let e=this.$refs.chatMsgBox.getBoundingClientRect();this.$refs.chatGroupReadedBox.open(e)}},computed:{sending(){return this.msgInfo.status==this.$enums.MESSAGE_STATUS.SENDING},sendFail(){return this.msgInfo.status==this.$enums.MESSAGE_STATUS.FAILED},contentData(){return JSON.parse(this.msgInfo.content)},fileSize(){let e=this.contentData.size;return e>1048576?Math.round(e/1024/1024)+"M":e>1024?Math.round(e/1024)+"KB":e+"B"},menuItems(){let e=[];return e.push({key:"DELETE",name:"删除",icon:"el-icon-delete"}),this.msgInfo.selfSend&&this.msgInfo.id>0&&e.push({key:"RECALL",name:"撤回",icon:"el-icon-refresh-left"}),e},isTextMessage(){return this.msgInfo.type==this.$enums.MESSAGE_TYPE.TEXT},isAction(){return this.$msgType.isAction(this.msgInfo.type)},isNormal(){const e=this.msgInfo.type;return this.$msgType.isNormal(e)||this.$msgType.isAction(e)},htmlText(){let e=this.msgInfo.selfSend?"white":"",t=this.$str.html2Escape(this.msgInfo.content);return t=this.$url.replaceURLWithHTMLLinks(t,e),this.$emo.transform(t,"emoji-normal")},isGroupMessage(){return!!this.msgInfo.groupId},imageStyle(){let e=this.configStore.fullScreen?360:240,t=60,s=this.contentData.width,i=this.contentData.height;if(s&&i){let n=Math.min(s,i)/Math.max(s,i),o=Math.max(Math.min(s>i?e:n*e,s),t),a=Math.max(Math.min(s>i?n*e:e,i),t);return`width: ${o}px;height:${a}px;object-fit: cover;`}return`max-width: ${e}px;min-width:60px;max-height: ${e}px;min-height:60px;`}}},z=L,F=(s("bb73"),Object(d["a"])(z,M,T,!1,null,null,null)),j=F.exports,H=s("1a05"),V=function(){var e=this,t=e._self._c;return t("div",{directives:[{name:"show",rawName:"v-show",value:e.show,expression:"show"}],on:{click:function(t){return e.close()}}},[t("div",{staticClass:"emotion-box",style:{left:e.x+"px",top:e.y+"px"}},[t("el-scrollbar",{staticStyle:{height:"220px"}},[t("div",{staticClass:"emotion-items"},e._l(e.$emo.emoTextList,(function(s,i){return t("div",{key:i,staticClass:"emotion-item",domProps:{innerHTML:e._s(e.$emo.textToImg(s,"emoji-large"))},on:{click:function(t){return e.onClickEmo(s)}}})})),0)])],1)])},W=[],q={name:"emotion",data(){return{show:!1,pos:{x:0,y:0}}},methods:{onClickEmo(e){let t=`#${e};`;this.$emit("emotion",t)},open(e){this.pos=e,this.show=!0},close(){this.show=!1}},computed:{x(){return this.pos.x-22},y(){return this.pos.y-234}}},J=q,Y=(s("e1e1"),Object(d["a"])(J,V,W,!1,null,"193e86e8",null)),K=Y.exports,X=function(){var e=this,t=e._self._c;return t("el-dialog",{directives:[{name:"dialogDrag",rawName:"v-dialogDrag"}],staticClass:"chat-record",attrs:{title:"语音录制",visible:e.visible,width:"600px","before-close":e.onClose},on:{"update:visible":function(t){e.visible=t}}},[t("div",{directives:[{name:"show",rawName:"v-show",value:"RECORD"==e.mode,expression:"mode == 'RECORD'"}]},[t("div",{staticClass:"tip"},[e._v(e._s(e.stateTip))]),t("div",[e._v("时长: "+e._s("STOP"==e.state?0:parseInt(e.rc.duration))+"s")])]),t("audio",{directives:[{name:"show",rawName:"v-show",value:"PLAY"==e.mode,expression:"mode == 'PLAY'"}],ref:"audio",attrs:{src:e.url,controls:""},on:{ended:function(t){return e.onStopAudio()}}}),t("el-divider",{attrs:{"content-position":"center"}}),t("el-row",{staticClass:"btn-group"},[t("el-button",{directives:[{name:"show",rawName:"v-show",value:"STOP"==e.state,expression:"state == 'STOP'"}],attrs:{round:"",type:"primary"},on:{click:function(t){return e.onStartRecord()}}},[e._v("开始录音")]),t("el-button",{directives:[{name:"show",rawName:"v-show",value:"RUNNING"==e.state,expression:"state == 'RUNNING'"}],attrs:{round:"",type:"warning"},on:{click:function(t){return e.onPauseRecord()}}},[e._v("暂停录音")]),t("el-button",{directives:[{name:"show",rawName:"v-show",value:"PAUSE"==e.state,expression:"state == 'PAUSE'"}],attrs:{round:"",type:"primary"},on:{click:function(t){return e.onResumeRecord()}}},[e._v("继续录音")]),t("el-button",{directives:[{name:"show",rawName:"v-show",value:"RUNNING"==e.state||"PAUSE"==e.state,expression:"state == 'RUNNING' || state == 'PAUSE'"}],attrs:{round:"",type:"danger"},on:{click:function(t){return e.onCompleteRecord()}}},[e._v(" 结束录音")]),t("el-button",{directives:[{name:"show",rawName:"v-show",value:"COMPLETE"==e.state&&"PLAY"!=e.mode,expression:"state == 'COMPLETE' && mode != 'PLAY'"}],attrs:{round:"",type:"success"},on:{click:function(t){return e.onPlayAudio()}}},[e._v("播放录音 ")]),t("el-button",{directives:[{name:"show",rawName:"v-show",value:"COMPLETE"==e.state&&"PLAY"==e.mode,expression:"state == 'COMPLETE' && mode == 'PLAY'"}],attrs:{round:"",type:"warning"},on:{click:function(t){return e.onStopAudio()}}},[e._v("停止播放 ")]),t("el-button",{directives:[{name:"show",rawName:"v-show",value:"COMPLETE"==e.state,expression:"state == 'COMPLETE'"}],attrs:{round:"",type:"primary"},on:{click:function(t){return e.onRestartRecord()}}},[e._v("重新录音")]),t("el-button",{directives:[{name:"show",rawName:"v-show",value:"COMPLETE"==e.state,expression:"state == 'COMPLETE'"}],attrs:{round:"",type:"primary"},on:{click:function(t){return e.onSendRecord()}}},[e._v("立即发送")])],1)],1)},Q=[],Z=s("d0fb"),ee=s.n(Z),te={name:"chatRecord",props:{visible:{type:Boolean}},data(){return{rc:new ee.a,audio:new Audio,state:"STOP",stateTip:"未开始",mode:"RECORD",duration:0,url:""}},methods:{onClose(){this.rc.destroy(),this.rc=new ee.a,this.audio.pause(),this.mode="RECORD",this.state="STOP",this.stateTip="未开始",this.$emit("close")},onStartRecord(){this.rc.start().then(e=>{this.state="RUNNING",this.stateTip="正在录音..."}).catch(e=>{this.$message.error(e)})},onPauseRecord(){this.rc.pause(),this.state="PAUSE",this.stateTip="已暂停录音"},onResumeRecord(){this.rc.resume(),this.state="RUNNING",this.stateTip="正在录音..."},onCompleteRecord(){this.rc.pause(),this.state="COMPLETE",this.stateTip="已结束录音"},onPlayAudio(){let e=this.rc.getWAVBlob(),t=URL.createObjectURL(e);this.$refs.audio.src=t,this.$refs.audio.play(),this.mode="PLAY"},onStopAudio(){this.$refs.audio.pause(),this.mode="RECORD"},onRestartRecord(){this.rc.destroy(),this.rc=new ee.a,this.rc.start(),this.state="RUNNING",this.mode="RECORD",this.stateTip="正在录音..."},onSendRecord(){let e=this.rc.getWAVBlob(),t=(new Date).getDate()+".wav";var s=new window.FormData;s.append("file",e,t),this.$http({url:"/file/upload",data:s,method:"post",headers:{"Content-Type":"multipart/form-data"}}).then(e=>{let t={duration:parseInt(this.rc.duration),url:e};this.$emit("send",t),this.onClose()})}}},se=te,ie=(s("a0f2"),Object(d["a"])(se,X,Q,!1,null,"3bd70ec4",null)),ne=ie.exports,oe=function(){var e=this,t=e._self._c;return t("el-drawer",{attrs:{title:"聊天历史记录",size:"700px",visible:e.visible,direction:"rtl","before-close":e.onClose},on:{"update:visible":function(t){e.visible=t}}},[t("div",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],staticClass:"chat-history",attrs:{"element-loading-text":"拼命加载中"}},[t("el-scrollbar",{ref:"scrollbar",staticClass:"scroll-box",attrs:{id:"historyScrollbar"}},[t("ul",e._l(e.messages,(function(s,i){return t("li",{key:i},[t("chat-message-item",{attrs:{mode:2,mine:s.sendId==e.mine.id,headImage:e.headImage(s),showName:e.showName(s),msgInfo:s,menu:!1}})],1)})),0)])],1)])},ae=[],re={name:"chatHistory",components:{ChatMessageItem:j},props:{visible:{type:Boolean},chat:{type:Object},friend:{type:Object},group:{type:Object},groupMembers:{type:Array}},data(){return{page:1,size:10,messages:[],loadAll:!1,loading:!1,lastScrollTime:new Date}},methods:{onClose(){this.page=1,this.messages=[],this.loadAll=!1,this.$emit("close")},onScroll(){let e=this.$refs.scrollbar.$refs.wrap.scrollTop,t=(new Date).getTime()-this.lastScrollTime.getTime();e<30&&t>500&&(this.lastScrollTime=new Date,this.loadMessages())},loadMessages(){if(this.loadAll)return this.$message.success("已到达顶部");let e={page:this.page++,size:this.size};"GROUP"==this.chat.type?e.groupId=this.group.id:e.friendId=this.friend.id,this.loading=!0,this.$http({url:this.histroyAction,method:"get",params:e}).then(e=>{e.forEach(e=>this.messages.unshift(e)),this.loading=!1,e.length{this.loading=!1})},showName(e){if("GROUP"==this.chat.type){let t=this.groupMembers.find(t=>t.userId==e.sendId);return t?t.showNickName:""}return e.sendId==this.mine.id?this.mine.nickName:this.chat.showName},headImage(e){if("GROUP"==this.chat.type){let t=this.groupMembers.find(t=>t.userId==e.sendId);return t?t.headImage:""}return e.sendId==this.mine.id?this.mine.headImageThumb:this.chat.headImage},refreshScrollPos(){let e=this.$refs.scrollbar.$refs.wrap,t=e.scrollHeight,s=e.scrollTop;this.$nextTick(()=>{let i=e.scrollHeight-t;e.scrollTop=s+i,e.scrollHeight==t&&this.loadMessages()})}},computed:{mine(){return this.userStore.userInfo},histroyAction(){return`/message/${this.chat.type.toLowerCase()}/history`}},watch:{visible:{handler(e,t){e&&(this.loadMessages(),this.$nextTick(()=>{document.getElementById("historyScrollbar").addEventListener("mousewheel",this.onScroll,!0)}))}}}},he=re,le=(s("6a77"),Object(d["a"])(he,oe,ae,!1,null,"c4e47060",null)),ce=le.exports,de=function(){var e=this,t=e._self._c;return t("el-scrollbar",{directives:[{name:"show",rawName:"v-show",value:e.show&&e.showMembers.length,expression:"show && showMembers.length"}],ref:"scrollBox",staticClass:"chat-at-box",style:{left:e.pos.x+"px",top:e.pos.y-300+"px"}},e._l(e.showMembers,(function(s,i){return t("div",{key:s.id},[t("chat-group-member",{attrs:{member:s,height:40,active:e.activeIdx==i},nativeOn:{click:function(t){return e.onSelectMember(s)}}})],1)})),0)},ue=[],me={name:"chatAtBox",components:{ChatGroupMember:B},props:{searchText:{type:String,default:""},ownerId:{type:Number},members:{type:Array}},data(){return{show:!1,pos:{x:0,y:0},activeIdx:0,showMembers:[]}},methods:{init(){this.$refs.scrollBox.wrap.scrollTop=0,this.showMembers=[];let e=this.userStore.userInfo.id,t="全体成员";this.ownerId==e&&t.startsWith(this.searchText)&&this.showMembers.push({userId:-1,showNickName:t}),this.members.forEach(t=>{this.showMembers.length>100||t.userId!=e&&!t.quit&&t.showNickName.startsWith(this.searchText)&&this.showMembers.push(t)}),this.activeIdx=this.showMembers.length>0?0:-1},open(e){this.show=!0,this.pos=e,this.init()},close(){this.show=!1},moveUp(){this.activeIdx>0&&(this.activeIdx--,this.scrollToActive())},moveDown(){this.activeIdx=0&&this.onSelectMember(this.showMembers[this.activeIdx]),this.close()},scrollToActive(){40*this.activeIdx-this.$refs.scrollBox.wrap.clientHeight>this.$refs.scrollBox.wrap.scrollTop&&(this.$refs.scrollBox.wrap.scrollTop+=140,this.$refs.scrollBox.wrap.scrollTop>this.$refs.scrollBox.wrap.scrollHeight&&(this.$refs.scrollBox.wrap.scrollTop=this.$refs.scrollBox.wrap.scrollHeight)),40*this.activeIdxe.id==t.id)||e.push({id:t.id,nickName:t.nickName,headImage:t.headImageThumb,isCamera:!1,isMicroPhone:!0});let s={isHost:!1,groupId:this.groupId,inviterId:t.id,userInfos:e};this.$eventBus.$emit("openGroupVideo",s)},onCancel(){this.isShow=!1}}},Ie=ye,Se=(s("67a4"),Object(d["a"])(Ie,ve,we,!1,null,"5f7cd41a",null)),be=Se.exports,xe=function(){var e=this,t=e._self._c;return t("div",{staticClass:"chat-input-area"},[t("div",{ref:"content",class:["edit-container",e.isEmpty?"":"not-empty"],attrs:{contenteditable:"true"},on:{paste:function(t){return t.preventDefault(),e.onPaste.apply(null,arguments)},keydown:e.onKeydown,compositionstart:function(t){e.compositionFlag=!0},compositionend:e.onCompositionEnd,input:e.onEditorInput,mousedown:e.onMousedown,keyup:e.onKeyup,click:e.onClickInput}}),t("chat-at-box",{ref:"atBox",attrs:{"search-text":e.atSearchText,ownerId:e.ownerId,members:e.groupMembers},on:{select:e.onAtSelect}})],1)},Ce=[],Me={name:"ChatInput",components:{ChatAtBox:ge},props:{ownerId:{type:Number},groupMembers:{type:Array}},data(){return{imageList:[],fileList:[],currentId:0,atSearchText:null,compositionFlag:!1,atIng:!1,isEmpty:!0,changeStored:!0,blurRange:null}},methods:{onPaste(e){this.isEmpty=!1;let t=e.clipboardData.getData("Text"),s=window.getSelection().getRangeAt(0);if(s.startContainer===s.endContainer&&s.startOffset===s.endOffset||s.deleteContents(),t&&"string"==typeof t){let e=document.createTextNode(t);return s.insertNode(e),void s.collapse()}let i=(e.clipboardData||window.clipboardData).items;if(i.length)for(let n=0;n{let i=document.createRange();i.setStart(e,0),i.setEnd(e,t||0),e.firstChild&&i.selectNodeContents(e.firstChild),i.collapse(),s.removeAllRanges(),s.addRange(i),e.focus&&e.focus()})},onCompositionEnd(e){this.compositionFlag=!1,this.onEditorInput(e)},onKeydown(e){if(13!==e.keyCode)8===e.keyCode&&setTimeout(()=>{let e=this.$refs.content.innerHTML.trim();""===e||"
"===e||"
 
"===e?(this.empty(),this.isEmpty=!0,this.selectElement(this.$refs.content)):this.isEmpty=!1}),this.atIng&&(38===e.keyCode&&(e.preventDefault(),e.stopPropagation(),this.$refs.atBox.moveUp()),40===e.keyCode&&(e.preventDefault(),e.stopPropagation(),this.$refs.atBox.moveDown()));else{if(e.preventDefault(),e.stopPropagation(),this.atIng)return void this.$refs.atBox.select();if(e.ctrlKey){let e=this.newLine(),t=document.createTextNode(" ");e.appendChild(t),this.selectElement(e.childNodes[0],0)}else{if(this.compositionFlag)return;this.submit()}}},onAtSelect(e){this.atIng=!1;let t=this.blurRange,s=t.endContainer,i=s.data.indexOf("@"+this.atSearchText),n=i+this.atSearchText.length+1;t.setStart(t.endContainer,i),t.setEnd(t.endContainer,n),t.deleteContents(),t.collapse(),this.focus();let o=document.createElement("SPAN");o.className="chat-at-user",o.dataset.id=e.userId,o.contentEditable="false",o.innerText="@"+e.showNickName,t.insertNode(o),t.collapse();let a=document.createTextNode(" ");t.insertNode(a),t.collapse(),this.atSearchText="",this.selectElement(a,1)},onEditorInput(e){if(this.isEmpty=!1,this.changeStored=!1,this.$props.groupMembers&&!this.compositionFlag){let t=window.getSelection(),s=t.getRangeAt(0),i=s.endContainer,n=s.endOffset,o=i.textContent,a=-1;for(let e=n;e>=0;e--)if("@"===o[e]){a=e;break}if(-1===a)return void this.$refs.atBox.close();let r=n;for(let e=n;ethis.selectElement(t))},showAtBox(e){this.atIng=!0;let t=window.getSelection(),s=t.getRangeAt(0),i=s.getBoundingClientRect();this.$refs.atBox.open({x:i.x,y:i.y}),this.updateRange()},submit(){let e=this.$refs.content.childNodes,t=[],s="",i=[],n=e=>{for(let o=0;o{s.id=e.id,s.status=e.status,this.isReceipt=!1,this.chatStore.updateMessage(s,t.chat)}).catch(()=>{s.status=this.$enums.MESSAGE_STATUS.FAILED,this.chatStore.updateMessage(s,t.chat)})},onImageFail(e,t){let s=JSON.parse(JSON.stringify(t.msgInfo));s.status=this.$enums.MESSAGE_STATUS.FAILED,this.chatStore.updateMessage(s,t.chat)},onImageBefore(e){if(this.isBanned)return void this.showBannedTip();let t=URL.createObjectURL(e),s={originUrl:t,thumbUrl:t},i={tmpId:this.generateId(),fileId:e.uid,sendId:this.mine.id,content:JSON.stringify(s),sendTime:(new Date).getTime(),selfSend:!0,type:this.$enums.MESSAGE_TYPE.IMAGE,readedCount:0,status:this.$enums.MESSAGE_STATUS.SENDING};this.fillTargetId(i,this.chat.targetId),this.chatStore.insertMessage(i,this.chat),this.moveChatToTop(),e.msgInfo=i,e.chat=this.chat;let n=this.chat;this.getImageSize(e).then(e=>{s.width=e.width,s.height=e.height,i.content=JSON.stringify(s),this.chatStore.updateMessage(i,n),this.scrollToBottom()})},onFileSuccess(e,t){let s={name:t.name,size:t.size,url:e},i=JSON.parse(JSON.stringify(t.msgInfo));i.content=JSON.stringify(s),i.receipt=this.isReceipt,this.sendMessageRequest(i).then(e=>{i.id=e.id,i.status=e.status,this.isReceipt=!1,this.refreshPlaceHolder(),this.chatStore.updateMessage(i,t.chat)}).catch(()=>{i.status=this.$enums.MESSAGE_STATUS.FAILED,this.chatStore.updateMessage(i,t.chat)})},onFileFail(e,t){let s=JSON.parse(JSON.stringify(t.msgInfo));s.status=this.$enums.MESSAGE_STATUS.FAILED,this.chatStore.updateMessage(s,t.chat)},onFileBefore(e){if(this.isBanned)return void this.showBannedTip();let t=URL.createObjectURL(e),s={name:e.name,size:e.size,url:t},i={tmpId:this.generateId(),sendId:this.mine.id,content:JSON.stringify(s),sendTime:(new Date).getTime(),selfSend:!0,type:this.$enums.MESSAGE_TYPE.FILE,readedCount:0,status:this.$enums.MESSAGE_STATUS.SENDING};this.fillTargetId(i,this.chat.targetId),this.chatStore.insertMessage(i,this.chat),this.moveChatToTop(),e.msgInfo=i,e.chat=this.chat},onCloseSide(){this.showSide=!1},onScrollToTop(){this.showMinIdx=this.showMinIdx>10?this.showMinIdx-10:0},onScroll(e){let t=e.target,s=t.scrollTop;s<30&&(this.showMinIdx=this.showMinIdx>20?this.showMinIdx-20:0,this.isInBottom=!1),s+t.clientHeight>=t.scrollHeight-30&&(this.isInBottom=!0,this.newMessageSize=0)},showEmotionBox(){let e=this.$refs.emotion.offsetWidth,t=this.$elm.fixLeft(this.$refs.emotion),s=this.$elm.fixTop(this.$refs.emotion);this.$refs.emoBox.open({x:t+e/2,y:s})},onEmotion(e){this.$refs.chatInputEditor.insertEmoji(e)},showRecordBox(){this.showRecord=!0},closeRecordBox(){this.showRecord=!1},showPrivateVideo(e){if(this.isBanned)return void this.showBannedTip();let t={mode:e,isHost:!0,friend:this.friend};this.$eventBus.$emit("openPrivateVideo",t)},onGroupVideo(){if(this.isBanned)return void this.showBannedTip();let e=[this.mine.id],t=this.configStore.webrtc.maxChannel;this.$refs.rtcSel.open(t,e,e,[])},onInviteOk(e){if(e.length<2)return;let t=[];e.forEach(e=>{t.push({id:e.userId,nickName:e.showNickName,headImage:e.headImage,isCamera:!1,isMicroPhone:!0})});let s={isHost:!0,groupId:this.group.id,inviterId:this.mine.id,userInfos:t};this.$eventBus.$emit("openGroupVideo",s)},showHistoryBox(){this.showHistory=!0},closeHistoryBox(){this.showHistory=!1},onSendRecord(e){if(this.isBanned)return void this.showBannedTip();let t={tmpId:this.generateId(),content:JSON.stringify(e),type:this.$enums.MESSAGE_TYPE.AUDIO,receipt:this.isReceipt};this.fillTargetId(t,this.chat.targetId);const s=this.chat;let i=this.buildTmpMessage(t);this.chatStore.insertMessage(i,s),this.moveChatToTop(),this.sendMessageRequest(t).then(e=>{i.id=e.id,i.status=e.status,this.chatStore.updateMessage(i,s),this.moveChatToTop(),this.$refs.chatInputEditor.focus(),this.scrollToBottom(),this.showRecord=!1,this.isReceipt=!1,this.refreshPlaceHolder()}).catch(()=>{i.status=this.$enums.MESSAGE_STATUS.FAILED,this.chatStore.updateMessage(i,this.chat)})},fillTargetId(e,t){"GROUP"==this.chat.type?e.groupId=t:e.recvId=t},notifySend(){this.$refs.chatInputEditor.submit()},async sendMessage(e){if(this.resetEditor(),this.readedMessage(),this.isBanned)return void this.showBannedTip();let t=this.isReceipt?"【回执消息】":"";e.forEach(async e=>{switch(e.type){case"text":await this.sendTextMessage(t+e.content,e.atUserIds);break;case"image":await this.sendImageMessage(e.content.file);break;case"file":await this.sendFileMessage(e.content.file);break}})},sendImageMessage(e){return new Promise((t,s)=>{this.onImageBefore(e);let i=new FormData;i.append("file",e),this.$http.post("/image/upload?isPermanent=false",i,{headers:{"Content-Type":"multipart/form-data"}}).then(s=>{this.onImageSuccess(s,e),t()}).catch(t=>{this.onImageFail(t,e),s()}),this.$nextTick(()=>this.$refs.chatInputEditor.focus()),this.scrollToBottom()})},sendTextMessage(e,t){return new Promise((s,i)=>{e.trim()||i();let n={tmpId:this.generateId(),content:e,type:this.$enums.MESSAGE_TYPE.TEXT};this.fillTargetId(n,this.chat.targetId),"GROUP"==this.chat.type&&(n.atUserIds=t,n.receipt=this.isReceipt),this.lockMessage=!0;const o=this.chat;let a=this.buildTmpMessage(n);this.chatStore.insertMessage(a,o),this.moveChatToTop(),this.sendMessageRequest(n).then(e=>{a.id=e.id,a.status=e.status,a.content=e.content,this.chatStore.updateMessage(a,o)}).catch(()=>{a.status=this.$enums.MESSAGE_STATUS.FAILED,this.chatStore.updateMessage(a,o)}).finally(()=>{this.isReceipt=!1,s()})})},sendFileMessage(e){return new Promise((t,s)=>{let i=this.$refs.fileUpload.beforeUpload(e);i&&this.$refs.fileUpload.onFileUpload({file:e})})},onResendMessage(e){if(e.type!=this.$enums.MESSAGE_TYPE.TEXT)return void this.$message.error("该消息不支持自动重新发送,建议手动重新发送");const t=this.chat;this.chatStore.deleteMessage(e,t),e.tmpId=this.generateId();let s=this.buildTmpMessage(e);this.chatStore.insertMessage(s,t),this.moveChatToTop(),this.sendMessageRequest(e).then(e=>{s.id=e.id,s.status=e.status,s.content=e.content,this.chatStore.updateMessage(s,t)}).catch(()=>{s.status=this.$enums.MESSAGE_STATUS.FAILED,this.chatStore.updateMessage(s,t)}).finally(()=>{this.scrollToBottom()})},deleteMessage(e){this.$confirm("确认删除消息?","删除消息",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(()=>{this.chatStore.deleteMessage(e,this.chat)})},recallMessage(e){this.$confirm("确认撤回消息?","撤回消息",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(()=>{let t=`/message/${this.chat.type.toLowerCase()}/recall/${e.id}`;this.$http({url:t,method:"delete"}).then(e=>{this.$message.success("消息已撤回"),e.selfSend=!0,this.chatStore.recallMessage(e,this.chat)})})},readedMessage(){if(this.chat.unreadCount>0){if(this.isGroup)var e="/message/group/readed?groupId="+this.chat.targetId;else e="/message/private/readed?friendId="+this.chat.targetId;this.$http({url:e,method:"put"}).then(()=>{}),this.chatStore.resetUnreadCount(this.chat)}},loadReaded(e){this.$http({url:"/message/private/maxReadedId?friendId="+e,method:"get"}).then(t=>{this.chatStore.readedMessage({friendId:e,maxId:t})})},loadGroup(e){this.$http({url:"/group/find/"+e,method:"get"}).then(e=>{this.group=e,this.chatStore.updateChatFromGroup(e),this.groupStore.updateGroup(e)}),this.$http({url:"/group/members/"+e,method:"get"}).then(e=>{this.groupMembers=e})},updateFriendInfo(){if(this.isFriend){let e=JSON.parse(JSON.stringify(this.friend));e.headImage=this.userInfo.headImageThumb,e.nickName=this.userInfo.nickName,e.showNickName=e.remarkNickName?e.remarkNickName:e.nickName,this.chatStore.updateChatFromFriend(e),this.friendStore.updateFriend(e)}else this.chatStore.updateChatFromUser(this.userInfo)},loadFriend(e){this.$http({url:"/user/find/"+e,method:"GET"}).then(e=>{this.userInfo=e,this.updateFriendInfo()})},showName(e){if(!e)return"";if(this.isGroup){let t=this.groupMembers.find(t=>t.userId==e.sendId);return t?t.showNickName:e.sendNickName||""}return e.selfSend?this.mine.nickName:this.chat.showName},headImage(e){if(this.isGroup){let t=this.groupMembers.find(t=>t.userId==e.sendId);return t?t.headImage:""}return e.sendId==this.mine.id?this.mine.headImageThumb:this.chat.headImage},resetEditor(){this.$nextTick(()=>{this.$refs.chatInputEditor.clear(),this.$refs.chatInputEditor.focus()})},scrollToBottom(){this.$nextTick(()=>{let e=document.getElementById("chatScrollBox");e.scrollTop=e.scrollHeight})},refreshPlaceHolder(){this.isReceipt?this.placeholder="【回执消息】":this.$refs.editBox&&this.$refs.editBox.innerHTML?this.placeholder="":this.placeholder="聊点什么吧~"},sendMessageRequest(e){return new Promise((t,s)=>{this.reqQueue.push({msgInfo:e,resolve:t,reject:s}),this.processReqQueue()})},processReqQueue(){if(this.reqQueue.length&&!this.isSending){this.isSending=!0;const e=this.reqQueue.shift();this.$http({url:this.messageAction,method:"post",data:e.msgInfo}).then(t=>{e.resolve(t)}).catch(t=>{e.reject(t)}).finally(()=>{this.isSending=!1,this.processReqQueue()})}},showBannedTip(){let e={tmpId:this.generateId(),sendId:this.mine.id,sendTime:(new Date).getTime(),type:this.$enums.MESSAGE_TYPE.TIP_TEXT};"PRIVATE"==this.chat.type?(e.recvId=this.mine.id,e.content="该用户已被管理员封禁,原因:"+this.userInfo.reason):(e.groupId=this.group.id,e.content="本群聊已被管理员封禁,原因:"+this.group.reason),this.chatStore.insertMessage(e,this.chat)},buildTmpMessage(e){let t=JSON.parse(JSON.stringify(e));return t.sendId=this.mine.id,t.sendTime=(new Date).getTime(),t.status=this.$enums.MESSAGE_STATUS.SENDING,t.selfSend=!0,this.isGroup&&(t.readedCount=0),t},getImageSize(e){return new Promise((t,s)=>{const i=new FileReader;i.onload=function(e){const i=new Image;i.onload=function(){t({width:i.width,height:i.height})},i.onerror=function(){s(new Error("无法加载图片"))},i.src=e.target.result},i.onerror=function(){s(new Error("无法读取文件"))},i.readAsDataURL(e)})},generateId(){const e=String((new Date).getTime())+String(Math.floor(1e3*Math.random()));return this.maxTmpId>e?this.generateId():(this.maxTmpId=e,e)}},computed:{mine(){return this.userStore.userInfo},isFriend(){return this.friendStore.isFriend(this.userInfo.id)},friend(){return this.friendStore.findFriend(this.userInfo.id)},title(){let e=this.chat.showName;if("GROUP"==this.chat.type){let t=this.groupMembers.filter(e=>!e.quit).length;e+=`(${t})`}return e},messageAction(){return`/message/${this.chat.type.toLowerCase()}/send`},unreadCount(){return this.chat.unreadCount},showMessages(){return this.chat.messages.slice(this.showMinIdx)},messageSize(){return this.chat&&this.chat.messages?this.chat.messages.length:0},isBanned(){return"PRIVATE"==this.chat.type&&this.userInfo.isBanned||"GROUP"==this.chat.type&&this.group.isBanned},memberSize(){return this.groupMembers.filter(e=>!e.quit).length},isGroup(){return"GROUP"==this.chat.type},isPrivate(){return"PRIVATE"==this.chat.type},loading(){return this.chatStore.loading}},watch:{chat:{handler(e,t){if(e.targetId>0&&(!t||e.type!=t.type||e.targetId!=t.targetId)){this.userInfo={},this.group={},this.groupMembers=[],"GROUP"==this.chat.type?this.loadGroup(this.chat.targetId):(this.loadFriend(this.chat.targetId),this.loadReaded(this.chat.targetId)),this.scrollToBottom(),this.showSide=!1,this.readedMessage();let e=this.chat.messages.length;this.showMinIdx=e>30?e-30:0,this.resetEditor(),this.isReceipt=!1,this.maxTmpId=0,this.refreshPlaceHolder()}},immediate:!0},messageSize:{handler(e,t){if(e>t){let t=this.chat.messages[e-1];t&&this.$msgType.isNormal(t.type)&&(this.isInBottom||t.selfSend?this.scrollToBottom():this.newMessageSize++)}}},loading:{handler(e,t){!e&&this.isPrivate&&this.loadReaded(this.chat.targetId)}}},mounted(){let e=document.getElementById("chatScrollBox");e.addEventListener("scroll",this.onScroll)}},_e=Ne,Ae=(s("06c2"),Object(d["a"])(_e,p,f,!1,null,"0eb65afd",null)),$e=Ae.exports,Pe=s("44de"),ke={name:"chat",components:{ChatItem:m,ChatBox:$e,ResizableAside:Pe["a"]},data(){return{searchText:"",messageContent:"",group:{},groupMembers:[]}},methods:{onActiveItem(e){this.chatStore.setActiveChat(e)},onDelItem(e){this.chatStore.removeChat(e)},onTop(e){this.chatStore.moveTop(e)},onDnd(e){"PRIVATE"==e.type?this.setFriendDnd(e,e.targetId,!e.isDnd):this.setGroupDnd(e,e.targetId,!e.isDnd)},setFriendDnd(e,t,s){let i={friendId:t,isDnd:s};this.$http({url:"/friend/dnd",method:"put",data:i}).then(()=>{this.friendStore.setDnd(t,s),this.chatStore.setDnd(e,s)})},setGroupDnd(e,t,s){let i={groupId:t,isDnd:s};this.$http({url:"/group/dnd",method:"put",data:i}).then(()=>{this.groupStore.setDnd(t,s),this.chatStore.setDnd(e,s)})}},computed:{loading(){return this.chatStore.loading}}},Be=ke,Oe=(s("92f9"),Object(d["a"])(Be,i,n,!1,null,"13bf412c",null));t["default"]=Oe.exports},"44de":function(e,t,s){"use strict";var i=function(){var e=this,t=e._self._c;return t("el-aside",{staticClass:"resizable-aside",style:{width:e.asideWidth+"px"}},[e._t("default"),t("div",{staticClass:"resize-handle",class:{resizing:e.isResizing},attrs:{title:"拖拽调整宽度"},on:{mousedown:e.startResize}},[t("div",{staticClass:"resize-line"})])],2)},n=[],o={name:"ResizableAside",props:{defaultWidth:{type:Number,default:260},minWidth:{type:Number,default:200},maxWidth:{type:Number,default:500},storageKey:{type:String,required:!0}},data(){return{asideWidth:this.defaultWidth,isResizing:!1,startX:0,startWidth:0}},mounted(){const e=localStorage.getItem(this.storageKey);e&&(this.asideWidth=parseInt(e)),document.addEventListener("mousemove",this.handleResize),document.addEventListener("mouseup",this.stopResize)},beforeDestroy(){document.removeEventListener("mousemove",this.handleResize),document.removeEventListener("mouseup",this.stopResize)},methods:{startResize(e){this.isResizing=!0,this.startX=e.clientX,this.startWidth=this.asideWidth,document.body.style.cursor="col-resize",document.body.style.userSelect="none",e.preventDefault()},handleResize(e){if(!this.isResizing)return;const t=e.clientX-this.startX;let s=this.startWidth+t;s=Math.max(this.minWidth,Math.min(this.maxWidth,s)),this.asideWidth=s},stopResize(){this.isResizing&&(this.isResizing=!1,document.body.style.cursor="",document.body.style.userSelect="",localStorage.setItem(this.storageKey,this.asideWidth.toString()))}}},a=o,r=(s("beb8"),s("c08c")),h=Object(r["a"])(a,i,n,!1,null,"6d0a3e1a",null);t["a"]=h.exports},"47d3":function(e,t,s){"use strict";var i=s("8c58"),n=s("b142"),o=s("de3d"),a=URLSearchParams.prototype,r=n(a.forEach);i&&!("size"in a)&&o(a,"size",{get:function(){var e=0;return r(this,(function(){e++})),e},configurable:!0,enumerable:!0})},"4a35":function(e,t,s){},"53bd":function(e,t,s){},"61eb":function(e,t,s){},"67a4":function(e,t,s){"use strict";s("ff07")},"67bd":function(e,t,s){},"6a77":function(e,t,s){"use strict";s("ef6f")},"6afe":function(e,t,s){"use strict";s("61eb")},"75ff":function(e,t,s){},"8ab1":function(e,t,s){},"8e0a":function(e,t,s){"use strict";s("8ab1")},"912a":function(e,t,s){},"92f9":function(e,t,s){"use strict";s("0d88")},"97a6":function(e,t,s){"use strict";s("fd09")},"9a67":function(e,t,s){"use strict";s("912a")},"9e26":function(e,t,s){},a0f2:function(e,t,s){"use strict";s("077f")},afa8:function(e,t,s){"use strict";var i=s("8495"),n=s("b142"),o=s("f9d1"),a=s("3c41"),r=URLSearchParams,h=r.prototype,l=n(h.append),c=n(h["delete"]),d=n(h.forEach),u=n([].push),m=new r("a=1&a=2&b=3");m["delete"]("a",1),m["delete"]("b",void 0),m+""!=="a=2"&&i(h,"delete",(function(e){var t=arguments.length,s=t<2?void 0:arguments[1];if(t&&void 0===s)return c(this,e);var i=[];d(this,(function(e,t){u(i,{key:t,value:e})})),a(t,1);var n,r=o(e),h=o(s),m=0,p=0,f=!1,g=i.length;while(m