fix: 修复ResultModal数据提取时的agent调用错误
详细说明: - 修复getProjectInfo函数中seq.agent()的类型错误 - 添加兼容性处理,支持函数和对象两种数据格式 - 解决选择订单班后点击按钮导致页面崩溃的问题 - 修改文件: WorkflowPageV4.tsx (第934行) - 影响模块: ResultModal数据显示系统 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -16,6 +16,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
initSmoothScroll();
|
||||
updateStats();
|
||||
initThemeToggle();
|
||||
initLightbox();
|
||||
});
|
||||
|
||||
// 导航功能
|
||||
@@ -267,3 +268,79 @@ function initThemeToggle() {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 图片放大查看功能(Lightbox)
|
||||
function initLightbox() {
|
||||
// 创建Lightbox模态框HTML结构
|
||||
const lightboxHTML = `
|
||||
<div class="lightbox-modal" id="lightboxModal">
|
||||
<div class="lightbox-content">
|
||||
<img src="" alt="" class="lightbox-image" id="lightboxImage">
|
||||
</div>
|
||||
<div class="lightbox-close" id="lightboxClose"></div>
|
||||
<div class="lightbox-label" id="lightboxLabel"></div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
// 将Lightbox添加到页面
|
||||
document.body.insertAdjacentHTML('beforeend', lightboxHTML);
|
||||
|
||||
// 获取元素
|
||||
const lightboxModal = document.getElementById('lightboxModal');
|
||||
const lightboxImage = document.getElementById('lightboxImage');
|
||||
const lightboxLabel = document.getElementById('lightboxLabel');
|
||||
const lightboxClose = document.getElementById('lightboxClose');
|
||||
|
||||
// 为所有图片容器添加点击事件
|
||||
const imageContainers = document.querySelectorAll('.image-container');
|
||||
imageContainers.forEach(container => {
|
||||
container.addEventListener('click', function() {
|
||||
const img = this.querySelector('img');
|
||||
if (img) {
|
||||
// 获取图片信息
|
||||
const imgSrc = img.src || img.getAttribute('data-src');
|
||||
const imgAlt = img.alt || '图片';
|
||||
const caption = this.querySelector('.image-caption');
|
||||
const labelText = caption ? caption.textContent : imgAlt;
|
||||
|
||||
// 设置Lightbox内容
|
||||
lightboxImage.src = imgSrc;
|
||||
lightboxImage.alt = imgAlt;
|
||||
lightboxLabel.textContent = labelText;
|
||||
|
||||
// 显示Lightbox
|
||||
lightboxModal.classList.add('active');
|
||||
document.body.style.overflow = 'hidden'; // 防止背景滚动
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// 关闭Lightbox函数
|
||||
function closeLightbox() {
|
||||
lightboxModal.classList.remove('active');
|
||||
document.body.style.overflow = ''; // 恢复滚动
|
||||
|
||||
// 延迟清空内容,等待动画完成
|
||||
setTimeout(() => {
|
||||
lightboxImage.src = '';
|
||||
lightboxLabel.textContent = '';
|
||||
}, 350);
|
||||
}
|
||||
|
||||
// 点击关闭按钮
|
||||
lightboxClose.addEventListener('click', closeLightbox);
|
||||
|
||||
// 点击背景关闭
|
||||
lightboxModal.addEventListener('click', function(e) {
|
||||
if (e.target === lightboxModal) {
|
||||
closeLightbox();
|
||||
}
|
||||
});
|
||||
|
||||
// ESC键关闭
|
||||
document.addEventListener('keydown', function(e) {
|
||||
if (e.key === 'Escape' && lightboxModal.classList.contains('active')) {
|
||||
closeLightbox();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user