Merge branch 'master' of https://git.yunzer.cn/yunzerwebsite/yunzer
This commit is contained in:
@@ -0,0 +1,282 @@
|
||||
<?php
|
||||
/**
|
||||
* 商业使用授权协议
|
||||
*
|
||||
* Copyright (c) 2025 [云泽网]. 保留所有权利.
|
||||
*
|
||||
* 本软件仅供评估使用。任何商业用途必须获得书面授权许可。
|
||||
* 未经授权商业使用本软件属于侵权行为,将承担法律责任。
|
||||
*
|
||||
* 授权购买请联系: 357099073@qq.com
|
||||
* 官方网站: https://www.yunzer.cn
|
||||
*
|
||||
* 评估用户须知:
|
||||
* 1. 禁止移除版权声明
|
||||
* 2. 禁止用于生产环境
|
||||
* 3. 禁止转售或分发
|
||||
*/
|
||||
|
||||
/**
|
||||
* 游戏下载控制器
|
||||
*/
|
||||
namespace app\index\controller;
|
||||
use app\index\controller\BaseController;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
use think\facade\Request;
|
||||
use app\index\model\Resources\Resources;
|
||||
use app\index\model\Resources\ResourcesCategory;
|
||||
use app\index\model\Attachments;
|
||||
|
||||
class ResourcesController extends BaseController
|
||||
{
|
||||
//资源中心
|
||||
public function index()
|
||||
{
|
||||
// 获取所有顶级分类
|
||||
$parentCategories = ResourcesCategory::where('cid', 0)
|
||||
->where('status', 1)
|
||||
->order('sort', 'asc')
|
||||
->select();
|
||||
|
||||
// 获取每个顶级分类下的子分类
|
||||
$categories = [];
|
||||
foreach ($parentCategories as $parent) {
|
||||
$subCategories = ResourcesCategory::where('cid', $parent->id)
|
||||
->where('status', 1)
|
||||
->order('sort', 'asc')
|
||||
->select();
|
||||
|
||||
// 获取每个子分类下的资源数量
|
||||
foreach ($subCategories as &$subCategory) {
|
||||
$subCategory['resource_count'] = Resources::where('cate', $subCategory->id)
|
||||
->where('status', 1)
|
||||
->count();
|
||||
}
|
||||
|
||||
$categories[] = [
|
||||
'parent' => $parent,
|
||||
'subCategories' => $subCategories
|
||||
];
|
||||
}
|
||||
|
||||
// 将数据传递给视图
|
||||
View::assign('categories', $categories);
|
||||
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
// 游戏列表页
|
||||
public function list()
|
||||
{
|
||||
$cid = input('cid/d', 0);
|
||||
$page = input('page/d', 1);
|
||||
|
||||
// 获取分类信息
|
||||
$category = ResourcesCategory::where('id', $cid)
|
||||
->where('status', 1)
|
||||
->find();
|
||||
|
||||
if (!$category) {
|
||||
$this->error('分类不存在');
|
||||
}
|
||||
|
||||
// 获取该分类下的资源,带分页
|
||||
$resources = Resources::where('cate', $cid)
|
||||
->where('status', 1)
|
||||
->order('sort', 'asc')
|
||||
->paginate([
|
||||
'list_rows' => 20,
|
||||
'page' => $page,
|
||||
'query' => Request::instance()->param()
|
||||
]);
|
||||
|
||||
// 将数据传递给视图
|
||||
View::assign('category', $category);
|
||||
View::assign('data', $resources);
|
||||
View::assign('page', $resources->render()); // 新增这一行
|
||||
|
||||
return View::fetch('list');
|
||||
}
|
||||
|
||||
// 游戏详情页
|
||||
public function detail()
|
||||
{
|
||||
$id = Request::param('id/d', 0);
|
||||
$game = Resources::where('id', $id)->find();
|
||||
|
||||
if (!$game) {
|
||||
return json(['code' => 0, 'msg' => '游戏不存在或已被删除']);
|
||||
}
|
||||
|
||||
// 如果size没有,从附件表中获取
|
||||
if (empty($game['size']) && !empty($game['fileurl'])) {
|
||||
$attachment = Attachments::where('src', $game['fileurl'])
|
||||
->find();
|
||||
|
||||
if ($attachment && !empty($attachment['size'])) {
|
||||
$size = $attachment['size'];
|
||||
// 转换文件大小为合适的单位
|
||||
if ($size >= 1073741824) { // 1GB = 1024MB = 1024*1024KB = 1024*1024*1024B
|
||||
$game['size'] = round($size / 1073741824, 2) . 'GB';
|
||||
} elseif ($size >= 1048576) { // 1MB = 1024KB = 1024*1024B
|
||||
$game['size'] = round($size / 1048576, 2) . 'MB';
|
||||
} else {
|
||||
$game['size'] = round($size / 1024, 2) . 'KB';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 获取分类名称
|
||||
$cateName = ResourcesCategory::where('id', $game['cate'])
|
||||
->value('name');
|
||||
|
||||
// 获取上一个和下一个游戏
|
||||
$prevGame = Resources::where('id', '<', $id)
|
||||
->where('delete_time', null)
|
||||
->where('status', 1)
|
||||
->where('cate', $game['cate'])
|
||||
->field(['id', 'title'])
|
||||
->order('id DESC')
|
||||
->find();
|
||||
|
||||
$nextGame = Resources::where('id', '>', $id)
|
||||
->where('delete_time', null)
|
||||
->where('status', 1)
|
||||
->where('cate', $game['cate'])
|
||||
->field(['id', 'title'])
|
||||
->order('id ASC')
|
||||
->find();
|
||||
|
||||
// 获取相关游戏(同分类的其他游戏)
|
||||
$relatedGames = Db::table('yz_resources')
|
||||
->alias('g')
|
||||
->join('yz_resources_category c', 'g.cate = c.id')
|
||||
->where('g.cate', $game['cate'])
|
||||
->where('g.id', '<>', $id)
|
||||
->where('g.delete_time', null)
|
||||
->where('g.status', 1)
|
||||
->field([
|
||||
'g.id',
|
||||
'g.title',
|
||||
'IF(g.icon IS NULL OR g.icon = "", c.icon, g.icon) as icon'
|
||||
])
|
||||
->order('g.id DESC')
|
||||
->limit(3)
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
// 如果是 AJAX 请求,返回 JSON 数据
|
||||
if (Request::isAjax()) {
|
||||
return json([
|
||||
'code' => 1,
|
||||
'msg' => '获取成功',
|
||||
'data' => [
|
||||
'game' => $game,
|
||||
'cateName' => $cateName,
|
||||
'prevGame' => $prevGame,
|
||||
'nextGame' => $nextGame,
|
||||
'relatedGames' => $relatedGames
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
// 非 AJAX 请求返回视图
|
||||
View::assign([
|
||||
'game' => $game,
|
||||
'cateName' => $cateName,
|
||||
'prevGame' => $prevGame,
|
||||
'nextGame' => $nextGame,
|
||||
'relatedGames' => $relatedGames
|
||||
]);
|
||||
|
||||
return View::fetch('detail');
|
||||
}
|
||||
|
||||
// 游戏下载
|
||||
public function downloadurl()
|
||||
{
|
||||
if (!Request::isAjax()) {
|
||||
return json(['code' => 0, 'msg' => '非法请求']);
|
||||
}
|
||||
|
||||
$id = Request::param('id/d', 0);
|
||||
|
||||
// 获取游戏信息
|
||||
$game = Resources::where('id', $id)
|
||||
->where('delete_time', null)
|
||||
->find();
|
||||
|
||||
if (!$game) {
|
||||
return json(['code' => 0, 'msg' => '游戏不存在']);
|
||||
}
|
||||
|
||||
// 更新下载次数
|
||||
$result = Resources::where('id', $id)
|
||||
->where('delete_time', null)
|
||||
->inc('downloads', 1)
|
||||
->update();
|
||||
|
||||
if ($result) {
|
||||
return json([
|
||||
'code' => 1,
|
||||
'msg' => '下载成功',
|
||||
'data' => [
|
||||
'url' => $game['url']
|
||||
]
|
||||
]);
|
||||
} else {
|
||||
return json(['code' => 0, 'msg' => '下载失败']);
|
||||
}
|
||||
}
|
||||
|
||||
// 获取访问统计
|
||||
public function viewStats()
|
||||
{
|
||||
$id = Request::param('id/d', 0);
|
||||
|
||||
// 获取总访问量
|
||||
$totalViews = Resources::where('id', $id)
|
||||
->value('views');
|
||||
|
||||
return json([
|
||||
'code' => 1,
|
||||
'data' => [
|
||||
'total' => $totalViews
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新游戏访问次数
|
||||
*/
|
||||
public function updateViews()
|
||||
{
|
||||
if (!Request::isPost()) {
|
||||
return json(['code' => 0, 'msg' => '非法请求']);
|
||||
}
|
||||
|
||||
$id = Request::post('id');
|
||||
if (!$id) {
|
||||
return json(['code' => 0, 'msg' => '参数错误']);
|
||||
}
|
||||
|
||||
try {
|
||||
// 更新访问次数
|
||||
$game = Resources::where('id', $id)->find();
|
||||
if (!$game) {
|
||||
return json(['code' => 0, 'msg' => '游戏不存在']);
|
||||
}
|
||||
|
||||
// 更新访问次数
|
||||
Resources::where('id', $id)->inc('views')->update();
|
||||
|
||||
// 获取更新后的访问次数
|
||||
$newViews = Resources::where('id', $id)->value('views');
|
||||
|
||||
return json(['code' => 1, 'msg' => '更新成功', 'data' => ['views' => $newViews]]);
|
||||
} catch (\Exception $e) {
|
||||
return json(['code' => 0, 'msg' => '更新失败:' . $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="more-btn" onclick="window.open('/index/articles/index?cateid=1', '_blank')">更多</div>
|
||||
<div class="more-btn" onclick="window.open('/index/articles/index?cateid=3', '_blank')">更多</div>
|
||||
</div>
|
||||
<div class="product-list" id="webArticlesList">
|
||||
<!-- 文章将通过JavaScript动态加载 -->
|
||||
@@ -56,7 +56,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="more-btn" onclick="window.open('/index/program/index?cateid=2', '_blank')">更多</div>
|
||||
<div class="more-btn" onclick="window.open('/index/resources/index?cateid=2', '_blank')">更多</div>
|
||||
</div>
|
||||
<div class="product-list" id="resourcesDownloadList">
|
||||
<!-- 文章将通过JavaScript动态加载 -->
|
||||
@@ -77,7 +77,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="more-btn" onclick="window.open('/index/program/index?cateid=1', '_blank')">更多</div>
|
||||
<div class="more-btn" onclick="window.open('/index/resources/index?cateid=1', '_blank')">更多</div>
|
||||
</div>
|
||||
<div class="product-list" id="programDownloadList">
|
||||
<!-- 程序将通过JavaScript动态加载 -->
|
||||
@@ -98,7 +98,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="more-btn" onclick="window.open('/index/game/index?cateid=8', '_blank')">更多</div>
|
||||
<div class="more-btn" onclick="window.open('/index/resources/index?cateid=8', '_blank')">更多</div>
|
||||
</div>
|
||||
<div class="product-list" id="gameDownloadList">
|
||||
<!-- 游戏将通过JavaScript动态加载 -->
|
||||
|
||||
@@ -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" /}
|
||||
@@ -1045,7 +1045,7 @@
|
||||
}
|
||||
|
||||
.lb-data .lb-caption {
|
||||
font-size: 14px;
|
||||
font-size: 1.3rem;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,759 @@
|
||||
{include file="component/head" /}
|
||||
{include file="component/header-simple" /}
|
||||
<div class="main">
|
||||
<div class="main-top">
|
||||
<div class="main-top-main">
|
||||
<div class="main-title">
|
||||
<?php echo $game['title']; ?>
|
||||
</div>
|
||||
<div class="location">
|
||||
<div class="container">
|
||||
<div class="location-item">
|
||||
<a href="/">首页</a>
|
||||
<span>></span>
|
||||
<a href="/index/game/list" id="cateLink"><?php echo $cateName; ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="detail-main">
|
||||
<div class="detail-top">
|
||||
<div class="detail-top-left">
|
||||
<div class="detail-top-card">
|
||||
<div class="detail-top-card-left">
|
||||
<div class="article-cover">
|
||||
<img src="<?php echo $game['icon'] ?: '/static/images/default-game.png'; ?>">
|
||||
<!-- <img src="https://www.yunzer.cn/storage/uploads/20250523/b75a51fa606fd3a18261a6ea283d35fe.jpg" alt=""> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="detail-top-card-right">
|
||||
<!-- <div class="detail-top-card-right-top">
|
||||
<div class="collect-btn">
|
||||
<button class="btn btn-primary" id="collectBtn"
|
||||
data-game-id="<?php echo $game['id']; ?>">
|
||||
<i class="fa-solid fa-heart"></i> 收藏
|
||||
</button>
|
||||
</div>
|
||||
<div class="report-btn">
|
||||
<button class="btn btn-primary" id="reportBtn" style="margin-left: 20px;">
|
||||
<i class="fa-solid fa-flag"></i> 举报
|
||||
</button>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="detail-top-card-right-middle">
|
||||
<div class="game-info">
|
||||
<div class="title">Free</div>
|
||||
<div class="infos">
|
||||
<div style="display: flex;">
|
||||
<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 $cateName; ?></span>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display: flex;">
|
||||
<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 $game['views']; ?></span>
|
||||
<span>次</span>
|
||||
</div>
|
||||
<div class="infoitem">
|
||||
<span>下载:</span>
|
||||
<span class="infoitem-value"><?php echo $game['downloads']; ?></span>
|
||||
<span>次</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="detail-top-card-right-bottom">
|
||||
<div class="game-actions1">
|
||||
<div style="display: flex;gap: 30px;}">
|
||||
<button id="downloadBtn" class="btn btn-primary">
|
||||
<i class="fa-solid fa-download"></i> 立即下载
|
||||
</button>
|
||||
<button id="codeBtn" class="codebtn">
|
||||
<i class="fa-solid fa-download"></i> 分享码:<?php echo $game['code']; ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="detail-top-right">
|
||||
这里放个人信息
|
||||
</div>
|
||||
</div>
|
||||
<div class="detail-middle">
|
||||
<div class="detial-middle-left">
|
||||
<div class="game-detail">
|
||||
<div class="game-info">
|
||||
<div class="game-content">
|
||||
<div class="game-desc">
|
||||
<?php echo $game['content']; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="game-actions">
|
||||
<div style="display: flex;gap: 30px;}">
|
||||
<button id="downloadBtn" class="btn btn-primary">
|
||||
<i class="fa-solid fa-download"></i> 立即下载
|
||||
</button>
|
||||
<button id="codeBtn" class="codebtn">
|
||||
<i class="fa-solid fa-download"></i> 分享码:<?php echo $game['code']; ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="disclaimers">
|
||||
<div class="disclaimer-item">
|
||||
<div class="disclaimer-title">免责声明:</div>
|
||||
<div class="disclaimer-content">
|
||||
<?php echo $config['disclaimers'] ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="game-navigation">
|
||||
<div class="prev-game" id="prevGame">
|
||||
</div>
|
||||
<div class="next-game" id="nextGame">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 相关游戏 -->
|
||||
<?php if (!empty($relatedGames)): ?>
|
||||
<div class="related-games">
|
||||
<h3>相关游戏</h3>
|
||||
<div class="game-list">
|
||||
<?php foreach ($relatedGames as $related): ?>
|
||||
<div class="game-item"
|
||||
onclick="window.location.href='/index/game/detail?id=<?php echo $related['id']; ?>'">
|
||||
<div class="game-cover">
|
||||
<img src="<?php echo $related['icon'] ?: '/static/images/default-game.png'; ?>"
|
||||
alt="<?php echo $related['title']; ?>">
|
||||
</div>
|
||||
<div class="game-info">
|
||||
<h4 class="game-title-1"><?php echo $related['title']; ?></h4>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="detial-middle-right">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- 返回顶部按钮 -->
|
||||
<div class="go-to-top" id="goToTop">
|
||||
<i class="layui-icon layui-icon-top"></i>
|
||||
</div>
|
||||
|
||||
{include file="component/footer" /}
|
||||
|
||||
<script>
|
||||
// 页面加载完成后执行
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
// 获取游戏ID
|
||||
const gameId = new URLSearchParams(window.location.search).get('id');
|
||||
if (!gameId) {
|
||||
alert('游戏ID不存在');
|
||||
return;
|
||||
}
|
||||
|
||||
// 获取游戏详情
|
||||
fetch('/index/game/detail?id=' + gameId, {
|
||||
headers: {
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(result => {
|
||||
if (result.code === 1) {
|
||||
// 渲染上一篇
|
||||
const prevGame = document.getElementById('prevGame');
|
||||
if (result.data.prevGame) {
|
||||
prevGame.innerHTML = `
|
||||
<a href="/index/game/detail?id=${result.data.prevGame.id}">
|
||||
<i class="fa fa-arrow-left"></i> 上一篇:${result.data.prevGame.title}
|
||||
</a>
|
||||
`;
|
||||
} else {
|
||||
prevGame.innerHTML = '<span class="disabled"><i class="fa fa-arrow-left"></i> 没有上一篇了</span>';
|
||||
}
|
||||
|
||||
// 渲染下一篇
|
||||
const nextGame = document.getElementById('nextGame');
|
||||
if (result.data.nextGame) {
|
||||
nextGame.innerHTML = `
|
||||
<a href="/index/game/detail?id=${result.data.nextGame.id}">
|
||||
下一篇:${result.data.nextGame.title} <i class="fa fa-arrow-right"></i>
|
||||
</a>
|
||||
`;
|
||||
} else {
|
||||
nextGame.innerHTML = '<span class="disabled">没有下一篇了 <i class="fa fa-arrow-right"></i></span>';
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('获取游戏详情失败:', error);
|
||||
});
|
||||
|
||||
// 更新访问次数
|
||||
updateGameViews(gameId);
|
||||
|
||||
// 下载功能
|
||||
const downloadBtn = document.getElementById('downloadBtn');
|
||||
if (downloadBtn) {
|
||||
downloadBtn.addEventListener('click', function () {
|
||||
fetch('/index/game/downloadurl?id=' + gameId, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error('网络响应失败');
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then(data => {
|
||||
if (data.code === 1) {
|
||||
const downloadsElement = document.getElementById('gameDownloads');
|
||||
if (downloadsElement) {
|
||||
let downloads = parseInt(downloadsElement.textContent);
|
||||
downloadsElement.textContent = downloads + 1;
|
||||
}
|
||||
|
||||
// 直接使用返回的URL
|
||||
if (data.data && data.data.url) {
|
||||
window.open(data.data.url, '_blank');
|
||||
} else {
|
||||
alert('下载地址不存在');
|
||||
}
|
||||
} else {
|
||||
alert('下载失败:' + data.msg);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('下载请求失败:', error);
|
||||
alert('下载请求失败,请稍后重试');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
//复制分享码
|
||||
const codeBtn = document.getElementById('codeBtn');
|
||||
if (codeBtn) {
|
||||
codeBtn.addEventListener('click', function () {
|
||||
const code = '<?php echo $game['code']; ?>';
|
||||
if (code) {
|
||||
// 创建一个临时输入框
|
||||
const tempInput = document.createElement('input');
|
||||
tempInput.value = code;
|
||||
document.body.appendChild(tempInput);
|
||||
tempInput.select();
|
||||
|
||||
try {
|
||||
// 尝试使用传统的复制方法
|
||||
document.execCommand('copy');
|
||||
layer.msg('分享码已复制到剪贴板');
|
||||
} catch (err) {
|
||||
console.error('复制失败:', err);
|
||||
layer.msg('复制失败,请手动复制');
|
||||
} finally {
|
||||
// 移除临时输入框
|
||||
document.body.removeChild(tempInput);
|
||||
}
|
||||
} else {
|
||||
layer.msg('分享码不存在');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 返回顶部功能
|
||||
const goToTop = document.getElementById('goToTop');
|
||||
|
||||
// 监听滚动事件
|
||||
window.addEventListener('scroll', function () {
|
||||
if (window.pageYOffset > 300) {
|
||||
goToTop.classList.add('show');
|
||||
} else {
|
||||
goToTop.classList.remove('show');
|
||||
}
|
||||
});
|
||||
|
||||
// 点击返回顶部
|
||||
goToTop.addEventListener('click', function () {
|
||||
window.scrollTo({
|
||||
top: 0,
|
||||
behavior: 'smooth'
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// 更新游戏访问次数
|
||||
function updateGameViews(gameId) {
|
||||
fetch('/index/game/updateViews', {
|
||||
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) {
|
||||
const viewsElement = document.querySelector('.game-views');
|
||||
if (viewsElement) {
|
||||
viewsElement.innerHTML = `<i class="fa-solid fa-eye"></i> ${result.data.views}`;
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('更新访问次数失败:', error);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.main-top {
|
||||
width: 100%;
|
||||
height: 400px;
|
||||
background-color: #0081ff;
|
||||
/* background: url('/static/images/top-bg.jpg') no-repeat center center; */
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.main-top-card {
|
||||
max-width: 1400px;
|
||||
margin: 0 auto;
|
||||
margin-top: 30px;
|
||||
border-radius: 8px;
|
||||
background-color: #fff;
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
.main-top-main {
|
||||
max-width: 1400px;
|
||||
margin: 0 auto;
|
||||
padding-top: 50px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 100%;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.main-top-main .main-title {
|
||||
font-size: 30px;
|
||||
font-weight: 700;
|
||||
max-width: 1000px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.detail-top {
|
||||
max-width: 1400px;
|
||||
/* height: 300px; */
|
||||
margin: 30px auto;
|
||||
position: relative;
|
||||
background-color: #fff;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.detail-top-left {
|
||||
width: 70%;
|
||||
}
|
||||
|
||||
.detail-top-right {
|
||||
width: 30%;
|
||||
border-left: 1px solid #eee ;
|
||||
margin: 20px;
|
||||
}
|
||||
|
||||
.detail-top-card {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
|
||||
.detail-top-card img {
|
||||
width: 350px;
|
||||
height: 260px;
|
||||
border-radius: 8px;
|
||||
object-fit: cover;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.detail-top-card-right {
|
||||
/* height: 230px; */
|
||||
display: flex;
|
||||
width: 100%;
|
||||
margin-left: 20px;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.detail-top-card-right-top {
|
||||
display: flex;
|
||||
margin-top: 25px;
|
||||
}
|
||||
|
||||
.detail-top-card-right-middle {}
|
||||
|
||||
.detail-top-card-right-middle .game-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.detail-top-card-right-middle .game-info .title {
|
||||
font-size: 30px;
|
||||
font-weight: 700;
|
||||
color: #42d697;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.detail-top-card-right-middle .game-info .infos {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.detail-top-card-right-middle .game-info .infos .infoitem {
|
||||
margin-right: 40px;
|
||||
}
|
||||
|
||||
.detail-top-card-right-middle .game-info .infos .infoitem span {
|
||||
color: #7d879c;
|
||||
}
|
||||
|
||||
.detail-middle {
|
||||
max-width: 1400px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.detail-main {
|
||||
position: relative;
|
||||
top: -200px;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.location {
|
||||
color: #fff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.location a {
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
.game-detail {
|
||||
padding: 50px;
|
||||
background: #fff;
|
||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.game-header {
|
||||
margin-bottom: 30px;
|
||||
border-bottom: 1px solid #eee;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
.game-title {
|
||||
font-size: 30px;
|
||||
font-weight: 700;
|
||||
color: #333;
|
||||
margin-bottom: 15px;
|
||||
line-height: 1.4;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.game-title-1 {
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
color: #333;
|
||||
margin-bottom: 15px;
|
||||
line-height: 1.4;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.game-meta {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 20px;
|
||||
color: #666;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.game-meta span {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.game-meta i {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.game-content {
|
||||
line-height: 1.8;
|
||||
color: #333;
|
||||
font-size: 16px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.game-cover {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.game-cover img {
|
||||
width: 100%;
|
||||
height: 300px;
|
||||
object-fit: cover;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.game-desc {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.game-actions {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 40px;
|
||||
margin: 30px 0;
|
||||
padding: 20px 0;
|
||||
border-top: 1px solid #eee;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
.game-actions1 {
|
||||
display: flex;
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.game-navigation {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin: 30px 0;
|
||||
}
|
||||
|
||||
.prev-game,
|
||||
.next-game {
|
||||
max-width: 45%;
|
||||
}
|
||||
|
||||
.prev-game a,
|
||||
.next-game a {
|
||||
color: #333 !important;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.prev-game a:hover,
|
||||
.next-game a:hover {
|
||||
color: #f57005 !important;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.btn {
|
||||
/* background: #f57005; */
|
||||
color: #fff;
|
||||
padding: 5px 15px;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.btn:hover {
|
||||
/* background: #e66600; */
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.codebtn {
|
||||
color: #0d6efd;
|
||||
padding: 15px 30px;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #0d6efd;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.codebtn:hover {
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.related-games {
|
||||
margin: 40px 0;
|
||||
}
|
||||
|
||||
.related-games h3 {
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 20px;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
.related-title {
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 20px;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
.game-list {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.game-item {
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
transition: transform 0.3s;
|
||||
}
|
||||
|
||||
.game-item:hover {
|
||||
transform: translateY(-5px);
|
||||
}
|
||||
|
||||
.game-item a {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.game-cover img {
|
||||
width: 100%;
|
||||
height: 150px;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.game-info {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.go-to-top {
|
||||
position: fixed;
|
||||
right: 30px;
|
||||
bottom: 30px;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
background: #f57005;
|
||||
color: #fff;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.go-to-top.show {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.go-to-top:hover {
|
||||
background: #e66600;
|
||||
transform: translateY(-3px);
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.game-title {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.game-list {
|
||||
grid-template-columns: repeat(1, 1fr);
|
||||
}
|
||||
|
||||
.game-meta {
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.go-to-top {
|
||||
right: 20px;
|
||||
bottom: 20px;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
}
|
||||
}
|
||||
|
||||
.disclaimers {
|
||||
color: #b1b1b1;
|
||||
width: 80%;
|
||||
margin: 20px auto;
|
||||
margin-bottom: 60px;
|
||||
}
|
||||
|
||||
.disclaimer-title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.disclaimer-content {
|
||||
font-size: 14px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.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" /}
|
||||
@@ -0,0 +1,357 @@
|
||||
{include file="component/head" /}
|
||||
{include file="component/header-simple" /}
|
||||
|
||||
<!-- 简约现代资源中心 -->
|
||||
<div class="modern-resources-page">
|
||||
<!-- 简约标题区 -->
|
||||
<div class="modern-header">
|
||||
<div class="container">
|
||||
<h1 class="modern-title">资源中心</h1>
|
||||
<p class="modern-subtitle">网络天下资源,一站式搜索</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 主要内容区 -->
|
||||
<div class="container">
|
||||
{volist name="categories" id="category"}
|
||||
<div class="category-section">
|
||||
<div class="category-header">
|
||||
<div class="category-info">
|
||||
<h2 class="category-title">{$category.parent.name}</h2>
|
||||
</div>
|
||||
<div class="category-count">
|
||||
<span class="count-badge">{$category.subCategories|count} 个分类</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="resource-grid">
|
||||
{volist name="category.subCategories" id="subCategory"}
|
||||
<a href="/index/resources/list?cid={$subCategory.id}" class="resource-card">
|
||||
<div class="card-image">
|
||||
<img src="{$subCategory.icon|default='/static/images/default-resource.jpg'}" alt="{$subCategory.name}">
|
||||
<div class="image-overlay"></div>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<div class="meta-info">
|
||||
</div>
|
||||
<h3 class="resource-title">{$subCategory.name}</h3>
|
||||
<div class="card-footer">
|
||||
<div class="resource-stats">
|
||||
<span class="stat-item">
|
||||
<i class="layui-icon layui-icon-template-1"></i>
|
||||
<span>{$subCategory.resource_count} 个资源</span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="view-more">
|
||||
<span>查看资源</span>
|
||||
<i class="layui-icon layui-icon-right"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
{/volist}
|
||||
</div>
|
||||
</div>
|
||||
{/volist}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
/* 基础样式重置 */
|
||||
.modern-resources-page {
|
||||
font-family: 'Helvetica Neue', Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
|
||||
color: #333;
|
||||
line-height: 1.6;
|
||||
background-color: #f9fafc;
|
||||
padding-bottom: 60px;
|
||||
}
|
||||
|
||||
/* 标题区样式 */
|
||||
.modern-header {
|
||||
background: linear-gradient(135deg, #1E9FFF 0%, #0d8aff 100%);
|
||||
color: white;
|
||||
padding: 150px 0;
|
||||
text-align: center;
|
||||
margin-bottom: 40px;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.modern-header::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: url('/static/images/pattern.png') repeat;
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
opacity: 0.1;
|
||||
}
|
||||
|
||||
.modern-title {
|
||||
font-size: 2.5rem;
|
||||
font-weight: 300;
|
||||
margin-bottom: 15px;
|
||||
letter-spacing: 1px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.modern-subtitle {
|
||||
font-size: 1.1rem;
|
||||
font-weight: 300;
|
||||
opacity: 0.9;
|
||||
margin: 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* 分类区块样式 */
|
||||
.category-section {
|
||||
margin-bottom: 60px;
|
||||
background: white;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
|
||||
padding: 30px;
|
||||
}
|
||||
|
||||
.category-header {
|
||||
margin-bottom: 30px;
|
||||
padding-bottom: 20px;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.category-info {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.category-title {
|
||||
font-size: 1.8rem;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
margin: 0 0 10px;
|
||||
}
|
||||
|
||||
.category-subtitle {
|
||||
font-size: 1rem;
|
||||
color: #666;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.category-count {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.count-badge {
|
||||
background: #f0f7ff;
|
||||
color: #1E9FFF;
|
||||
padding: 6px 12px;
|
||||
border-radius: 20px;
|
||||
font-size: 0.85rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* 资源网格布局 */
|
||||
.resource-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 25px;
|
||||
}
|
||||
|
||||
/* 资源卡片样式 */
|
||||
.resource-card {
|
||||
background: white;
|
||||
border-radius: 12px;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 3px 15px rgba(0, 0, 0, 0.03);
|
||||
transition: all 0.3s ease;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
border: 1px solid #f0f0f0;
|
||||
}
|
||||
|
||||
.resource-card:hover {
|
||||
transform: translateY(-5px);
|
||||
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
|
||||
border-color: #e6f7ff;
|
||||
}
|
||||
|
||||
.card-image {
|
||||
height: 180px;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
background-color: #f5f7fa;
|
||||
}
|
||||
|
||||
.card-image img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
transition: transform 0.5s ease;
|
||||
}
|
||||
|
||||
.image-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: linear-gradient(to top, rgba(0, 0, 0, 0.3), transparent);
|
||||
}
|
||||
|
||||
.status-badge {
|
||||
position: absolute;
|
||||
top: 12px;
|
||||
right: 12px;
|
||||
padding: 4px 12px;
|
||||
border-radius: 20px;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 500;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.status-badge.active {
|
||||
background: rgba(82, 196, 26, 0.9);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.status-badge.inactive {
|
||||
background: rgba(255, 77, 79, 0.9);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.resource-card:hover .card-image img {
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
.card-content {
|
||||
padding: 20px;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.meta-info {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 12px;
|
||||
font-size: 0.85rem;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.resource-number {
|
||||
background: #f0f7ff;
|
||||
color: #1E9FFF;
|
||||
padding: 3px 10px;
|
||||
border-radius: 4px;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.resource-title {
|
||||
font-size: 1.1rem;
|
||||
font-weight: 500;
|
||||
margin: 0 0 15px;
|
||||
color: #333;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.card-footer {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-top: auto;
|
||||
padding-top: 15px;
|
||||
border-top: 1px solid #f0f0f0;
|
||||
}
|
||||
|
||||
.resource-stats {
|
||||
font-size: 0.85rem;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.stat-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
.stat-item i {
|
||||
font-size: 1rem;
|
||||
color: #1E9FFF;
|
||||
}
|
||||
|
||||
.view-more {
|
||||
color: #1E9FFF;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 500;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
.view-more i {
|
||||
font-size: 0.8rem;
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.resource-card:hover .view-more i {
|
||||
transform: translateX(3px);
|
||||
}
|
||||
|
||||
/* 响应式设计 */
|
||||
@media (max-width: 1200px) {
|
||||
.resource-grid {
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 992px) {
|
||||
.resource-grid {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
|
||||
.category-section {
|
||||
padding: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 576px) {
|
||||
.resource-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.modern-title {
|
||||
font-size: 1.8rem;
|
||||
}
|
||||
|
||||
.modern-subtitle {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.category-title {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
.category-header {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.category-count {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
h2{
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
{include file="component/foot" /}
|
||||
@@ -0,0 +1,306 @@
|
||||
{include file="component/head" /}
|
||||
{include file="component/header-simple" /}
|
||||
|
||||
<!-- 简约现代资源列表页 -->
|
||||
<div class="modern-resources-page">
|
||||
<!-- 简约标题区 -->
|
||||
<div class="modern-header">
|
||||
<div class="container">
|
||||
<h1 class="modern-title">{$category.name}</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 主要内容区 -->
|
||||
<div class="container">
|
||||
<div class="modern-layout">
|
||||
<!-- 资源列表网格 -->
|
||||
<div class="resource-grid" id="resourceList">
|
||||
{volist name="data" id="resource"}
|
||||
<div class="resource-card">
|
||||
<div class="card-image">
|
||||
<img src="{$resource.icon|default='/static/images/default-resource.jpg'}"
|
||||
alt="{$resource.title}">
|
||||
<div class="image-overlay"></div>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<div class="meta-info">
|
||||
<span class="resource-number">{$resource.number}</span>
|
||||
<time class="create-date">{$resource.create_time|date="Y-m-d"}</time>
|
||||
</div>
|
||||
<h3 class="resource-title">{$resource.title}</h3>
|
||||
<div class="card-footer">
|
||||
<div class="resource-stats">
|
||||
<span class="stat-item">
|
||||
<i class="layui-icon layui-icon-template-1"></i>
|
||||
<span>资源详情</span>
|
||||
</span>
|
||||
</div>
|
||||
<a href="/index/resources/detail?id={$resource.id}" class="view-more">
|
||||
<span>查看详情</span>
|
||||
<i class="layui-icon layui-icon-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/volist}
|
||||
</div>
|
||||
|
||||
<!-- 分页 -->
|
||||
<div class="pagination-container">
|
||||
{$page|raw}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
/* 基础样式重置 */
|
||||
.modern-resources-page {
|
||||
font-family: 'Helvetica Neue', Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
|
||||
color: #333;
|
||||
line-height: 1.6;
|
||||
background-color: #f9fafc;
|
||||
padding-bottom: 60px;
|
||||
}
|
||||
|
||||
/* 标题区样式 */
|
||||
.modern-header {
|
||||
background: linear-gradient(135deg, #1E9FFF 0%, #0d8aff 100%);
|
||||
color: white;
|
||||
padding: 150px 0;
|
||||
text-align: center;
|
||||
margin-bottom: 40px;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.modern-header::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: url('/static/images/pattern.png') repeat;
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
opacity: 0.1;
|
||||
}
|
||||
|
||||
.modern-title {
|
||||
font-size: 2.5rem;
|
||||
font-weight: 300;
|
||||
margin-bottom: 15px;
|
||||
letter-spacing: 1px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.modern-subtitle {
|
||||
font-size: 1.1rem;
|
||||
font-weight: 300;
|
||||
opacity: 0.9;
|
||||
margin: 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* 资源网格布局 */
|
||||
.resource-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 25px;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
/* 资源卡片样式 */
|
||||
.resource-card {
|
||||
background: white;
|
||||
border-radius: 12px;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 3px 15px rgba(0, 0, 0, 0.03);
|
||||
transition: all 0.3s ease;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border: 1px solid #f0f0f0;
|
||||
}
|
||||
|
||||
.resource-card:hover {
|
||||
transform: translateY(-5px);
|
||||
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
|
||||
border-color: #e6f7ff;
|
||||
}
|
||||
|
||||
.card-image {
|
||||
height: 180px;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
background-color: #f5f7fa;
|
||||
}
|
||||
|
||||
.card-image img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
transition: transform 0.5s ease;
|
||||
}
|
||||
|
||||
.image-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: linear-gradient(to top, rgba(0, 0, 0, 0.3), transparent);
|
||||
}
|
||||
|
||||
.resource-card:hover .card-image img {
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
.card-content {
|
||||
padding: 20px;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.meta-info {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 12px;
|
||||
font-size: 0.85rem;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.resource-number {
|
||||
background: #f0f7ff;
|
||||
color: #1E9FFF;
|
||||
padding: 3px 10px;
|
||||
border-radius: 4px;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.resource-title {
|
||||
font-size: 1.1rem;
|
||||
font-weight: 500;
|
||||
margin: 0 0 15px;
|
||||
color: #333;
|
||||
line-height: 1.4;
|
||||
border-top: 1px solid #f0f0f0;
|
||||
padding-top: 10px;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: normal;
|
||||
max-height: 3.2em;
|
||||
}
|
||||
|
||||
.card-footer {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-top: auto;
|
||||
padding-top: 15px;
|
||||
border-top: 1px solid #f0f0f0;
|
||||
}
|
||||
|
||||
.resource-stats {
|
||||
font-size: 0.85rem;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.stat-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
.stat-item i {
|
||||
font-size: 1rem;
|
||||
color: #1E9FFF;
|
||||
}
|
||||
|
||||
.view-more {
|
||||
color: #1E9FFF;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 500;
|
||||
text-decoration: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
.view-more i {
|
||||
font-size: 0.8rem;
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.resource-card:hover .view-more i {
|
||||
transform: translateX(3px);
|
||||
}
|
||||
|
||||
/* 分页样式 */
|
||||
.pagination-container {
|
||||
text-align: center;
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
.pagination-container .pagination {
|
||||
display: inline-flex;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
.pagination-container .pagination a,
|
||||
.pagination-container .pagination span {
|
||||
padding: 8px 16px;
|
||||
border-radius: 4px;
|
||||
background: white;
|
||||
color: #666;
|
||||
text-decoration: none;
|
||||
transition: all 0.3s ease;
|
||||
border: 1px solid #f0f0f0;
|
||||
}
|
||||
|
||||
.pagination-container .pagination a:hover {
|
||||
background: #f0f7ff;
|
||||
color: #1E9FFF;
|
||||
border-color: #e6f7ff;
|
||||
}
|
||||
|
||||
.pagination-container .pagination .active {
|
||||
background: #1E9FFF;
|
||||
color: white;
|
||||
border-color: #1E9FFF;
|
||||
}
|
||||
|
||||
/* 响应式设计 */
|
||||
@media (max-width: 1200px) {
|
||||
.resource-grid {
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 992px) {
|
||||
.resource-grid {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 576px) {
|
||||
.resource-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.modern-title {
|
||||
font-size: 1.8rem;
|
||||
}
|
||||
|
||||
.modern-subtitle {
|
||||
font-size: 1rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
{include file="component/foot" /}
|
||||
Reference in New Issue
Block a user