40 lines
26 KiB
JavaScript
40 lines
26 KiB
JavaScript
import{c as z,d as re,f as $,r as P,j as e,B as T,ae as oe,ac as O,H as D,S as Q,aa as Y,P as ee,a6 as ce,I as U,T as de,ad as me,v as xe}from"./index-BRtKGkIF.js";import{C as Z,a as J,b as X}from"./card-CvlqAMBZ.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 ue=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],pe=z("ArrowDown",ue);/**
|
||
* @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=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],fe=z("ArrowUp",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=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ge=z("ChevronRight",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 ke=[["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"}]],be=z("GripVertical",ke);/**
|
||
* @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=[["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"}]],ve=z("PanelRightClose",je);/**
|
||
* @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 Ne=[["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"}]],we=z("PanelRightOpen",Ne);/**
|
||
* @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:"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"}]],Se=z("Printer",Ce),M=[{key:"info",defaultTitle:"基本信息",kind:"info",fixed:!0},{key:"education",defaultTitle:"教育经历",kind:"edu",fixed:!0},{key:"skills",defaultTitle:"核心技能",kind:"text"},{key:"projects",defaultTitle:"项目经历",kind:"list",types:["竞赛","科研","实习实践"]},{key:"certs",defaultTitle:"证书与荣誉",kind:"list",types:["荣誉惩处","证书技能"]},{key:"campus",defaultTitle:"在校经历",kind:"list",types:["学生工作","志愿公益"]},{key:"activity",defaultTitle:"文体活动",kind:"list",types:["文体活动"]},{key:"other",defaultTitle:"其他经历",kind:"list"},{key:"self",defaultTitle:"自我评价",kind:"text",fixed:!0}],I={skills:{text:`路由交换:熟悉TCP/IP协议栈与基础路由交换,掌握VLAN、链路聚合、MSTP、VRRP/VRRP6等园区网冗余技术,熟悉OSPF、RIP、BGP等动态路由协议,具备IPv4/IPv6双栈网络的规划与部署能力。
|
||
网络安全:熟悉防火墙安全区域、ACL访问控制与安全策略配置,掌握NAPT、NAT Server、NAT64地址转换,了解GRE over IPsec隧道与防火墙双机热备。
|
||
网络设备:熟悉华为交换机、路由器、防火墙CLI操作与配置,掌握GVRP、MSTP、VRRP、链路聚合及BFD联动快速收敛,熟悉Wireshark抓包分析。
|
||
运维基础:熟悉RedHat、Ubuntu等Linux系统部署与日常维护,了解Docker、K8s、Prometheus等云原生运维工具。`},campus:{items:[{title:"学校图书馆 勤工俭学固定岗",subtitle:"图书管理员",date:"2024.12 - 2026.7",desc:"负责图书上架、整理和维护,定时进行馆内安全巡检,协助读者检索和借阅服务,累计服务读者超2000人次,零服务投诉。这段经历培养了高度的责任意识与服务意识,锻炼了高效执行和多任务时间管理能力。"},{title:"学院团总支学生会宣传部 干事",subtitle:"视觉设计",date:"2023.9 - 2024.9",desc:"独立完成学院活动海报、邀请函、KT板、易拉宝等40余份宣传物料设计,参与换届大会、迎新、毕业季等重大活动视觉设计与宣传品制作。负责报告厅后台多媒体设备控制,保障12场大型活动视觉呈现零失误,锻炼了应急处置能力与谨慎细致的工作态度。"}]},self:{text:"心态沉稳、抗压能力较好,遇到突发状况能冷静应对、稳住局面。做事有计划性,习惯提前预判风险并做好预案,追求稳妥与确定性,执行质量有保障,能在压力下保持稳定输出。责任心强,凡事有始有终,注重细节与条理,能在复杂环境中稳步推进工作,是一名可靠、值得信赖的执行者。"}};function H(){return{version:2,template:"tech",accent:"#3056d3",fontScale:1,density:"normal",onePage:!1,sections:M.map(i=>({key:i.key,title:i.defaultTitle,enabled:!0,kind:i.kind,types:i.types,...i.key==="skills"?{text:I.skills.text}:{},...i.key==="campus"?{items:I.campus.items}:{},...i.key==="self"?{text:I.self.text}:{}}))}}function te(i){const a=H();if(!i||typeof i!="object")return a;const h=i,j=Array.isArray(h.sections)?h.sections:[],d=a.sections.map(s=>{var v;const p=j.find(c=>c.key===s.key),N=M.find(c=>c.key===s.key),w={...s,enabled:(p==null?void 0:p.enabled)??!0,title:(p==null?void 0:p.title)??(N==null?void 0:N.defaultTitle)??s.title};return s.key==="skills"&&!w.text&&(w.text=I.skills.text),s.key==="campus"&&!((v=w.items)!=null&&v.length)&&(w.items=I.campus.items),s.key==="self"&&!w.text&&(w.text=I.self.text),w});for(const s of j)d.some(p=>p.key===s.key)||d.push({key:s.key,title:s.title||s.key,enabled:s.enabled??!0,kind:"text",text:""});return{version:2,template:h.template??"tech",accent:h.accent??"#3056d3",fontScale:Math.min(1.2,Math.max(.8,h.fontScale??1)),density:h.density??"normal",onePage:h.onePage??!1,sections:d}}function _e(){return M.filter(i=>i.types).flatMap(i=>i.types)}function Pe(i){const a=[i.organizer,i.level,i.award_grade].filter(j=>j!=null&&j!=="").map(String).join(" · "),h=[i.result,i.description].filter(j=>j!=null&&j!=="").map(String).join(" — ");return{title:i.title,subtitle:a||void 0,date:i.start_date??i.created_at.slice(0,10),desc:h||void 0,fromRecord:i.id}}function se(i,a){const h=[],j=_e();for(const d of a.sections){if(!d.enabled)continue;const s=M.find(c=>c.key===d.key);if(d.key==="info"){h.push({key:d.key,title:d.title,kind:"info"});continue}if(d.key==="self"||d.kind==="text"){h.push({key:d.key,title:d.title,kind:"text",text:d.text??""});continue}const p=new Set(d.excluded??[]);let N=[];const w=s==null?void 0:s.types;w?N=i.filter(c=>w.includes(c.type_name)&&c.status!=="draft"&&!p.has(c.id)):N=i.filter(c=>c.status!=="draft"&&!p.has(c.id)&&!j.includes(c.type_name));const v=N.map(Pe).filter(c=>!c.fromRecord||!p.has(c.fromRecord)).map(c=>{var f;return{...c,...((f=d.overrides)==null?void 0:f[String(c.fromRecord)])??{}}});for(const c of d.items??[])v.push({...c});v.sort((c,f)=>(f.date??"").localeCompare(c.date??"")),v.length&&h.push({key:d.key,title:d.title,kind:"list",items:v})}return h}const ne=[{key:"tech",name:"互联网技术风",desc:"品牌色标题 + 左侧色条,紧凑现代"},{key:"minimal",name:"极简风",desc:"灰色大写字距标题,大量留白"},{key:"classic",name:"经典风",desc:"黑色衬线标题 + 通栏分隔线,正式通用"}],ae=["#3056d3","#0f766e","#7c3aed","#c2410c","#0e7490","#1f2937"],S=i=>String(i??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");function Re(i,a,h,j){const d=h.fontScale,s=f=>(f*d).toFixed(1)+"pt",p=h.accent,N={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:"+p+";border-left:3pt solid "+p+";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"},w=i.map(f=>{let o="";if(f.kind==="info"){const x=[["姓名",b(a).name],["性别",b(a).gender],["出生年月",b(a).birth],["民族",b(a).nation],["籍贯",b(a).native],["政治面貌",b(a).political],["学校",b(a).school],["学院",b(a).college],["专业",b(a).major],["班级",b(a).className],["学号",b(a).studentId],["学历",b(a).degree],["手机",b(a).phone],["邮箱",b(a).email]].filter(C=>C[1]!=="");o='<table style="width:100%;border-collapse:collapse;font-size:'+s(12)+'">'+x.map(([C,r],E)=>(E%2===0?"<tr>":"")+'<td style="width:80px;padding:3px 6px;color:#555">'+S(C)+'</td><td style="padding:3px 6px">'+S(r)+"</td>"+(E%2===1?"</tr>":"")).join("")+"</table>"}else if(f.kind==="edu"){const x=[["学校",a.school??""],["专业",a.major??""],["学制",a.eduLength??""],["学历",a.degree??""],["入学",a.eduStart??""],["毕业",a.eduEnd??""]].filter(C=>C[1]!=="");o='<table style="width:100%;border-collapse:collapse;font-size:'+s(12)+'">'+x.map(function(C){return'<tr><td style="width:80px;padding:3px 6px;color:#555">'+S(C[0])+'</td><td style="padding:3px 6px">'+S(C[1])+"</td></tr>"}).join("")+"</table>"+(a.majorCourses?'<div style="margin-top:6pt"><b style="font-size:'+s(11)+'">主修课程:</b><span style="font-size:'+s(11.5)+'">'+S(a.majorCourses)+"</span></div>":"")}else f.kind==="list"?o='<div style="margin-bottom:6pt">'+(f.items??[]).map(x=>{const C=x.subtitle?'<div style="color:#666;font-size:'+s(10.5)+'">'+S(x.subtitle)+"</div>":"",r=x.desc?'<div style="color:#444;font-size:'+s(11)+';line-height:1.5">'+S(x.desc)+"</div>":"";return'<div style="margin-bottom:7pt"><div style="display:flex;justify-content:space-between"><b style="font-size:'+s(12)+'">'+S(x.title)+'</b><span style="color:#666;font-size:'+s(10.5)+'">'+S(x.date??"")+"</span></div>"+C+r+"</div>"}).join("")+"</div>":o='<p style="font-size:'+s(12)+';line-height:1.7;margin:0">'+S(f.text??"")+"</p>";return'<h2 style="'+N[h.template]+'">'+S(f.title)+"</h2>"+o}).join(""),v=j&&a.photoUrl?'<div style="text-align:right"><img src="'+S(a.photoUrl)+'" alt="证件照" style="width:'+(90*d).toFixed(0)+"pt;height:"+(120*d).toFixed(0)+'pt;object-fit:cover" /></div>':"",c=[b(a).school,b(a).college,b(a).major,b(a).degree].filter(f=>f!=="").map(f=>S(f)).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>'+S(b(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:"+(h.template==="tech"?p:"#111")+'">'+S(b(a).name||"个人简历")+"</h1>"+v+"</div>"+(c?'<div style="color:#555;font-size:'+s(11)+';margin-bottom:8pt">'+c+"</div>":"")+w+"</body></html>"}function b(i){return i??{}}const Te=Object.freeze(Object.defineProperty({__proto__:null,ACCENT_CHOICES:ae,RESUME_SECTION_DEFS:M,TEMPLATES:ne,assembleSections:se,defaultResumeConfig:H,migrateResumeConfig:te,resumeToWordHtml:Re},Symbol.toStringTag,{value:"Module"}));function L({html:i,onCommit:a,className:h}){const j=i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");return e.jsx("span",{contentEditable:!0,suppressContentEditableWarning:!0,spellCheck:!1,className:"outline-none rounded-sm transition-shadow focus:shadow-[0_0_0_1.5px_rgba(48,86,211,0.5)] cursor-text "+(h??""),dangerouslySetInnerHTML:{__html:j},onBlur:d=>{const s=(d.currentTarget.textContent??"").trim();s!==i&&a(s)}})}function Me(){var q,W,G;const i=re(),a=$({queryKey:["profile"],queryFn:me}),h=$({queryKey:["resume-records"],queryFn:()=>xe({page:1,page_size:500})}),[j,d]=P.useState(null),[s,p]=P.useState(""),[N,w]=P.useState(!0),[v,c]=P.useState(new Set),[f,o]=P.useState(1),x=P.useRef(null),C=P.useRef(null);P.useEffect(()=>{var u,n;const t=(u=a.data)==null?void 0:u.content;t&&(d(te(t.resume)),p(((n=t.info)==null?void 0:n.selfIntro)??""))},[a.data]);const r={...((W=(q=a.data)==null?void 0:q.content)==null?void 0:W.info)??{}},E=((G=h.data)==null?void 0:G.items)??[],l=j??H(),K={...r,selfIntro:s},F=P.useMemo(()=>se(E,l),[E,l]),V=(t,u)=>d(n=>{if(!n)return n;const y=[...n.sections],k=t+u;return k<0||k>=y.length?n:([y[t],y[k]]=[y[k],y[t]],{...n,sections:y})}),_=t=>{d(t),O({info:{...r,selfIntro:s},resume:t}).catch(u=>i("error",u.message))},A=t=>{d(u=>{const n=u??l,y=n.sections.map(m=>{var g;if(m.key!==t.secKey)return m;if(t.field==="text")return{...m,text:t.value};if(t.fromRecord!=null){const R={...((g=m.overrides)==null?void 0:g[t.fromRecord])??{},[t.field]:t.value};return{...m,overrides:{...m.overrides??{},[t.fromRecord]:R}}}if(t.itemIdx!=null&&m.items){const R=[...m.items];return R[t.itemIdx]={...R[t.itemIdx],[t.field]:t.value},{...m,items:R}}return m}),k={...n,sections:y};return O({info:{...r,selfIntro:s},resume:k}).catch(m=>i("error",m.message)),k})};P.useEffect(()=>{if(!l.onePage){o(1);return}const t=x.current;if(!t)return;const u=1043,n=t.scrollHeight;o(n>u?Math.max(.7,u/n):1)},[l.onePage,l.fontScale,l.density,F]);const B=l.fontScale*(l.onePage?f:1),ie=()=>{ce(()=>Promise.resolve().then(()=>Te),void 0).then(function(t){const u=t.resumeToWordHtml(F,K,l,r.photoUrl),n=new Blob(["\uFEFF"+u],{type:"application/msword"}),y=URL.createObjectURL(n),k=document.createElement("a");k.href=y,k.download=(r.name||"个人简历")+".doc",k.click(),setTimeout(()=>URL.revokeObjectURL(y),6e4),i("success","Word 文档已导出")})},le=t=>{var u,n;return((n=(u=M.find(y=>y.key===t))==null?void 0:u.types)==null?void 0:n.join(" / "))??"固定板块"};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:()=>w(t=>!t),children:[N?e.jsx(ve,{size:13}):e.jsx(we,{size:13}),N?"收起设置":"展开设置"]}),e.jsxs(T,{variant:"secondary",onClick:ie,children:[e.jsx(oe,{size:13})," 导出 Word"]}),e.jsxs(T,{variant:"primary",onClick:()=>window.print(),children:[e.jsx(Se,{size:13})," 打印 / PDF"]})]})]}),e.jsxs("div",{className:"grid gap-4 "+(N?"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:l.onePage?1123:void 0},children:e.jsxs("div",{ref:x,className:"p-8 sm:p-10 resume-tpl-"+l.template,style:{zoom:B,"--accent":l.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 "+(l.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"})]}),F.map(t=>{var u;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:e.jsx(L,{html:t.title,onCommit:n=>A({secKey:t.key,field:"title",value:n})})}),t.kind==="edu"?e.jsxs("div",{children:[e.jsx("div",{className:"grid grid-cols-2 gap-x-8 gap-y-1 text-[12.5px]",children:[["学校",r.school],["专业",r.major],["学制",r.eduLength],["学历",r.degree],["入学",r.eduStart],["毕业",r.eduEnd]].filter(n=>n[1]).map(n=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx("span",{className:"w-16 shrink-0 text-neutral-500",children:n[0]}),e.jsx("span",{children:n[1]})]},n[0]))}),r.majorCourses&&e.jsxs("p",{className:"mt-2.5 text-[12.5px] leading-relaxed text-neutral-700",children:[e.jsx("b",{children:"主修课程:"}),e.jsx(L,{html:r.majorCourses,onCommit:n=>{const y={...K,majorCourses:n};O({info:y}).then(()=>a.refetch()).catch(k=>i("error",k.message))}})]})]}):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(n=>n[1]).map(n=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx("span",{className:"w-16 shrink-0 text-neutral-500",children:n[0]}),e.jsx("span",{children:n[1]})]},n[0]))}):t.kind==="text"?e.jsx("p",{className:"whitespace-pre-wrap text-neutral-700 "+(l.density==="compact"?"":"leading-relaxed"),children:e.jsx(L,{html:t.text??"",onCommit:n=>A({secKey:t.key,field:"text",value:n})})}):e.jsx("div",{className:l.density==="compact"?"flex flex-col gap-1.5":"flex flex-col gap-3",children:(u=t.items)==null?void 0:u.map((n,y)=>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:e.jsx(L,{html:n.title,onCommit:k=>A({secKey:t.key,field:"title",value:k,itemIdx:y,fromRecord:n.fromRecord})})}),e.jsx("span",{className:"num shrink-0 text-[11.5px] text-neutral-500",children:n.date??""})]}),n.subtitle&&e.jsx("div",{className:"text-[12px] text-neutral-600",children:n.subtitle}),n.desc&&e.jsx("p",{className:"text-[12px] text-neutral-500 "+(l.density==="compact"?"":"mt-0.5"),children:e.jsx(L,{html:n.desc,onCommit:k=>A({secKey:t.key,field:"desc",value:k,itemIdx:y,fromRecord:n.fromRecord})})})]},(n.title??"")+(n.date??"")+y))})]},t.key)})]})}),l.onePage&&e.jsxs("div",{className:"no-print mt-2 text-center text-[11.5px] text-ink-3",children:["一页限定已启用:内容自动缩放 ",Math.round(B*100),"% 以适配单页 A4"]})]}),N&&e.jsxs("div",{className:"no-print flex flex-col gap-4 lg:sticky lg:top-4 lg:self-start",children:[e.jsxs(Z,{children:[e.jsx(J,{title:"模板与风格"}),e.jsxs(X,{className:"flex flex-col gap-3",children:[e.jsx("div",{className:"grid grid-cols-1 gap-2",children:ne.map(t=>e.jsxs("button",{className:"rounded-md border px-3 py-2 text-left transition-all "+(l.template===t.key?"border-brand bg-brand-subtle":"border-line bg-surface hover:border-line-strong"),onClick:()=>_({...l,template:t.key}),children:[e.jsx("div",{className:"text-[12.5px] font-semibold "+(l.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(D,{label:"主题色",children:e.jsx("div",{className:"flex flex-wrap gap-1.5 pt-1",children:ae.map(t=>e.jsx("button",{"aria-label":"主题色 "+t,className:"size-5 rounded-full border-2 transition-transform "+(l.accent===t?"scale-110 border-ink-1":"border-transparent"),style:{backgroundColor:t},onClick:()=>_({...l,accent:t})},t))})}),e.jsx(D,{label:"字号",children:e.jsx(Q,{value:String(l.fontScale),onChange:t=>_({...l,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(D,{label:"间距",children:e.jsx(Q,{value:l.density,onChange:t=>_({...l,density:t.target.value}),options:[{value:"compact",label:"紧凑"},{value:"normal",label:"标准"},{value:"relaxed",label:"宽松"}]})}),e.jsx(D,{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 "+(l.onePage?"border-brand bg-brand-subtle text-brand-text":"border-line bg-surface text-ink-2"),onClick:()=>_({...l,onePage:!l.onePage}),children:l.onePage?"已开启":"已关闭"})})]})]})]}),e.jsxs(Z,{children:[e.jsx(J,{title:"板块布局",extra:e.jsx("span",{className:"text-[11px] text-ink-3",children:"拖动排序 · 点击预览可改内容"})}),e.jsx(X,{className:"p-0",children:e.jsxs("div",{className:"flex flex-col divide-y divide-line",children:[l.sections.map((t,u)=>{var k;const n=v.has(t.key),y=t.kind==="info"?"固定":t.kind==="text"?"文本":t.kind==="edu"?"教育":"记录";return e.jsxs("div",{draggable:!0,onDragStart:()=>{C.current=t.key},onDragOver:m=>m.preventDefault(),onDrop:()=>{const m=l.sections.findIndex(g=>g.key===C.current);if(m>=0&&m!==u){const g=[...l.sections],R=g.splice(m,1)[0];g.splice(u,0,R),_({...l,sections:g})}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(be,{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:m=>_({...l,sections:l.sections.map(g=>g.key===t.key?{...g,title:m.target.value}:g)})}),e.jsx("button",{className:"rounded p-1 text-ink-3 hover:text-ink-1 disabled:opacity-30","aria-label":"上移",disabled:u===0,onClick:()=>V(u,-1),children:e.jsx(fe,{size:12})}),e.jsx("button",{className:"rounded p-1 text-ink-3 hover:text-ink-1 disabled:opacity-30","aria-label":"下移",disabled:u===l.sections.length-1,onClick:()=>V(u,1),children:e.jsx(pe,{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:()=>_({...l,sections:l.sections.map(m=>m.key===t.key?{...m,enabled:!m.enabled}:m)}),children:t.enabled?"显示":"隐藏"}),e.jsx("button",{className:"rounded p-1 text-ink-3 hover:text-ink-1","aria-label":"展开编辑",onClick:()=>c(m=>{const g=new Set(m);return g.has(t.key)?g.delete(t.key):g.add(t.key),g}),children:e.jsx(ge,{size:13,className:"transition-transform "+(n?"rotate-90":"")})})]}),n&&e.jsx("div",{className:"border-t border-line bg-surface-2 px-3 py-2.5",children:t.kind==="text"?e.jsx(Y,{rows:4,value:t.text??"",placeholder:"输入该板块内容…",onChange:m=>_({...l,sections:l.sections.map(g=>g.key===t.key?{...g,text:m.target.value}:g)})}):t.kind==="list"?e.jsx(ze,{cfg:l,section:t,records:E,persist:_,sectionTypes:le(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:[y,(k=t.types)!=null&&k.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();_({...l,sections:[...l.sections,{key:t,title:"自定义板块",enabled:!0,kind:"text",text:""}]}),c(u=>new Set(u).add(t))},children:[e.jsx(ee,{size:13})," 新增文本板块"]})})]})})]})]})]})]})}function ze({cfg:i,section:a,records:h,persist:j,sectionTypes:d}){const[s,p]=P.useState(null),N=new Set(a.excluded??[]),w=h.filter(o=>(a.types??[]).includes(o.type_name)&&o.status!=="draft").sort((o,x)=>(x.start_date??x.created_at).localeCompare(o.start_date??o.created_at)),v=a.items??[],c=o=>j({...i,sections:i.sections.map(x=>x.key===a.key?{...x,...o}:x)}),f=o=>{const x=new Set(a.excluded??[]);x.has(o)?x.delete(o):x.add(o),c({excluded:[...x]})};return e.jsxs("div",{className:"flex flex-col gap-2.5",children:[e.jsx("div",{className:"text-[11px] text-ink-3",children:"来自记录的条目(勾选 = 显示)· 另可添加自定义条目"}),w.map(o=>e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-[12px]",children:[e.jsx("input",{type:"checkbox",className:"size-3.5",checked:!N.has(o.id),onChange:()=>f(o.id)}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-ink-1",children:o.title}),e.jsx("span",{className:"num shrink-0 text-[11px] text-ink-3",children:(o.start_date??"").slice(0,7)})]},o.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:["自定义条目(",v.length,")"]}),e.jsxs(T,{size:"sm",variant:"ghost",onClick:()=>p({title:""}),children:[e.jsx(ee,{size:12})," 添加"]})]}),s&&e.jsxs("div",{className:"mb-2 rounded-md border border-line bg-surface p-2",children:[e.jsx(U,{className:"mb-1.5",placeholder:"标题",value:s.title,onChange:o=>p({...s,title:o.target.value})}),e.jsxs("div",{className:"mb-1.5 grid grid-cols-2 gap-1.5",children:[e.jsx(U,{placeholder:"副标题(单位/角色)",value:s.subtitle??"",onChange:o=>p({...s,subtitle:o.target.value})}),e.jsx(U,{placeholder:"日期(2025.9)",value:s.date??"",onChange:o=>p({...s,date:o.target.value})})]}),e.jsx(Y,{rows:2,placeholder:"描述:做了什么、负责什么、学会什么",value:s.desc??"",onChange:o=>p({...s,desc:o.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()&&(c({items:[...v,s]}),p(null))},children:"添加"}),e.jsx(T,{size:"sm",variant:"ghost",onClick:()=>p(null),children:"取消"})]})]}),v.map((o,x)=>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:[o.title,e.jsxs("span",{className:"text-ink-3",children:[" · ",o.date??""]})]}),e.jsx("button",{className:"text-ink-3 hover:text-danger","aria-label":"删除条目",onClick:()=>c({items:v.filter((C,r)=>r!==x)}),children:e.jsx(de,{size:12})})]},x)),!v.length&&!s&&e.jsx("p",{className:"text-[11.5px] text-ink-3",children:"暂无自定义条目"})]}),e.jsxs("p",{className:"text-[11px] text-ink-3",children:["「",d,"」相关条目来自你的记录数据,此处可隐藏不需要展示的条目;描述可在预览中点击直接修改。"]})]})}export{Me as ResumePage};
|