2 lines
8.0 KiB
JavaScript
Executable File
2 lines
8.0 KiB
JavaScript
Executable File
import{_ as t,o as e,c as a,w as s,g as l,d as n,e as i,F as c,j as o,S as r,f as d,i as u,t as m,a3 as p,h,k as f,l as g,s as y,u as _,m as b,q as C,n as x,K as k,L as v,M as T,r as w,N as I,a4 as S,y as B}from"./index-22d2df30.js";import{s as L}from"./status.1eeec7ff.js";const j=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=o,k=f,v=r;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(c,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"]]),D=g(y),M=_(y),{contacts:N,sysUnread:V}=b(D);const z=t({components:{breadcurm:j,statusPoint:L},name:"contacts",props:{TabCur:{type:Number,default:0}},data:()=>({tabbarH:50,hidden:!0,listCurID:"",list:[],listCur:"",total:0,scrollLeft:0,msgs:N,unread:V,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=o,L=f,j=w("statusPoint"),D=w("Empty"),M=r,N=I,V=w("breadcurm"),z=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(L,{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(L,{class:"c-333"},{default:s((()=>[u("群聊")])),_:1})])),_:1})])),_:1},8,["onClick"])])),_:1}),(e(!0),n(c,null,i(_.contacts,((t,o)=>(e(),a(C,{key:o,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(c,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(j,{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(D,{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(c,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(L,{class:"cuIcon-search"}),l(N,{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(V,{tree:_.tree,onOpenBread:b.openDep},null,8,["tree","onOpenBread"])])),_:1}),l(C,{class:"im-department-list"},{default:s((()=>[(e(!0),n(c,null,i(_.depList,((t,n)=>(e(),a(z,{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(L,{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(c,null,i(_.userList,((t,n)=>(e(),a(z,{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(D,{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{z as default};
|