更新前端展示页

This commit is contained in:
2025-06-19 17:40:02 +08:00
parent 8e96995e1c
commit 10d5d90dd5
3 changed files with 166 additions and 94 deletions
+40 -26
View File
@@ -44,11 +44,17 @@
<div class="game-info">
<div class="title">Free</div>
<div class="infos">
<div class="infoitem"><span>更新时间:</span><?php echo date('Y-m-d', $game['create_time']); ?></div>
<div class="infoitem"><span>所属分类:</span><?php echo $cateName; ?></div>
<div class="infoitem"><span>程序编号:</span><?php echo $game['number']; ?></div>
<div class="infoitem"><span>查看</span><?php echo $game['views']; ?></div>
<div class="infoitem"><span>下载:</span><?php echo $game['downloads']; ?></div>
<div class="infoitem"><span>更新时间:</span><span
class="infoitem-value"><?php echo date('Y-m-d', $game['create_time']); ?></span>
</div>
<div class="infoitem"><span>所属分类</span><span
class="infoitem-value"><?php echo $cateName; ?></span></div>
<div class="infoitem"><span>程序编号:</span><span
class="infoitem-value"><?php echo $game['number']; ?></span></div>
<div class="infoitem"><span>查看:</span><span
class="infoitem-value"><?php echo $game['views']; ?></span></div>
<div class="infoitem"><span>下载:</span><span
class="infoitem-value"><?php echo $game['downloads']; ?></span></div>
</div>
</div>
</div>
@@ -143,7 +149,7 @@
<script>
// 页面加载完成后执行
document.addEventListener('DOMContentLoaded', function() {
document.addEventListener('DOMContentLoaded', function () {
// 获取游戏ID
const gameId = new URLSearchParams(window.location.search).get('id');
if (!gameId) {
@@ -153,10 +159,10 @@
// 获取游戏详情
fetch('/index/game/detail?id=' + gameId, {
headers: {
'X-Requested-With': 'XMLHttpRequest'
}
})
headers: {
'X-Requested-With': 'XMLHttpRequest'
}
})
.then(response => response.json())
.then(result => {
if (result.code === 1) {
@@ -195,13 +201,13 @@
// 下载功能
const downloadBtn = document.getElementById('downloadBtn');
if (downloadBtn) {
downloadBtn.addEventListener('click', function() {
downloadBtn.addEventListener('click', function () {
fetch('/index/game/downloadurl?id=' + gameId, {
method: 'GET',
headers: {
'X-Requested-With': 'XMLHttpRequest'
}
})
method: 'GET',
headers: {
'X-Requested-With': 'XMLHttpRequest'
}
})
.then(response => {
if (!response.ok) {
throw new Error('网络响应失败');
@@ -236,7 +242,7 @@
//复制分享码
const codeBtn = document.getElementById('codeBtn');
if (codeBtn) {
codeBtn.addEventListener('click', function() {
codeBtn.addEventListener('click', function () {
const code = '<?php echo $game['code']; ?>';
if (code) {
// 创建一个临时输入框
@@ -266,7 +272,7 @@
const goToTop = document.getElementById('goToTop');
// 监听滚动事件
window.addEventListener('scroll', function() {
window.addEventListener('scroll', function () {
if (window.pageYOffset > 300) {
goToTop.classList.add('show');
} else {
@@ -275,7 +281,7 @@
});
// 点击返回顶部
goToTop.addEventListener('click', function() {
goToTop.addEventListener('click', function () {
window.scrollTo({
top: 0,
behavior: 'smooth'
@@ -286,13 +292,13 @@
// 更新游戏访问次数
function updateGameViews(gameId) {
fetch('/index/game/updateViews', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest'
},
body: 'id=' + gameId
})
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest'
},
body: 'id=' + gameId
})
.then(response => response.json())
.then(result => {
if (result.code === 1) {
@@ -705,6 +711,14 @@
.disclaimer-content p {
margin-bottom: 0;
}
.infoitem-value {
border: 1px #0d6efd dashed;
padding: 3px 6px;
font-size: 13px;
background-color: #0081ff12;
border-radius: 5px;
}
</style>
{include file="component/foot" /}