37 lines
21 KiB
JavaScript
37 lines
21 KiB
JavaScript
import{c as P,d as se,f as q,r as _,j as e,B as T,ae as ne,H as M,S as B,aa as G,P as K,a6 as ae,ac as ie,I as O,T as le,ad as re,v as oe}from"./index-CSVqyJB0.js";import{C as $,a as V,b as W}from"./card-BcMbz03g.js";/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const ce=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],de=P("ArrowDown",ce);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const xe=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],me=P("ArrowUp",xe);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const pe=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ue=P("ChevronRight",pe);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const he=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],fe=P("GripVertical",he);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const ye=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],ge=P("PanelRightClose",ye);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const be=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],ke=P("PanelRightOpen",be);/**
|
||
* @license lucide-react v0.475.0 - ISC
|
||
*
|
||
* This source code is licensed under the ISC license.
|
||
* See the LICENSE file in the root directory of this source tree.
|
||
*/const je=[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]],ve=P("Printer",je),E=[{key:"info",defaultTitle:"基本信息",kind:"info",fixed:!0},{key:"education",defaultTitle:"教育背景",kind:"list",types:["学业"]},{key:"skills",defaultTitle:"技能证书",kind:"list",types:["证书技能"]},{key:"awards",defaultTitle:"荣誉奖项",kind:"list",types:["荣誉惩处"]},{key:"competition",defaultTitle:"竞赛经历",kind:"list",types:["竞赛"]},{key:"research",defaultTitle:"科研经历",kind:"list",types:["科研"]},{key:"practice",defaultTitle:"实践经历",kind:"list",types:["志愿公益","实习实践","学生工作"]},{key:"activity",defaultTitle:"文体活动",kind:"list",types:["文体活动"]},{key:"other",defaultTitle:"其他经历",kind:"list"},{key:"self",defaultTitle:"自我评价",kind:"text",fixed:!0}];function U(){return{version:2,template:"tech",accent:"#3056d3",fontScale:1,density:"normal",onePage:!1,sections:E.map(i=>({key:i.key,title:i.defaultTitle,enabled:!0,kind:i.kind,types:i.types}))}}function Q(i){const a=U();if(!i||typeof i!="object")return a;const u=i,b=Array.isArray(u.sections)?u.sections:[],c=a.sections.map(s=>{const d=b.find(N=>N.key===s.key),k=E.find(N=>N.key===s.key);return{...s,enabled:(d==null?void 0:d.enabled)??!0,title:(d==null?void 0:d.title)??(k==null?void 0:k.defaultTitle)??s.title}});for(const s of b)c.some(d=>d.key===s.key)||c.push({key:s.key,title:s.title||s.key,enabled:s.enabled??!0,kind:"text",text:""});return{version:2,template:u.template??"tech",accent:u.accent??"#3056d3",fontScale:Math.min(1.2,Math.max(.8,u.fontScale??1)),density:u.density??"normal",onePage:u.onePage??!1,sections:c}}function Ne(){return E.filter(i=>i.types).flatMap(i=>i.types)}function we(i){const a=[i.organizer,i.level,i.award_grade].filter(b=>b!=null&&b!=="").map(String).join(" · "),u=[i.result,i.description].filter(b=>b!=null&&b!=="").map(String).join(" — ");return{title:i.title,subtitle:a||void 0,date:i.start_date??i.created_at.slice(0,10),desc:u||void 0,fromRecord:i.id}}function Z(i,a){const u=[],b=Ne();for(const c of a.sections){if(!c.enabled)continue;const s=E.find(x=>x.key===c.key);if(c.key==="info"){u.push({key:c.key,title:c.title,kind:"info"});continue}if(c.key==="self"||c.kind==="text"){u.push({key:c.key,title:c.title,kind:"text",text:c.text??""});continue}const d=new Set(c.excluded??[]);let k=[];const N=s==null?void 0:s.types;N?k=i.filter(x=>N.includes(x.type_name)&&x.status!=="draft"&&!d.has(x.id)):k=i.filter(x=>x.status!=="draft"&&!d.has(x.id)&&!b.includes(x.type_name));const j=k.map(we).filter(x=>!x.fromRecord||!d.has(x.fromRecord));for(const x of c.items??[])j.push({...x});j.sort((x,g)=>(g.date??"").localeCompare(x.date??"")),j.length&&u.push({key:c.key,title:c.title,kind:"list",items:j})}return u}const J=[{key:"tech",name:"互联网技术风",desc:"品牌色标题 + 左侧色条,紧凑现代"},{key:"minimal",name:"极简风",desc:"灰色大写字距标题,大量留白"},{key:"classic",name:"经典风",desc:"黑色衬线标题 + 通栏分隔线,正式通用"}],X=["#3056d3","#0f766e","#7c3aed","#c2410c","#0e7490","#1f2937"],w=i=>String(i??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");function Ce(i,a,u,b){const c=u.fontScale,s=g=>(g*c).toFixed(1)+"pt",d=u.accent,k={classic:"font-size:"+s(14)+";border-bottom:1.5pt solid #333;padding-bottom:3pt;margin:12pt 0 6pt;color:#111",tech:"font-size:"+s(14)+";color:"+d+";border-left:3pt solid "+d+";padding-left:6pt;margin:12pt 0 6pt",minimal:"font-size:"+s(11.5)+";color:#555;letter-spacing:1.5pt;text-transform:uppercase;margin:14pt 0 6pt"},N=i.map(g=>{let l="";if(g.kind==="info"){const m=[["姓名",f(a).name],["性别",f(a).gender],["出生年月",f(a).birth],["民族",f(a).nation],["籍贯",f(a).native],["政治面貌",f(a).political],["学校",f(a).school],["学院",f(a).college],["专业",f(a).major],["班级",f(a).className],["学号",f(a).studentId],["学历",f(a).degree],["手机",f(a).phone],["邮箱",f(a).email]].filter(C=>C[1]!=="");l='<table style="width:100%;border-collapse:collapse;font-size:'+s(12)+'">'+m.map(([C,r],R)=>(R%2===0?"<tr>":"")+'<td style="width:80px;padding:3px 6px;color:#555">'+w(C)+'</td><td style="padding:3px 6px">'+w(r)+"</td>"+(R%2===1?"</tr>":"")).join("")+"</table>"}else g.kind==="list"?l='<div style="margin-bottom:6pt">'+(g.items??[]).map(m=>{const C=m.subtitle?'<div style="color:#666;font-size:'+s(10.5)+'">'+w(m.subtitle)+"</div>":"",r=m.desc?'<div style="color:#444;font-size:'+s(11)+';line-height:1.5">'+w(m.desc)+"</div>":"";return'<div style="margin-bottom:7pt"><div style="display:flex;justify-content:space-between"><b style="font-size:'+s(12)+'">'+w(m.title)+'</b><span style="color:#666;font-size:'+s(10.5)+'">'+w(m.date??"")+"</span></div>"+C+r+"</div>"}).join("")+"</div>":l='<p style="font-size:'+s(12)+';line-height:1.7;margin:0">'+w(g.text??"")+"</p>";return'<h2 style="'+k[u.template]+'">'+w(g.title)+"</h2>"+l}).join(""),j=b&&a.photoUrl?'<div style="text-align:right"><img src="'+w(a.photoUrl)+'" alt="证件照" style="width:'+(90*c).toFixed(0)+"pt;height:"+(120*c).toFixed(0)+'pt;object-fit:cover" /></div>':"",x=[f(a).school,f(a).college,f(a).major,f(a).degree].filter(g=>g!=="").map(g=>w(g)).join(" · ");return'<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word"><head><meta charset="utf-8"><title>'+w(f(a).name||"个人简历")+'</title></head><body style="font-family:SimSun,Calibri,sans-serif;margin:36pt;color:#222"><div style="display:flex;justify-content:space-between;align-items:flex-start"><h1 style="font-size:'+s(20)+";margin:0 0 4pt;color:"+(u.template==="tech"?d:"#111")+'">'+w(f(a).name||"个人简历")+"</h1>"+j+"</div>"+(x?'<div style="color:#555;font-size:'+s(11)+';margin-bottom:8pt">'+x+"</div>":"")+N+"</body></html>"}function f(i){return i??{}}const Se=Object.freeze(Object.defineProperty({__proto__:null,ACCENT_CHOICES:X,RESUME_SECTION_DEFS:E,TEMPLATES:J,assembleSections:Z,defaultResumeConfig:U,migrateResumeConfig:Q,resumeToWordHtml:Ce},Symbol.toStringTag,{value:"Module"}));function Pe(){var D,L,H;const i=se(),a=q({queryKey:["profile"],queryFn:re}),u=q({queryKey:["resume-records"],queryFn:()=>oe({page:1,page_size:500})}),[b,c]=_.useState(null),[s,d]=_.useState(""),[k,N]=_.useState(!0),[j,x]=_.useState(new Set),[g,l]=_.useState(1),m=_.useRef(null),C=_.useRef(null);_.useEffect(()=>{var p,o;const t=(p=a.data)==null?void 0:p.content;t&&(c(Q(t.resume)),d(((o=t.info)==null?void 0:o.selfIntro)??""))},[a.data]);const r={...((L=(D=a.data)==null?void 0:D.content)==null?void 0:L.info)??{}},R=((H=u.data)==null?void 0:H.items)??[],n=b??U(),I=_.useMemo(()=>Z(R,n),[R,r,s,n]),F=(t,p)=>c(o=>{if(!o)return o;const z=o,v=[...z.sections],h=t+p;return h<0||h>=v.length?z:([v[t],v[h]]=[v[h],v[t]],{...z,sections:v})}),S=t=>{c(t),ie({info:{...r,selfIntro:s},resume:t}).catch(p=>i("error",p.message))};_.useEffect(()=>{if(!n.onePage){l(1);return}const t=m.current;if(!t)return;const p=1043,o=t.scrollHeight;l(o>p?Math.max(.7,p/o):1)},[n.onePage,n.fontScale,n.density,I]);const A=n.fontScale*(n.onePage?g:1),Y=()=>{ae(async()=>{const{resumeToWordHtml:t}=await Promise.resolve().then(()=>Se);return{resumeToWordHtml:t}},void 0).then(({resumeToWordHtml:t})=>{const p=t(I,{...r,selfIntro:s},n,r.photoUrl),o=new Blob(["\uFEFF"+p],{type:"application/msword"}),z=URL.createObjectURL(o),v=document.createElement("a");v.href=z,v.download=(r.name||"个人简历")+".doc",v.click(),setTimeout(()=>URL.revokeObjectURL(z),6e4),i("success","Word 文档已导出(按当前模板与字号)")})},ee=t=>{var p;return((p=E.find(o=>o.key===t))==null?void 0:p.defaultTitle)??t};return e.jsxs("div",{className:"mx-auto max-w-[1280px] px-3 py-4 sm:px-6 sm:py-5",children:[e.jsxs("div",{className:"no-print mb-4 flex flex-wrap items-center justify-between gap-2",children:[e.jsx("h2",{className:"text-[15px] font-semibold text-ink-1",children:"我的简历"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(T,{variant:"secondary",onClick:()=>N(t=>!t),children:[k?e.jsx(ge,{size:13}):e.jsx(ke,{size:13}),k?"收起设置":"展开设置"]}),e.jsxs(T,{variant:"secondary",onClick:Y,children:[e.jsx(ne,{size:13})," 导出 Word"]}),e.jsxs(T,{variant:"primary",onClick:()=>window.print(),children:[e.jsx(ve,{size:13})," 打印 / PDF"]})]})]}),e.jsxs("div",{className:"grid gap-4 "+(k?"lg:grid-cols-[1fr_340px]":"grid-cols-1"),children:[e.jsxs("div",{children:[e.jsx("div",{className:"print-sheet mx-auto w-full max-w-[794px] rounded-lg border border-line bg-white shadow-card",style:{minHeight:n.onePage?1123:void 0},children:e.jsxs("div",{ref:m,className:"p-8 sm:p-10 resume-tpl-"+n.template,style:{zoom:A,"--accent":n.accent},children:[e.jsxs("div",{className:"mb-6 flex items-start justify-between gap-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-[26px] font-bold leading-tight "+(n.template==="tech"?"text-[var(--accent)]":"text-neutral-900"),children:r.name||"姓名"}),e.jsx("div",{className:"mt-1.5 text-[12.5px] text-neutral-500",children:[r.school,r.college,r.major,r.degree].filter(Boolean).join(" · ")||"完善个人信息后自动展示"}),e.jsx("div",{className:"mt-1 text-[12px] text-neutral-500",children:[r.phone,r.email,r.homepage].filter(Boolean).join(" · ")})]}),r.photoUrl&&e.jsx("img",{src:r.photoUrl,alt:"证件照",className:"h-[110px] w-[82px] rounded border border-neutral-200 object-cover"})]}),I.map(t=>{var p;return e.jsxs("div",{className:"mb-5 r-sec",children:[e.jsx("div",{className:"r-sec-title mb-2.5 text-[14px] font-bold text-neutral-900",children:t.title}),t.kind==="info"?e.jsx("div",{className:"grid grid-cols-2 gap-x-8 gap-y-1 text-[12.5px]",children:[["姓名",r.name],["性别",r.gender],["出生年月",r.birth],["民族",r.nation],["籍贯",r.native],["政治面貌",r.political],["班级",r.className],["学号",r.studentId],["手机",r.phone],["邮箱",r.email]].filter(o=>o[1]).map(([o,z])=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx("span",{className:"w-16 shrink-0 text-neutral-500",children:o}),e.jsx("span",{children:z})]},o))}):t.kind==="text"?e.jsx("p",{className:"whitespace-pre-wrap text-neutral-700 "+(n.density==="compact"?"":"leading-relaxed"),children:t.text||"(在右侧板块设置中填写内容)"}):e.jsx("div",{className:n.density==="compact"?"flex flex-col gap-1.5":"flex flex-col gap-3",children:(p=t.items)==null?void 0:p.map(o=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[e.jsx("span",{className:"text-[13px] font-semibold text-neutral-900 r-item-title",children:o.title}),e.jsx("span",{className:"num shrink-0 text-[11.5px] text-neutral-500",children:o.date??""})]}),o.subtitle&&e.jsx("div",{className:"text-[12px] text-neutral-600",children:o.subtitle}),o.desc&&e.jsx("p",{className:"text-[12px] text-neutral-500 "+(n.density==="compact"?"":"mt-0.5"),children:o.desc})]},o.title+o.date))})]},t.key)})]})}),n.onePage&&e.jsxs("div",{className:"no-print mt-2 text-center text-[11.5px] text-ink-3",children:["一页限定已启用:内容自动缩放 ",Math.round(A*100),"% 以适配单页 A4"]})]}),k&&e.jsxs("div",{className:"no-print flex flex-col gap-4 lg:sticky lg:top-4 lg:self-start",children:[e.jsxs($,{children:[e.jsx(V,{title:"模板与风格"}),e.jsxs(W,{className:"flex flex-col gap-3",children:[e.jsx("div",{className:"grid grid-cols-1 gap-2",children:J.map(t=>e.jsxs("button",{className:"rounded-md border px-3 py-2 text-left transition-all "+(n.template===t.key?"border-brand bg-brand-subtle":"border-line bg-surface hover:border-line-strong"),onClick:()=>S({...n,template:t.key}),children:[e.jsx("div",{className:"text-[12.5px] font-semibold "+(n.template===t.key?"text-brand-text":"text-ink-1"),children:t.name}),e.jsx("div",{className:"text-[11px] text-ink-3",children:t.desc})]},t.key))}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(M,{label:"主题色",children:e.jsx("div",{className:"flex flex-wrap gap-1.5 pt-1",children:X.map(t=>e.jsx("button",{"aria-label":"主题色 "+t,className:"size-5 rounded-full border-2 transition-transform "+(n.accent===t?"scale-110 border-ink-1":"border-transparent"),style:{backgroundColor:t},onClick:()=>S({...n,accent:t})},t))})}),e.jsx(M,{label:"字号",children:e.jsx(B,{value:String(n.fontScale),onChange:t=>S({...n,fontScale:Number(t.target.value)}),options:[{value:"0.9",label:"小"},{value:"1",label:"标准"},{value:"1.1",label:"大"}]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(M,{label:"间距",children:e.jsx(B,{value:n.density,onChange:t=>S({...n,density:t.target.value}),options:[{value:"compact",label:"紧凑"},{value:"normal",label:"标准"},{value:"relaxed",label:"宽松"}]})}),e.jsx(M,{label:"单页限定",children:e.jsx("button",{className:"flex h-9 w-full items-center justify-center gap-1.5 rounded-md border text-[12px] transition-colors "+(n.onePage?"border-brand bg-brand-subtle text-brand-text":"border-line bg-surface text-ink-2"),onClick:()=>S({...n,onePage:!n.onePage}),children:n.onePage?"已开启":"已关闭"})})]})]})]}),e.jsxs($,{children:[e.jsx(V,{title:"板块布局",extra:e.jsx("span",{className:"text-[11px] text-ink-3",children:"拖动排序 · 内容可编辑"})}),e.jsx(W,{className:"p-0",children:e.jsxs("div",{className:"flex flex-col divide-y divide-line",children:[n.sections.map((t,p)=>{var v;const o=j.has(t.key),z=t.kind==="info"?"固定":t.kind==="text"?"文本":"记录";return e.jsxs("div",{draggable:!0,onDragStart:()=>{C.current=t.key},onDragOver:h=>h.preventDefault(),onDrop:()=>{const h=n.sections.findIndex(y=>y.key===C.current);if(h>=0&&h!==p){const y=[...n.sections],[te]=y.splice(h,1);y.splice(p,0,te),S({...n,sections:y})}C.current=null},className:"bg-surface "+(C.current===t.key?"opacity-40":""),children:[e.jsxs("div",{className:"flex items-center gap-1 px-3 py-2",children:[e.jsx(fe,{size:13,className:"shrink-0 cursor-grab text-ink-3"}),e.jsx("input",{className:"min-w-0 flex-1 rounded-sm border border-transparent bg-transparent px-1 py-0.5 text-[12.5px] font-medium text-ink-1 hover:border-line focus:border-brand focus:outline-none",value:t.title,onChange:h=>S({...n,sections:n.sections.map(y=>y.key===t.key?{...y,title:h.target.value}:y)})}),e.jsx("button",{className:"rounded p-1 text-ink-3 hover:text-ink-1 disabled:opacity-30","aria-label":"上移",disabled:p===0,onClick:()=>F(p,-1),children:e.jsx(me,{size:12})}),e.jsx("button",{className:"rounded p-1 text-ink-3 hover:text-ink-1 disabled:opacity-30","aria-label":"下移",disabled:p===n.sections.length-1,onClick:()=>F(p,1),children:e.jsx(de,{size:12})}),e.jsx("button",{className:"ml-0.5 rounded-sm border px-1.5 py-0.5 text-[11px] transition-colors "+(t.enabled?"border-brand/40 bg-brand-subtle text-brand-text":"border-line bg-surface-2 text-ink-3"),onClick:()=>S({...n,sections:n.sections.map(h=>h.key===t.key?{...h,enabled:!h.enabled}:h)}),children:t.enabled?"显示":"隐藏"}),e.jsx("button",{className:"rounded p-1 text-ink-3 hover:text-ink-1","aria-label":"展开编辑",onClick:()=>x(h=>{const y=new Set(h);return y.has(t.key)?y.delete(t.key):y.add(t.key),y}),children:e.jsx(ue,{size:13,className:"transition-transform "+(o?"rotate-90":"")})})]}),o&&e.jsx("div",{className:"border-t border-line bg-surface-2 px-3 py-2.5",children:t.kind==="text"?e.jsx(G,{rows:4,value:t.text??"",placeholder:"输入该板块内容…",onChange:h=>S({...n,sections:n.sections.map(y=>y.key===t.key?{...y,text:h.target.value}:y)})}):t.kind==="list"?e.jsx(_e,{cfg:n,section:t,records:R,persist:S,sectionTitle:ee(t.key)}):e.jsx("p",{className:"text-[11.5px] text-ink-3",children:"基本信息板块来自「个人信息」页,无法在此编辑。"})}),e.jsxs("div",{className:"px-3 pb-1.5 text-[10.5px] text-ink-3",children:[z,(v=t.types)!=null&&v.length?" · "+t.types.join("/"):""]})]},t.key)}),e.jsx("div",{className:"p-3",children:e.jsxs(T,{size:"sm",variant:"secondary",className:"w-full",onClick:()=>{const t="custom_"+Date.now();S({...n,sections:[...n.sections,{key:t,title:"自定义板块",enabled:!0,kind:"text",text:""}]}),x(p=>new Set(p).add(t))},children:[e.jsx(K,{size:13})," 新增文本板块"]})})]})})]})]})]})]})}function _e({cfg:i,section:a,records:u,persist:b,sectionTitle:c}){const[s,d]=_.useState(null),k=new Set(a.excluded??[]),N=u.filter(l=>(a.types??[]).includes(l.type_name)&&l.status!=="draft").sort((l,m)=>(m.start_date??m.created_at).localeCompare(l.start_date??l.created_at)),j=a.items??[],x=l=>b({...i,sections:i.sections.map(m=>m.key===a.key?{...m,...l}:m)}),g=l=>{const m=new Set(a.excluded??[]);m.has(l)?m.delete(l):m.add(l),x({excluded:[...m]})};return e.jsxs("div",{className:"flex flex-col gap-2.5",children:[e.jsx("div",{className:"text-[11px] text-ink-3",children:"来自记录的条目(勾选 = 显示)· 另可添加自定义条目"}),N.map(l=>e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-[12px]",children:[e.jsx("input",{type:"checkbox",className:"size-3.5",checked:!k.has(l.id),onChange:()=>g(l.id)}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-ink-1",children:l.title}),e.jsx("span",{className:"num shrink-0 text-[11px] text-ink-3",children:(l.start_date??"").slice(0,7)})]},l.id)),e.jsxs("div",{className:"mt-1 border-t border-line pt-2",children:[e.jsxs("div",{className:"mb-1.5 flex items-center justify-between",children:[e.jsxs("span",{className:"text-[11.5px] font-medium text-ink-2",children:["自定义条目(",j.length,")"]}),e.jsxs(T,{size:"sm",variant:"ghost",onClick:()=>d({title:""}),children:[e.jsx(K,{size:12})," 添加"]})]}),s&&e.jsxs("div",{className:"mb-2 rounded-md border border-line bg-surface p-2",children:[e.jsx(O,{className:"mb-1.5",placeholder:"标题",value:s.title,onChange:l=>d({...s,title:l.target.value})}),e.jsxs("div",{className:"mb-1.5 grid grid-cols-2 gap-1.5",children:[e.jsx(O,{placeholder:"副标题(单位/角色)",value:s.subtitle??"",onChange:l=>d({...s,subtitle:l.target.value})}),e.jsx(O,{placeholder:"日期(2025-06)",value:s.date??"",onChange:l=>d({...s,date:l.target.value})})]}),e.jsx(G,{rows:2,placeholder:"描述",value:s.desc??"",onChange:l=>d({...s,desc:l.target.value})}),e.jsxs("div",{className:"mt-1.5 flex gap-1.5",children:[e.jsx(T,{size:"sm",variant:"primary",disabled:!s.title.trim(),onClick:()=>{s.title.trim()&&(x({items:[...j,s]}),d(null))},children:"添加"}),e.jsx(T,{size:"sm",variant:"ghost",onClick:()=>d(null),children:"取消"})]})]}),j.map((l,m)=>e.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-line bg-surface p-1.5 text-[12px]",children:[e.jsxs("span",{className:"min-w-0 flex-1 truncate text-ink-1",children:[l.title,e.jsxs("span",{className:"text-ink-3",children:[" · ",l.date??""]})]}),e.jsx("button",{className:"text-ink-3 hover:text-danger","aria-label":"删除条目",onClick:()=>x({items:j.filter((C,r)=>r!==m)}),children:e.jsx(le,{size:12})})]},m)),!j.length&&!s&&e.jsx("p",{className:"text-[11.5px] text-ink-3",children:"暂无自定义条目"})]}),e.jsxs("p",{className:"text-[11px] text-ink-3",children:["「",c,"」板块的记录条目来自你的记录数据,此处可隐藏不需要展示的条目。"]})]})}export{Pe as ResumePage};
|