import{_ as e,aI as a,b as s,z as r,d as n,e as i,f as d,w as t,i as l,o,h as u,S as m,T as c,V as f,W as h,a1 as p,j as _,t as k,a2 as S,a3 as g,m as w}from"./index-DHnrKYrL.js";import{_ as x}from"./next-watermark.ChvoZ5mY.js";import{_ as I}from"./uni-search-bar.Cr49wPc-.js";import{_ as b}from"./head-image.Bo0L7nQ8.js";import"./uni-icons.DhPZCKE1.js";const C=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,C,T){const j=n(i("next-watermark"),x),y=l,F=n(i("uni-search-bar"),I),z=n(i("head-image"),b),N=w,V=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:C.searchText,"onUpdate:modelValue":a[0]||(a[0]=e=>C.searchText=e),radius:"100",focus:!0,onConfirm:a[1]||(a[1]=e=>T.onSearch()),onCancel:a[2]||(a[2]=e=>T.onCancel()),placeholder:"用户名/昵称"},null,8,["modelValue"])])),_:1}),u(y,{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(C.users,(a=>p((o(),d(y,{key:a.id},{default:t((()=>[u(y,{class:"user-item"},{default:t((()=>[u(z,{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(N,{type:"primary",size:"mini",onClick:S((e=>T.onAddFriend(a)),["stop"])},{default:t((()=>[_("加为好友")])),_:2},1032,["onClick"]),[[g,!T.isFriend(a.id)]]),p(u(N,{type:"default",size:"mini",disabled:""},{default:t((()=>[_("已添加")])),_:2},1536),[[g,T.isFriend(a.id)]])])),_:2},1024)])),_:2},1024)])),_:2},1024)),[[g,a.id!==e.userStore.userInfo.id]]))),128))])),_:1})])),_:1})])),_:1})}],["__scopeId","data-v-3ce4e6de"]]);export{C as default};
