fix: 修复展示页面多个关键问题
修复内容: 1. 修复Agent头像显示问题 - 使用真实图片替代emoji 2. 移除ResultPageV2自动跳转行为 3. 删除不符合需求的ResultPageV2组件 4. 修复undefined变量错误(currentTerminalData) 5. 添加缺失的getSimulationData导入 6. 优化ResultModal支持动态内容展示 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -24,6 +24,20 @@ app.use('/js', express.static('js'));
|
||||
app.use('/data', express.static('data'));
|
||||
app.use('/order-classes', express.static('order-classes'));
|
||||
|
||||
// 为每个订单班提供独立的静态文件服务
|
||||
app.use('/order-class/wenlu/css', express.static('order-classes/wenlu/css'));
|
||||
app.use('/order-class/wenlu/js', express.static('order-classes/wenlu/js'));
|
||||
app.use('/order-class/wenlu/data', express.static('order-classes/wenlu/data'));
|
||||
|
||||
// 由于HTML中使用相对路径,还需要从父路径提供静态文件
|
||||
app.use('/order-class/css', express.static('order-classes/wenlu/css'));
|
||||
app.use('/order-class/js', express.static('order-classes/wenlu/js'));
|
||||
app.use('/order-class/data', express.static('order-classes/wenlu/data'));
|
||||
|
||||
app.use('/order-class/food/css', express.static('order-classes/food/css'));
|
||||
app.use('/order-class/food/js', express.static('order-classes/food/js'));
|
||||
app.use('/order-class/food/data', express.static('order-classes/food/data'));
|
||||
|
||||
// 日志中间件
|
||||
app.use((req, res, next) => {
|
||||
console.log(`[${new Date().toISOString()}] ${req.method} ${req.url}`);
|
||||
@@ -43,6 +57,26 @@ app.get('/', (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
// 处理 /order-class/*.html 形式的请求(wenlu 子页面)- 必须放在前面
|
||||
app.get('/order-class/:page', (req, res, next) => {
|
||||
const page = req.params.page;
|
||||
// 只处理 .html 文件
|
||||
if (!page.endsWith('.html')) {
|
||||
// 如果不是 .html 文件,继续下一个路由
|
||||
next();
|
||||
return;
|
||||
}
|
||||
|
||||
const filePath = path.join(__dirname, 'order-classes', 'wenlu', page);
|
||||
|
||||
if (fs.existsSync(filePath)) {
|
||||
let html = fs.readFileSync(filePath, 'utf8');
|
||||
res.send(html);
|
||||
} else {
|
||||
res.status(404).send(generate404Page(page));
|
||||
}
|
||||
});
|
||||
|
||||
// 订单班路由
|
||||
app.get('/order-class/:className', (req, res) => {
|
||||
const className = req.params.className;
|
||||
@@ -61,12 +95,8 @@ app.get('/order-class/:className', (req, res) => {
|
||||
// 读取文件并修改相对路径
|
||||
let html = fs.readFileSync(filePath, 'utf8');
|
||||
|
||||
// 修正资源路径
|
||||
html = html.replace(/href="css\//g, 'href="/css/');
|
||||
html = html.replace(/src="js\//g, 'src="/js/');
|
||||
html = html.replace(/href="pages\//g, `href="${classConfig.path}`);
|
||||
html = html.replace(/src="\/data\//g, 'src="/data/');
|
||||
html = html.replace(/href="\/pages\//g, `href="${classConfig.path}`);
|
||||
// 保持相对路径,让浏览器自己解析
|
||||
// 不需要修改路径,因为我们已经设置了静态文件服务
|
||||
|
||||
res.send(html);
|
||||
} else {
|
||||
@@ -85,17 +115,15 @@ app.get('/order-classes/:className/:page', (req, res) => {
|
||||
if (fs.existsSync(filePath)) {
|
||||
let html = fs.readFileSync(filePath, 'utf8');
|
||||
|
||||
// 修正资源路径
|
||||
html = html.replace(/href="\.\.\/css\//g, 'href="/css/');
|
||||
html = html.replace(/src="\.\.\/js\//g, 'src="/js/');
|
||||
html = html.replace(/src="\/data\//g, 'src="/data/');
|
||||
|
||||
// 保持相对路径不变
|
||||
res.send(html);
|
||||
} else {
|
||||
res.status(404).send(generate404Page(`${className}/${page}`));
|
||||
}
|
||||
});
|
||||
|
||||
// 已删除 /order-class/pages/:page 路由,因为导航链接已修复为相对路径
|
||||
|
||||
// 生成首页(选择页面)
|
||||
function generateIndexPage() {
|
||||
const orderClasses = Object.entries(config.order_classes);
|
||||
|
||||
Reference in New Issue
Block a user