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.
2 lines
6.9 KiB
2 lines
6.9 KiB
import{j as e}from"./markdown-vendor-BZI_VWzW.js";import{u as M,r as l}from"./data-vendor-BOGugMqL.js";import{h as Y,b5 as W,g as F,d as G,b6 as K,b7 as Q,o as O}from"./index-D2jM1hO2.js";import{E as z}from"./arco-vendor-CAnKnMnO.js";import"./react-vendor-wlKWdfEb.js";const D=60,H=new URL("/assets/ic_checkbox-XedLjJlZ.png",import.meta.url).href,J=new URL("/assets/ic_checkbox_checked-kEFZj2gE.png",import.meta.url).href;function V(s){return s===0?"1,2,3,4":String(s)}function X(s){const t=s.type===2?s.cover:s.images?.[0];return typeof t=="string"&&t.length>0?t:void 0}function q(s){const n=s.id;if(typeof n=="number"&&Number.isFinite(n))return n;if(typeof n=="string"){const t=Number(n);return Number.isFinite(t)?t:null}return null}function le(){const{t:s}=M(),n=l.useMemo(()=>[{label:s("pages.profile.tabs.all"),assetType:0},{label:s("pages.profile.tabs.image"),assetType:1},{label:s("pages.profile.tabs.video"),assetType:2},{label:s("pages.profile.tabs.audio"),assetType:3},{label:s("pages.profile.tabs.template"),assetType:4},{label:s("layout.nav.characters"),assetType:5}],[s]),[t,k]=l.useState(null),[Z,S]=l.useState(""),[p,T]=l.useState(0),[y,P]=l.useState([]),[g,N]=l.useState(!1),[E,w]=l.useState(0),[o,d]=l.useState(!1),[c,m]=l.useState(()=>new Set),[u,A]=l.useState(!1),j=Y(),U=l.useCallback(async()=>{await j(t?.id)},[j,t?.id]),h=l.useCallback(async()=>{const a=await W();k(a?.data?.user??a?.user??null)},[]);l.useEffect(()=>{h()},[h]),l.useEffect(()=>{F().then(a=>{S(a.contentConfig.userHomepageHeaderImage)})},[]),l.useEffect(()=>{d(!1),m(new Set)},[p]),l.useEffect(()=>{let a=!1;N(!0);const r=V(p);return G({type:r,page:1,pageSize:D,self:!0}).then(i=>{a||P(i?.data?.list??[])}).catch(()=>{a||P([])}).finally(()=>{a||N(!1)}),()=>{a=!0}},[p,E]);const b=l.useCallback(()=>{d(!1),m(new Set)},[]),B=l.useCallback(a=>{m(r=>{const i=new Set(r);return i.has(a)?i.delete(a):i.add(a),i})},[]),C=l.useCallback(async()=>{const a=Array.from(c);if(!(a.length===0||u)){A(!0);try{await K(a),b(),w(r=>r+1)}finally{A(!1)}}},[c,u,b]),L=l.useCallback(()=>{const a=c.size;a===0||u||z.confirm({title:s("pages.profile.batch.confirmUnpublishTitle"),content:s("pages.profile.batch.confirmUnpublishContent",{count:a}),okText:s("pages.profile.batch.confirmUnpublishAction"),cancelText:s("button.cancel"),onOk:()=>C()})},[c,u,C,s]);if(!t)return null;const R=[{label:s("pages.profile.stats.fans"),value:String(t.fansNum)},{label:s("pages.profile.stats.following"),value:String(t.followingNum)},{label:s("pages.profile.stats.useCount"),value:String(t.taskNum)},{label:s("pages.profile.stats.likes"),value:String(t.likeNum)}];return e.jsxs("div",{className:"profilePage",children:[e.jsx("div",{className:"profilePage__banner",children:e.jsx("img",{src:new URL("/assets/logo-full-white-B2Ofmfir.png",import.meta.url).href,alt:""})}),e.jsxs("div",{className:"profilePage__content",children:[e.jsxs("section",{className:"profilePage__header",children:[e.jsx("img",{className:"profilePage__avatar",src:t.avatar,alt:s("pages.profile.avatarAlt")}),e.jsx("button",{type:"button",className:"profilePage__editButton",onClick:()=>void Q(t,()=>{},()=>void h()),children:s("pages.profile.editProfile")})]}),e.jsxs("section",{className:"profilePage__identity",children:[e.jsxs("div",{className:"profilePage__nameRow",children:[e.jsx("h1",{className:"profilePage__name",children:t.name}),(()=>{const a=Number(t?.memberLevel??0),r=a===0,i=["profilePage__userTag",r?"profilePage__userTag--free":"",a===3?"profilePage__userTag--lv3":"profilePage__userTag--lv12"].filter(Boolean).join(" ");return e.jsx("span",{className:i,children:r?s("pages.profile.freeUser"):e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"profilePage__userTagPrefix",children:[s("pages.profile.memberPrefix")," "]}),e.jsx("span",{className:"profilePage__userTagLevel",children:`Lv${a}`})]})})})(),e.jsxs("span",{className:"profilePage__idWrap",children:[e.jsx("span",{className:"profilePage__idText",children:t.id}),e.jsx("button",{type:"button",className:"profilePage__verifyIcon",onClick:()=>void U(),"aria-label":"copy id",children:e.jsx("img",{src:new URL("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAACXBIWXMAAAsTAAALEwEAmpwYAAABWUlEQVRYhe3YsS8DURzA8U8FiYSGxGCRzkwYROwWU0mMwtQY+5dgbgi7wcR/YDUYLDWIwSQiBoNKa+g1qtreta5VyX2Tl/fu3e/37nuXd5f3LlWpVAwSQ38t0EgiFMbACQ036ywUCvWH4yhiJuZrZ3K53EMkoQamA5kSHmMQSWMKk+hKqMYtFmIQyuOg1cn/MYdwjsWGmHncRxy3iC28xCWUbdI3gkzEcTO4wBre4hCC1w4E6rnBLFZxpnpzpTiEKrp45CgH9RPWcYydYLxQejmps3jGNvajJvVS6BITQTuPvShJvRC6Duq06otQYyVKci+ENpGqKxudJA/chzERCiMRCiMRCqOTBdpvWcahr2VNU/opNBeUGk1XAP0UusJR0H5XXcT9oJ9CdzgNC2onNIrdGESWOgluJzSGk9+5fOMjSlAroYzqvikuyiJuEFLJ75gQEqEwBk7oE5CnMiGC6jI6AAAAAElFTkSuQmCC",import.meta.url).href,alt:""})})]})]}),e.jsx("p",{className:"profilePage__bio",children:t.signature})]}),e.jsx("section",{className:"profilePage__stats",children:R.map(a=>e.jsxs("div",{className:"profilePage__statItem",children:[e.jsx("span",{className:"profilePage__statValue",children:a.value}),e.jsx("span",{className:"profilePage__statLabel",children:a.label})]},a.label))}),e.jsxs("section",{className:"profilePage__toolbar",children:[e.jsx("div",{className:"profilePage__tabs",role:"tablist","aria-label":s("pages.profile.tabs.aria"),children:n.map(a=>e.jsx("button",{type:"button",className:`profilePage__tab ${p===a.assetType?"profilePage__tab--active":""}`,role:"tab","aria-selected":p===a.assetType,onClick:()=>T(a.assetType),children:a.label},a.assetType))}),e.jsx("div",{className:"profilePage__toolbarRight",children:o?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"profilePage__unpublishButton",disabled:c.size===0||u,onClick:()=>L(),children:s("pages.assetDetails.unpublish")}),e.jsx("button",{type:"button",className:"profilePage__batchButton",onClick:b,children:s("button.cancel")})]}):e.jsx("button",{type:"button",className:"profilePage__batchButton",onClick:()=>d(!0),children:s("pages.profile.batch.manage")})})]}),e.jsxs("section",{className:"profilePage__gallery","aria-label":s("pages.profile.gallery.aria"),children:[g?e.jsx("p",{className:"profilePage__galleryHint",children:s("common.loading")}):null,!g&&y.length===0?e.jsx("p",{className:"profilePage__galleryHint",children:s("pages.profile.gallery.empty")}):null,g?null:y.map((a,r)=>{const i=X(a);if(i==null)return null;const I=a.id??`p-${r}`,f=q(a),_=f!=null&&c.has(f),v=()=>{if(o){if(f==null)return;B(f);return}O({assetId:a.id})};return e.jsxs("article",{className:["profilePage__cardWrap",o?"profilePage__cardWrap--batch":"",_?"profilePage__cardWrap--selected":""].filter(Boolean).join(" "),role:o?"checkbox":"button","aria-checked":o?_:void 0,tabIndex:f==null?-1:0,onClick:v,onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),v())},children:[o?e.jsx("div",{className:"profilePage__cardCheckbox","aria-hidden":!0,children:e.jsx("img",{src:_?J:H,alt:""})}):null,e.jsx("img",{className:"profilePage__card",src:i,alt:"",loading:"lazy",decoding:"async"})]},I)})]})]})]})}export{le as default};
|
|
//# sourceMappingURL=index-OqQhw6-P.js.map
|
|
|