You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.6 KiB
40 lines
1.6 KiB
document.addEventListener("DOMContentLoaded", function () {
|
|
fetch("/api/nezha2")
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
const movieData = data.data;
|
|
|
|
// 设置标题和描述
|
|
document.getElementById("title").textContent = movieData.title;
|
|
document.getElementById("description").textContent = movieData.description;
|
|
|
|
// 设置预告片链接
|
|
const trailerIframe = document.getElementById("trailer-iframe");
|
|
trailerIframe.src = movieData.trailer_url;
|
|
|
|
// 渲染主演介绍
|
|
const castContainer = document.getElementById("cast-container");
|
|
movieData.cast.forEach(cast => {
|
|
const castItem = document.createElement("div");
|
|
castItem.classList.add("cast-item");
|
|
|
|
const castName = document.createElement("div");
|
|
castName.textContent = `${cast.name} - ${cast.role}`;
|
|
|
|
const castDescription = document.createElement("div");
|
|
castDescription.textContent = cast.description;
|
|
|
|
castItem.appendChild(castName);
|
|
castItem.appendChild(castDescription);
|
|
|
|
castContainer.appendChild(castItem);
|
|
});
|
|
|
|
// 设置上映日期和分级
|
|
document.getElementById("release-date").textContent = movieData.release_date;
|
|
document.getElementById("rating").textContent = movieData.rating;
|
|
})
|
|
.catch(error => {
|
|
console.error("Error fetching movie data:", error);
|
|
});
|
|
});
|