173.a7484acb.js 7.3 KB

1
  1. "use strict";(self["webpackChunkRaingad_IM"]=self["webpackChunkRaingad_IM"]||[]).push([[173],{4173:function(t,e,s){s.r(e),s.d(e,{default:function(){return u}});var a=function(){var t=this,e=t._self._c;return e("div",{staticClass:"pd-20"},[e("el-container",[e("el-aside",{attrs:{width:"320px"}},[e("div",{staticClass:"lz-flex group-box"},[t.showSearch?e("div",{staticClass:"group-box-header"},[e("el-input",{staticStyle:{width:"300px"},attrs:{placeholder:"请输入关键字搜索"},nativeOn:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.handleChange.apply(null,arguments)}},model:{value:t.params.keywords,callback:function(e){t.$set(t.params,"keywords",e)},expression:"params.keywords"}},[e("el-button",{attrs:{slot:"prepend",icon:"el-icon-back"},on:{click:function(e){t.showSearch=!1}},slot:"prepend"}),e("el-button",{attrs:{slot:"append",icon:"el-icon-search"},on:{click:t.handleChange},slot:"append"})],1)],1):e("div",{staticClass:"group-box-header"},[e("div",[t._v("群列表")]),e("div",[e("el-button",{attrs:{plain:"",circle:"",icon:"el-icon-search",title:"搜索"},on:{click:function(e){t.showSearch=!0}}}),e("el-button",{attrs:{plain:"",round:""},on:{click:function(e){t.createChatBox=!0,t.isAdd=!0}}},[t._v("创建群聊")])],1)]),e("div",{staticClass:"group-box-list"},[e("el-scrollbar",t._l(t.chats,(function(s){return e("div",{key:s.group_id,staticClass:"chat-item",class:t.active==s.group_id?"active":"",on:{click:function(e){return t.openGroup(s)}}},[e("div",{staticClass:"chat-avatar"},[e("img",{attrs:{src:s.avatar,alt:"avatar"}})]),e("div",{staticClass:"chat-content"},[e("span",{staticClass:"chat-name"},[t._v(t._s(s.name))]),e("p",{staticClass:"chat-message c-999"},[t._v(" 创建人:"+t._s(s.owner_id_info.realname))])]),e("div",{staticClass:"chat-time"},[t._v(" "+t._s(s.reate_time)+" ")])])})),0)],1),e("div",{staticClass:"group-box-page",attrs:{align:"center"}},[e("el-pagination",{attrs:{background:"",total:t.total,"current-page":t.params.page,"page-size":t.params.limit,layout:"total, prev, next , jumper"},on:{"current-change":t.getGroupList,"update:currentPage":function(e){return t.$set(t.params,"page",e)},"update:current-page":function(e){return t.$set(t.params,"page",e)},"update:pageSize":function(e){return t.$set(t.params,"limit",e)},"update:page-size":function(e){return t.$set(t.params,"limit",e)}}})],1)])]),e("el-main",{staticStyle:{padding:"0"}},[e("div",{staticClass:"lz-flex group-box group-user-box"},[e("div",{staticClass:"group-box-header"},[e("div",[t._v("群成员")]),t.members.length>0?e("div",[e("el-button",{attrs:{plain:"",round:""},on:{click:t.openAddUser}},[t._v("添加成员")]),e("el-button",{attrs:{type:"warning",plain:"",round:""},on:{click:t.openMessageBox}},[t._v("群聊监控")]),e("el-button",{attrs:{type:"danger",plain:"",round:""},on:{click:t.delGroup}},[t._v("解散群聊")])],1):t._e()]),e("div",{staticClass:"group-box-list"},[e("el-scrollbar",[t.members.length>0?e("div",{staticClass:"member-list"},t._l(t.members,(function(s){return e("div",{key:s.id,staticClass:"member-item"},[e("div",{staticClass:"member-avatar"},[e("img",{attrs:{src:s.userInfo.avatar,alt:"avatar"}})]),e("div",{staticClass:"member-content"},[e("div",{staticClass:"member-header"},[e("span",{staticClass:"member-name"},[t._v(t._s(s.userInfo.displayName))]),1==s.role?e("el-tag",{staticClass:"mt-3",attrs:{type:"warning",size:"mini"}},[t._v("群主")]):t._e(),2==s.role?e("el-tag",{staticClass:"mt-3",attrs:{type:"info",size:"mini"}},[t._v("管理员")]):t._e(),3==s.role?e("span",{staticClass:"member-role mt-3"},[t._v("普通成员")]):t._e()],1),e("div",{staticClass:"member-actions"},[e("el-dropdown",{on:{command:function(e){return t.handleCommand(s,e)}}},[e("el-button",{attrs:{type:"text",icon:"el-icon-more"}}),e("el-dropdown-menu",{attrs:{slot:"dropdown"},slot:"dropdown"},[e("el-dropdown-item",{attrs:{command:"info"}},[t._v("查看资料")]),s.role>1?e("el-dropdown-item",{attrs:{command:"setManager"}},[t._v(" "+t._s(2==s.role?"取消":"设置")+"管理员")]):t._e(),s.role>1?e("el-dropdown-item",{attrs:{command:"changeOwner"}},[t._v("设置为群主")]):t._e(),s.role>1?e("el-dropdown-item",{attrs:{command:"removeUser"}},[e("span",{staticClass:"c-red"},[t._v("移除成员")])]):t._e()],1)],1)],1)])])})),0):e("div",[e("el-empty",{attrs:{description:"请选择群聊"}})],1)])],1)])])],1),e("Group",{attrs:{visible:t.createChatBox,title:t.dialogTitle,isAdd:t.isAdd,userIds:t.userIds},on:{"update:visible":function(e){t.createChatBox=e},manageGroup:t.manageGroup}}),e("el-dialog",{attrs:{title:"消息管理器",visible:t.messageBox,modal:!0,width:"800px","append-to-body":""},on:{"update:visible":function(e){t.messageBox=e}}},[e("ChatRecord",{key:t.componentKey,attrs:{contact:t.currentChat}})],1)],1)},i=[],r=s(284),o=s(4539),n=s(2325),c={components:{Group:r.Z,ChatRecord:o.Z},data(){return{componentKey:99,messageBox:!1,isAdd:!0,dialogTitle:"创建群聊",createChatBox:!1,userIds:[],showSearch:!1,value:!1,active:0,currentChat:{},params:{page:1,limit:20,keywords:""},total:0,chats:[],members:[]}},mounted(){this.getGroupList()},methods:{openMessageBox(){this.componentKey++,this.messageBox=!0},openGroup(t){this.active=t.group_id,t.id="group-"+t.group_id,t.is_group=1,this.currentChat=t,this.getGroupUser(t.group_id)},getGroupList(){this.$api.groupApi.getGroupList(this.params).then((t=>{0==t.code&&(this.chats=t.data,this.total=t.count,this.params.page=t.page)}))},getGroupUser(t){this.$api.imApi.groupUserListAPI({group_id:"group-"+t}).then((t=>{0==t.code&&(this.members=t.data)}))},handleChange(){this.params.page=1,this.getGroupList()},manageGroup(t,e,s){this.createChatBox=!1,e?this.$api.imApi.addGroupAPI({user_ids:t,name:s}).then((t=>{0==t.code&&(this.$message.success("创建成功"),this.params.page=1,this.getGroupList())})):this.$api.groupApi.addGroupUser({group_id:this.active,user_ids:t}).then((t=>{0==t.code&&(this.$message.success("添加成功"),this.getGroupUser(this.active))}))},openAddUser(){if(0==this.active)return void this.$message.warning("请选择群聊");this.createChatBox=!0,this.isAdd=!1,this.dialogTitle="添加成员";let t=n.Nj(this.members,"user_id");this.userIds=t},delGroup(){0!=this.active?this.$confirm("确定要解散该群聊吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((()=>{this.$api.groupApi.delGroup({group_id:this.active}).then((t=>{0==t.code&&(this.$message.success("解散成功"),this.params.page=1,this.members=[],this.getGroupList())}))})).catch((()=>{this.$message.info("已取消操作")})):this.$message.warning("请选择群聊")},handleCommand(t,e){"info"==e?this.$user(t.user_id):"setManager"==e?this.$api.groupApi.setManager({group_id:this.active,user_id:t.user_id,role:2==t.role?3:2}).then((t=>{0==t.code&&(this.$message.success(t.msg),this.getGroupUser(this.active))})):"changeOwner"==e?this.$api.groupApi.changeOwner({group_id:this.active,user_id:t.user_id}).then((t=>{0==t.code&&(this.$message.success(t.msg),this.getGroupUser(this.active))})):"removeUser"==e&&this.$confirm("确定要移除该成员吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((()=>{this.$api.groupApi.delGroupUser({group_id:this.active,user_id:t.user_id}).then((t=>{0==t.code&&(this.$message.success(t.msg),this.getGroupUser(this.active))}))})).catch((()=>{this.$message.info("已取消操作")}))}}},p=c,d=s(1001),l=(0,d.Z)(p,a,i,!1,null,"79495ffc",null),u=l.exports}}]);