2 lines
5.7 KiB
JavaScript
2 lines
5.7 KiB
JavaScript
import{_ as M,k as E,I as G,aa as N,o as V,c as r,l as C,q as o,b as t,m as U,t as d,F,x as K,r as p,S as Q,an as T,j as n,D as L,a7 as $,E as q,v as g,G as H,Q as R}from"./index-CIAVq8iD-1776148658686.js";import{_ as J}from"./search-D2xJuklA-1776148658686.js";import{a as m,s as P}from"./toast-aIWCznBB-1776148658686.js";import{h as A}from"./imageHandler-DstQGL3Z-1776148658686.js";import{s as O}from"./userInfo-gLO2xl8i-1776148658686.js";import{i as W,f as X,j as Y}from"./bdCenter-Dx55XoC5-1776148658686.js";import{G as Z}from"./GeneralHeader-ClI1i1Ud-1776148658686.js";import{G as D}from"./GradientBorder-CfwSeIMB-1776148658686.js";const ee={class:"fullPage"},te={style:{padding:"16px",position:"relative"}},se={style:{display:"flex","align-items":"center",gap:"8px","margin-bottom":"8px"}},ie={style:{padding:"0 8px",display:"flex","align-items":"center",height:"max-content"}},oe={src:J,alt:"",style:{display:"block",width:"2em","aspect-ratio":"1/1",opacity:"0.6"}},ae=["placeholder"],ne=["disabled"],le={key:0,style:{margin:"16px 0",display:"flex","flex-direction":"column",gap:"12px"}},re={style:{padding:"10px",transition:"all 0.2s"}},de={key:0,style:{position:"absolute","z-index":"3",top:"-2px",right:"-2px"}},ce={key:0,style:{"background-image":"linear-gradient(112deg, #759cff 5.66%, #3d73ff 42.49%)",padding:"4px 8px","border-radius":"0 12px",color:"white","font-weight":"600"}},ue={key:1,style:{"background-image":"linear-gradient(112deg, #75ff98 5.66%, #3dff54 42.49%)",padding:"4px 8px","border-radius":"0 12px",color:"white","font-weight":"600"}},pe={style:{"font-weight":"600"}},ve={style:{display:"flex","align-items":"center","justify-content":"space-between",gap:"4px"}},ge={style:{flex:"1","min-width":"0","align-self":"stretch",display:"flex","align-items":"center",gap:"4px"}},fe={style:{width:"3em",display:"flex","align-items":"center","justify-content":"center"}},_e=["src"],he={style:{flex:"1","min-width":"0","align-self":"stretch"}},ye={style:{"margin-bottom":"4px","font-weight":"700",overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"}},me={style:{"font-size":"0.9em",color:"rgba(0, 0, 0, 0.4)","font-weight":"500"}},xe={style:{width:"auto","min-width":"0","align-self":"stretch",display:"flex","justify-content":"center","align-items":"center"}},we=["onClick"],be={key:1,class:"no-data"},ke={__name:"inviteAgency",setup(Ie){const{t:i,locale:x}=E();x.value&&G(x.value);const l=p(""),w=p([]),v=p([]),u=p(!0),c=p({}),_=p(!1),b=Q(()=>l.value?v.value:w.value),k=()=>{l.value="",v.value=[],c.value={},u.value=!0,f()},S=()=>{l.value.trim()||(v.value=[],c.value={},u.value=!0,f())},I=N(async()=>{if(!_.value){_.value=!0,console.log("搜索用户id:",l.value),v.value=[],c.value={},u.value=!0;try{if(l.value.trim()){const e=await O(l.value);if(e.status&&e.body){let a={userProfile:e.body};v.value.push(a)}}}catch(e){m(e.response?.errorMsg)}finally{_.value=!1}}},500,!0),j=e=>{console.log("选择用户:",e),c.value?.id==e.userProfile.id?(c.value={},u.value=!0):(c.value=e.userProfile,e.status==0||e.status==1?u.value=!0:u.value=!1)},z=async()=>{console.log("点击邀请代理");try{let e={inviteUserId:c.value.id};(await X(e)).status&&P(i("invitation_submitted"))}catch(e){m(e.response?.errorMsg||i("something_went_wrong"))}k()},f=async()=>{const e=await W();console.log("已邀请列表:",e),e.status&&e.body&&(w.value=e.body)},B=async e=>{console.log("取消邀请用户id:",e);try{(await Y(e)).status&&(P(i("application_cancelled")),f())}catch(a){let h=a.response?.errorMsg?.replace(/^.*\]\s*/,"")||i("cancellation_failed_try_again");m(h)}};return V(()=>{f()}),(e,a)=>{const h=T("smart-img");return n(),r("div",ee,[C(Z,{showLanguageList:!0,title:o(i)("invite_become_agent"),color:"black"},null,8,["title"]),t("div",te,[t("div",se,[C(D,{radius:"4px",style:{flex:"1","min-width":"0"}},{default:U(()=>[t("div",ie,[L(t("img",oe,null,512),[[h]]),L(t("input",{"onUpdate:modelValue":a[0]||(a[0]=s=>l.value=s),type:"text",name:"",id:"",placeholder:o(i)("enter_user_id"),onKeyup:a[1]||(a[1]=$((...s)=>o(I)&&o(I)(...s),["enter"])),onInput:S,style:{width:"100%",color:"rgba(0, 0, 0, 0.4)","font-weight":"600",outline:"none",border:"none","background-color":"transparent",padding:"8px"}},null,40,ae),[[q,l.value]]),l.value?(n(),r("button",{key:0,onClick:k,style:{background:"none",border:"none",color:"#9ca3af",cursor:"pointer",padding:"0 4px"}}," × ")):g("",!0)])]),_:1}),t("button",{style:{"font-weight":"600"},class:"invite-btn",onClick:z,disabled:u.value},d(o(i)("invite")),9,ne)]),b.value.length>0?(n(),r("div",le,[(n(!0),r(F,null,K(b.value,s=>(n(),H(D,{key:s.id,style:{position:"relative","z-index":"0"},onClick:y=>j(s)},{default:U(()=>[t("div",re,[t("div",{style:{position:"absolute",inset:"0px","border-radius":"20px","z-index":"2"},class:R({selected:c.value?.id===s.userProfile.id})},null,2),s.status==0||s.status==1?(n(),r("div",de,[s.status==0?(n(),r("div",ce,d(o(i)("pending")),1)):g("",!0),s.status==1?(n(),r("div",ue,d(o(i)("success")),1)):g("",!0)])):g("",!0),t("div",pe,d(o(i)("information"))+":",1),t("div",ve,[t("div",ge,[t("div",fe,[t("img",{src:s.userProfile.userAvatar||"",style:{width:"100%","aspect-ratio":"1/1","object-fit":"cover","border-radius":"50%"},alt:"",onError:a[2]||(a[2]=(...y)=>o(A)&&o(A)(...y))},null,40,_e)]),t("div",he,[t("div",ye,d(s.userProfile.userNickname),1),t("div",me,d(o(i)("user_id_prefix"))+" "+d(s.userProfile.account),1)])]),t("div",xe,[s.status==0?(n(),r("div",{key:0,style:{padding:"4px 8px","border-radius":"32px","background-color":"red",color:"white","font-weight":"600","z-index":"5"},onClick:y=>B(s.id)},d(o(i)("cancel")),9,we)):g("",!0)])])])]),_:2},1032,["onClick"]))),128))])):(n(),r("div",be,d(o(i)("no_users_found")),1))])])}}},ze=M(ke,[["__scopeId","data-v-a2e9deb9"]]);export{ze as default};
|