40 lines
27 KiB
JavaScript
40 lines
27 KiB
JavaScript
import{c as L,d as ce,f as Q,r as R,j as e,B as M,ag as de,ae as U,H,S as Z,ac as te,P as se,a8 as me,I as W,T as xe,af as pe,v as ue}from"./index-BCAZXiEu.js";import{C as X,a as Y,b as J}from"./card-DaQiiTAq.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 he=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],fe=L("ArrowDown",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:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],ge=L("ArrowUp",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=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ke=L("ChevronRight",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=[["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"}]],ve=L("GripVertical",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:"m8 9 3 3-3 3",key:"12hl5m"}]],we=L("PanelRightClose",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=[["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"}]],Se=L("PanelRightOpen",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 _e=[["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"}]],Re=L("Printer",_e),A=[{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:`程序设计:熟悉 Python 与 C/C++,掌握常用数据结构与算法,能独立完成中小型工具与脚本开发。
|
||
网络安全:熟悉常见 Web 漏洞原理(SQL 注入、XSS、CSRF 等)与防护方案,掌握 Burp Suite、Nmap、Wireshark 等常用工具。
|
||
网络基础:熟悉 TCP/IP 协议栈与交换路由基础配置,理解 VLAN、NAT、ACL 等核心技术。
|
||
运维基础:熟悉 Linux 常用操作与 Shell 脚本,了解 Docker 容器化部署与 Nginx 服务配置。`},campus:{items:[{title:"校图书馆学生助理",subtitle:"读者服务岗",date:"2024.9 - 2025.6",desc:"负责书库整理与借阅服务,协助开展入馆培训与阅读推广活动,累计服务读者千余人次。培养了责任意识与服务意识,锻炼了多任务时间管理能力。"},{title:"院学生会宣传部干事",subtitle:"平面设计与文案",date:"2023.9 - 2024.6",desc:"参与学院活动的海报设计与推文撰写,负责活动现场的后勤与设备保障。锻炼了审美表达、协作沟通与临场应变能力。"}]},self:{text:"性格沉稳踏实,做事有计划性,习惯提前预判风险并准备预案;学习能力强,能快速上手新技术与工具;责任心强,注重细节与条理,凡事有始有终,能独立推进任务并在压力下保持稳定输出。"}};function K(){return{version:2,template:"tech",accent:"#3056d3",fontScale:1,density:"normal",onePage:!1,sections:A.map(l=>({key:l.key,title:l.defaultTitle,enabled:!0,kind:l.kind,types:l.types,...l.key==="skills"?{text:I.skills.text}:{},...l.key==="campus"?{items:I.campus.items}:{},...l.key==="self"?{text:I.self.text}:{}}))}}function ne(l){const u=K();if(!l||typeof l!="object")return u;const h=l,v=Array.isArray(h.sections)?h.sections:[],y=u.sections.map(d=>{var N;const a=v.find(o=>o.key===d.key),C=A.find(o=>o.key===d.key),k={...d,enabled:(a==null?void 0:a.enabled)??!0,title:(a==null?void 0:a.title)??(C==null?void 0:C.defaultTitle)??d.title};return d.key==="skills"&&!k.text&&(k.text=I.skills.text),d.key==="campus"&&!((N=k.items)!=null&&N.length)&&(k.items=I.campus.items),d.key==="self"&&!k.text&&(k.text=I.self.text),k}),n=new Set(["awards","competition","practice","research"]);for(const d of v)n.has(d.key)||y.some(a=>a.key===d.key)||y.push({key:d.key,title:d.title||d.key,enabled:d.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:y}}function ze(){return A.filter(l=>l.types).flatMap(l=>l.types)}function Pe(l){const u=[l.organizer,l.level,l.award_grade].filter(v=>v!=null&&v!=="").map(String).join(" · "),h=[l.result,l.description].filter(v=>v!=null&&v!=="").map(String).join(" — ");return{title:l.title,subtitle:u||void 0,date:l.start_date??l.created_at.slice(0,10),desc:h||void 0,fromRecord:l.id}}function ie(l,u){const h=[],v=ze(),y=new Set;for(const n of u.sections){if(!n.enabled)continue;const d=A.find(o=>o.key===n.key);if(n.key==="info"){h.push({key:n.key,title:n.title,kind:"info"});continue}if(n.key==="self"||n.kind==="text"){const o=n.text??"";if(!o.trim())continue;h.push({key:n.key,title:n.title,kind:"text",text:o});continue}const a=new Set(n.excluded??[]);let C=[];const k=d==null?void 0:d.types;k?C=l.filter(o=>k.includes(o.type_name)&&o.status!=="draft"&&!a.has(o.id)&&!y.has(o.id)):C=l.filter(o=>o.status!=="draft"&&!a.has(o.id)&&!y.has(o.id)&&!v.includes(o.type_name));const N=C.map(Pe).filter(o=>!o.fromRecord||!a.has(o.fromRecord)).map(o=>{var r;return{...o,...((r=n.overrides)==null?void 0:r[String(o.fromRecord)])??{}}});N.forEach(o=>{o.fromRecord&&y.add(o.fromRecord)});for(const o of n.items??[])N.push({...o});N.sort((o,r)=>(r.date??"").localeCompare(o.date??"")),N.length&&h.push({key:n.key,title:n.title,kind:"list",items:N})}return h}const ae=[{key:"tech",name:"互联网技术风",desc:"品牌色标题 + 左侧色条,紧凑现代"},{key:"minimal",name:"极简风",desc:"灰色大写字距标题,大量留白"},{key:"classic",name:"经典风",desc:"黑色衬线标题 + 通栏分隔线,正式通用"}],le=["#3056d3","#0f766e","#7c3aed","#c2410c","#0e7490","#1f2937"],w=l=>String(l??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");function Te(l,u,h,v){const y=h.fontScale,n=p=>(p*y).toFixed(1)+"pt",d=h.accent,a=u,C={classic:"font-size:"+n(14)+";color:#111;border-bottom:1.5pt solid #333;padding-bottom:3pt;margin:14pt 0 7pt",tech:"font-size:"+n(14)+";color:"+d+";border-bottom:1pt solid "+d+";padding-bottom:3pt;margin:14pt 0 7pt",minimal:"font-size:"+n(11.5)+";color:#555;letter-spacing:1.5pt;text-transform:uppercase;border-bottom:0.75pt solid #e0e0e0;padding-bottom:3pt;margin:14pt 0 7pt"},k=h.template==="tech"?d:"#111",N=[a.school,a.college,a.major,a.degree].filter(p=>p!=="").map(p=>w(p)).join(" · "),o=[a.phone,a.email,a.homepage].filter(p=>p!=="").map(p=>w(p)).join(" · "),r=v&&a.photoUrl?'<td style="width:'+(120*y).toFixed(0)+'px;text-align:right;vertical-align:top"><img src="'+w(a.photoUrl)+'" alt="证件照" width="'+Math.round(120*y)+'" height="'+Math.round(160*y)+'" style="width:'+Math.round(120*y)+"px;height:"+Math.round(160*y)+'px" /></td>':"",j='<table style="width:100%;border-collapse:collapse"><tr><td style="vertical-align:top"><div style="font-size:'+n(20)+";font-weight:bold;color:"+k+'">'+w(a.name||"个人简历")+"</div>"+(N?'<div style="color:#555;font-size:'+n(11)+';margin-top:3pt">'+N+"</div>":"")+(o?'<div style="color:#555;font-size:'+n(11)+';margin-top:2pt">'+o+"</div>":"")+"</td>"+r+"</tr></table>",P=p=>'<table style="width:100%;border-collapse:collapse;margin-top:'+(h.density==="compact"?4:7)+'pt"><tr><td style="font-weight:bold;font-size:'+n(12)+'">'+w(p.title)+'</td><td style="text-align:right;color:#666;font-size:'+n(10.5)+';white-space:nowrap">'+w(p.date??"")+"</td></tr></table>"+(p.subtitle?'<div style="color:#666;font-size:'+n(10.5)+'">'+w(p.subtitle)+"</div>":"")+(p.desc?'<div style="color:#444;font-size:'+n(11)+';line-height:1.55;margin-top:2pt">'+w(p.desc)+"</div>":""),c=l.map(p=>{let i="";if(p.kind==="edu"){const T=[["学校",a.school??""],["专业",a.major??""],["学制",a.eduLength??""],["学历",a.degree??""],["入学",a.eduStart??""],["毕业",a.eduEnd??""]].filter(S=>S[1]!=="");i='<table style="width:100%;border-collapse:collapse;font-size:'+n(12)+'">'+T.map(S=>'<tr><td style="width:80px;padding:3px 6px;color:#555">'+w(S[0])+'</td><td style="padding:3px 6px">'+w(S[1])+"</td></tr>").join("")+"</table>"+(a.majorCourses?'<div style="margin-top:6pt;font-size:'+n(11.5)+';line-height:1.6"><b>主修课程:</b>'+w(a.majorCourses)+"</div>":"")}else if(p.kind==="info"){const T=[["姓名",a.name??""],["性别",a.gender??""],["出生年月",a.birth??""],["民族",a.nation??""],["籍贯",a.native??""],["政治面貌",a.political??""],["班级",a.className??""],["学号",a.studentId??""],["学历",a.degree??""],["手机",a.phone??""],["邮箱",a.email??""]].filter(S=>S[1]!=="");i='<table style="width:100%;border-collapse:collapse;font-size:'+n(12)+'">'+T.map((S,D)=>(D%2===0?"<tr>":"")+'<td style="width:80px;padding:3px 6px;color:#555">'+w(S[0])+'</td><td style="padding:3px 6px">'+w(S[1])+"</td>"+(D%2===1?"</tr>":"")).join("")+"</table>"}else p.kind==="list"?i="<div>"+(p.items??[]).map(P).join("")+"</div>":i='<p style="font-size:'+n(12)+';line-height:1.7;margin:0;text-align:justify">'+w(p.text??"").replace(/\n/g,"<br/>")+"</p>";return'<div style="'+C[h.template]+'">'+w(p.title)+"</div>"+i}).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(a.name||"个人简历")+'</title><!--[if gte mso 9]><xml><w:WordDocument><w:View>Print</w:View></w:WordDocument></xml><![endif]--></head><body style="font-family:Calibri,SimSun,sans-serif;margin:36pt;color:#222">'+j+c+"</body></html>"}const Ee=Object.freeze(Object.defineProperty({__proto__:null,ACCENT_CHOICES:le,RESUME_SECTION_DEFS:A,TEMPLATES:ae,assembleSections:ie,defaultResumeConfig:K,migrateResumeConfig:ne,resumeToWordHtml:Te},Symbol.toStringTag,{value:"Module"}));function ee(l){const u=/^(\d{4})-(\d{1,2})/.exec(l??"");return u?u[1]+"."+Number(u[2]):l??""}function z({html:l,onCommit:u,className:h}){const v=l.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");return e.jsx("span",{contentEditable:!0,suppressContentEditableWarning:!0,spellCheck:!1,className:"outline-none break-words rounded-sm transition-shadow focus:shadow-[0_0_0_1.5px_rgba(48,86,211,0.5)] cursor-text "+(h??""),dangerouslySetInnerHTML:{__html:v},onBlur:y=>{const n=(y.currentTarget.textContent??"").trim();n!==l&&u(n)}})}function Ie(){var q,$,G;const l=ce(),u=Q({queryKey:["profile"],queryFn:pe}),h=Q({queryKey:["resume-records"],queryFn:()=>ue({page:1,page_size:500})}),[v,y]=R.useState(null),[n,d]=R.useState(""),[a,C]=R.useState(!0),[k,N]=R.useState(new Set),[o,r]=R.useState(1),j=R.useRef(null),P=R.useRef(null);R.useEffect(()=>{var m,s;const t=(m=u.data)==null?void 0:m.content;t&&(y(ne(t.resume)),d(((s=t.info)==null?void 0:s.selfIntro)??""))},[u.data]);const c={...(($=(q=u.data)==null?void 0:q.content)==null?void 0:$.info)??{}},p=((G=h.data)==null?void 0:G.items)??[],i=v??K(),T={...c,selfIntro:n},S=[ee(c.eduStart),ee(c.eduEnd)].filter(Boolean).join("-"),D=R.useMemo(()=>ie(p,i),[p,i]),B=(t,m)=>y(s=>{if(!s)return s;const f=[...s.sections],g=t+m;return g<0||g>=f.length?s:([f[t],f[g]]=[f[g],f[t]],{...s,sections:f})}),_=t=>{y(t),U({info:{...c,selfIntro:n},resume:t}).catch(m=>l("error",m.message))},O=t=>{y(m=>{const s=m??i,f=s.sections.map(x=>{var b;if(x.key!==t.secKey)return x;if(t.field==="text")return{...x,text:t.value};if(t.fromRecord!=null){const E={...((b=x.overrides)==null?void 0:b[t.fromRecord])??{},[t.field]:t.value};return{...x,overrides:{...x.overrides??{},[t.fromRecord]:E}}}if(t.itemIdx!=null&&x.items){const E=[...x.items];return E[t.itemIdx]={...E[t.itemIdx],[t.field]:t.value},{...x,items:E}}return x}),g={...s,sections:f};return U({info:{...c,selfIntro:n},resume:g}).catch(x=>l("error",x.message)),g})},F=(t,m)=>{U({info:{...T,[t]:m}}).then(()=>u.refetch()).catch(s=>l("error",s.message))};R.useEffect(()=>{if(!i.onePage){r(1);return}const t=j.current;if(!t)return;const m=1043,s=t.scrollHeight;r(s>m?Math.max(.7,m/s):1)},[i.onePage,i.fontScale,i.density,D]);const V=i.fontScale*(i.onePage?o:1),oe=()=>{me(()=>Promise.resolve().then(()=>Ee),void 0).then(function(t){const m=t.resumeToWordHtml(D,T,i,c.photoUrl),s=new Blob(["\uFEFF"+m],{type:"application/msword"}),f=URL.createObjectURL(s),g=document.createElement("a");g.href=f,g.download=(c.name||"个人简历")+".doc",g.click(),setTimeout(()=>URL.revokeObjectURL(f),6e4),l("success","Word 文档已导出")})},re=t=>{var m,s;return((s=(m=A.find(f=>f.key===t))==null?void 0:m.types)==null?void 0:s.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(M,{variant:"secondary",onClick:()=>C(t=>!t),children:[a?e.jsx(we,{size:13}):e.jsx(Se,{size:13}),a?"收起设置":"展开设置"]}),e.jsxs(M,{variant:"secondary",onClick:oe,children:[e.jsx(de,{size:13})," 导出 Word"]}),e.jsxs(M,{variant:"primary",onClick:()=>window.print(),children:[e.jsx(Re,{size:13})," 打印 / PDF"]})]})]}),e.jsxs("div",{className:"grid gap-4 "+(a?"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:i.onePage?1123:void 0},children:e.jsxs("div",{ref:j,className:"min-w-0 overflow-x-hidden p-5 sm:p-10 resume-tpl-"+i.template,style:{zoom:V,"--accent":i.accent},children:[e.jsxs("div",{className:"mb-6 flex items-start justify-between gap-4 sm:gap-6",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h1",{className:"text-[26px] font-bold leading-tight "+(i.template==="tech"?"text-[var(--accent)]":"text-neutral-900"),children:c.name||"姓名"}),e.jsx("div",{className:"mt-1.5 text-[12.5px] text-neutral-500",children:[c.school,c.college,c.major,c.degree].filter(Boolean).join(" · ")||"完善个人信息后自动展示"}),e.jsx("div",{className:"mt-1 text-[12px] text-neutral-500",children:[c.phone,c.email,c.homepage].filter(Boolean).join(" · ")})]}),c.photoUrl&&e.jsx("img",{src:c.photoUrl,alt:"证件照",className:"h-[110px] w-[82px] rounded border border-neutral-200 object-cover"})]}),D.map(t=>{var m;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(z,{html:t.title,onCommit:s=>O({secKey:t.key,field:"title",value:s})})}),t.kind==="edu"?e.jsxs("div",{children:[e.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-x-4 gap-y-0.5 text-[13px]",children:[e.jsx("span",{className:"num shrink-0 text-neutral-500",children:e.jsx(z,{html:S,onCommit:s=>{const f=/(\d{4})\.(\d{1,2})\s*[-—~至]\s*(\d{4})\.(\d{1,2})/.exec(s);if(!f){l("error","时间格式:2023.9-2027.6");return}U({info:{...T,eduStart:f[1]+"-"+f[2].padStart(2,"0"),eduEnd:f[3]+"-"+f[4].padStart(2,"0")}}).then(()=>u.refetch()).catch(g=>l("error",g.message))}})}),e.jsx("span",{className:"min-w-0 font-semibold text-neutral-900",children:e.jsx(z,{html:c.school??"",onCommit:s=>F("school",s)})}),e.jsxs("span",{className:"shrink-0 text-neutral-600",children:[e.jsx(z,{html:c.major??"",onCommit:s=>F("major",s)}),c.degree?e.jsxs("span",{children:[" | ",e.jsx(z,{html:c.degree,onCommit:s=>F("degree",s)})]}):null]})]}),c.majorCourses&&e.jsxs("p",{className:"mt-1.5 text-[12px] leading-relaxed text-justify text-neutral-700",children:[e.jsx("b",{children:"主修课程:"}),e.jsx(z,{html:c.majorCourses,onCommit:s=>F("majorCourses",s)})]})]}):t.kind==="info"?e.jsx("div",{className:"grid grid-cols-1 gap-x-8 gap-y-1 text-[12.5px] sm:grid-cols-2",children:[["姓名",c.name],["性别",c.gender],["出生年月",c.birth],["民族",c.nation],["籍贯",c.native],["政治面貌",c.political],["班级",c.className],["学号",c.studentId],["手机",c.phone],["邮箱",c.email]].filter(s=>s[1]).map(s=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx("span",{className:"w-16 shrink-0 text-neutral-500",children:s[0]}),e.jsx("span",{children:s[1]})]},s[0]))}):t.kind==="text"?e.jsx("p",{className:"whitespace-pre-wrap text-justify text-neutral-700 "+(i.density==="compact"?"":"leading-relaxed"),children:e.jsx(z,{html:t.text??"",onCommit:s=>O({secKey:t.key,field:"text",value:s})})}):e.jsx("div",{className:i.density==="compact"?"flex flex-col gap-1.5":"flex flex-col gap-3",children:(m=t.items)==null?void 0:m.map((s,f)=>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(z,{html:s.title,onCommit:g=>O({secKey:t.key,field:"title",value:g,itemIdx:f,fromRecord:s.fromRecord})})}),e.jsx("span",{className:"num shrink-0 text-[11.5px] text-neutral-500",children:e.jsx(z,{html:s.date??"",onCommit:g=>O({secKey:t.key,field:"date",value:g,itemIdx:f,fromRecord:s.fromRecord})})})]}),s.subtitle&&e.jsx("div",{className:"text-[12px] text-neutral-600",children:s.subtitle}),s.desc&&e.jsx("p",{className:"text-justify text-[12px] text-neutral-500 "+(i.density==="compact"?"":"mt-0.5"),children:e.jsx(z,{html:s.desc,onCommit:g=>O({secKey:t.key,field:"desc",value:g,itemIdx:f,fromRecord:s.fromRecord})})})]},(s.title??"")+(s.date??"")+f))})]},t.key)})]})}),i.onePage&&e.jsxs("div",{className:"no-print mt-2 text-center text-[11.5px] text-ink-3",children:["一页限定已启用:内容自动缩放 ",Math.round(V*100),"% 以适配单页 A4"]})]}),a&&e.jsxs("div",{className:"no-print flex flex-col gap-4 lg:sticky lg:top-4 lg:max-h-[calc(100vh-2rem)] lg:self-start lg:overflow-y-auto lg:pr-1",children:[e.jsxs(X,{children:[e.jsx(Y,{title:"模板与风格"}),e.jsxs(J,{className:"flex flex-col gap-3",children:[e.jsx("div",{className:"grid grid-cols-1 gap-2",children:ae.map(t=>e.jsxs("button",{className:"rounded-md border px-3 py-2 text-left transition-all "+(i.template===t.key?"border-brand bg-brand-subtle":"border-line bg-surface hover:border-line-strong"),onClick:()=>_({...i,template:t.key}),children:[e.jsx("div",{className:"text-[12.5px] font-semibold "+(i.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(H,{label:"主题色",children:e.jsx("div",{className:"flex flex-wrap gap-1.5 pt-1",children:le.map(t=>e.jsx("button",{"aria-label":"主题色 "+t,className:"size-5 rounded-full border-2 transition-transform "+(i.accent===t?"scale-110 border-ink-1":"border-transparent"),style:{backgroundColor:t},onClick:()=>_({...i,accent:t})},t))})}),e.jsx(H,{label:"字号",children:e.jsx(Z,{value:String(i.fontScale),onChange:t=>_({...i,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(H,{label:"间距",children:e.jsx(Z,{value:i.density,onChange:t=>_({...i,density:t.target.value}),options:[{value:"compact",label:"紧凑"},{value:"normal",label:"标准"},{value:"relaxed",label:"宽松"}]})}),e.jsx(H,{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 "+(i.onePage?"border-brand bg-brand-subtle text-brand-text":"border-line bg-surface text-ink-2"),onClick:()=>_({...i,onePage:!i.onePage}),children:i.onePage?"已开启":"已关闭"})})]})]})]}),e.jsxs(X,{children:[e.jsx(Y,{title:"板块布局",extra:e.jsx("span",{className:"text-[11px] text-ink-3",children:"拖动排序 · 点击预览可改内容"})}),e.jsx(J,{className:"p-0",children:e.jsxs("div",{className:"flex flex-col divide-y divide-line",children:[i.sections.map((t,m)=>{var g;const s=k.has(t.key),f=t.kind==="info"?"固定":t.kind==="text"?"文本":t.kind==="edu"?"教育":"记录";return e.jsxs("div",{draggable:!0,onDragStart:()=>{P.current=t.key},onDragOver:x=>x.preventDefault(),onDrop:()=>{const x=i.sections.findIndex(b=>b.key===P.current);if(x>=0&&x!==m){const b=[...i.sections],E=b.splice(x,1)[0];b.splice(m,0,E),_({...i,sections:b})}P.current=null},className:"bg-surface "+(P.current===t.key?"opacity-40":""),children:[e.jsxs("div",{className:"flex items-center gap-1 px-3 py-2",children:[e.jsx(ve,{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:x=>_({...i,sections:i.sections.map(b=>b.key===t.key?{...b,title:x.target.value}:b)})}),e.jsx("button",{className:"rounded p-1 text-ink-3 hover:text-ink-1 disabled:opacity-30","aria-label":"上移",disabled:m===0,onClick:()=>B(m,-1),children:e.jsx(ge,{size:12})}),e.jsx("button",{className:"rounded p-1 text-ink-3 hover:text-ink-1 disabled:opacity-30","aria-label":"下移",disabled:m===i.sections.length-1,onClick:()=>B(m,1),children:e.jsx(fe,{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:()=>_({...i,sections:i.sections.map(x=>x.key===t.key?{...x,enabled:!x.enabled}:x)}),children:t.enabled?"显示":"隐藏"}),e.jsx("button",{className:"rounded p-1 text-ink-3 hover:text-ink-1","aria-label":"展开编辑",onClick:()=>N(x=>{const b=new Set(x);return b.has(t.key)?b.delete(t.key):b.add(t.key),b}),children:e.jsx(ke,{size:13,className:"transition-transform "+(s?"rotate-90":"")})})]}),s&&e.jsx("div",{className:"border-t border-line bg-surface-2 px-3 py-2.5",children:t.kind==="text"?e.jsx(te,{rows:4,value:t.text??"",placeholder:"输入该板块内容…",onChange:x=>_({...i,sections:i.sections.map(b=>b.key===t.key?{...b,text:x.target.value}:b)})}):t.kind==="list"?e.jsx(Me,{cfg:i,section:t,records:p,persist:_,sectionTypes:re(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:[f,(g=t.types)!=null&&g.length?" · "+t.types.join("/"):""]})]},t.key)}),e.jsx("div",{className:"p-3",children:e.jsxs(M,{size:"sm",variant:"secondary",className:"w-full",onClick:()=>{const t="custom_"+Date.now();_({...i,sections:[...i.sections,{key:t,title:"自定义板块",enabled:!0,kind:"text",text:""}]}),N(m=>new Set(m).add(t))},children:[e.jsx(se,{size:13})," 新增文本板块"]})})]})})]})]})]})]})}function Me({cfg:l,section:u,records:h,persist:v,sectionTypes:y}){const[n,d]=R.useState(null),a=new Set(u.excluded??[]),C=h.filter(r=>(u.types??[]).includes(r.type_name)&&r.status!=="draft").sort((r,j)=>(j.start_date??j.created_at).localeCompare(r.start_date??r.created_at)),k=u.items??[],N=r=>v({...l,sections:l.sections.map(j=>j.key===u.key?{...j,...r}:j)}),o=r=>{const j=new Set(u.excluded??[]);j.has(r)?j.delete(r):j.add(r),N({excluded:[...j]})};return e.jsxs("div",{className:"flex flex-col gap-2.5",children:[e.jsx("div",{className:"text-[11px] text-ink-3",children:"来自记录的条目(勾选 = 显示)· 另可添加自定义条目"}),C.map(r=>e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-[12px]",children:[e.jsx("input",{type:"checkbox",className:"size-3.5",checked:!a.has(r.id),onChange:()=>o(r.id)}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-ink-1",children:r.title}),e.jsx("span",{className:"num shrink-0 text-[11px] text-ink-3",children:(r.start_date??"").slice(0,7)})]},r.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:["自定义条目(",k.length,")"]}),e.jsxs(M,{size:"sm",variant:"ghost",onClick:()=>d({title:""}),children:[e.jsx(se,{size:12})," 添加"]})]}),n&&e.jsxs("div",{className:"mb-2 rounded-md border border-line bg-surface p-2",children:[e.jsx(W,{className:"mb-1.5",placeholder:"标题",value:n.title,onChange:r=>d({...n,title:r.target.value})}),e.jsxs("div",{className:"mb-1.5 grid grid-cols-2 gap-1.5",children:[e.jsx(W,{placeholder:"副标题(单位/角色)",value:n.subtitle??"",onChange:r=>d({...n,subtitle:r.target.value})}),e.jsx(W,{placeholder:"日期(2025.9)",value:n.date??"",onChange:r=>d({...n,date:r.target.value})})]}),e.jsx(te,{rows:2,placeholder:"描述:做了什么、负责什么、学会什么",value:n.desc??"",onChange:r=>d({...n,desc:r.target.value})}),e.jsxs("div",{className:"mt-1.5 flex gap-1.5",children:[e.jsx(M,{size:"sm",variant:"primary",disabled:!n.title.trim(),onClick:()=>{n.title.trim()&&(N({items:[...k,n]}),d(null))},children:"添加"}),e.jsx(M,{size:"sm",variant:"ghost",onClick:()=>d(null),children:"取消"})]})]}),k.map((r,j)=>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:[r.title,e.jsxs("span",{className:"text-ink-3",children:[" · ",r.date??""]})]}),e.jsx("button",{className:"text-ink-3 hover:text-danger","aria-label":"删除条目",onClick:()=>N({items:k.filter((P,c)=>c!==j)}),children:e.jsx(xe,{size:12})})]},j)),!k.length&&!n&&e.jsx("p",{className:"text-[11.5px] text-ink-3",children:"暂无自定义条目"})]}),e.jsxs("p",{className:"text-[11px] text-ink-3",children:["「",y,"」相关条目来自你的记录数据,此处可隐藏不需要展示的条目;描述可在预览中点击直接修改。"]})]})}export{Ie as ResumePage};
|