完善资源模块
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<?php /*a:4:{s:49:"E:\Demo\PHP\yunzer\app\index\view\index\index.php";i:1746890051;s:54:"E:\Demo\PHP\yunzer\app\index\view\component\header.php";i:1746796639;s:52:"E:\Demo\PHP\yunzer\app\index\view\component\main.php";i:1747316984;s:54:"E:\Demo\PHP\yunzer\app\index\view\component\footer.php";i:1746796639;}*/ ?>
|
||||
<?php /*a:4:{s:49:"E:\Demo\PHP\yunzer\app\index\view\index\index.php";i:1746890051;s:54:"E:\Demo\PHP\yunzer\app\index\view\component\header.php";i:1747402501;s:52:"E:\Demo\PHP\yunzer\app\index\view\component\main.php";i:1747410946;s:54:"E:\Demo\PHP\yunzer\app\index\view\component\footer.php";i:1747402501;}*/ ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
@@ -21,17 +21,24 @@
|
||||
<div class="container">
|
||||
<div style="width: 70%;">
|
||||
<ul class="list-unstyled topbar-one__info">
|
||||
<li class="topbar-one__info__item"><span class="topbar-one__info__icon fas fa-phone-alt"></span><a
|
||||
href="tel:629-555-0129">(629) 555-0129</a></li>
|
||||
<li class="topbar-one__info__item"><span class="topbar-one__info__icon fas fa-envelope"></span><a
|
||||
href="mailto:info@example.com">info@example.com</a></li>
|
||||
<li class="topbar-one__info__item">
|
||||
<span class="topbar-one__info__icon fas fa-phone-alt" style="margin-right: 10px;"></span>
|
||||
<a href="<?php echo htmlentities((string) $config['admin_phone']); ?>"><?php echo htmlentities((string) $config['admin_phone']); ?></a>
|
||||
</li>
|
||||
<li class="topbar-one__info__item">
|
||||
<span class="topbar-one__info__icon fas fa-envelope" style="margin-right: 10px;"></span>
|
||||
<a href="mailto:<?php echo htmlentities((string) $config['admin_email']); ?>"><?php echo htmlentities((string) $config['admin_email']); ?></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="topbar-one__social" style="width: 30%;">
|
||||
<a href="https://facebook.com"><i class="fab fa-facebook-f"></i></a>
|
||||
<a href="https://twitter.com"><i class="fab fa-twitter"></i></a>
|
||||
<a href="https://instagram.com"><i class="fab fa-instagram"></i></a>
|
||||
<a href="https://www.youtube.com/"><i class="fab fa-linkedin"></i></a>
|
||||
<a href="/index/user/login" class="mr-10"><i class="layui-icon layui-icon-username"></i> 登录</a>
|
||||
<a href="/index/user/register" class="mr-10"><i class="layui-icon layui-icon-user"></i> 注册</a>
|
||||
<a href="javascript:;" class="qrcode-trigger"><i class="layui-icon layui-icon-qrcode"></i> 公众号</a>
|
||||
<div class="qrcode-popup"
|
||||
style="display:none;position:absolute;right:54px;top:32px;background:#fff;padding:10px;box-shadow:0 0 10px rgba(0,0,0,0.1); z-index: 1000;">
|
||||
<img src="<?php echo htmlentities((string) $config['admin_wechat']); ?>" alt="公众号二维码" style="width:180px;height:180px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -39,7 +46,7 @@
|
||||
<div class="main-menu">
|
||||
<div class="container">
|
||||
<div class="main-menu__logo">
|
||||
<a href="index.html"><img src="/static/images/logo.png" width="186" alt="Logo"></a>
|
||||
<a href="index.html"><img src="<?php echo htmlentities((string) $config['logo1']); ?>" width="186" alt="Logo"></a>
|
||||
</div>
|
||||
<div class="main-menu__nav">
|
||||
<ul class="main-menu__list">
|
||||
@@ -50,8 +57,28 @@
|
||||
</ul>
|
||||
</div>
|
||||
<div class="main-menu__right">
|
||||
<a href="#" class="main-menu__search"><i class="layui-icon layui-icon-search"></i></a>
|
||||
<a href="login.html" class="main-menu__login"><i class="layui-icon layui-icon-username"></i></a>
|
||||
<div class="layui-inline">
|
||||
<div class="layui-inline" style="position: relative;">
|
||||
<img src="/static/images/avatar.webp" class="layui-circle"
|
||||
style="width: 40px; height: 40px; cursor: pointer;" id="userAvatarMain">
|
||||
<div class="user-dropdown" id="userDropdownMain">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/index/user/profile"><i
|
||||
class="layui-icon layui-icon-user"></i><span>个人中心</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/index/user/settings"><i
|
||||
class="layui-icon layui-icon-set"></i><span>账号管理</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="javascript:;" class="logout-btn"><i
|
||||
class="layui-icon layui-icon-logout"></i><span>退出登录</span></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -59,43 +86,6 @@
|
||||
<!-- Banner轮播 -->
|
||||
<div class="layui-carousel" id="test10" lay-filter="test10">
|
||||
<div carousel-item="">
|
||||
<div>
|
||||
<div class="banner-content">
|
||||
<span class="banner-title">智能科技 引领未来</span>
|
||||
<span class="banner-desc">打造智能化解决方案,助力企业数字化转型,打造智能化解决方案,助力企业数字化转型,打造智能化解决方案,助力企业数字化转型</span>
|
||||
<a href="#" class="btn btn-primary" style="margin-top: 20px;width:150px">了解更多</a>
|
||||
</div>
|
||||
<a href="#" class="banner-slide">
|
||||
<img src="/static/images/banner/banner1.jpg" alt="Banner 1">
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
<div class="banner-content">
|
||||
<span class="banner-title">创新技术 卓越服务</span>
|
||||
<spanp class="banner-desc">以创新科技为核心,为客户提供优质服务</spanp>
|
||||
</div>
|
||||
<a href="#" class="banner-slide">
|
||||
<img src="/static/images/banner/banner2.jpg" alt="Banner 2">
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
<div class="banner-content">
|
||||
<span class="banner-title">专业团队 值得信赖</span>
|
||||
<spanp class="banner-desc">资深专家团队,为您提供专业的技术支持</spanp>
|
||||
</div>
|
||||
<a href="#" class="banner-slide">
|
||||
<img src="/static/images/banner/banner3.jpg" alt="Banner 3">
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
<div class="banner-content">
|
||||
<span class="banner-title">全球视野 本地服务</span>
|
||||
<span class="banner-desc">立足本地,放眼全球,打造国际化服务</span>
|
||||
</div>
|
||||
<a href="#" class="banner-slide">
|
||||
<img src="/static/images/banner/banner4.jpg" alt="Banner 4">
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -105,7 +95,7 @@
|
||||
<div class="sticky-nav" style="display: none;">
|
||||
<div class="container">
|
||||
<div class="sticky-nav__logo">
|
||||
<a href="index.html"><img src="/static/images/logo.png" width="150" alt="Logo"></a>
|
||||
<a href="index.html"><img src="<?php echo htmlentities((string) $config['logo1']); ?>" width="150" alt="Logo"></a>
|
||||
</div>
|
||||
<div class="sticky-nav__menu">
|
||||
<ul>
|
||||
@@ -116,65 +106,350 @@
|
||||
</ul>
|
||||
</div>
|
||||
<div class="sticky-nav__right">
|
||||
<a href="#" class="main-menu__search"><i class="layui-icon layui-icon-search"></i></a>
|
||||
<a href="login.html" class="main-menu__login"><i class="layui-icon layui-icon-username"></i></a>
|
||||
<div class="main-menu__right">
|
||||
<div class="layui-inline">
|
||||
<div class="layui-inline" style="position: relative;">
|
||||
<img src="/static/images/avatar.webp" class="layui-circle"
|
||||
style="width: 40px; height: 40px; cursor: pointer;" id="userAvatarSticky">
|
||||
<div class="user-dropdown" id="userDropdownSticky">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/index/user/profile"><i
|
||||
class="layui-icon layui-icon-user"></i><span>个人中心</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/index/user/settings"><i
|
||||
class="layui-icon layui-icon-set"></i><span>账号管理</span></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="javascript:;" class="logout-btn"><i
|
||||
class="layui-icon layui-icon-logout"></i><span>退出登录</span></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
layui.use(['carousel', 'form'], function(){
|
||||
var carousel = layui.carousel
|
||||
,form = layui.form;
|
||||
|
||||
//图片轮播
|
||||
carousel.render({
|
||||
elem: '#test10'
|
||||
,width: '100%'
|
||||
,height: '86vh'
|
||||
,interval: 4000
|
||||
});
|
||||
|
||||
var $ = layui.$, active = {
|
||||
set: function(othis){
|
||||
var THIS = 'layui-bg-normal'
|
||||
,key = othis.data('key')
|
||||
,options = {};
|
||||
|
||||
othis.css('background-color', '#5FB878').siblings().removeAttr('style');
|
||||
options[key] = othis.data('value');
|
||||
ins3.reload(options);
|
||||
<style>
|
||||
/* 用户头像样式 */
|
||||
#userAvatar {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
};
|
||||
|
||||
//监听开关
|
||||
form.on('switch(autoplay)', function(){
|
||||
ins3.reload({
|
||||
autoplay: this.checked
|
||||
});
|
||||
});
|
||||
|
||||
$('.demoSet').on('keyup', function(){
|
||||
var value = this.value
|
||||
,options = {};
|
||||
if(!/^\d+$/.test(value)) return;
|
||||
|
||||
options[this.name] = value;
|
||||
ins3.reload(options);
|
||||
});
|
||||
|
||||
// 监听滚动事件
|
||||
$(window).scroll(function() {
|
||||
var scrollTop = $(window).scrollTop();
|
||||
if (scrollTop > 150) { // 当滚动超过150px时显示固定导航
|
||||
$('.sticky-nav').fadeIn();
|
||||
} else {
|
||||
$('.sticky-nav').fadeOut();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
#userAvatar:hover {
|
||||
transform: scale(1.05);
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
/* 下拉菜单容器 */
|
||||
.user-dropdown {
|
||||
position: absolute;
|
||||
top: 50px;
|
||||
right: 0;
|
||||
width: 160px;
|
||||
background: #fff;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
transform: translateY(-10px);
|
||||
transition: all 0.3s ease;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
.user-dropdown.show {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
/* 下拉菜单列表 */
|
||||
.user-dropdown ul {
|
||||
margin: 0;
|
||||
padding: 5px 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
/* 下拉菜单项 */
|
||||
.user-dropdown li {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* 下拉菜单链接 */
|
||||
.user-dropdown li a {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10px 15px;
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
/* 下拉菜单图标 */
|
||||
.user-dropdown li a i {
|
||||
margin-right: 10px;
|
||||
font-size: 16px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
/* 下拉菜单文字 */
|
||||
.user-dropdown li a span {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
/* 下拉菜单悬停效果 */
|
||||
.user-dropdown li a:hover {
|
||||
background: #f5f5f5;
|
||||
color: #1E9FFF;
|
||||
}
|
||||
|
||||
.user-dropdown li a:hover i {
|
||||
color: #1E9FFF;
|
||||
}
|
||||
|
||||
/* 分隔线 */
|
||||
.user-dropdown li:not(:last-child) {
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
}
|
||||
|
||||
#userDropdownSticky a {
|
||||
color: #0d6efd !important;
|
||||
}
|
||||
|
||||
/* Banner样式 */
|
||||
.banner-content {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.banner-image {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.banner-image img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
object-position: center;
|
||||
}
|
||||
|
||||
.banner-text {
|
||||
position: absolute;
|
||||
top: 40%;
|
||||
left: 10%;
|
||||
z-index: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.banner-text a {
|
||||
text-decoration: none;
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.banner-title {
|
||||
font-size: 4em;
|
||||
font-weight: 600;
|
||||
margin-bottom: 10px;
|
||||
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.banner-desc {
|
||||
font-size: 2em;
|
||||
font-weight: 400;
|
||||
max-width: 800px;
|
||||
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.banner-btn {
|
||||
background: #fff;
|
||||
color: #000;
|
||||
padding: 10px 20px;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.banner-btn:hover {
|
||||
background: #000;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.banner-slider {
|
||||
width: 100%;
|
||||
height: 86vh;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.banner-container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.banner-slide {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.banner-slide img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
/* 关键:等比缩放并铺满 */
|
||||
display: block;
|
||||
}
|
||||
|
||||
.layui-carousel {
|
||||
background: #f8f8f8;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* 确保轮播容器和项目的高度正确 */
|
||||
#test10,
|
||||
#test10 [carousel-item],
|
||||
#test10 [carousel-item]>* {
|
||||
height: 86vh !important;
|
||||
}
|
||||
|
||||
#test10 [carousel-item]>* {
|
||||
background: none !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
layui.use(['carousel', 'form', 'layer'], function () {
|
||||
var carousel = layui.carousel, form = layui.form, layer = layui.layer, $ = layui.$;
|
||||
|
||||
// 加载banner数据
|
||||
$.ajax({
|
||||
url: '/index/index/bannerlist',
|
||||
type: 'GET',
|
||||
success: function (res) {
|
||||
if (res.code === 1) {
|
||||
var bannerHtml = '';
|
||||
res.banner.forEach(function (banner) {
|
||||
bannerHtml += '<div>' +
|
||||
'<div class="banner-content">' +
|
||||
'<div class="banner-image">' +
|
||||
'<img src="' + banner.image + '" alt="' + (banner.title || '') + '">' +
|
||||
'</div>' +
|
||||
'<div class="banner-text">' +
|
||||
'<span class="banner-title">' + (banner.title || '') + '</span>' +
|
||||
'<span class="banner-desc">' + (banner.desc || '') + '</span>' +
|
||||
'<a href="' + (banner.url || 'javascript:;') + '" class="banner-slide">' +
|
||||
'<span class="banner-btn">查看详情</span>' +
|
||||
'</a>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
});
|
||||
$('#test10 div[carousel-item]').html(bannerHtml);
|
||||
|
||||
// 图片轮播
|
||||
carousel.render({
|
||||
elem: '#test10',
|
||||
width: '100%',
|
||||
height: '100vh',
|
||||
interval: 4000,
|
||||
anim: 'fade',
|
||||
autoplay: true,
|
||||
full: false,
|
||||
arrow: 'hover'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
// 主导航头像
|
||||
$("#userAvatarMain").click(function (e) {
|
||||
e.stopPropagation();
|
||||
$("#userDropdownMain").toggleClass("show");
|
||||
$("#userDropdownSticky").removeClass("show"); // 保证只显示一个
|
||||
});
|
||||
// 固定导航头像
|
||||
$("#userAvatarSticky").click(function (e) {
|
||||
e.stopPropagation();
|
||||
$("#userDropdownSticky").toggleClass("show");
|
||||
$("#userDropdownMain").removeClass("show"); // 保证只显示一个
|
||||
});
|
||||
|
||||
// 点击页面其他地方隐藏所有菜单
|
||||
$(document).click(function (e) {
|
||||
if (!$(e.target).closest('.user-dropdown, #userAvatarMain, #userAvatarSticky').length) {
|
||||
$("#userDropdownMain, #userDropdownSticky").removeClass("show");
|
||||
}
|
||||
});
|
||||
|
||||
// 点击菜单项时隐藏菜单
|
||||
$("#userDropdownMain li a, #userDropdownSticky li a").click(function () {
|
||||
$("#userDropdownMain, #userDropdownSticky").removeClass("show");
|
||||
});
|
||||
});
|
||||
|
||||
// 退出登录
|
||||
$('.logout-btn').on('click', function () {
|
||||
layer.confirm('确定要退出登录吗?', {
|
||||
btn: ['确定', '取消']
|
||||
}, function () {
|
||||
window.location.href = '/index/user/logout';
|
||||
});
|
||||
});
|
||||
|
||||
// 监听滚动事件
|
||||
$(window).scroll(function () {
|
||||
var scrollTop = $(window).scrollTop();
|
||||
if (scrollTop > 150) { // 当滚动超过150px时显示固定导航
|
||||
$('.sticky-nav').fadeIn();
|
||||
} else {
|
||||
$('.sticky-nav').fadeOut();
|
||||
}
|
||||
});
|
||||
|
||||
// 公众号二维码
|
||||
const trigger = document.querySelector('.qrcode-trigger');
|
||||
const popup = document.querySelector('.qrcode-popup');
|
||||
|
||||
// 鼠标移入显示二维码
|
||||
trigger.addEventListener('mouseenter', function () {
|
||||
popup.style.display = 'block';
|
||||
});
|
||||
|
||||
// 鼠标移出隐藏二维码
|
||||
trigger.addEventListener('mouseleave', function () {
|
||||
popup.style.display = 'none';
|
||||
});
|
||||
|
||||
// 鼠标移入二维码区域时保持显示
|
||||
popup.addEventListener('mouseenter', function () {
|
||||
popup.style.display = 'block';
|
||||
});
|
||||
|
||||
// 鼠标移出二维码区域时隐藏
|
||||
popup.addEventListener('mouseleave', function () {
|
||||
popup.style.display = 'none';
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<main class="main-content">
|
||||
<div class="container">
|
||||
<!-- 站点资讯模块 -->
|
||||
@@ -203,7 +478,7 @@ layui.use(['carousel', 'form'], function(){
|
||||
<div class="module-header">
|
||||
<div>
|
||||
<div class="ModuleTitle_titleWrapper">
|
||||
<h3 class="ModuleTitle_title">技术文章11</h3>
|
||||
<h3 class="ModuleTitle_title">技术文章</h3>
|
||||
<div class="tab-container">
|
||||
<div class="tab-header">
|
||||
<div class="tab-item active" data-tab="all">全部</div>
|
||||
@@ -219,6 +494,48 @@ layui.use(['carousel', 'form'], function(){
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 资源下载模块 -->
|
||||
<div class="core-block core-module" id="resourcesDownload" style="order: 3;">
|
||||
<div class="module-header">
|
||||
<div>
|
||||
<div class="ModuleTitle_titleWrapper">
|
||||
<h3 class="ModuleTitle_title">办公资源</h3>
|
||||
<div class="tab-container">
|
||||
<div class="tab-header">
|
||||
<div class="tab-item active" data-tab="all">全部</div>
|
||||
<!-- 分类标签将通过JavaScript动态加载 -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="more-btn">更多</div>
|
||||
</div>
|
||||
<div class="product-list" id="resourcesDownloadList">
|
||||
<!-- 文章将通过JavaScript动态加载 -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 程序下载模块 -->
|
||||
<div class="core-block core-module" id="programDownload" style="order: 3;">
|
||||
<div class="module-header">
|
||||
<div>
|
||||
<div class="ModuleTitle_titleWrapper">
|
||||
<h3 class="ModuleTitle_title">程序下载</h3>
|
||||
<div class="tab-container">
|
||||
<div class="tab-header">
|
||||
<div class="tab-item active" data-tab="all">全部</div>
|
||||
<!-- 分类标签将通过JavaScript动态加载 -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="more-btn">更多</div>
|
||||
</div>
|
||||
<div class="product-list" id="programDownloadList">
|
||||
<!-- 程序将通过JavaScript动态加载 -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</main>
|
||||
|
||||
@@ -285,6 +602,60 @@ layui.use(['carousel', 'form'], function(){
|
||||
});
|
||||
}
|
||||
|
||||
// 加载资源下载
|
||||
function loadResources() {
|
||||
fetch('/index/index/resourcesList')
|
||||
.then(response => response.json())
|
||||
.then(result => {
|
||||
if (result.code === 1) {
|
||||
// 渲染分类标签
|
||||
if (result.categories) {
|
||||
renderCategoryTabs(result.categories, 'resourcesDownload');
|
||||
}
|
||||
// 渲染资源列表
|
||||
if (result.resources && result.resources.length > 0) {
|
||||
// 只取最新的8条
|
||||
renderResources(result.resources.slice(0, 8), 'resourcesDownloadList');
|
||||
} else {
|
||||
showNoData('resourcesDownloadList');
|
||||
}
|
||||
} else {
|
||||
showNoData('resourcesDownloadList');
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('请求失败:', error);
|
||||
showError('resourcesDownloadList');
|
||||
});
|
||||
}
|
||||
|
||||
// 加载程序下载
|
||||
function loadPrograms() {
|
||||
fetch('/index/index/programList')
|
||||
.then(response => response.json())
|
||||
.then(result => {
|
||||
if (result.code === 1) {
|
||||
// 渲染分类标签
|
||||
if (result.categories) {
|
||||
renderCategoryTabs(result.categories, 'programDownload');
|
||||
}
|
||||
// 渲染程序列表
|
||||
if (result.programs && result.programs.length > 0) {
|
||||
// 只取最新的8条
|
||||
renderPrograms(result.programs.slice(0, 8), 'programDownloadList');
|
||||
} else {
|
||||
showNoData('programDownloadList');
|
||||
}
|
||||
} else {
|
||||
showNoData('programDownloadList');
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('请求失败:', error);
|
||||
showError('programDownloadList');
|
||||
});
|
||||
}
|
||||
|
||||
// 显示无数据提示
|
||||
function showNoData(containerId) {
|
||||
document.getElementById(containerId).innerHTML = '<div class="no-data">暂无数据</div>';
|
||||
@@ -333,11 +704,20 @@ layui.use(['carousel', 'form'], function(){
|
||||
// 获取选中的分类ID
|
||||
const selectedCategoryId = this.getAttribute('data-tab');
|
||||
|
||||
// 重新加载对应分类的文章
|
||||
if (moduleId === 'opencourse') {
|
||||
loadCategoryArticles(selectedCategoryId, 'webArticlesList');
|
||||
} else {
|
||||
loadCategoryArticles(selectedCategoryId, 'techArticlesList');
|
||||
// 根据不同模块加载对应数据
|
||||
switch(moduleId) {
|
||||
case 'opencourse':
|
||||
loadCategoryArticles(selectedCategoryId, 'webArticlesList');
|
||||
break;
|
||||
case 'techArticles':
|
||||
loadCategoryArticles(selectedCategoryId, 'techArticlesList');
|
||||
break;
|
||||
case 'resourcesDownload':
|
||||
loadCategoryResources(selectedCategoryId, 'resourcesDownloadList');
|
||||
break;
|
||||
case 'programDownload':
|
||||
loadCategoryPrograms(selectedCategoryId, 'programDownloadList');
|
||||
break;
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -435,10 +815,155 @@ layui.use(['carousel', 'form'], function(){
|
||||
`;
|
||||
}
|
||||
|
||||
// 渲染资源列表
|
||||
function renderResources(resources, containerId) {
|
||||
const container = document.getElementById(containerId);
|
||||
if (!container) return;
|
||||
|
||||
let html = '';
|
||||
if (Array.isArray(resources)) {
|
||||
resources.forEach(resource => {
|
||||
html += createResourceHtml(resource);
|
||||
});
|
||||
}
|
||||
|
||||
container.innerHTML = html || '<div class="no-data">暂无数据</div>';
|
||||
}
|
||||
|
||||
// 创建资源HTML
|
||||
function createResourceHtml(resource) {
|
||||
if (!resource) return '';
|
||||
|
||||
// 格式化日期
|
||||
const uploadDate = new Date(resource.uploaddate * 1000);
|
||||
const formattedDate = uploadDate.toLocaleDateString('zh-CN', {
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit'
|
||||
});
|
||||
|
||||
// 格式化文件大小
|
||||
const formatFileSize = (bytes) => {
|
||||
if (bytes === 0) return '0 B';
|
||||
const k = 1024;
|
||||
const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
|
||||
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
||||
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
|
||||
};
|
||||
|
||||
return `
|
||||
<div class="opencourse product-item" onclick="window.open('/index/resource/detail?id=${resource.id || ''}', '_blank')">
|
||||
<div class="video">
|
||||
<img src="${resource.thumbnail || '/static/images/default-resource.png'}" alt="" class="cover">
|
||||
<div class="file-type">${resource.filetype || '未知类型'}</div>
|
||||
</div>
|
||||
<div class="introduction">
|
||||
<div class="title">${resource.title || '无标题'}</div>
|
||||
<div class="description">${resource.description || '暂无描述'}</div>
|
||||
<div class="publishdate">${formattedDate}</div>
|
||||
</div>
|
||||
<div class="bottom">
|
||||
<div class="views"><i class="fa-solid fa-eye"></i><span style="margin-left: 5px;">${resource.views || 0}</span></div>
|
||||
<div class="author"><i class="fa-regular fa-user"></i><span style="margin-left: 5px;">${resource.uploader || '未知作者'}</span></div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
// 渲染程序列表
|
||||
function renderPrograms(programs, containerId) {
|
||||
const container = document.getElementById(containerId);
|
||||
if (!container) return;
|
||||
|
||||
let html = '';
|
||||
if (Array.isArray(programs)) {
|
||||
programs.forEach(program => {
|
||||
html += createProgramHtml(program);
|
||||
});
|
||||
}
|
||||
|
||||
container.innerHTML = html || '<div class="no-data">暂无数据</div>';
|
||||
}
|
||||
|
||||
// 创建程序HTML
|
||||
function createProgramHtml(program) {
|
||||
if (!program) return '';
|
||||
|
||||
// 格式化日期
|
||||
const createDate = new Date(program.create_time * 1000);
|
||||
const formattedDate = createDate.toLocaleDateString('zh-CN', {
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit'
|
||||
});
|
||||
|
||||
return `
|
||||
<div class="opencourse product-item" onclick="window.open('/index/program/detail?id=${program.id || ''}', '_blank')">
|
||||
<div class="video">
|
||||
<img src="${program.icon || '/static/images/default-program.png'}" alt="" class="cover">
|
||||
</div>
|
||||
<div class="introduction">
|
||||
<div class="title">${program.title || '无标题'}</div>
|
||||
<div class="publishdate">${formattedDate}</div>
|
||||
</div>
|
||||
<div class="bottom">
|
||||
<div class="views"><i class="fa-solid fa-eye"></i><span style="margin-left: 5px;">${program.views || 0}</span></div>
|
||||
<div class="author"><i class="fa-regular fa-user"></i><span style="margin-left: 5px;">${program.uploader || '未知作者'}</span></div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
// 加载分类资源
|
||||
function loadCategoryResources(categoryId, containerId) {
|
||||
fetch('/index/index/resourcesList')
|
||||
.then(response => response.json())
|
||||
.then(result => {
|
||||
if (result.code === 1) {
|
||||
if (categoryId === 'all') {
|
||||
renderResources(result.resources.slice(0, 8), containerId);
|
||||
} else {
|
||||
const filteredResources = result.resources.filter(resource => resource.cate == categoryId);
|
||||
renderResources(filteredResources, containerId);
|
||||
}
|
||||
} else {
|
||||
showNoData(containerId);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('请求失败:', error);
|
||||
showError(containerId);
|
||||
});
|
||||
}
|
||||
|
||||
// 加载分类程序
|
||||
function loadCategoryPrograms(categoryId, containerId) {
|
||||
fetch('/index/index/programList')
|
||||
.then(response => response.json())
|
||||
.then(result => {
|
||||
if (result.code === 1) {
|
||||
if (categoryId === 'all') {
|
||||
renderPrograms(result.programs.slice(0, 8), containerId);
|
||||
} else {
|
||||
const filteredPrograms = result.programs.filter(program => program.cate == categoryId);
|
||||
renderPrograms(filteredPrograms, containerId);
|
||||
}
|
||||
} else {
|
||||
showNoData(containerId);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('请求失败:', error);
|
||||
showError(containerId);
|
||||
});
|
||||
}
|
||||
|
||||
// 页面加载完成后执行
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
loadWebArticles();
|
||||
loadTechArticles();
|
||||
loadResources();
|
||||
loadPrograms();
|
||||
});
|
||||
</script>
|
||||
<footer class="footer" style="background-image: url(/static/images/footer-bg-1.png)">
|
||||
@@ -446,7 +971,7 @@ layui.use(['carousel', 'form'], function(){
|
||||
<div class="row" style="width: 100%;">
|
||||
<div class="row-main">
|
||||
<div class="mr-20">
|
||||
<img src="/static/images/logo-l-w.png" alt="" height="70">
|
||||
<img src="<?php echo htmlentities((string) $config['logo']); ?>" alt="" height="70">
|
||||
<p class="text-white-50 my-4 f18" style="width: 400px;">美天智能科技,这里是介绍!</p>
|
||||
</div>
|
||||
<div style="display: flex; justify-content: space-between;width: 100%;margin-right: 200px;">
|
||||
@@ -478,7 +1003,7 @@ layui.use(['carousel', 'form'], function(){
|
||||
|
||||
<div>
|
||||
<div class="text-center">
|
||||
<img src="/static/images/code.png" alt="微信二维码" class="img-fluid" style="max-width: 150px;">
|
||||
<img src="<?php echo htmlentities((string) $config['admin_wechat']); ?>" alt="微信二维码" class="img-fluid" style="max-width: 150px;">
|
||||
<p class="text-white-50 mt-2">微信公众号</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user