im/public/h5/assets/pages-message-group-groupUs...

2 lines
5.4 KiB
JavaScript
Executable File

import{_ as e,z as s,p as a,R as t,q as l,o as r,c as i,w as u,j as c,g as o,i as n,n as d,d as m,e as g,F as h,h as _,t as f,f as p,r as y,k,N as U}from"./index-22d2df30.js";const b=s("userInfo");const x=e({data:()=>({keywords:"",group_id:"",modelName:"",userList:[],allUser:[],isAdmin:!1,isManage:!1,isAuth:!1,userInfo:b,curUser:{}}),watch:{keywords(e){""==e?this.userList=this.allUser:this.search()}},onLoad(e){this.group_id=e.group_id?e.group_id:"",this.getGroupuserlist()},methods:{getGroupuserlist(){this.userList=[],this.$api.msgApi.groupUserList({group_id:this.group_id}).then((e=>{const s=e.data.filter((e=>1==e.role&&e.userInfo.id==b.user_id));s.length&&(this.isAdmin=!0);const a=e.data.filter((e=>2==e.role&&e.userInfo.id==b.user_id));a.length&&(this.manage=!0),(s.length||a.length)&&(this.isAuth=!0);const t=e.data;t.forEach((e=>{e.realname=e.userInfo.displayName,e.name_py=e.userInfo.name_py})),this.allUser=t,this.userList=e.data}))},openModel(e){e.realname=e.userInfo.displayName,e.avatar=e.userInfo.avatar,this.curUser=e,this.modelName="userOpt"},setManage(){const e=2==this.curUser.role?3:2;this.$api.msgApi.setManager({id:this.group_id,user_id:this.curUser.user_id,role:e}).then((e=>{0==e.code&&this.getGroupuserlist(),this.modelName=""}))},removeUser(){this.modelName="",a({title:"确定要删除该成员吗?",success:e=>{e.confirm&&this.$api.msgApi.removeUser({id:this.group_id,user_id:this.curUser.user_id}).then((e=>{0==e.code&&this.getGroupuserlist()}))}})},changeOwner(){this.modelName="",a({title:"确定将管理权限转移给该成员吗?",success:e=>{e.confirm&&this.$api.msgApi.changeOwner({id:this.group_id,user_id:this.curUser.user_id}).then((e=>{0==e.code&&t({url:"/pages/index/index"})}))}})},search(){const e=JSON.parse(JSON.stringify(this.allUser));this.userList=this.$util.searchObject(e,["realname","name_py"],this.keywords)},openChatDetail(e){b.user_id!=e.user_id&&l({url:"/pages/contacts/detail?id="+e.user_id})}}},[["render",function(e,s,a,t,l,b){const x=y("cu-custom"),I=k,w=U,N=c,C=y("Empty");return r(),i(N,null,{default:u((()=>[o(x,{bgColor:"bg-gradual-green",isBack:!0},{backText:u((()=>[])),content:u((()=>[n("群成员")])),_:1}),o(N,{class:"cu-bar bg-white search fixed",style:d([{top:e.CustomBar+"px"}])},{default:u((()=>[o(N,{class:"search-form round"},{default:u((()=>[o(I,{class:"cuIcon-search"}),o(w,{type:"text",modelValue:l.keywords,"onUpdate:modelValue":s[0]||(s[0]=e=>l.keywords=e),placeholder:"输入搜索的关键词","confirm-type":"search"},null,8,["modelValue"])])),_:1})])),_:1},8,["style"]),o(N,{style:{"margin-top":"104rpx"}},{default:u((()=>[o(N,{class:"cu-list menu-avatar"},{default:u((()=>[(r(!0),m(h,null,g(l.userList,(e=>(r(),i(N,{class:"cu-item"},{default:u((()=>[o(N,{class:"cu-avatar round lg",style:d("background-image:url("+e.userInfo.avatar+");"),onClick:s=>b.openChatDetail(e)},null,8,["style","onClick"]),o(N,{class:"content"},{default:u((()=>[o(N,{class:"text-grey"},{default:u((()=>[o(N,{class:"text-cut"},{default:u((()=>[n(f(e.userInfo.displayName),1)])),_:2},1024),e.role<3?(r(),i(N,{key:0,class:p(["cu-tag round sm",1==e.role?"bg-red":"bg-orange"])},{default:u((()=>[n(f(1==e.role?"群主":2==e.role?"管理员":""),1)])),_:2},1032,["class"])):_("",!0),e.user_id==l.userInfo.user_id?(r(),i(N,{key:1,class:"cu-tag round sm"},{default:u((()=>[n("我")])),_:1})):_("",!0)])),_:2},1024)])),_:2},1024),o(N,{class:"action",onClick:s=>b.openModel(e)},{default:u((()=>[o(N,{class:"text-grey text-sm"},{default:u((()=>[e.role>1&&l.isAuth?(r(),i(I,{key:0,class:"cuIcon-more f-24"})):_("",!0)])),_:2},1024)])),_:2},1032,["onClick"])])),_:2},1024)))),256)),l.userList.length?_("",!0):(r(),i(C,{key:0,noDatatext:"未搜索到数据",textcolor:"#999"}))])),_:1})])),_:1}),o(N,{class:p(["cu-modal bottom-modal","userOpt"==l.modelName?"show":""])},{default:u((()=>[o(N,{class:"cu-dialog"},{default:u((()=>[o(N,{class:"manage-content"},{default:u((()=>[o(N,{class:"cu-list menu bg-white"},{default:u((()=>[l.curUser?(r(),i(N,{key:0,class:"cu-item"},{default:u((()=>[o(N,{class:"content im-flex im-justify-content-center im-align-items-center"},{default:u((()=>[o(N,{class:"cu-avatar round sm",style:d("background-image:url("+l.curUser.avatar+");")},null,8,["style"]),o(N,{class:"text-cut ml-5"},{default:u((()=>[n(f(l.curUser.realname),1)])),_:1}),2==l.curUser.role?(r(),i(N,{key:0,class:"cu-tag round sm bg-orange"},{default:u((()=>[n("管理员")])),_:1})):_("",!0)])),_:1})])),_:1})):_("",!0),l.isAdmin?(r(),i(N,{key:1,class:"cu-item",onClick:s[1]||(s[1]=e=>b.changeOwner())},{default:u((()=>[o(N,{class:"content padding-tb-sm"},{default:u((()=>[o(I,{class:"c-orange"},{default:u((()=>[n("转让管理权限")])),_:1})])),_:1})])),_:1})):_("",!0),l.isAdmin?(r(),i(N,{key:2,class:"cu-item",onClick:s[2]||(s[2]=e=>b.setManage())},{default:u((()=>[o(N,{class:"content padding-tb-sm"},{default:u((()=>[o(I,null,{default:u((()=>[n(f(2==l.curUser.role?"取消管理员":"设为管理员"),1)])),_:1})])),_:1})])),_:1})):_("",!0),o(N,{class:"cu-item",onClick:s[3]||(s[3]=e=>b.removeUser())},{default:u((()=>[o(N,{class:"content padding-tb-sm"},{default:u((()=>[o(I,null,{default:u((()=>[n("移出群聊")])),_:1})])),_:1})])),_:1}),o(N,{class:"parting-line-5"}),o(N,{class:"cu-item",onClick:s[4]||(s[4]=e=>l.modelName="")},{default:u((()=>[o(N,{class:"content padding-tb-sm"},{default:u((()=>[o(I,{class:"c-red"},{default:u((()=>[n("取消")])),_:1})])),_:1})])),_:1})])),_:1})])),_:1})])),_:1})])),_:1},8,["class"])])),_:1})}],["__scopeId","data-v-7446cab0"]]);export{x as default};