535 lines
		
	
	
		
			15 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			535 lines
		
	
	
		
			15 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| {include file="component/head" /}
 | |
| {include file="component/header-simple" /}
 | |
| 
 | |
| <!-- 简约现代文章中心 -->
 | |
| <div class="modern-programs-page">
 | |
|     <!-- 简约标题区 -->
 | |
|     <div class="modern-header">
 | |
|         <div class="container">
 | |
|             <h1 class="modern-title">资源中心</h1>
 | |
|             <p class="modern-subtitle">发现优质程序与工具</p>
 | |
|         </div>
 | |
|     </div>
 | |
| 
 | |
|     <!-- 主要内容区 -->
 | |
|     <div class="container">
 | |
|         <div class="modern-layout">
 | |
|             <!-- 侧边分类导航 -->
 | |
|             <aside class="modern-sidebar">
 | |
|                 <div class="sidebar-card">
 | |
|                     <h3 class="sidebar-title">
 | |
|                         <i class="layui-icon layui-icon-list"></i>
 | |
|                         <span>分类导航</span>
 | |
|                     </h3>
 | |
|                     <ul class="category-menu">
 | |
|                         {volist name="cate.subCategories" id="subCategory"}
 | |
|                         <li class="menu-item {$cate.id == $subCategory.id ? 'active' : ''}" data-cateid="{$subCategory.id}">
 | |
|                             <span>{$subCategory.name}</span>
 | |
|                             <i class="layui-icon layui-icon-right"></i>
 | |
|                         </li>
 | |
|                         {/volist}
 | |
|                     </ul>
 | |
|                 </div>
 | |
|             </aside>
 | |
| 
 | |
|             <!-- 文章内容区 -->
 | |
|             <main class="modern-main">
 | |
|                 <!-- 文章列表 -->
 | |
|                 <div class="article-grid" id="programList">
 | |
|                     {volist name="cate.subCategories" id="subCategory"}
 | |
|                     {if $cate.id == $subCategory.id}
 | |
|                         {if !empty($subCategory.list)}
 | |
|                             {volist name="subCategory.list" id="program"}
 | |
|                             <program class="program-card">
 | |
|                                 <div class="card-image">
 | |
|                                     <img src="{$program.icon|default='/static/images/default-program.jpg'}" alt="{$program.title}">
 | |
|                                     <div class="image-overlay"></div>
 | |
|                                 </div>
 | |
|                                 <div class="card-content">
 | |
|                                     <div class="meta-info">
 | |
|                                         <span class="category-tag">{$subCategory.name}</span>
 | |
|                                         <time class="publish-date">{$program.create_time|date="Y-m-d"}</time>
 | |
|                                     </div>
 | |
|                                     <h3 class="program-title">{$program.title}</h3>
 | |
|                                     <div class="card-footer">
 | |
|                                         <div class="stats">
 | |
|                                             <span class="views"><i class="layui-icon layui-icon-eye"></i> {$program.views|default=0}</span>
 | |
|                                             <span class="likes"><i class="layui-icon layui-icon-praise"></i> {$program.likes|default=0}</span>
 | |
|                                         </div>
 | |
|                                         <a href="/index/program/detail?id={$program.id}" class="read-more">阅读更多</a>
 | |
|                                     </div>
 | |
|                                 </div>
 | |
|                             </program>
 | |
|                             {/volist}
 | |
|                         {else}
 | |
|                             <div class="empty-state">
 | |
|                                 <div class="empty-icon">
 | |
|                                     <i class="layui-icon layui-icon-template-1"></i>
 | |
|                                 </div>
 | |
|                                 <h4>暂无文章</h4>
 | |
|                                 <p>当前分类下没有找到相关文章</p>
 | |
|                             </div>
 | |
|                         {/if}
 | |
|                     {/if}
 | |
|                     {/volist}
 | |
|                 </div>
 | |
| 
 | |
|                 <!-- 分页 -->
 | |
|                 <div class="modern-pagination" id="pagination"></div>
 | |
|             </main>
 | |
|         </div>
 | |
|     </div>
 | |
| </div>
 | |
| 
 | |
| <script>
 | |
|     layui.use(['laypage', 'jquery'], function(){
 | |
|         var laypage = layui.laypage;
 | |
|         var $ = layui.jquery;
 | |
| 
 | |
|         // 分类切换
 | |
|         $('.menu-item').on('click', function() {
 | |
|             var cateid = $(this).data('cateid');
 | |
|             var $menuItems = $('.menu-item');
 | |
|             
 | |
|             // 更新选中状态
 | |
|             $menuItems.removeClass('active');
 | |
|             $(this).addClass('active');
 | |
|             
 | |
|             // 加载文章
 | |
|             loadArticles(cateid, 1);
 | |
|         });
 | |
| 
 | |
|         // 页面加载完成后,自动触发第一个分类的点击事件
 | |
|         $(document).ready(function() {
 | |
|             var $firstMenuItem = $('.menu-item').first();
 | |
|             if ($firstMenuItem.length > 0) {
 | |
|                 $firstMenuItem.click();
 | |
|             }
 | |
|         });
 | |
| 
 | |
|         // 加载文章函数
 | |
|         function loadArticles(cateid, page) {
 | |
|             $.ajax({
 | |
|                 url: '/index/program/list',
 | |
|                 type: 'POST',
 | |
|                 data: {
 | |
|                     cate: cateid,
 | |
|                     page: page
 | |
|                 },
 | |
|                 beforeSend: function() {
 | |
|                     $('#programList').html('<div class="loading-state"><i class="layui-icon layui-icon-loading"></i>加载中...</div>');
 | |
|                 },
 | |
|                 success: function(res) {
 | |
|                     if(res.code === 1) {
 | |
|                         var html = '';
 | |
|                         if(res.data.programs && res.data.programs.length > 0) {
 | |
|                             res.data.programs.forEach(function(program) {
 | |
|                                 html += `<program class="program-card">
 | |
|                                     <div class="card-image">
 | |
|                                         <img src="${program.icon || '/static/images/default-program.jpg'}" alt="${program.title}">
 | |
|                                         <div class="image-overlay"></div>
 | |
|                                     </div>
 | |
|                                     <div class="card-content">
 | |
|                                         <div class="meta-info">
 | |
|                                             <span class="category-tag">${program.category_name || '未分类'}</span>
 | |
|                                             <time class="publish-date">${program.create_time || ''}</time>
 | |
|                                         </div>
 | |
|                                         <h3 class="program-title">${program.title}</h3>
 | |
|                                         <div class="card-footer">
 | |
|                                             <div class="stats">
 | |
|                                                 <span class="views"><i class="layui-icon layui-icon-eye"></i> ${program.views || 0}</span>
 | |
|                                                 <span class="likes"><i class="layui-icon layui-icon-praise"></i> ${program.likes || 0}</span>
 | |
|                                             </div>
 | |
|                                             <a href="/index/program/detail?id=${program.id}" class="read-more">阅读更多</a>
 | |
|                                         </div>
 | |
|                                     </div>
 | |
|                                 </program>`;
 | |
|                             });
 | |
|                         } else {
 | |
|                             html = `<div class="empty-state">
 | |
|                                 <div class="empty-icon">
 | |
|                                     <i class="layui-icon layui-icon-template-1"></i>
 | |
|                                 </div>
 | |
|                                 <h4>暂无文章</h4>
 | |
|                                 <p>当前分类下没有找到相关文章</p>
 | |
|                             </div>`;
 | |
|                         }
 | |
|                         $('#programList').html(html);
 | |
|                         
 | |
|                         // 渲染分页
 | |
|                         laypage.render({
 | |
|                             elem: 'pagination',
 | |
|                             count: res.data.total || 0,
 | |
|                             limit: res.data.per_page || 12,
 | |
|                             curr: res.data.current_page || 1,
 | |
|                             theme: '#1E9FFF',
 | |
|                             layout: ['prev', 'page', 'next'],
 | |
|                             jump: function(obj, first) {
 | |
|                                 if(!first) {
 | |
|                                     loadArticles(cateid, obj.curr);
 | |
|                                 }
 | |
|                             }
 | |
|                         });
 | |
|                     }
 | |
|                 }
 | |
|             });
 | |
|         }
 | |
|     });
 | |
| </script>
 | |
| 
 | |
| {include file="component/footer" /}
 | |
| 
 | |
| <style>
 | |
|     /* 基础样式重置 */
 | |
|     .modern-programs-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: 80px 0 60px;
 | |
|         text-align: center;
 | |
|         margin-bottom: 40px;
 | |
|     }
 | |
| 
 | |
|     .modern-title {
 | |
|         font-size: 2.5rem;
 | |
|         font-weight: 300;
 | |
|         margin-bottom: 15px;
 | |
|         letter-spacing: 1px;
 | |
|     }
 | |
| 
 | |
|     .modern-subtitle {
 | |
|         font-size: 1.1rem;
 | |
|         font-weight: 300;
 | |
|         opacity: 0.9;
 | |
|         margin: 0;
 | |
|     }
 | |
| 
 | |
|     /* 布局结构 */
 | |
|     .modern-layout {
 | |
|         display: grid;
 | |
|         grid-template-columns: 260px 1fr;
 | |
|         gap: 30px;
 | |
|     }
 | |
| 
 | |
|     /* 侧边栏样式 */
 | |
|     .modern-sidebar {
 | |
|         position: sticky;
 | |
|         top: 30px;
 | |
|         align-self: start;
 | |
|     }
 | |
| 
 | |
|     .sidebar-card {
 | |
|         background: white;
 | |
|         border-radius: 8px;
 | |
|         box-shadow: 0 2px 15px rgba(0, 0, 0, 0.03);
 | |
|         overflow: hidden;
 | |
|     }
 | |
| 
 | |
|     .sidebar-title {
 | |
|         font-size: 1.1rem;
 | |
|         font-weight: 500;
 | |
|         padding: 20px;
 | |
|         margin: 0;
 | |
|         display: flex;
 | |
|         align-items: center;
 | |
|         color: #555;
 | |
|         border-bottom: 1px solid #f0f0f0;
 | |
|     }
 | |
| 
 | |
|     .sidebar-title i {
 | |
|         margin-right: 10px;
 | |
|         font-size: 1.2rem;
 | |
|         color: #1E9FFF;
 | |
|     }
 | |
| 
 | |
|     .category-menu {
 | |
|         list-style: none;
 | |
|         padding: 0;
 | |
|         margin: 0;
 | |
|     }
 | |
| 
 | |
|     .menu-item {
 | |
|         padding: 15px 20px;
 | |
|         display: flex;
 | |
|         justify-content: space-between;
 | |
|         align-items: center;
 | |
|         cursor: pointer;
 | |
|         transition: all 0.2s ease;
 | |
|         border-left: 3px solid transparent;
 | |
|     }
 | |
| 
 | |
|     .menu-item:hover {
 | |
|         background-color: #f8fafd;
 | |
|         color: #1E9FFF;
 | |
|     }
 | |
| 
 | |
|     .menu-item.active {
 | |
|         background-color: #f0f7ff;
 | |
|         border-left-color: #1E9FFF;
 | |
|         color: #1E9FFF;
 | |
|         font-weight: 500;
 | |
|     }
 | |
| 
 | |
|     .menu-item i {
 | |
|         font-size: 0.9rem;
 | |
|         color: #aaa;
 | |
|     }
 | |
| 
 | |
|     .menu-item.active i,
 | |
|     .menu-item:hover i {
 | |
|         color: #1E9FFF;
 | |
|     }
 | |
| 
 | |
|     /* 主内容区样式 */
 | |
|     .modern-main {
 | |
|         background: transparent;
 | |
|     }
 | |
| 
 | |
|     /* 文章网格布局 */
 | |
|     .article-grid {
 | |
|         display: grid;
 | |
|         grid-template-columns: repeat(4, 1fr);
 | |
|         gap: 20px;
 | |
|         margin-bottom: 40px;
 | |
|     }
 | |
| 
 | |
|     /* 文章卡片样式 */
 | |
|     .article-card {
 | |
|         background: white;
 | |
|         border-radius: 8px;
 | |
|         overflow: hidden;
 | |
|         box-shadow: 0 3px 15px rgba(0, 0, 0, 0.03);
 | |
|         transition: all 0.3s ease;
 | |
|         display: flex;
 | |
|         flex-direction: column;
 | |
|     }
 | |
| 
 | |
|     .article-card:hover {
 | |
|         transform: translateY(-5px);
 | |
|         box-shadow: 0 5px 25px rgba(0, 0, 0, 0.08);
 | |
|     }
 | |
| 
 | |
|     .card-image {
 | |
|         height: 180px;
 | |
|         position: relative;
 | |
|         overflow: hidden;
 | |
|     }
 | |
| 
 | |
|     .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);
 | |
|     }
 | |
| 
 | |
|     .article-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;
 | |
|     }
 | |
| 
 | |
|     .category-tag {
 | |
|         background: #f0f7ff;
 | |
|         color: #1E9FFF;
 | |
|         padding: 3px 10px;
 | |
|         border-radius: 4px;
 | |
|         font-size: 0.75rem;
 | |
|     }
 | |
| 
 | |
|     .program-title {
 | |
|         font-size: 1rem;
 | |
|         font-weight: 500;
 | |
|         margin: 0 0 10px;
 | |
|         color: #333;
 | |
|         line-height: 1.4;
 | |
|         display: -webkit-box;
 | |
|         -webkit-line-clamp: 2;
 | |
|         -webkit-box-orient: vertical;
 | |
|         overflow: hidden;
 | |
|         text-overflow: ellipsis;
 | |
|     }
 | |
| 
 | |
|     .program-excerpt {
 | |
|         font-size: 0.9rem;
 | |
|         color: #666;
 | |
|         margin: 0 0 20px;
 | |
|         flex: 1;
 | |
|         display: -webkit-box;
 | |
|         -webkit-line-clamp: 3;
 | |
|         -webkit-box-orient: vertical;
 | |
|         overflow: hidden;
 | |
|     }
 | |
| 
 | |
|     .card-footer {
 | |
|         display: flex;
 | |
|         justify-content: space-between;
 | |
|         align-items: center;
 | |
|         margin-top: auto;
 | |
|     }
 | |
| 
 | |
|     .stats {
 | |
|         font-size: 0.85rem;
 | |
|         color: #999;
 | |
|         display: flex;
 | |
|         gap: 15px;
 | |
|     }
 | |
| 
 | |
|     .stats i {
 | |
|         margin-right: 3px;
 | |
|     }
 | |
| 
 | |
|     .read-more {
 | |
|         color: #1E9FFF;
 | |
|         font-size: 0.9rem;
 | |
|         text-decoration: none;
 | |
|         font-weight: 500;
 | |
|         transition: all 0.2s ease;
 | |
|         display: inline-flex;
 | |
|         align-items: center;
 | |
|     }
 | |
| 
 | |
|     .read-more:hover {
 | |
|         color: #0d8aff;
 | |
|         text-decoration: underline;
 | |
|     }
 | |
| 
 | |
|     /* 分页样式 */
 | |
|     .modern-pagination {
 | |
|         text-align: center;
 | |
|         margin-top: 40px;
 | |
|     }
 | |
| 
 | |
|     .layui-laypage a, 
 | |
|     .layui-laypage span {
 | |
|         border-radius: 4px !important;
 | |
|         margin: 0 3px !important;
 | |
|     }
 | |
| 
 | |
|     .layui-laypage a {
 | |
|         color: #666 !important;
 | |
|     }
 | |
| 
 | |
|     .layui-laypage .layui-laypage-curr .layui-laypage-em {
 | |
|         background-color: #1E9FFF !important;
 | |
|     }
 | |
| 
 | |
|     /* 空状态样式 */
 | |
|     .empty-state {
 | |
|         grid-column: 1 / -1;
 | |
|         text-align: center;
 | |
|         padding: 60px 20px;
 | |
|         background: white;
 | |
|         border-radius: 8px;
 | |
|         box-shadow: 0 3px 15px rgba(0, 0, 0, 0.03);
 | |
|     }
 | |
| 
 | |
|     .empty-icon {
 | |
|         font-size: 3rem;
 | |
|         color: #ddd;
 | |
|         margin-bottom: 20px;
 | |
|     }
 | |
| 
 | |
|     .empty-icon i {
 | |
|         font-size: inherit;
 | |
|     }
 | |
| 
 | |
|     .empty-state h4 {
 | |
|         font-size: 1.2rem;
 | |
|         font-weight: 400;
 | |
|         color: #666;
 | |
|         margin: 0 0 10px;
 | |
|     }
 | |
| 
 | |
|     .empty-state p {
 | |
|         color: #999;
 | |
|         font-size: 0.95rem;
 | |
|         margin: 0;
 | |
|     }
 | |
| 
 | |
|     /* 加载状态 */
 | |
|     .loading-state {
 | |
|         grid-column: 1 / -1;
 | |
|         text-align: center;
 | |
|         padding: 40px;
 | |
|         color: #666;
 | |
|     }
 | |
| 
 | |
|     .loading-state i {
 | |
|         font-size: 1.5rem;
 | |
|         margin-right: 10px;
 | |
|         animation: spin 1s linear infinite;
 | |
|     }
 | |
| 
 | |
|     @keyframes spin {
 | |
|         0% { transform: rotate(0deg); }
 | |
|         100% { transform: rotate(360deg); }
 | |
|     }
 | |
| 
 | |
|     /* 响应式设计 */
 | |
|     @media (max-width: 1200px) {
 | |
|         .article-grid {
 | |
|             grid-template-columns: repeat(3, 1fr);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     @media (max-width: 992px) {
 | |
|         .modern-layout {
 | |
|             grid-template-columns: 1fr;
 | |
|         }
 | |
|         
 | |
|         .modern-sidebar {
 | |
|             position: static;
 | |
|             margin-bottom: 30px;
 | |
|         }
 | |
|         
 | |
|         .article-grid {
 | |
|             grid-template-columns: repeat(2, 1fr);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     @media (max-width: 576px) {
 | |
|         .article-grid {
 | |
|             grid-template-columns: 1fr;
 | |
|         }
 | |
|         
 | |
|         .modern-title {
 | |
|             font-size: 1.8rem;
 | |
|         }
 | |
|         
 | |
|         .modern-subtitle {
 | |
|             font-size: 1rem;
 | |
|         }
 | |
|     }
 | |
| </style>
 | |
| 
 | |
| {include file="component/foot" /} | 
