import{_ as e,aI as a,s,B as r,f as n,h as i,i as d,w as t,j as l,o,k as u,V as m,W as c,X as f,Y as h,a3 as p,l as _,t as k,a4 as g,a5 as S,q as w}from"./index-VNZyFo9C.js";import{_ as x}from"./next-watermark.BjyP61mW.js";import{_ as I}from"./uni-search-bar.D2iG_X8E.js";import{_ as C}from"./head-image.CRPw_rZn.js";import"./uni-icons.CmIcu7af.js";const b=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,b,j){const y=n(i("next-watermark"),x),F=l,T=n(i("uni-search-bar"),I),N=n(i("head-image"),C),z=w,V=h;return o(),d(F,{class:"page friend-add"},{default:t((()=>[u(F,null,{default:t((()=>[u(y,{watermark:String(e.userStore.watermark)},null,8,["watermark"])])),_:1}),u(F,{class:"search-bar"},{default:t((()=>[u(T,{modelValue:b.searchText,"onUpdate:modelValue":a[0]||(a[0]=e=>b.searchText=e),radius:"100",focus:!0,onConfirm:a[1]||(a[1]=e=>j.onSearch()),onCancel:a[2]||(a[2]=e=>j.onCancel()),placeholder:"用户名/昵称"},null,8,["modelValue"])])),_:1}),u(F,{class:"user-items"},{default:t((()=>[u(V,{class:"scroll-bar","scroll-with-animation":"true","scroll-y":"true"},{default:t((()=>[(o(!0),m(f,null,c(b.users,(a=>p((o(),d(F,{key:a.id},{default:t((()=>[u(F,{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(F,{class:"user-name"},{default:t((()=>[_(k(a.nickName),1)])),_:2},1024),u(F,{class:"user-btns"},{default:t((()=>[p(u(z,{type:"primary",size:"mini",onClick:g((e=>j.onAddFriend(a)),["stop"])},{default:t((()=>[_("加为好友")])),_:2},1032,["onClick"]),[[S,!j.isFriend(a.id)]]),p(u(z,{type:"default",size:"mini",disabled:""},{default:t((()=>[_("已添加")])),_:2},1536),[[S,j.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{b as default};
