fix: homepage layout optimization (2-col grid, guest CTA, daily question for guests)
- Unified feature grid to consistent 2-column layout - Improved hero guest card with benefit tags - Show daily question section for guests with login prompt - Added AGENTS.md: H5 deployment docs, git remote, build gotchas
This commit is contained in:
@@ -20,7 +20,7 @@ zhiyin/
|
||||
│ └── modules/ # 20 个模块(详见下文)
|
||||
├── zhiyin-app/ # uni-app 3.x 前端 (H5 + 微信小程序)
|
||||
│ └── src/
|
||||
│ ├── pages/ # 19 个页面 (pages.json 路由)
|
||||
│ ├── pages/ # 20 个页面 (pages.json 路由)
|
||||
│ ├── services/api.ts # API 调用封装 (uni.request)
|
||||
│ ├── config.ts # 端点定义 + api() 辅助函数
|
||||
│ └── App.vue # 设计 Token + 全局样式
|
||||
@@ -52,9 +52,9 @@ zhiyin/
|
||||
| `daily-question` | 每日一题 API |
|
||||
| `schemas/` | 共享 Schema(pricing 定价、site-config、company-bank 等) |
|
||||
|
||||
### 前端页面(3 Tab + 17 子页)
|
||||
### 前端页面(3 Tab + 18 子页)
|
||||
|
||||
- **Tab1 面试**: pages/index/index → interview → report
|
||||
- **Tab1 面试**: pages/index/index → interview → report → career
|
||||
- **Tab2 面经**: pages/history/history → contribute → company-bank
|
||||
- **Tab3 我的**: pages/user/user → login/member/progress/resume/review/career/about/agreement/privacy/admin/share
|
||||
- 其他: internship, result
|
||||
@@ -111,8 +111,9 @@ zhiyin/
|
||||
npm run start:dev # 开发模式(watch)
|
||||
npm run build # 编译到 dist/
|
||||
npm test # 单元测试(43 个,jest --forceExit --detectOpenHandles)
|
||||
npm run test:e2e # 集成测试(11 个,需 MongoDB 运行)
|
||||
npm run test:watch # 监听模式
|
||||
npm run test:cov # 覆盖率报告
|
||||
npm run test:e2e # 集成测试(需 MongoDB 运行)
|
||||
npm run test:browser # Playwright API 测试(需后端运行)
|
||||
```
|
||||
|
||||
@@ -132,7 +133,7 @@ npm test # 前端单元测试(vitest,7 个)
|
||||
cd backend && NODE_OPTIONS="--max-old-space-size=2048" npx nest build
|
||||
```
|
||||
|
||||
### 部署
|
||||
### 部署后端
|
||||
```bash
|
||||
cd backend && npx nest build
|
||||
cp -rf dist/* /www/wwwroot/server/zhiyin/backend/dist/
|
||||
@@ -141,6 +142,17 @@ pm2 restart yhl-backend
|
||||
sleep 3 && curl -s http://localhost:3006/api/user/wx-login -X POST -H "Content-Type: application/json" -d '{"code":"test"}'
|
||||
```
|
||||
|
||||
### 部署前端 H5
|
||||
```bash
|
||||
cd zhiyin-app && npx uni build
|
||||
rm -rf /www/wwwroot/zhiyin.yzrcloud.cn/assets
|
||||
cp -r dist/build/h5/index.html /www/wwwroot/zhiyin.yzrcloud.cn/
|
||||
cp -r dist/build/h5/assets /www/wwwroot/zhiyin.yzrcloud.cn/
|
||||
chown -R www:www /www/wwwroot/zhiyin.yzrcloud.cn/index.html /www/wwwroot/zhiyin.yzrcloud.cn/assets
|
||||
# 验证无缺失文件
|
||||
grep -oP '["'"'"']([a-zA-Z0-9_-]+\.[a-z]+(\.js|\.css|\.png|\.svg))["'"'"']' /www/wwwroot/zhiyin.yzrcloud.cn/assets/index-*.js | sort -u
|
||||
```
|
||||
|
||||
### 小程序上传
|
||||
```bash
|
||||
cd zhiyin-app && npm run build:mp-weixin && node scripts/upload-mp.js
|
||||
@@ -216,7 +228,15 @@ VITE_APP_NAME=AI磁场
|
||||
|
||||
---
|
||||
|
||||
## 八、技术细节与坑
|
||||
## 八、Git
|
||||
|
||||
- 远程仓库: `http://127.0.0.1:2999/txai-dev/zhiyin.git`(本机 Gitea,带 token 认证)
|
||||
- 默认分支: `master`
|
||||
- 最新 tag: `v1.0.11`(小程序上传版本号源自 git tag)
|
||||
|
||||
---
|
||||
|
||||
## 九、技术细节与坑
|
||||
|
||||
1. **DOMMatrix polyfill**: `main.ts` 顶部有 pdf-parse 所需的浏览器 API polyfill(DOMMatrix / DOMPoint),新增 PDF 相关功能时注意兼容性
|
||||
2. **postbuild**: `backend/package.json` 中的 `postbuild` 脚本自动复制 `certs/` 到 `dist/src/certs/`,这是微信支付证书的必要步骤
|
||||
@@ -226,10 +246,12 @@ VITE_APP_NAME=AI磁场
|
||||
6. **API 限流**: 100 次/60 秒(在 `app.module.ts` 中配置),注意避免在定时任务和批量操作中被限
|
||||
7. **验证码**: 开发模式下手机验证码固定为 `123456`(`user.service.ts` 中实现),生产环境需移除
|
||||
8. **MongoDB**: 8 个核心集合 + 2 个分享集合
|
||||
9. **api.ts 陷阱**: 对象字面量必须在 `export const apiService = {` 或 `const apiService = { ... export default apiService` 中包裹,否则 uni-app 构建报错 `Expected ";" but found ":"`。git pull 后经常丢失这行声明,需手动补回
|
||||
10. **H5 构建 assets 清理**: `assets/` 中的旧 hash 文件不能随意删除——`index-*.js`(主 bundle)动态 import 了所有 page chunk,删除仍在引用的文件会导致浏览器 `NS_ERROR_CORRUPTED_CONTENT`
|
||||
|
||||
---
|
||||
|
||||
## 九、交付检查清单(每次实施/修改后执行)
|
||||
## 十、交付检查清单(每次实施/修改后执行)
|
||||
|
||||
### Step 1: 代码评审
|
||||
- [ ] 是否符合现有模块模式(schema→service→controller→module)
|
||||
|
||||
Reference in New Issue
Block a user