2 lines
4.0 KiB
JavaScript
2 lines
4.0 KiB
JavaScript
import{_ as k,k as S,I as N,c as p,l as U,q as n,b as e,D as A,E as C,a7 as I,t as c,F as B,x as D,r as f,a8 as E,u as G,j as u,G as j,m as z,y as F}from"./index-CIAVq8iD-1776148658686.js";import{_ as L}from"./search-D2xJuklA-1776148658686.js";import{s as P}from"./coinSellerStore-FCN4A8Yr-1776148658686.js";import{h as _}from"./imageHandler-DstQGL3Z-1776148658686.js";import{G as V}from"./GeneralHeader-ClI1i1Ud-1776148658686.js";import{G as K}from"./GradientBorder-CfwSeIMB-1776148658686.js";const M={class:"coin-seller-search"},R={class:"content"},q={style:{display:"flex",gap:"4px"}},H={style:{flex:"1","background-color":"white","border-radius":"32px",border:"1px solid #fff","box-sizing":"border-box",display:"flex","align-items":"center",gap:"4px",padding:"4px 12px"}},Q=["placeholder"],T={style:{margin:"20px 0"}},$={style:{padding:"16px"}},J={style:{display:"flex","align-items":"center","justify-content":"space-between",gap:"4px"}},O={style:{flex:"1","min-width":"0",display:"flex","align-items":"center",gap:"4px"}},W={style:{width:"3.5em","align-self":"stretch",display:"flex","align-items":"center","justify-content":"center"}},X=["src"],Y={style:{flex:"1","min-width":"0","align-self":"stretch",display:"flex","flex-direction":"column",gap:"4px"}},Z={style:{"font-weight":"700",overflow:"hidden","white-space":"nowrap","text-overflow":"ellipsis"}},ee={style:{"font-size":"0.9em","font-weight":"500",color:"rgba(0, 0, 0, 0.4)"}},te=["onClick"],se={__name:"SearchUser",setup(ae){const{t:i,locale:v}=S(),g=G();v.value&&N(v.value);const r=f(""),l=f([]),d=f(!1),s=f(null),y=()=>{r.value.trim()||(l.value=[],d.value=!1,s.value=null)},x=()=>{r.value.trim()&&h()},h=async()=>{if(!r.value.trim()){l.value=[];return}try{const a=await E(encodeURIComponent(r.value.trim())),o=a&&a.body,t=o&&(o.userProfile||o.profile||o.user||o);if(a&&a.status&&t&&(t.id||t.userId)){l.value=[{id:t.id||t.userId,name:t.userNickname||t.name||t.nickName||"User",userNickname:t.userNickname||t.name||t.nickName,account:t.account||t.ownSpecialId?.account||r.value.trim(),userAvatar:t.userAvatar||t.avatar}]}else l.value=[];d.value=!0,s.value=null}catch(a){console.error("Search user failed:",a),l.value=[],d.value=!0}},b=()=>{r.value="",l.value=[],d.value=!1,s.value=null},w=a=>{s.value=a,s.value&&(P({id:s.value.id,name:s.value.name,userNickname:s.value.userNickname,account:s.value.account,userAvatar:s.value.userAvatar}),g.go(-1))};return(a,t)=>(u(),p("div",M,[U(V,{showLanguageList:!0,title:n(i)("search_user"),color:"black"},null,8,["title"]),e("div",R,[e("div",q,[e("div",H,[t[2]||(t[2]=e("img",{src:L,alt:"",style:{width:"1.5em",opacity:"0.6"}},null,-1)),A(e("input",{"onUpdate:modelValue":t[0]||(t[0]=o=>r.value=o),type:"text",placeholder:n(i)("enter_user_id"),class:"search-input",style:{flex:"1",border:"none",padding:"4px 0",background:"transparent",outline:"none",width:"100%"},onKeyup:I(x,["enter"]),onInput:y},null,40,Q),[[C,r.value]])]),!d.value&&r.value?(u(),p("button",{key:0,style:{border:"none",color:"rgba(0, 0, 0, 0.4)","font-weight":"600","background-color":"transparent"},onClick:h},c(n(i)("search")),1)):(u(),p("button",{key:1,style:{border:"none","font-weight":"600","background-color":"transparent"},onClick:b},c(n(i)("cancel")),1))]),e("div",T,[(u(!0),p(B,null,D(l.value,o=>(u(),j(K,{key:o.id,style:{"margin-bottom":"12px"}},{default:z(()=>[e("div",$,[e("div",J,[e("div",O,[e("div",W,[e("img",{src:o.userAvatar||"",style:{display:"block",width:"100%","aspect-ratio":"1/1","border-radius":"50%","object-fit":"cover"},onError:t[1]||(t[1]=(...m)=>n(_)&&n(_)(...m))},null,40,X)]),e("div",Y,[e("div",Z,c(o.name),1),e("div",ee,c(n(i)("user_id_prefix"))+" "+c(o.account||o.id),1)])]),e("div",{style:{width:"auto",color:"white","border-radius":"12px",background:"linear-gradient(269deg, #feb219 7.04%, #ff9326 96.78%)","font-size":"0.9em","font-weight":"500",padding:"4px 10px",cursor:"pointer"},onClick:F(m=>w(o),["stop"])},c(n(i)("add")),9,te)])])]),_:2},1024))),128))])])]))}},de=k(se,[["__scopeId","data-v-29eddba0"]]);export{de as default};
|