545 lines
15 KiB
HTML
545 lines
15 KiB
HTML
{{ define "web/project" }}
|
|
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>{{.Project.Name}} - {{.Resume.BasicInfo.Name}}</title>
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/highlight.js@11.8.0/styles/github.min.css">
|
|
<style>
|
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
a { text-decoration: none; color: unset; }
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
background: #f5f7fa;
|
|
min-height: 100vh;
|
|
line-height: 1.65;
|
|
}
|
|
|
|
.nav-bar {
|
|
background: white;
|
|
border-bottom: 0.06rem solid #e8ecef;
|
|
padding: 0.88rem 1.25rem;
|
|
position: sticky;
|
|
top: 0;
|
|
z-index: 1000;
|
|
box-shadow: 0 0.06rem 0.19rem rgba(0,0,0,0.04);
|
|
}
|
|
|
|
.nav-bar .nav-content {
|
|
max-width: 62.50rem;
|
|
margin: 0 auto;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
}
|
|
|
|
.nav-bar .back-link {
|
|
color: #3498db;
|
|
text-decoration: none;
|
|
font-size: 0.95em;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.38rem;
|
|
transition: all 0.3s ease;
|
|
}
|
|
|
|
.nav-bar .back-link:hover {
|
|
color: #2980b9;
|
|
gap: 0.62rem;
|
|
}
|
|
|
|
.nav-bar .nav-title {
|
|
font-size: 1.1em;
|
|
font-weight: 600;
|
|
color: #2c3e50;
|
|
}
|
|
|
|
.project-container {
|
|
max-width: 62.50rem;
|
|
margin: 2.19rem auto;
|
|
padding: 0 1.25rem;
|
|
display: grid;
|
|
grid-template-columns: 17.50rem 1fr;
|
|
gap: 1.75rem;
|
|
}
|
|
|
|
.project-sidebar {
|
|
background: white;
|
|
border-radius: 0.38rem;
|
|
padding: 1.38rem;
|
|
box-shadow: 0 0.12rem 0.50rem rgba(0,0,0,0.04);
|
|
position: sticky;
|
|
top: 5rem;
|
|
height: fit-content;
|
|
}
|
|
|
|
.project-sidebar .sidebar-title {
|
|
font-size: 0.88em;
|
|
font-weight: 600;
|
|
color: #888;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.03rem;
|
|
margin-bottom: 0.88rem;
|
|
padding-bottom: 0.50rem;
|
|
border-bottom: 0.06rem solid #f0f2f5;
|
|
}
|
|
|
|
.project-sidebar .project-name {
|
|
font-size: 1.2em;
|
|
font-weight: 700;
|
|
color: #2c3e50;
|
|
margin-bottom: 0.75rem;
|
|
line-height: 1.4;
|
|
}
|
|
|
|
.project-sidebar .meta-item {
|
|
display: flex;
|
|
align-items: flex-start;
|
|
gap: 0.50rem;
|
|
margin-bottom: 0.75rem;
|
|
font-size: 0.92em;
|
|
color: #555;
|
|
}
|
|
|
|
.project-sidebar .meta-item i {
|
|
color: #3498db;
|
|
font-size: 0.85em;
|
|
margin-top: 0.12rem;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.project-sidebar .meta-item .meta-label {
|
|
color: #888;
|
|
font-size: 0.85em;
|
|
margin-right: 0.38rem;
|
|
}
|
|
|
|
.project-sidebar .tech-stack {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: 0.38rem;
|
|
margin-top: 0.50rem;
|
|
}
|
|
|
|
.project-sidebar .tech-tag {
|
|
padding: 0.25rem 0.62rem;
|
|
background: #e8f4fd;
|
|
color: #3498db;
|
|
border-radius: 0.19rem;
|
|
font-size: 0.82em;
|
|
border: 0.06rem solid #d5eaf9;
|
|
}
|
|
|
|
.project-sidebar .links {
|
|
margin-top: 1.12rem;
|
|
padding-top: 1.12rem;
|
|
border-top: 0.06rem solid #f0f2f5;
|
|
}
|
|
|
|
.project-sidebar .links a {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.50rem;
|
|
color: #3498db;
|
|
text-decoration: none;
|
|
font-size: 0.92em;
|
|
padding: 0.50rem 0;
|
|
transition: all 0.3s ease;
|
|
border-radius: 0.25rem;
|
|
padding-left: 0.62rem;
|
|
}
|
|
|
|
.project-sidebar .links a:hover {
|
|
background: #f0f7ff;
|
|
padding-left: 1rem;
|
|
}
|
|
|
|
.project-main {
|
|
background: white;
|
|
border-radius: 0.38rem;
|
|
padding: 2rem;
|
|
box-shadow: 0 0.12rem 0.50rem rgba(0,0,0,0.04);
|
|
}
|
|
|
|
.project-main .doc-content {
|
|
color: #333;
|
|
font-size: 0.98em;
|
|
}
|
|
|
|
.doc-content h1 {
|
|
font-size: 1.7em;
|
|
font-weight: 700;
|
|
color: #2c3e50;
|
|
margin-bottom: 1.12rem;
|
|
padding-bottom: 0.75rem;
|
|
border-bottom: 0.12rem solid #3498db;
|
|
}
|
|
|
|
.doc-content h2 {
|
|
font-size: 1.4em;
|
|
font-weight: 600;
|
|
color: #2c3e50;
|
|
margin: 1.50rem 0 0.88rem;
|
|
padding-bottom: 0.50rem;
|
|
border-bottom: 0.06rem solid #e8ecef;
|
|
}
|
|
|
|
.doc-content h3 {
|
|
font-size: 1.15em;
|
|
font-weight: 600;
|
|
color: #34495e;
|
|
margin: 1.25rem 0 0.75rem;
|
|
}
|
|
|
|
.doc-content p {
|
|
margin-bottom: 0.88rem;
|
|
line-height: 1.75;
|
|
color: #444;
|
|
}
|
|
|
|
.doc-content ul, .doc-content ol {
|
|
margin-bottom: 0.88rem;
|
|
padding-left: 1.50rem;
|
|
}
|
|
|
|
.doc-content li {
|
|
margin-bottom: 0.38rem;
|
|
color: #444;
|
|
}
|
|
|
|
.doc-content blockquote {
|
|
border-left: 0.19rem solid #3498db;
|
|
padding: 0.75rem 1.12rem;
|
|
margin: 1rem 0;
|
|
background: #f8fbfe;
|
|
color: #555;
|
|
border-radius: 0 0.25rem 0.25rem 0;
|
|
font-style: italic;
|
|
}
|
|
|
|
.doc-content pre {
|
|
background: #2d2d2d;
|
|
color: #ccc;
|
|
padding: 1rem 1.25rem;
|
|
border-radius: 0.38rem;
|
|
overflow-x: auto;
|
|
margin: 1rem 0;
|
|
font-size: 0.88em;
|
|
line-height: 1.6;
|
|
}
|
|
|
|
.doc-content pre code {
|
|
background: none;
|
|
padding: 0;
|
|
color: inherit;
|
|
}
|
|
|
|
.doc-content code {
|
|
background: #f4f6f8;
|
|
padding: 0.12rem 0.38rem;
|
|
border-radius: 0.19rem;
|
|
font-size: 0.9em;
|
|
color: #e74c3c;
|
|
font-family: 'Fira Code', 'Monaco', monospace;
|
|
}
|
|
|
|
.doc-content table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
margin: 1rem 0;
|
|
font-size: 0.92em;
|
|
}
|
|
|
|
.doc-content th, .doc-content td {
|
|
border: 0.06rem solid #e8ecef;
|
|
padding: 0.62rem 0.88rem;
|
|
text-align: left;
|
|
}
|
|
|
|
.doc-content th {
|
|
background: #f8fafc;
|
|
font-weight: 600;
|
|
color: #2c3e50;
|
|
}
|
|
|
|
.doc-content tr:nth-child(even) {
|
|
background: #fafbfc;
|
|
}
|
|
|
|
.doc-content img {
|
|
max-width: 100%;
|
|
border-radius: 0.38rem;
|
|
margin: 0.75rem 0;
|
|
box-shadow: 0 0.12rem 0.50rem rgba(0,0,0,0.08);
|
|
}
|
|
|
|
.doc-content a {
|
|
color: #3498db;
|
|
text-decoration: none;
|
|
position: relative;
|
|
}
|
|
|
|
.doc-content a::after {
|
|
content: '';
|
|
position: absolute;
|
|
width: 0;
|
|
height: 0.06rem;
|
|
bottom: -0.06rem;
|
|
left: 0;
|
|
background: #3498db;
|
|
transition: width 0.3s ease;
|
|
}
|
|
|
|
.doc-content a:hover::after {
|
|
width: 100%;
|
|
}
|
|
|
|
.doc-content hr {
|
|
border: none;
|
|
border-top: 0.06rem solid #e8ecef;
|
|
margin: 1.50rem 0;
|
|
}
|
|
|
|
.mermaid-placeholder {
|
|
background: #fafbfc;
|
|
border: 0.06rem dashed #dde3e8;
|
|
border-radius: 0.38rem;
|
|
padding: 1.25rem;
|
|
margin: 1rem 0;
|
|
text-align: center;
|
|
color: #888;
|
|
}
|
|
|
|
.mermaid {
|
|
margin: 1rem 0;
|
|
text-align: center;
|
|
}
|
|
|
|
.mermaid svg {
|
|
max-width: 100%;
|
|
height: auto;
|
|
}
|
|
|
|
.no-doc {
|
|
text-align: center;
|
|
padding: 3.75rem 1.25rem;
|
|
color: #888;
|
|
}
|
|
|
|
.no-doc i {
|
|
font-size: 3em;
|
|
margin-bottom: 1rem;
|
|
opacity: 0.5;
|
|
}
|
|
|
|
.no-doc p {
|
|
font-size: 1em;
|
|
}
|
|
|
|
@media (max-width: 56.25rem) {
|
|
.project-container {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
|
|
.project-sidebar {
|
|
position: static;
|
|
order: 2;
|
|
}
|
|
|
|
.project-main {
|
|
order: 1;
|
|
}
|
|
}
|
|
|
|
@media (max-width: 48rem) {
|
|
.nav-bar {
|
|
padding: 0.75rem 0.94rem;
|
|
}
|
|
|
|
.nav-bar .nav-title {
|
|
font-size: 1em;
|
|
}
|
|
|
|
.project-container {
|
|
margin: 1.25rem auto;
|
|
padding: 0 0.94rem;
|
|
}
|
|
|
|
.project-sidebar {
|
|
padding: 1.12rem;
|
|
}
|
|
|
|
.project-main {
|
|
padding: 1.38rem;
|
|
}
|
|
|
|
.doc-content h1 {
|
|
font-size: 1.4em;
|
|
}
|
|
|
|
.doc-content h2 {
|
|
font-size: 1.2em;
|
|
}
|
|
|
|
.doc-content h3 {
|
|
font-size: 1.05em;
|
|
}
|
|
|
|
.doc-content pre {
|
|
padding: 0.75rem;
|
|
font-size: 0.8em;
|
|
}
|
|
}
|
|
|
|
@media print {
|
|
body { background: white; }
|
|
.nav-bar { display: none; }
|
|
.project-container {
|
|
grid-template-columns: 1fr;
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
.project-sidebar {
|
|
position: static;
|
|
box-shadow: none;
|
|
border: 0.06rem solid #ddd;
|
|
}
|
|
.project-main {
|
|
box-shadow: none;
|
|
border: 0.06rem solid #ddd;
|
|
border-top: none;
|
|
}
|
|
a { color: #3498db; text-decoration: underline; }
|
|
@page { margin: 15mm; }
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<nav class="nav-bar">
|
|
<div class="nav-content">
|
|
<a href="/" class="back-link">
|
|
<i class="fas fa-arrow-left"></i> 返回简历
|
|
</a>
|
|
<span class="nav-title">{{.Project.Name}}</span>
|
|
</div>
|
|
</nav>
|
|
|
|
<div class="project-container">
|
|
<aside class="project-sidebar">
|
|
<div class="project-name">{{.Project.Name}}</div>
|
|
<div class="sidebar-title">项目信息</div>
|
|
|
|
<div class="meta-item">
|
|
<i class="fas fa-calendar"></i>
|
|
<span>{{.Project.StartDate}} - {{.Project.EndDate}}</span>
|
|
</div>
|
|
|
|
<div class="meta-item">
|
|
<i class="fas fa-tags"></i>
|
|
<div class="tech-stack">
|
|
{{ range .Project.TechStack }}
|
|
<span class="tech-tag">{{.}}</span>
|
|
{{ end }}
|
|
</div>
|
|
</div>
|
|
|
|
{{ if .Project.Description }}
|
|
<div class="meta-item">
|
|
<i class="fas fa-file-alt"></i>
|
|
<span>{{.Project.Description}}</span>
|
|
</div>
|
|
{{ end }}
|
|
|
|
<div class="links">
|
|
{{ if .Project.URL }}
|
|
<a href="{{.Project.URL}}" target="_blank">
|
|
<i class="fas fa-external-link-alt"></i> 项目链接
|
|
</a>
|
|
{{ end }}
|
|
{{ if .Project.Doc }}
|
|
<a href="#doc-content">
|
|
<i class="fas fa-scroll"></i> 项目文档
|
|
</a>
|
|
{{ end }}
|
|
</div>
|
|
</aside>
|
|
|
|
<main class="project-main">
|
|
<div id="doc-content" class="doc-content">
|
|
{{ if .Project.Doc }}
|
|
<div id="markdown-output" data-markdown="{{ .Project.Doc }}"></div>
|
|
{{ else }}
|
|
<div class="no-doc">
|
|
<i class="fas fa-file"></i>
|
|
<p>该项目暂无详细文档</p>
|
|
</div>
|
|
{{ end }}
|
|
</div>
|
|
</main>
|
|
</div>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/highlight.js@11.8.0/lib/highlight.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/dompurify@3/dist/purify.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js"></script>
|
|
|
|
<script>
|
|
mermaid.initialize({
|
|
startOnLoad: false,
|
|
theme: 'default',
|
|
flowchart: { htmlLabels: false },
|
|
graph: { htmlLabels: false }
|
|
});
|
|
|
|
async function renderMarkdown(markdown) {
|
|
const mermaidBlocks = [];
|
|
const processed = markdown.replace(/```mermaid\s*([\s\S]*?)```/g, (match, content) => {
|
|
const id = 'mermaid-' + Date.now() + '-' + mermaidBlocks.length;
|
|
mermaidBlocks.push({ id, content: content.trim() });
|
|
return `<div id="${id}" class="mermaid"></div>`;
|
|
});
|
|
|
|
const html = DOMPurify.sanitize(marked.parse(processed), {
|
|
ADD_TAGS: ['iframe'],
|
|
ADD_ATTR: ['allow', 'allowfullscreen', 'frameborder', 'scrolling']
|
|
});
|
|
|
|
const container = document.createElement('div');
|
|
container.innerHTML = html;
|
|
|
|
if (typeof hljs !== 'undefined') {
|
|
container.querySelectorAll('pre code').forEach((block) => {
|
|
hljs.highlightElement(block);
|
|
});
|
|
}
|
|
|
|
await Promise.all(mermaidBlocks.map(async (block) => {
|
|
const el = container.querySelector('#' + block.id);
|
|
if (el) {
|
|
try {
|
|
const { svg } = await mermaid.render(block.id, block.content);
|
|
el.innerHTML = svg;
|
|
} catch (e) {
|
|
el.innerHTML = '<div style="color: #e74c3c; padding: 0.62rem; background: #fef5f5; border-radius: 0.25rem;">' + e.message + '</div>';
|
|
}
|
|
}
|
|
}));
|
|
|
|
return container.innerHTML;
|
|
}
|
|
|
|
document.addEventListener('DOMContentLoaded', async () => {
|
|
const output = document.getElementById('markdown-output');
|
|
if (output) {
|
|
const markdown = output.getAttribute('data-markdown');
|
|
if (markdown && markdown.trim()) {
|
|
output.innerHTML = await renderMarkdown(markdown);
|
|
}
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|
|
{{ end }} |