53 lines
1.5 KiB
JavaScript
53 lines
1.5 KiB
JavaScript
$(function () {
|
|
var viewer = new Viewer(document.getElementById("viewer"), {
|
|
button: true,
|
|
inline: false,
|
|
zoomable: true,
|
|
title: true,
|
|
tooltip: true,
|
|
minZoomRatio: 0.5,
|
|
maxZoomRatio: 100,
|
|
movable: true,
|
|
interval: 2000,
|
|
navbar: true,
|
|
loading: true,
|
|
});
|
|
|
|
// 点击显示图片 box-item
|
|
$(".box-item").click(function () {
|
|
// 设置图片
|
|
$("#viewer").attr("src", $(this).find("img").attr("src"));
|
|
viewer.show();
|
|
});
|
|
|
|
// 设置首页函数
|
|
function setIndexData() {
|
|
const commentObj = window.__themeCommon
|
|
? window.__themeCommon
|
|
: (sessionStorage.commentData ? JSON.parse(sessionStorage.commentData) : {});
|
|
if (Array.isArray(commentObj.honor) && commentObj.honor.length > 0) {
|
|
commentObj.honor.forEach((item) => {
|
|
$("#honor-box").append(`
|
|
<div class="box-item">
|
|
<img src=${item.img} alt="">
|
|
<p class="font-16 mt-20">${item.name}</p>
|
|
</div>
|
|
`);
|
|
});
|
|
}
|
|
if (Array.isArray(commentObj.partner)) {
|
|
commentObj.partner.forEach((item) => {
|
|
$("#partner-box").append(`
|
|
<div class="box-item">
|
|
<img src="${item.img}" alt="">
|
|
<h4 class="mt-30">${item.name}</h4>
|
|
<p class="mt-20">${item.description}</p>
|
|
</div>
|
|
`);
|
|
});
|
|
}
|
|
}
|
|
// 直接使用服务端注入的数据渲染关于页
|
|
setIndexData();
|
|
});
|