pages-contacts-index.ea1d4495.js 8.0 KB

1
  1. import{_ as t,o as e,c as a,w as s,v as l,a as n,r as i,F as r,f as c,S as o,n as d,d as u,t as m,a3 as p,e as h,i as f,u as g,s as y,h as _,g as b,q as C,b as x,N as k,E as v,G as T,x as w,a4 as I,a5 as S,z as B}from"./index-01d5b8eb.js";import{s as D}from"./status.9074c73e.js";const L=t({name:"breadcrum",props:{tree:{type:Array,default:()=>({})},icon:{type:String,default:()=>"cuIcon-right"}},data:()=>({}),methods:{open(t){this.$emit("openBread",t)}}},[["render",function(t,g,y,_,b,C){const x=c,k=f,v=o;return e(),a(x,null,{default:s((()=>[l(v,{class:"folder-wap","scroll-x":!0,"scroll-left":99999999},{default:s((()=>[l(x,{class:"im-flex im-justify-content-start im-align-items-center"},{default:s((()=>[(e(!0),n(r,null,i(y.tree,((n,i)=>(e(),a(x,{class:"tab-item im-flex im-justify-content-start im-align-items-center",onClick:t=>C.open(n),key:i},{default:s((()=>[l(x,{class:d(["mar10 lz-tree-name font-color-999",{"font-color-333":i==y.tree.length-1}])},{default:s((()=>[u(m(n.name),1)])),_:2},1032,["class"]),p(t.$slots,"icon",{},(()=>[i<y.tree.length-1?(e(),a(k,{key:0,class:d(["font-color-999",[y.icon?y.icon:"cuIcon-right"]])},null,8,["class"])):h("",!0)]),!0)])),_:2},1032,["onClick"])))),128))])),_:3})])),_:3})])),_:3})}],["__scopeId","data-v-b66ec5ca"]]),j=g(y),M=_(y),{contacts:z,sysUnread:N}=b(j);const V=t({components:{breadcurm:L,statusPoint:D},name:"contacts",props:{TabCur:{type:Number,default:0}},data:()=>({tabbarH:50,hidden:!0,listCurID:"",list:[],listCur:"",total:0,scrollLeft:0,msgs:z,unread:N,globalConfig:M.globalConfig,appSetting:M.appSetting,tree:[{id:1,name:"技术部"},{id:2,name:"产品部"},{id:3,name:"信息部"}],depList:[{id:1,name:"技术部"},{id:2,name:"财务部"}],userList:[{id:1,realname:"张三",avatar:"https://api.multiavatar.com/raingad1.png?apikey=zdvXV3W4MjwhP9"},{id:2,realname:"李四",avatar:"https://api.multiavatar.com/raingad2.png?apikey=zdvXV3W4MjwhP9"}],tabList:["普通通讯录","企业通讯录"],contacts:[]}),watch:{msgs(t){this.initContacts(t)}},created(){this.listCur=this.contacts[0]},mounted(){this.initContacts(this.msgs)},methods:{initContacts(t){const e=JSON.parse(JSON.stringify(t)).filter((t=>0==t.is_group));this.total=e.length;const a=e.sort(((t,e)=>"#"===t.index?1:"#"===e.index?-1:t.index.localeCompare(e.index,"zh"))).reduce(((t,e)=>{const a=e.index,s=t.findIndex((t=>t.name===a));return-1===s?t.push({name:a,children:[e]}):t[s].children.push(e),t}),[]);this.contacts=a},openDep(t){},openDetails(t){C({url:"/pages/contacts/detail?id="+t.id})},openGroup(){C({url:"/pages/contacts/group"})},openFriend(){C({url:"/pages/contacts/friend"})},tabSelect(t){this.TabCur=t.currentTarget.dataset.id,this.scrollLeft=60*(t.currentTarget.dataset.id-1)},getCur(t){this.hidden=!1,this.listCur=this.contacts[t.target.id].name},setCur(t){this.hidden=!0,this.listCur=this.listCur},tMove(t){let e=t.touches[0].clientY,a=this.boxTop,s=this;if(e>a){let t=parseInt((e-a)/20);this.listCur=s.contacts[t].name}},tStart(){this.hidden=!1},tEnd(){this.hidden=!0,this.listCurID=this.listCur},indexSelect(t){let e=this,a=this.barHeight,s=this.contacts,l=Math.ceil(s.length*t.detail.y/a);for(let n=0;n<s.length;n++)if(l<n+1)return e.listCur=s[n].name,e.movableY=20*n,!1}}},[["render",function(t,p,g,y,_,b){const C=c,D=f,L=w("statusPoint"),j=w("Empty"),M=o,z=I,N=w("breadcurm"),V=S,A=B;return e(),a(C,null,{default:s((()=>[0==g.TabCur?(e(),a(M,{key:0,"scroll-y":"",class:"indexes","scroll-into-view":"indexes-"+_.listCurID,style:x([{height:"calc(100vh - "+(t.CustomBar+t.inlineTools+t.StatusBar)+"px)"}]),"scroll-with-animation":!0,"enable-back-to-top":!0},{default:s((()=>[l(C,{style:{"padding-bottom":"30rpx"}},{default:s((()=>[l(C,{class:"cu-list menu mt-10"},{default:s((()=>[2==_.globalConfig.sysInfo.runMode?(e(),a(C,{key:0,class:"cu-item arrow",onClick:b.openFriend},{default:s((()=>[l(C,{class:d(["cu-avatar mr-15 invite-bg",_.appSetting.circleAvatar?"round":"radius"])},null,8,["class"]),l(C,{class:"content"},{default:s((()=>[l(D,{class:"c-333"},{default:s((()=>[u("新邀请")])),_:1})])),_:1}),l(C,{class:"action"},{default:s((()=>[_.unread>0?(e(),a(C,{key:0,class:"cu-tag round bg-red sm"},{default:s((()=>[u(m(_.unread),1)])),_:1})):h("",!0)])),_:1})])),_:1},8,["onClick"])):h("",!0),l(C,{class:"cu-item arrow",onClick:b.openGroup},{default:s((()=>[l(C,{class:d(["cu-avatar mr-15 group-bg",_.appSetting.circleAvatar?"round":"radius"])},null,8,["class"]),l(C,{class:"content"},{default:s((()=>[l(D,{class:"c-333"},{default:s((()=>[u("群聊")])),_:1})])),_:1})])),_:1},8,["onClick"])])),_:1}),(e(!0),n(r,null,i(_.contacts,((t,c)=>(e(),a(C,{key:c,class:d("indexItem-"+t.name),id:"indexes-"+t.name,"data-index":t.name},{default:s((()=>[l(C,{class:"padding"},{default:s((()=>[u(m(t.name),1)])),_:2},1024),l(C,{class:"cu-list menu no-padding"},{default:s((()=>[(e(!0),n(r,null,i(t.children,((t,n)=>(e(),a(C,{class:"cu-item",key:n,onClick:e=>b.openDetails(t)},{default:s((()=>[l(C,{class:d(["cu-avatar mr-15",_.appSetting.circleAvatar?"round":"radius"]),style:x([{backgroundImage:"url("+t.avatar+")"}])},null,8,["class","style"]),l(C,{class:"content"},{default:s((()=>[l(C,{class:"c-333"},{default:s((()=>[t.is_online&&0==t.is_group&&1==_.globalConfig.chatInfo.online?(e(),a(L,{key:0,type:"success"})):h("",!0),u(" "+m(t.displayName),1)])),_:2},1024)])),_:2},1024)])),_:2},1032,["onClick"])))),128))])),_:2},1024)])),_:2},1032,["class","id","data-index"])))),128)),l(C,{class:"text-center m-20 text-grey"},{default:s((()=>[u(m(_.total)+" 个朋友",1)])),_:1}),_.contacts.length?h("",!0):(e(),a(j,{key:0,noDatatext:"暂无联系人",textcolor:"#999"}))])),_:1})])),_:1},8,["scroll-into-view","style"])):h("",!0),0==g.TabCur?(e(),a(C,{key:1,class:"indexBar",style:x([{height:"calc(100vh - "+t.CustomBar+"px - 50px)"}])},{default:s((()=>[l(C,{class:"indexBar-box",onTouchstart:b.tStart,onTouchend:b.tEnd,onTouchmove:k(b.tMove,["stop"])},{default:s((()=>[(e(!0),n(r,null,i(_.contacts,((t,l)=>(e(),a(C,{class:"indexBar-item",key:l,id:l,onTouchstart:b.getCur,onTouchend:b.setCur},{default:s((()=>[u(m(t.name),1)])),_:2},1032,["id","onTouchstart","onTouchend"])))),128))])),_:1},8,["onTouchstart","onTouchend","onTouchmove"])])),_:1},8,["style"])):h("",!0),1==g.TabCur?(e(),a(C,{key:2,class:"cu-bar bg-white search fixed",style:x([{top:t.CustomBar+"px"}])},{default:s((()=>[l(C,{class:"search-form round"},{default:s((()=>[l(D,{class:"cuIcon-search"}),l(z,{type:"text",modelValue:t.keywords,"onUpdate:modelValue":p[0]||(p[0]=e=>t.keywords=e),placeholder:"输入搜索的关键词","confirm-type":"search"},null,8,["modelValue"])])),_:1})])),_:1},8,["style"])):h("",!0),1==g.TabCur?(e(),a(M,{key:3,"scroll-y":"",class:"indexes",style:x([{top:"50px",height:"calc(100vh - "+(t.CustomBar+t.inlineTools+t.StatusBar)+"px)"}]),"scroll-with-animation":!0,"enable-back-to-top":!0},{default:s((()=>[l(C,{class:""},{default:s((()=>[l(N,{tree:_.tree,onOpenBread:b.openDep},null,8,["tree","onOpenBread"])])),_:1}),l(C,{class:"im-department-list"},{default:s((()=>[(e(!0),n(r,null,i(_.depList,((t,n)=>(e(),a(V,{class:"im-flex im-justify-content-start im-align-items-center mt-10",onClick:e=>b.openDep(t),key:n},{default:s((()=>[l(C,{class:"im-folder-bar mr-10"},{default:s((()=>[l(D,{class:"cuIcon-file color-blue"})])),_:1}),l(C,{class:"im-list-body im-border-b"},{default:s((()=>[l(C,{class:"im-list-title word"},{default:s((()=>[u(m(t.name),1)])),_:2},1024)])),_:2},1024)])),_:2},1032,["onClick"])))),128)),(e(!0),n(r,null,i(_.userList,((t,n)=>(e(),a(V,{class:"im-flex im-justify-content-start im-align-items-center mt-10",key:t.id,url:"/pages/contacts/detail?user_id="+t.id},{default:s((()=>[l(C,{class:"im-folder-bar im-image mr-10"},{default:s((()=>[l(A,{src:t.avatar,mode:"widthFix"},null,8,["src"])])),_:2},1024),l(C,{class:"im-list-body im-border-b"},{default:s((()=>[l(C,{class:"im-list-title word"},{default:s((()=>[u(m(t.realname),1)])),_:2},1024)])),_:2},1024)])),_:2},1032,["url"])))),128)),0==_.depList.length&&0==_.userList.length?(e(),a(j,{key:0})):h("",!0)])),_:1})])),_:1},8,["style"])):h("",!0),v(l(C,{class:"indexToast"},{default:s((()=>[u(m(_.listCur),1)])),_:1},512),[[T,!_.hidden]])])),_:1})}],["__scopeId","data-v-3279d953"]]);export{V as default};