chunk-14b7d1c9.2f3e016a.js 6.2 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-14b7d1c9"],{"0af3":function(t,s,e){"use strict";var i=e("8656"),o=e.n(i);o.a},"57d1":function(t,s,e){"use strict";var i=function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("div",{staticClass:"chat-item",class:{current:t.item.session_id==t.curSession,moblie:t.isMoblie,top:1==t.item.is_pin},on:{click:function(s){t.changeSessionId(t.item)},contextmenu:function(s){return s.preventDefault(),t.onToolBtn(s)}}},[e("div",{staticClass:"avatar-wrap"},[t.item.unread>0?e("i",{staticClass:"ext"},[t._v(t._s(t.item.unread))]):t._e(),t.item.cover_photo?e("img",{staticClass:"user-avatar",attrs:{src:t.item.cover_photo,alt:""}}):e("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()}})]),e("div",{staticClass:"info"},[e("h3",[1==t.item.is_group?e("i",{staticClass:"icon-group"}):t._e(),e("span",[t._v(t._s(t.item.name))]),1==t.item.is_mute?e("i",{staticClass:"icon-mute"}):t._e()]),e("p",[t._v(t._s(t.item.cont))]),e("span",{staticClass:"time"},[t._v(t._s(t._f("handleUpdate")(t.item.update_time_int)))])]),t.item.session_id?e("ul",{directives:[{name:"show",rawName:"v-show",value:t.showToolbar,expression:"showToolbar"}],staticClass:"pub-pop-toolbar ext-session",style:{left:t.toolBarX,top:t.toolBarY,bottom:t.toolBarBottom}},[e("li",{staticClass:"split-line",on:{click:function(s){s.stopPropagation(),t.changePin(t.item.session_id,t.item.is_pin)}}},[t._v(t._s(1==t.item.is_pin?"取消置顶":"置顶"))]),e("li",{staticClass:"split-line",on:{click:function(s){s.stopPropagation(),t.changeMute(t.item.session_id,t.item.is_mute)}}},[t._v(t._s(1==t.item.is_mute?"取消免打扰":"消息免打扰"))]),e("li",{on:{click:function(s){s.stopPropagation(),t.delSession(t.item.session_id)}}},[t._v("删除会话")])]):t._e()])},o=[],n=(e("28a5"),e("ac6a"),e("4917"),e("be94")),a=e("2f62"),r=e("5975"),c=e("33f8"),u={name:"msgItem",props:{item:{type:Object},isMoblie:{type:Boolean,default:!1}},data:function(){return{toolBarX:0,toolBarY:0,toolBarBottom:0,showToolbar:!1}},computed:Object(n["a"])({},Object(a["d"])(["curSession","userId"]),Object(a["c"])(["setSessionItemUnread"]),{userInfo:function(){return this.$store.state.userInfo}}),methods:{changeSessionId:function(t){var s=1==t.is_group?"/group/".concat(t.session_id):"/pm/".concat(t.session_id);this.$router.push({path:s}),this.$store.commit("setSessionItemUnread",{session_id:t.session_id,unread:0,curSession:this.curSession})},bgColorNum:function(t){var s=this;if(t.match("-")){var e=0;return t.split("-").forEach(function(t){t!==s.userId&&(e=t%9)}),e}return t%9},hideToolbar:function(t){!1!==this.showToolbar&&(this.showToolbar=!1,document.body.removeEventListener("click",this.hideToolbar,!1),document.body.removeEventListener("contextmenu",this.hideToolbar,!1))},onToolBtn:function(t){var s=this;if(this.showToolbar)this.hideToolbar(t);else{var e,i,o=window.innerWidth,n=window.innerHeight;t instanceof MouseEvent&&(e=t.clientX,i=t.clientY,this.toolBarX=t.layerX>170?170:t.layerX+20,this.toolBarY=t.layerY,setTimeout(function(){document.body.addEventListener("click",s.hideToolbar,!1),document.body.addEventListener("contextmenu",s.hideToolbar,!1)},0)),e>.5*o&&(this.toolBarX=this.toolBarX-120),this.toolBarX+="px",i>n/2?(this.toolBarBottom=this.toolBarY+"px",this.toolBarY="auto"):(this.toolBarBottom="auto",this.toolBarY+="px"),this.showToolbar=!0}},changePin:function(t,s){var e=this;0==s?r["a"].session.setPin({session_id:t}).then(function(){e.curSession==t&&e.$store.commit("updatePin","1"),e.$store.commit("updateSessionListByPin",t),e.hideToolbar()}):r["a"].session.cancelPin({session_id:t}).then(function(){e.curSession==t&&e.$store.commit("updatePin","0"),e.$store.commit("cancelSessionListByPin",t),e.hideToolbar()})},changeMute:function(t,s){var e=this;0==s?r["a"].session.setMute({session_id:t}).then(function(){e.curSession==t&&e.$store.commit("updateMute","1"),e.$store.commit("updateSessionListByMute",t),e.hideToolbar()}):r["a"].session.cancelMute({session_id:t}).then(function(){e.curSession==t&&e.$store.commit("updateMute","0"),e.$store.commit("cancelSessionListByMute",t),e.hideToolbar()})},delSession:function(t){var s=this;Object(c["f"])("确认删除当前会话?").then(function(){r["a"].session.deleteSession({session_id:t}).then(function(){s.$store.commit("removeSessionListById",t),s.$showTips("已退出该会话"),s.hideToolbar(),s.curSession==t&&(s.$store.commit("changeSessionId",0),s.$router.push({path:"/"}))})})}},filters:{handleUpdate:function(t){return Object(c["k"])(t)}}},l=u,h=(e("0af3"),e("2877")),m=Object(h["a"])(l,i,o,!1,null,"1fd44357",null);m.options.__file="sessionItem.vue";s["a"]=m.exports},6865:function(t,s,e){"use strict";var i=e("94eb"),o=e.n(i);o.a},8656:function(t,s,e){},"94eb":function(t,s,e){},a510:function(t,s,e){"use strict";e.r(s);var i=function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("div",{staticClass:"chat-list"},[e("div",{staticClass:"top-search"},[e("i",{staticClass:"meechat-icon"}),t.searchShow?e("input",{directives:[{name:"focus",rawName:"v-focus"}],staticClass:"search-wrap",attrs:{type:"text"},on:{input:function(s){t.searchUser(s,t.sessionList)},blur:t.handleBlur}}):e("div",{staticClass:"search-tips search-wrap",on:{click:function(s){t.searchShow=!0}}},[e("i",{staticClass:"el-icon-search"}),t._v("搜索\n ")]),e("i",{staticClass:"add-icon"})]),e("div",{staticClass:"chat-list pub-scroll-box"},[t.isSearch?t._l(t.searchList,function(t,s){return e("session-item",{key:s,attrs:{item:t,isMoblie:!0}})}):t._l(t.sessionList,function(t,s){return e("session-item",{key:s,attrs:{item:t,isMoblie:!0}})})],2)])},o=[],n=e("be94"),a=e("2f62"),r=e("57d1"),c=e("8869"),u={name:"chatList",mixins:[c["e"]],components:{sessionItem:r["a"]},data:function(){return{searchShow:!1}},computed:Object(n["a"])({},Object(a["d"])({sessionList:function(t){return t.chat.sessionList},userInfo:function(t){return t.userInfo}})),methods:{handleBlur:function(t){var s=t.target.value;s||(this.searchShow=!1)}},created:function(){this.$store.dispatch("getSessionList"),this.$store.dispatch("getUserInfo")}},l=u,h=(e("6865"),e("2877")),m=Object(h["a"])(l,i,o,!1,null,"78a031d3",null);m.options.__file="chatList.vue";s["default"]=m.exports}}]);