chunk-57c7c03e.b31d0b5f.js 17 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-57c7c03e"],{"1dab":function(t,e,n){},"3e04":function(t,e,n){"use strict";var i=n("646e"),s=n.n(i);s.a},"417d":function(t,e,n){"use strict";var i=n("6c85"),s=n.n(i);function r(t){if(s()(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}var o=n("ab6b"),a=n.n(o),c=n("ad81"),u=n.n(c);function h(t){if(u()(Object(t))||"[object Arguments]"===Object.prototype.toString.call(t))return a()(t)}function l(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function f(t){return r(t)||h(t)||l()}n.d(e,"a",function(){return f})},"50cd":function(t,e,n){"use strict";var i=n("4cf4"),s=n("0763");t.exports=function(t,e,n){e in t?i.f(t,e,s(0,n)):t[e]=n}},"57d1":function(t,e,n){"use strict";var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"pub-chat-item",class:{current:t.item.session_id==t.curSession,top:1==t.item.is_pin},on:{click:function(e){return t.changeSessionId(t.item)},contextmenu:function(e){return e.preventDefault(),t.onToolBtn(e)}}},[n("div",{staticClass:"avatar-wrap"},[t.item.unread>0&&1==t.item.is_mute?n("i",{staticClass:"mute mute-point"}):t.item.unread>0&&0==t.item.is_mute?n("i",{staticClass:"mute mute-num"},[t._v(t._s(t.item.unread))]):t._e(),t.item.cover_photo?n("img",{staticClass:"user-avatar",attrs:{src:t.item.cover_photo,alt:""}}):n("div",{staticClass:"user-avatar",class:"avatar_bg"+t.bgColorNum(t.item.session_id),attrs:{"data-name":t.item.name&&t.item.name.slice(0,2).toUpperCase()}}),1==t.item.is_auth?n("i",{staticClass:"icon-auth"}):t._e()]),n("div",{staticClass:"info"},[n("h3",[1==t.item.is_group?n("i",{staticClass:"icon-group"}):t._e(),n("span",[t._v(t._s(t.item.name))])]),n("p",[t.item.unread>0&&1==t.item.is_mute?n("span",[t._v("["+t._s(t.item.unread)+t._s(t.$t("public.item"))+"]")]):t._e(),t.item.last_msg?[5==t.item.last_msg.msg_type?["grab_redpack"==t.item.last_msg.event_type?[t._v("\n "+t._s((t.userInfo&&t.userInfo.user_id)==t.item.last_msg.from?t.$t("public.you"):t.item.last_msg.nick_name)+" "+t._s(t.$t("redPacket.receiveRedpack"))+"\n ")]:"join"==t.item.last_msg.event_type?[t._v("\n "+t._s((t.userInfo&&t.userInfo.user_id)==t.item.last_msg.from?t.$t("public.you"):t.item.last_msg.nick_name)+" "+t._s(t.$t("chat.joinGroup"))+"\n ")]:t._e()]:t.item.is_group?[t._v("\n "+t._s(t.item.last_msg.nick_name)+":"+t._s(0===t.item.last_msg.msg_type?t.item.cont:-1===t.item.last_msg.msg_type?t.$t("chat.revokeMsg"):"["+t.$t("chat.msgType["+(t.item.last_msg.msg_type-1)+"]")+"]")+"\n ")]:[t._v("\n "+t._s(0===t.item.last_msg.msg_type?t.item.cont:-1===t.item.last_msg.msg_type?""+(t.userId==t.item.last_msg.from?t.$t("public.you"):t.item.last_msg.nick_name)+t.$t("chat.revokeMsg"):"["+t.$t("chat.msgType["+(t.item.last_msg.msg_type-1)+"]")+"]")+"\n ")]]:t._e()],2),n("span",{staticClass:"time"},[t._v(t._s(t.handleUpdate(t.item.update_time_int)))]),1==t.item.is_mute?n("i",{staticClass:"icon-mute"}):t._e()]),t.item.session_id?n("ul",{directives:[{name:"show",rawName:"v-show",value:t.showToolbar,expression:"showToolbar"}],staticClass:"pub-pop-toolbar ext-session",style:{left:t.toolBarLeft,top:t.toolBarTop}},[n("li",{on:{click:function(e){return e.stopPropagation(),t.changePin(t.item.session_id,t.item.is_pin)}}},[t._v(t._s(1==t.item.is_pin?""+t.$t("public.cancel")+t.$t("chat.sticky"):t.$t("chat.sticky")))]),n("li",{on:{click:function(e){return e.stopPropagation(),t.changeMute(t.item.session_id,t.item.is_mute)}}},[t._v(t._s(1==t.item.is_mute?t.$t("group.cancelDisturb"):t.$t("group.doNotDisturb")))]),n("li",{on:{click:function(e){return e.stopPropagation(),t.delSession(t.item.session_id)}}},[t._v(t._s(t.$t("chat.deleteSession")))])]):t._e()])},s=[],r=(n("4453"),n("ee95")),o=n("3f47"),a=n("52c1"),c=n("5975"),u=n("33f8"),h={name:"msgItem",props:{item:{type:Object}},data:function(){return{toolBarLeft:0,toolBarTop:0,showToolbar:!1,meechatType:Object(u["n"])()}},computed:Object(o["a"])({},Object(a["e"])(["curSession","userId"]),{userInfo:function(){return this.$store.state.userInfo}}),methods:{changeSessionId:function(t){var e=1==t.is_group?"/group/".concat(t.session_id):"/pm/".concat(t.session_id);this.$router.push({path:e})},bgColorNum:function(t){return Object(u["k"])(t,this.userId)},hideToolbar:function(t){!1!==this.showToolbar&&(this.showToolbar=!1,document.body.removeEventListener("click",this.hideToolbar,!1),document.body.removeEventListener("contextmenu",this.hideToolbar,!1))},getPagePos:function(t){var e=t,n=0,i=0;while(!/pub-chat-item/gi.test(e.getAttribute("class")))e=e.offsetParent;while(null!=e)n+=e.offsetLeft,i+=e.offsetTop,e=e.offsetParent;return{actualX:n,actualY:i}},onToolBtn:function(t){var e=this;if(this.showToolbar)this.hideToolbar(t);else{var n="h5"==this.meechatType?window.innerWidth:276,i=100,s=this.getPagePos(t.target),r=s.actualX,o=t.pageX,a=o-r,c=n-i-20;this.toolBarLeft="".concat(a<c?a:c,"px"),setTimeout(function(){document.body.addEventListener("click",e.hideToolbar,!1),document.body.addEventListener("contextmenu",e.hideToolbar,!1)},0),this.showToolbar=!0}},changePin:function(){var t=Object(r["a"])(regeneratorRuntime.mark(function t(e,n){var i,s,r,o;return regeneratorRuntime.wrap(function(t){while(1)switch(t.prev=t.next){case 0:return i=0==n?"setPin":"cancelPin",s=0==n?"updateSessionListByPin":"cancelSessionListByPin",t.next=4,c["a"].session[i]({session_id:e});case 4:r=t.sent,o=r.data.data,this.$store.commit("updatePin",n),this.hideToolbar(),this.$store.commit(s,{session_id:e,is_pin:o.is_pin,pin_time_int:o.pin_time_int});case 9:case"end":return t.stop()}},t,this)}));function e(e,n){return t.apply(this,arguments)}return e}(),changeMute:function(){var t=Object(r["a"])(regeneratorRuntime.mark(function t(e,n){var i,s;return regeneratorRuntime.wrap(function(t){while(1)switch(t.prev=t.next){case 0:return i=0==n?"setMute":"cancelMute",s=0==n?"updateSessionListByMute":"cancelSessionListByMute",t.next=4,c["a"].session[i]({session_id:e});case 4:this.hideToolbar(),this.$store.commit("updateMute",n),this.$store.commit(s,e);case 7:case"end":return t.stop()}},t,this)}));function e(e,n){return t.apply(this,arguments)}return e}(),delSession:function(t){var e=this;Object(u["e"])(this.$t("chat.closeSessionMsg")).then(function(){e.$store.commit("removeSessionListById",t),e.hideToolbar(),e.curSession==t&&(e.$store.commit("changeSessionId",0),e.$router.push({path:"/"}))})},handleUpdate:function(t){return Object(u["i"])(t,1,this)}}},l=h,f=(n("3e04"),n("17cc")),m=Object(f["a"])(l,i,s,!1,null,null,null);e["a"]=m.exports},"646e":function(t,e,n){},8869:function(t,e,n){"use strict";n.d(e,"f",function(){return f}),n.d(e,"e",function(){return m}),n.d(e,"c",function(){return d}),n.d(e,"d",function(){return p}),n.d(e,"a",function(){return g}),n.d(e,"b",function(){return v});var i=n("396f"),s=(n("5f33"),n("3f47")),r=(n("f10e"),n("417d")),o=(n("612f"),n("4453"),n("ee95")),a=(n("3a23"),n("5975")),c=n("33f8"),u=n("52c1"),h=n("c1f9"),l=n.n(h),f={data:function(){return{isSearch:!1,searchList:null}},methods:{searchUser:function(t,e){var n=t.target.value.toLocaleLowerCase();n?(this.searchList=e.filter(function(t){var e,i,s=(t.name||t.user_name||"").toLocaleLowerCase(),r=(t.nick_name||"").toLocaleLowerCase();return e=!!s&&s.indexOf(n)>-1,i=!!r&&r.indexOf(n)>-1,e||i}),this.isSearch=!0):this.isSearch=!1}}},m={data:function(){return{showNum:0,isSearchGroup:!1,searchUserTimer:null,searchGroupList:[]}},methods:{searchUser:function(){var t=Object(o["a"])(regeneratorRuntime.mark(function t(e,n){var i=this;return regeneratorRuntime.wrap(function(t){while(1)switch(t.prev=t.next){case 0:if(e){t.next=2;break}return t.abrupt("return");case 2:clearTimeout(this.searchUserTimer),this.searchUserTimer=setTimeout(Object(o["a"])(regeneratorRuntime.mark(function t(){var s,o;return regeneratorRuntime.wrap(function(t){while(1)switch(t.prev=t.next){case 0:if(s=e.target.value.toLocaleLowerCase(),o=i.inviteType,i.isSearchGroup=!0,s.trim()){t.next=7;break}return n.forEach(function(t){i.$set(t,"isShow",!0)}),i.$nextTick(function(){i.isSearchGroup=!1,i.showNum=n.length,n=i.originListCache}),t.abrupt("return");case 7:if(n.forEach(function(t){var e,n,r=(t.user_name||"").toLocaleLowerCase(),o=(t.nick_name||"").toLocaleLowerCase();e=!!r&&r.indexOf(s)>-1,n=!!o&&o.indexOf(s)>-1,i.$set(t,"isShow",e||n)}),n.length+1>=i.membersNum||1==o||2==o){t.next=11;break}return t.next=11,a["a"].group.searchMember({group_id:i.group.groupId,keyword:s}).then(function(t){var e=t.data,i=e.data;i.forEach(function(t){t.isChecked=!1,t.isChoosed=!1,t.isShow=!0}),n=l.a.unionBy([].concat(Object(r["a"])(n),Object(r["a"])(i)),"user_id")});case 11:i.searchGroupList=n,i.$nextTick(function(){i.showNum=n.filter(function(t){return t.isShow}).length});case 13:case"end":return t.stop()}},t)})),200);case 4:case"end":return t.stop()}},t,this)}));function e(e,n){return t.apply(this,arguments)}return e}()}},d={data:function(){return{atInd:0}},methods:{atPerson:function(t){arguments.length>1&&void 0!==arguments[1]&&arguments[1];var e=this.$refs.chatInput,n=e.selectionStart,i=n-this.keyAfterAt.length;this.inputMsg=this.inputMsg.slice(0,i)+"".concat(t," ")+this.inputMsg.slice(n),this.atInd=0,e.focus(),this.$nextTick(function(){e.setSelectionRange(i+t.length+1,i+t.length+1)}),this.$store.commit("updateIsNewAt",{isNewAt:this.group.isNewAt,isNewAtFound:!0}),this.$store.commit("updateGroupSearchList",[])},handleUp:function(t){return this.atInd>0&&this.atInd--,this.atShow&&t.preventDefault(),!0},handleDown:function(t){var e=this.filterMembers.length;return this.atInd<e-1?this.atInd++:this.atInd=0,this.atShow&&t.preventDefault(),!0}}},p={data:function(){return{selectionAfterAt:!1,keyAfterAt:"",keyAfterAtTimer:"",lastKeyAfterAt:"",isIOS:!!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),isShowContextmenu:!1,menuTop:0,menuLeft:0}},mounted:function(){},computed:Object(s["a"])({},Object(u["e"])(["copyText"]),{filterMembers:function(){if(!this.group.groupId)return[];var t=this.group.membersArray,e=[];if(""!==this.keyAfterAt)e=this.group.searchList;else for(var n=0;n<t.length;n++)t[n].user_id!=this.userId&&e.push(t[n]);return e.slice(0,100)},atShow:function(){return this.atInd=0,this.selectionAfterAt&&this.filterMembers.length}}),watch:{keyAfterAt:function(t){var e=this;clearTimeout(this.keyAfterAtTimer),this.keyAfterAtTimer=setTimeout(function(){e.handleKeyAfterAt(t)},200)},inputMsg:function(t,e){this.handleSelectionChange()}},methods:{handleKeyAfterAt:function(t){var e=this;if(this.group.groupId&&""!=t.trim()&&!this.group.isNewAtFound)if(this.group.membersArray.length<this.group.membersNum)a["a"].group.searchMember({group_id:this.group.groupId,keyword:t}).then(function(t){var n=t.data;e.$store.commit("updateGroupSearchList",n.data)});else{var n=this.group.membersArray.filter(function(e){var n,i;return n=!!e.user_name&&e.user_name.indexOf(t)>-1,i=!!e.nick_name&&e.nick_name.indexOf(t)>-1,n||i});this.$store.commit("updateGroupSearchList",n)}},getStrBeforeSelection:function(){var t=this.$refs.chatInput;if(!t)return"";var e=t.selectionStart,n=this.inputMsg.slice(0,e);return n},getStrAfterSelection:function(){var t=this.$refs.chatInput;if(!t)return"";var e=t.selectionStart,n=this.inputMsg.slice(e);return n},handleClick:function(){this.isShowContextmenu=!1},handleLeft:function(t){var e=this.$refs.chatInput,n=e.selectionStart;if(0===n)return!0;var i=this.getStrBeforeSelection(),s=this.group.members;for(var r in s){var o=s[r].user_name,a=new RegExp("@".concat(o," $"));if(a.test(i))return t.preventDefault(),e.setSelectionRange(n-o.length-2,n-o.length-2),!0}},handleRight:function(t){var e=this.$refs.chatInput,n=e.selectionStart,i=this.getStrAfterSelection(),s=this.group.members;for(var r in s){var o=s[r].user_name,a=new RegExp("^@".concat(o," "));if(a.test(i))return t.preventDefault(),e.setSelectionRange(n+o.length+2,n+o.length+2),!0}return!0},handleDel:function(t){var e=this,n=this.$refs.chatInput,s=n.selectionStart;if(0!==s){var r=this.getStrBeforeSelection(),o=this.group.members,a=function(i){var a=o[i].user_name,c=new RegExp("@".concat(a," $"));if(c.test(r))return t.preventDefault(),e.inputMsg=e.inputMsg.slice(0,s-a.length-2)+e.inputMsg.slice(s),e.$nextTick(function(){n.setSelectionRange(s-a.length-2,s-a.length-2)}),{v:void 0}};for(var c in o){var u=a(c);if("object"===Object(i["a"])(u))return u.v}}},handleKeyDown:function(t){var e=this;if(!this.atShow){if(t.altKey||t.ctrlKey){var n=this.getStrBeforeSelection(),i=this.getStrAfterSelection();this.inputMsg=n+"\n"+i,this.$nextTick(function(){e.$refs.chatInput.setSelectionRange(n.length+1,n.length+1)})}else this.handleSend(t),t.preventDefault();return!0}t.preventDefault();var s=this.filterMembers[this.atInd];this.atPerson(s.user_name,s.nick_name)},handleFocus:function(){var t=this;this.$emit("handleFocus"),this.updateChatInputFocus(!0),document.addEventListener("selectionchange",this.handleSelectionChange),this.isIOS&&setTimeout(function(){t.$root.$el.addEventListener("click",t.fixIOS)},0)},handleBlur:function(){var t=this;if(document.removeEventListener("selectionchange",this.handleSelectionChange),this.updateChatInputFocus(!1),(this.selectionAfterAt||this.isShowContextmenu)&&setTimeout(function(){t.selectionAfterAt=!1,t.isShowContextmenu=!1},200),this.isIOS){var e=document.body.scrollTop;document.body.scrollTop=e,this.$root.$el.removeEventListener("click",this.fixIOS)}Object(c["v"])()},handleEsc:function(){this.selectionAfterAt=!1},handleSelectionChange:function(){var t=this.$refs.chatInput;if(t){var e=t.selectionStart,n=this.$refs.chatInput.selectionEnd;if(e===n){var i=this.getStrBeforeSelection();if(this.selectionAfterAt=/@/.test(i),this.selectionAfterAt){this.keyAfterAt=i.slice(i.lastIndexOf("@")+1);var s=this.keyAfterAt.indexOf(this.lastKeyAfterAt)<0;this.$store.commit("updateIsNewAt",{isNewAt:s,isNewAtFound:!s&&this.group.isNewAtFound}),s&&this.$store.commit("updateGroupSearchList",[]),this.lastKeyAfterAt=this.keyAfterAt}}}},handleContextmenu:function(t){this.copyText&&(this.isShowContextmenu=!this.isShowContextmenu,this.isShowContextmenu&&(this.menuTop=t.offsetY,this.menuLeft=t.offsetX>100?t.offsetX-30:t.offsetX))},handlePaste:function(){this.isShowContextmenu=!1,this.inputMsg+=this.copyText},closeEmojiList:function(){this.emojiShow=!1},fixIOS:function(t){var e=this;setTimeout(function(){e.$refs.chatInput===document.activeElement&&document.activeElement.blur()},0)}}},g={methods:{addPanelSession:function(t,e){var n=this,i=this.sessionList.some(function(t){return t.session_id==e});i||a["a"].user.getOtherInfo({target_id:t}).then(function(t){var i=t.data,s=i.data,r={cover_photo:s.cover_photo,is_group:"0",name:s.nick_name,session_id:e,unread:0};n.$store.commit("addSessionItem",r)})}}},v={data:function(){return{curLang:Object(c["r"])("lang")||Object(c["m"])()}},methods:{changeLang:function(){var t="en"==this.curLang?"zh":"en";this.$i18n.locale=t,this.curLang=t,Object(c["z"])("lang",t)}}}},"8af1":function(t,e,n){"use strict";var i=n("8232"),s=n("471d"),r=n("7182"),o=n("44a7"),a=n("33ef"),c=n("3202"),u=n("50cd"),h=n("0811");s(s.S+s.F*!n("1969")(function(t){Array.from(t)}),"Array",{from:function(t){var e,n,s,l,f=r(t),m="function"==typeof this?this:Array,d=arguments.length,p=d>1?arguments[1]:void 0,g=void 0!==p,v=0,_=h(f);if(g&&(p=i(p,d>2?arguments[2]:void 0,2)),void 0==_||m==Array&&a(_))for(e=c(f.length),n=new m(e);e>v;v++)u(n,v,g?p(f[v],v):f[v]);else for(l=_.call(f),n=new m;!(s=l.next()).done;v++)u(n,v,g?o(l,p,[s.value,v],!0):s.value);return n.length=v,n}})},"92dd":function(t,e,n){n("4d6c"),n("8af1"),t.exports=n("836e").Array.from},"95e6":function(t,e,n){"use strict";var i=n("1dab"),s=n.n(i);s.a},a510:function(t,e,n){"use strict";n.r(e);var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"chat-list"},[n("div",{staticClass:"top-search"},[n("a",{staticClass:"meechat-icon",attrs:{href:"https://www.mee.chat",target:"_blank"}}),n("div",{staticClass:"search-tips search-wrap",on:{click:t.toSearch}},[n("i",{staticClass:"el-icon-search"}),t._v(t._s(t.$t("public.searchHotGroup"))+"\n ")]),n("router-link",{staticClass:"add-icon",attrs:{to:"/invite/1"}})],1),n("div",{staticClass:"pwa-guide",staticStyle:{display:"none"},attrs:{id:"btnPwa"}},[n("span",[t._v(t._s(t.$t("public.installPwa")))]),n("div",{staticClass:"btn-close"},[n("i",{staticClass:"el-icon-close",on:{click:function(e){return e.stopPropagation(),t.closePwaGuide()}}})])]),n("div",{staticClass:"chat-list pub-scroll-box"},[t.isSearch?t._l(t.searchList,function(t,e){return n("session-item",{key:e,attrs:{item:t}})}):t._l(t.sessionList,function(t,e){return n("session-item",{key:e,attrs:{item:t}})})],2)])},s=[],r=n("3f47"),o=n("52c1"),a=n("57d1"),c=n("8869"),u={name:"chatList",mixins:[c["f"]],components:{sessionItem:a["a"]},data:function(){return{searchShow:!1}},computed:Object(r["a"])({},Object(o["e"])({sessionList:function(t){return t.chat.sessionList},userInfo:function(t){return t.userInfo}})),methods:Object(r["a"])({},Object(o["d"])(["clearHash"]),{handleBlur:function(t){var e=t.target.value;e||(this.searchShow=!1)},toSearch:function(){this.$router.push({path:"/search"})},closePwaGuide:function(){var t=document.getElementById("btnPwa");t.style.display="none"}}),created:function(){this.sessionList.length<=0&&this.$store.dispatch("getSessionList"),this.userInfo&&this.userInfo&&this.userInfo.user_id||this.$store.dispatch("getUserInfo"),this.$store.commit("setUserId",localStorage.getItem("user_id"))},mounted:function(){this.clearHash()}},h=u,l=(n("95e6"),n("17cc")),f=Object(l["a"])(h,i,s,!1,null,"719df6ba",null);e["default"]=f.exports},ab6b:function(t,e,n){t.exports=n("92dd")},ad81:function(t,e,n){t.exports=n("a945")}}]);