im/public/h5/assets/pages-index-search.649d5b90.js

2 lines
2.8 KiB
JavaScript
Executable File

import{_ as a,z as t,q as s,o as e,c as l,w as c,j as o,g as n,i as u,t as i,n as d,d as r,e as p,F as h,h as g,r as y,k as m,N as f}from"./index-22d2df30.js";const _=a({name:"search",data:()=>({title:"搜索聊天",keywords:"",allContacts:[],contacts:[],groupList:[],type:1}),watch:{keywords(a){this.search()}},onLoad(a){this.type=a.type,2==this.type?this.title="搜索联系人":3==this.type?this.title="搜索群聊":this.title="搜索聊天"},mounted(){this.allContacts=t("allContacts")},methods:{search(){const a=this.$util.searchObject(this.allContacts,["displayName","name_py","account"],this.keywords),t=[],s=[];a.forEach((a=>{1==a.is_group?s.push(a):t.push(a)})),this.groupList=s,this.contacts=t},openDetails(a){2==this.type&&0==a.is_gourp&&s({url:"/pages/contacts/detail?id="+a.id}),s({url:"/pages/message/chat?id="+a.id})}}},[["render",function(a,t,s,_,k,C){const x=y("cu-custom"),b=m,w=f,v=o,L=y("Empty");return e(),l(v,null,{default:c((()=>[n(x,{bgColor:"bg-gradual-green",isBack:!0},{backText:c((()=>[])),content:c((()=>[u(i(k.title),1)])),_:1}),n(v,{class:"cu-bar bg-white search fixed",style:d([{top:a.CustomBar+"px"}])},{default:c((()=>[n(v,{class:"search-form round"},{default:c((()=>[n(b,{class:"cuIcon-search"}),n(w,{type:"text",modelValue:k.keywords,"onUpdate:modelValue":t[0]||(t[0]=a=>k.keywords=a),placeholder:"输入搜索的关键词","confirm-type":"search"},null,8,["modelValue"])])),_:1})])),_:1},8,["style"]),n(v,{style:{"margin-top":"120rpx"}},{default:c((()=>[k.type<3&&k.contacts.length>0?(e(),l(v,{key:0},{default:c((()=>[n(v,{class:"padding"},{default:c((()=>[u("联系人")])),_:1}),n(v,{class:"cu-list menu-avatar no-padding"},{default:c((()=>[(e(!0),r(h,null,p(k.contacts,((a,t)=>(e(),l(v,{class:"cu-item",key:t,onClick:t=>C.openDetails(a)},{default:c((()=>[n(v,{class:"cu-avatar lg radius mr-15",style:d([{backgroundImage:"url("+a.avatar+")"}])},null,8,["style"]),n(v,{class:"content"},{default:c((()=>[n(v,{class:"c-333"},{default:c((()=>[u(i(a.displayName),1)])),_:2},1024)])),_:2},1024)])),_:2},1032,["onClick"])))),128))])),_:1})])),_:1})):g("",!0),k.groupList.length>0?(e(),l(v,{key:1},{default:c((()=>[n(v,{class:"padding"},{default:c((()=>[u("群聊")])),_:1}),n(v,{class:"cu-list menu-avatar no-padding"},{default:c((()=>[(e(!0),r(h,null,p(k.groupList,((a,t)=>(e(),l(v,{class:"cu-item",key:t,onClick:t=>C.openDetails(a)},{default:c((()=>[n(v,{class:"cu-avatar lg radius mr-15",style:d([{backgroundImage:"url("+a.avatar+")"}])},null,8,["style"]),n(v,{class:"content"},{default:c((()=>[n(v,{class:"c-333"},{default:c((()=>[u(i(a.displayName),1)])),_:2},1024)])),_:2},1024)])),_:2},1032,["onClick"])))),128))])),_:1})])),_:1})):g("",!0),k.groupList.length||k.contacts.length?g("",!0):(e(),l(v,{key:2},{default:c((()=>[n(L,{noDatatext:"暂无数据",textcolor:"#999"})])),_:1}))])),_:1})])),_:1})}]]);export{_ as default};