document.addEventListener("DOMContentLoaded", function () { fetch("/api/wps-review") .then(response => response.json()) .then(data => { const introduction = document.getElementById("introduction"); introduction.textContent = data.data.introduction; const keyTopicsContainer = document.getElementById("key-topics-container"); const tipsContainer = document.getElementById("tips-container"); // 渲染核心知识点 data.data.key_topics.forEach(topic => { const topicItem = document.createElement("div"); topicItem.classList.add("item"); const topicName = document.createElement("div"); topicName.classList.add("item-name"); topicName.textContent = topic.topic; const topicContent = document.createElement("div"); topicContent.classList.add("item-description"); topicContent.textContent = topic.content; topicItem.appendChild(topicName); topicItem.appendChild(topicContent); keyTopicsContainer.appendChild(topicItem); }); // 渲染复习小贴士 data.data.tips.forEach(tip => { const tipItem = document.createElement("div"); tipItem.classList.add("item"); tipItem.textContent = tip; tipsContainer.appendChild(tipItem); }); }) .catch(error => { console.error("Error fetching review data:", error); }); });