feat: 新增员工端应用主页与个人中心,优化应急三端页面
- 新增 employee-app/home/index.html 应用主页(功能按钮收起展开、体重管理、健康数据、智能监测24h曲线、膳食摄入) - 新增 employee-app/profile/ 个人中心模块(16页:个人资料、头像、密码、手机号、紧急联系人、设置等) - 修复 health-consult/index.html 返回导航逻辑 - 优化应急三端(驻场/操作/专业人员端)页面交互与截图 - 新增操作人员端、专业人员端 PRD 文档 - 更新 SITE_MAP 导航页 - 新增截图工具脚本(gen_screenshots.py、screenshot.js) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+107
@@ -0,0 +1,107 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
// 页面配置
|
||||
const PAGES = {
|
||||
onsite: {
|
||||
baseUrl: 'http://localhost:8000/emergency-app/onsite',
|
||||
pages: [
|
||||
{ page: 'workbench/index.html', screenshot: 'screenshots/index.jpg' },
|
||||
{ page: 'workbench/work-order-detail-ongoing.html', screenshot: 'screenshots/work-order-detail-ongoing.jpg' },
|
||||
{ page: 'workbench/work-order-detail.html', screenshot: 'screenshots/work-order-detail.jpg' },
|
||||
{ page: 'workbench/serious-illness-list.html', screenshot: 'screenshots/serious-illness-list.jpg' },
|
||||
{ page: 'workbench/serious-illness-detail-pending.html', screenshot: 'screenshots/serious-illness-detail-pending.jpg' },
|
||||
{ page: 'workbench/serious-illness-detail-done.html', screenshot: 'screenshots/serious-illness-detail-done.jpg' },
|
||||
{ page: 'knowledge/index.html', screenshot: 'screenshots/knowledge-index.jpg' },
|
||||
{ page: 'knowledge/article-detail.html', screenshot: 'screenshots/knowledge-article-detail.jpg' },
|
||||
{ page: 'profile/index.html', screenshot: 'screenshots/profile-index.jpg' },
|
||||
{ page: 'profile/edit-profile.html', screenshot: 'screenshots/edit-profile.jpg' },
|
||||
{ page: 'profile/change-pwd.html', screenshot: 'screenshots/change-pwd.jpg' },
|
||||
]
|
||||
},
|
||||
operator: {
|
||||
baseUrl: 'http://localhost:8000/emergency-app/operator',
|
||||
pages: [
|
||||
{ page: 'workbench/index.html', screenshot: 'screenshots/index.jpg' },
|
||||
{ page: 'workbench/emergency-chat-ongoing.html', screenshot: 'screenshots/emergency-chat-ongoing.jpg' },
|
||||
{ page: 'workbench/emergency-chat-done.html', screenshot: 'screenshots/emergency-chat-done.jpg' },
|
||||
{ page: 'workbench/work-order-detail.html', screenshot: 'screenshots/work-order-detail.jpg' },
|
||||
{ page: 'workbench/serious-illness-detail-pending.html', screenshot: 'screenshots/serious-illness-detail-pending.jpg' },
|
||||
{ page: 'knowledge/index.html', screenshot: 'screenshots/knowledge-index.jpg' },
|
||||
{ page: 'knowledge/article-detail.html', screenshot: 'screenshots/knowledge-article-detail.jpg' },
|
||||
{ page: 'profile/index.html', screenshot: 'screenshots/profile-index.jpg' },
|
||||
{ page: 'profile/edit-profile.html', screenshot: 'screenshots/edit-profile.jpg' },
|
||||
{ page: 'profile/change-pwd.html', screenshot: 'screenshots/change-pwd.jpg' },
|
||||
]
|
||||
},
|
||||
professional: {
|
||||
baseUrl: 'http://localhost:8000/emergency-app/professional',
|
||||
pages: [
|
||||
{ page: 'workbench/index.html', screenshot: 'screenshots/index.jpg' },
|
||||
{ page: 'workbench/emergency-chat-ongoing.html', screenshot: 'screenshots/emergency-chat-ongoing.jpg' },
|
||||
{ page: 'workbench/emergency-chat-done.html', screenshot: 'screenshots/emergency-chat-done.jpg' },
|
||||
{ page: 'workbench/work-order-detail-ongoing.html', screenshot: 'screenshots/work-order-detail-ongoing.jpg' },
|
||||
{ page: 'workbench/work-order-detail.html', screenshot: 'screenshots/work-order-detail.jpg' },
|
||||
{ page: 'knowledge/index.html', screenshot: 'screenshots/knowledge-index.jpg' },
|
||||
{ page: 'knowledge/article-detail.html', screenshot: 'screenshots/knowledge-article-detail.jpg' },
|
||||
{ page: 'profile/index.html', screenshot: 'screenshots/profile-index.jpg' },
|
||||
{ page: 'profile/edit-profile.html', screenshot: 'screenshots/edit-profile.jpg' },
|
||||
{ page: 'profile/change-pwd.html', screenshot: 'screenshots/change-pwd.jpg' },
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
async function takeScreenshots() {
|
||||
const playwright = require('playwright');
|
||||
const browser = await playwright.chromium.launch();
|
||||
|
||||
// 仅跑指定页面:ONLY_PAGES="professional:workbench/patient-location.html,professional:workbench/rescue-opinion.html"
|
||||
const onlyPages = (process.env.ONLY_PAGES || '').split(',').map(s => s.trim()).filter(Boolean);
|
||||
if (onlyPages.length > 0) console.log(`[Filter] Only run: ${onlyPages.join(', ')}`);
|
||||
|
||||
for (const [role, config] of Object.entries(PAGES)) {
|
||||
console.log(`\nScreenshotting ${role}...`);
|
||||
|
||||
for (const item of config.pages) {
|
||||
if (onlyPages.length > 0) {
|
||||
const key = `${role}:${item.page}`;
|
||||
if (!onlyPages.includes(key)) continue;
|
||||
}
|
||||
|
||||
const url = `${config.baseUrl}/${item.page}`;
|
||||
const outputPath = path.join(__dirname, 'emergency-app', role, 'doc', item.screenshot);
|
||||
|
||||
// Create directory if not exists
|
||||
const dir = path.dirname(outputPath);
|
||||
if (!fs.existsSync(dir)) {
|
||||
fs.mkdirSync(dir, { recursive: true });
|
||||
}
|
||||
|
||||
try {
|
||||
const page = await browser.newPage();
|
||||
await page.setViewportSize({ width: 375, height: 812 });
|
||||
console.log(` Loading: ${url}`);
|
||||
await page.goto(url, { waitUntil: 'networkidle' });
|
||||
|
||||
// 修复:部分页面 fullPage 计算高度异常,改为截取手机壳容器
|
||||
if (role === 'professional' && (item.page === 'workbench/patient-location.html' || item.page === 'workbench/rescue-opinion.html')) {
|
||||
console.log(` [FIX] Using .phone-shell selector for ${item.page}`);
|
||||
const shell = await page.$('.phone-shell');
|
||||
if (!shell) throw new Error('Cannot find .phone-shell');
|
||||
await shell.screenshot({ path: outputPath });
|
||||
} else {
|
||||
await page.screenshot({ path: outputPath, fullPage: true });
|
||||
}
|
||||
|
||||
await page.close();
|
||||
console.log(` OK: ${item.screenshot}`);
|
||||
} catch (e) {
|
||||
console.log(` FAIL: ${item.screenshot} - ${e.message}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
await browser.close();
|
||||
}
|
||||
|
||||
takeScreenshots().catch(console.error);
|
||||
Reference in New Issue
Block a user