Files
materials/interview/README.md
huanghaosheng 3a762378a9 feat(interview): 面经站上线,得物 Golang 一面 15 题
- 首页即汇总:左侧面经导航、中间正文、右侧本页题目目录;进 #/interview 默认打开第一篇
- 正文 15 题按原文整理、题号从 1 重排,答案用 details 折叠并留占位
- 主题与资料库共用 localStorage;窄屏左栏收成抽屉,打印时答案全展开
- 索引单源:assets/interviews.js 驱动左侧导航;portal.data.js 登记,README 与 interview/README.md 同步
2026-11-08 15:30:09 +08:00

63 lines
3.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 面试记录(interview)
面经汇总站:**左侧是全部面经,中间是当前这篇的正文,右侧是本页题目目录**。纯静态,双击
`index.html` 就能看,不需要起服务。
## 结构
```text
interview/
├── index.html # 汇总页 + 默认打开的第一篇(得物 Golang 一面)
├── assets/
│ ├── interviews.js # 面经索引 window.INTERVIEWS —— 左侧导航由它渲染
│ ├── doc.css # 三栏布局与折叠问答样式(与知识站点同一套设计变量)
│ └── doc.js # 左侧导航、右侧目录、折叠计数、主题、打印展开
└── 2026-10-17-某公司-岗位-二面.html # 之后新增的面经,文件名带日期
```
为什么第一篇是 `index.html` 而不是带日期的文件:这是用户要的「进面经模块默认就看第一篇」,同时避免同一份
内容在汇总页和独立页里各存一份。新增的面经统统用带日期的文件名,不再往 `index.html` 里塞第二篇。
## 页面布局
| 区域 | 内容 | 来源 |
|---|---|---|
| 左侧 `.sidebar` | 面经导航(日期块 + 公司 · 岗位 + 轮次 / 题量 / 状态) | `assets/interviews.js` 的 `window.INTERVIEWS` |
| 中间 `.main-col > article` | 页头元数据、题目列表(`details.q`,答案折叠) | 页面自身的 HTML |
| 右侧 `.qtoc` | 本页题目微型目录,滚动高亮;宽度 ≤ 1340px 时隐藏 | 由 `doc.js` 从 `details.q` 生成 |
窄屏(≤ 1080px)左侧导航变成抽屉,顶栏「☰ 面经」打开。打印 / 导出 PDF 时答案自动全部展开。
## 命名规范
- **首页**:`index.html`,放默认打开的那一篇(当前是得物一面),`<body data-interview="…">` 指向
`interviews.js` 里对应条目的 `id`。
- **其余面经**:`YYYY-MM-DD-公司-岗位-轮次.html`,日期补齐到年,与页面 `.meta` 里的「时间」一致;
公司、岗位用中文正名(`得物`、`Golang 开发`),轮次写「一面 / 二面 / 三面 / HR 面」。
## 新增一场面经(四步)
1. 复制 `index.html` 为 `YYYY-MM-DD-公司-岗位-轮次.html`,放进 `interview/`。
2. 改页头:`<title>`、`<meta name="description">`、`<body data-interview="新 id">`、面包屑、
`.hero` 标题与概述、`.meta` 六项(时间 / 公司 / 岗位 / 轮次 / 题量 / 状态)。
3. 换题目:把 `.qlist` 里的 `details.q` 整段替换,`id` 从 `q1` 连续编(题号一律从 1 开始,
原记录的编号不抄进来),每题的考点标签写在 `.q-tags` 里;答案先写
`<p class="ph"><b>答案待补。</b>…</p>` 占位。
4. 登记索引:在 `assets/interviews.js` 的 `window.INTERVIEWS` 里加一项
(`id` / `file` / `date` / `company` / `role` / `round` / `questions` / `status`),
再在 `assets/portal.data.js` 的 `interview.entries` 里补一条,最后跑:
```bash
node tools/check-portal.js
node tools/add-back-links.js --check
```
`index.html` 里的「加一场新面经」一节就是这四步的页面版,改流程时两边一起改。
## 校验
- `node tools/check-portal.js`:注册表里每个 path 是否真实存在。
- `node tools/add-back-links.js --check`:子页面是否都能回到资料库(interview 页面自带
`../index.html#/interview` 链接,会被跳过)。
- 改完 `doc.js` 后 `node --check interview/assets/doc.js` 快速验语法。