import{_ as e,aI as a,s,A as r,e as n,f as i,h as d,w as t,i as l,o,j as u,T as m,V as c,W as f,X as h,a2 as p,k as _,t as k,a3 as g,a4 as S,p as w}from"./index-BiZOcPG_.js";import{_ as x}from"./next-watermark.DOJ_cSSS.js";import{_ as I}from"./uni-search-bar.Dv-vOcpm.js";import{_ as C}from"./head-image.CtNbpm50.js";import"./uni-icons.BKTssli-.js";const T=e({data:()=>({searchText:"",users:[]}),methods:{onCancel(){a()},onSearch(){this.$http({url:"/user/findByName?name="+this.searchText,method:"GET"}).then((e=>{this.users=e,console.log(e)}))},onAddFriend(e){this.$http({url:"/friend/add?friendId="+e.id,method:"POST"}).then((a=>{let r={id:e.id,nickName:e.nickName,headImage:e.headImage,online:e.online};this.friendStore.addFriend(r),s({title:"添加成功，对方已成为您的好友",icon:"none"})}))},onShowUserInfo(e){r({url:"/pages/common/user-info?id="+e.id})},isFriend(e){return!!this.friendStore.friends.find((a=>a.id==e))}}},[["render",function(e,a,s,r,T,b){const j=n(i("next-watermark"),x),y=l,F=n(i("uni-search-bar"),I),N=n(i("head-image"),C),z=w,A=h;return o(),d(y,{class:"page friend-add"},{default:t((()=>[u(y,null,{default:t((()=>[u(j,{watermark:String(e.userStore.watermark)},null,8,["watermark"])])),_:1}),u(y,{class:"search-bar"},{default:t((()=>[u(F,{modelValue:T.searchText,"onUpdate:modelValue":a[0]||(a[0]=e=>T.searchText=e),radius:"100",focus:!0,onConfirm:a[1]||(a[1]=e=>b.onSearch()),onCancel:a[2]||(a[2]=e=>b.onCancel()),placeholder:"用户名/昵称"},null,8,["modelValue"])])),_:1}),u(y,{class:"user-items"},{default:t((()=>[u(A,{class:"scroll-bar","scroll-with-animation":"true","scroll-y":"true"},{default:t((()=>[(o(!0),m(f,null,c(T.users,(a=>p((o(),d(y,{key:a.id},{default:t((()=>[u(y,{class:"user-item"},{default:t((()=>[u(N,{id:a.id,name:a.nickName,online:a.online,url:a.headImage,size:100},null,8,["id","name","online","url"]),u(y,{class:"user-name"},{default:t((()=>[_(k(a.nickName),1)])),_:2},1024),u(y,{class:"user-btns"},{default:t((()=>[p(u(z,{type:"primary",size:"mini",onClick:g((e=>b.onAddFriend(a)),["stop"])},{default:t((()=>[_("加为好友")])),_:2},1032,["onClick"]),[[S,!b.isFriend(a.id)]]),p(u(z,{type:"default",size:"mini",disabled:""},{default:t((()=>[_("已添加")])),_:2},1536),[[S,b.isFriend(a.id)]])])),_:2},1024)])),_:2},1024)])),_:2},1024)),[[S,a.id!==e.userStore.userInfo.id]]))),128))])),_:1})])),_:1})])),_:1})}],["__scopeId","data-v-3ce4e6de"]]);export{T as default};
