chunk-dc040b34.4a17ab7f.js 5.8 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-dc040b34"],{"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},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",[t._v(t._s(t.item.name))]),e("p",[t._v(t._s(t.item.cont))])]),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("cadf"),e("551c"),e("097d"),e("2f62")),c=e("5975"),r=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"]),{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})},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?c["a"].session.setPin({session_id:t}).then(function(){e.curSession==t&&e.$store.commit("updatePin","1"),e.$store.commit("updateSessionListByPin",t),e.hideToolbar()}):c["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?c["a"].session.setMute({session_id:t}).then(function(){e.curSession==t&&e.$store.commit("updateMute","1"),e.$store.commit("updateSessionListByMute",t),e.hideToolbar()}):c["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(r["f"])("确认删除当前会话?").then(function(){c["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:"/"}))})})}}},l=u,h=(e("662d"),e("2877")),d=Object(h["a"])(l,i,o,!1,null,"06c539bf",null);d.options.__file="sessionItem.vue";s["a"]=d.exports},"662d":function(t,s,e){"use strict";var i=e("fc4e"),o=e.n(i);o.a},6865:function(t,s,e){"use strict";var i=e("94eb"),o=e.n(i);o.a},"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"),c=e("57d1"),r=e("8869"),u={name:"chatList",mixins:[r["d"]],components:{sessionItem:c["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")),d=Object(h["a"])(l,i,o,!1,null,"78a031d3",null);d.options.__file="chatList.vue";s["default"]=d.exports},fc4e:function(t,s,e){}}]);