// Survey renderer - 使用JSON数据渲染页面 class SurveyRenderer { constructor() { this.data = null; this.init(); } async init() { try { // 从URL查询参数获取ID const urlParams = new URLSearchParams(window.location.search); const id = urlParams.get('id'); if (!id) { throw new Error('缺少报告ID参数'); } // 调用本地API获取数据 const response = await fetch(`/api/report/${id}`, { method: 'GET', headers: { 'Content-Type': 'application/json' } }); if (!response.ok) { throw new Error(`API请求失败: ${response.status}`); } this.data = await response.json(); // 渲染页面 this.render(); } catch (error) { console.error('加载数据失败:', error); document.getElementById('content').innerHTML = `
${summaryData.summary}
${tag.description}
${chapter.description}
${chapter.note}
${dimension.description}
${cognitiveAnalysis.behaviorInsight.content}
目标:${plan.goal}
${plan.sections.map(section => `暂无可重新生成的报告
检查可重新生成报告失败: ${error.message}