You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
paopao-ce/web/dist/assets/user-card-B9Y02rEu.js

1 line
2.6 KiB

import{A as e,Bt as t,C as n,D as r,J as i,M as a,O as o,Q as s,S as c,W as l,b as u,ht as d,p as f,w as p,x as m}from"./@css-render-YsNuQTaE.js";import{G as h,U as g,W as _,ct as v,it as y,nt as b,s as x}from"./naive-ui-DIGPL69-.js";import{r as S}from"./sidebar-CIS7wt6Z.js";import{_ as C,k as w,o as T,ot as E}from"./@vicons-Bd7TWO2p.js";import{n as D}from"./index-D3WChr5M.js";import{t as O}from"./useUserAction-iK-3kVew.js";var k={class:`user-card`},A={class:`nickname-wrap`},j={class:`username-wrap`},M={class:`user-info`},N={class:`info-item`},P={class:`info-item`},F={class:`item-header-extra`},I=S(e({__name:`user-card`,props:{contact:{},type:{default:`contact`}},emits:[`send-whisper`,`unfollow-success`],setup(e,{emit:S}){let I=g(),L=e,R=u(()=>L.type===`follow`),z=u(()=>L.type===`follow`),B=S,V=e=>()=>a(h,null,{default:()=>a(e)}),H=()=>{let e=L.contact.is_following;O.followAction(I,L.contact.user_id,L.contact.username,L.contact.is_following).then(t=>{L.contact.is_following=t,e&&!t&&B(`unfollow-success`)}).catch(e=>{console.log(e)})},U=u(()=>{let e=[{label:`私信 @`+L.contact.username,key:`whisper`,icon:V(w)}];return z.value&&(L.contact.is_following?e.push({label:`取消关注 @`+L.contact.username,key:`unfollow`,icon:V(C)}):e.push({label:`关注 @`+L.contact.username,key:`follow`,icon:V(E)})),e}),W=e=>{switch(e){case`follow`:case`unfollow`:H();break;case`whisper`:B(`send-whisper`,{id:L.contact.user_id,avatar:L.contact.avatar,username:L.contact.username,nickname:L.contact.nickname,is_admin:!1,is_friend:!0,is_following:!1,created_on:0,follows:0,followings:0,status:1});break;default:break}};return(a,u)=>{let g=y,S=i(`router-link`),C=v,w=b,E=_,O=x;return l(),p(`div`,k,[o(O,{"content-indented":``},{avatar:s(()=>[o(g,{size:54,src:e.contact.avatar},null,8,[`src`])]),header:s(()=>[m(`span`,A,[o(S,{onClick:u[0]||=f(()=>{},[`stop`]),class:`username-link`,to:{name:`user`,query:{s:e.contact.username}}},{default:s(()=>[r(t(e.contact.nickname),1)]),_:1},8,[`to`])]),m(`span`,j,` @`+t(e.contact.username),1),R.value&&e.contact.is_following?(l(),c(C,{key:0,class:`top-tag`,type:`success`,size:`small`,round:``},{default:s(()=>[...u[1]||=[r(` 已关注 `,-1)]]),_:1})):n(``,!0),m(`div`,M,[m(`span`,N,` UID. `+t(e.contact.user_id),1),m(`span`,P,t(d(D)(e.contact.created_on))+`\xA0加入 `,1)])]),"header-extra":s(()=>[m(`div`,F,[o(E,{placement:`bottom-end`,trigger:`click`,size:`small`,options:U.value,onSelect:W},{default:s(()=>[o(w,{quaternary:``,circle:``},{icon:s(()=>[o(d(h),null,{default:s(()=>[o(d(T))]),_:1})]),_:1})]),_:1},8,[`options`])])]),_:1})])}}}),[[`__scopeId`,`data-v-3d50a1bc`]]);export{I as t};