数据加载中

视频中心
公开信息按发布时间滚动。阅读「星空体育APP怎么用」后,可返回栏目或查看相邻条目。
建议先扫读标题与摘要,再进入全文。同栏目条目通常按更新顺序排列。
继续浏览时优先选择同栏目或相近主题,避免被站外镜像带偏。
`; }); $('.swiper-wrapper').html(html); let titleHtml = ''; bannerList.forEach((item, index) => { titleHtml += `
${item.title}
`; }); $('.swiper-title').html(titleHtml); var mySwiper = new Swiper('.swiper-container', { pagination: '.swiper-pagination', paginationHide: true, paginationClickable: true, onSlideChangeEnd: function(swiper){ $('.title-item').hide(); $(`.title-item[data-index="${swiper.activeIndex}"]`).show(); } }); $('.swiper-slide').click(function() { const url = $(this).attr('url'); parent.window.locations.href = url; }); }, error: function (err) { console.log(err) } }); } // 加载数据函数 function loadData(attempt = 1) { const params = { Page: pageIndex, PerPage: 3000, Search: keywords, Orders: news ? 'addDate desc' : '', Hot: hot ? 1 : 0, Cjl: scene, Cpl: product, index: '视频中心' } $.ajax({ url: '/api/app/cms/contents', type: 'GET', dataType: 'json', data: params, timeout: 10000, // 设置请求超时时间为10秒 success: function (data) { totalCount = data.totalCount; renderContent(data.contents); // renderPagination(); hideLoading(); }, error: function (xhr, status, error) { if (status === 'timeout') { console.log('请求超时,正在重试...'); if (attempt < 3) { setTimeout(() => loadData(attempt + 1), 2000); } else { alert('请求失败,请稍后重试。'); } } else { // } } }); } // 加载数据函数 function loadPhoneData() { const params = { Page: pageIndex, PerPage: 3000, Search: '', Orders: news ? 'addDate desc' : '', Hot: 0, Cjl: scene, Cpl: '', index: '视频中心' } $.ajax({ url: '/api/app/cms/contents', type: 'GET', dataType: 'json', data: params, success: function (data) { totalCount = data.totalCount; renderContent(data.contents); hideLoading(); }, error: function (err) { console.log(err) } }); } function renderPagination() { const totalPages = Math.ceil(totalCount / pageSize); if (totalPages > 1) { let paginationHtml = ''; // 显示5个页码(当前页居中) let startPage = Math.max(1, pageIndex - 2); let endPage = Math.min(totalPages, startPage + 4); for (let i = startPage; i <= endPage; i++) { paginationHtml += `
`; } paginationHtml += ''; $('.paging-box').html(paginationHtml); } else { $('.paging-box').html(''); } } function highlightKeyword(text, keyword) { if (!keyword) return text; const regex = new RegExp(keyword, 'gi'); return text.replace(regex, match => `${match}`); } // 渲染内容函数 function renderContent(data) { let html = ''; if (data && data.length > 0) { data.forEach(item => { html += `
${highlightKeyword(item.summary, keywords) || ''}
`; }); } else { html = '

暂无内容
'; } $('#contentArea').html(html); const gap = $('.left-nav').width() === 67 ? '18px' : '22px'; const width = $('.left-nav').width() === 67 ? 'calc(20% - 15px)' : 'calc(25% - 17px)'; $(".video-box").css('column-gap', gap); $(".video-box .item").css('width', width); let phoneHtml = ''; if (data && data.length > 0) { data.forEach(item => { phoneHtml += `
`; }); } else { phoneHtml = '

暂无内容
'; } $('.phones-list').html(phoneHtml); } //最新热门切换 $('.normal-tab').click(function () { $('.normal-tab').removeClass('active-tab'); $(this).addClass('active-tab'); hot = $(this).attr('value') === 'Hot'; news = $(this).attr('value') === 'New'; pageIndex = 1; loadData(); }) //tab切换 $('.filter-tab').click(function () { const parentClass = $(this).parent().hasClass('filter-one') ? 'filter-one' : 'filter-two'; $(`.${parentClass} .filter-tab`).removeClass('tab-weight'); $(this).addClass('tab-weight'); if (parentClass === 'filter-one') { scene = $(this).attr('value'); } else { product = $(this).attr('value'); } pageIndex = 1; loadData(); }); // 分页点击事件 $(document).on('click', '.page-prev', function () { if (pageIndex > 1) { pageIndex--; loadData(); } }); $(document).on('click', '.page-next', function () { if (pageIndex < Math.ceil(totalCount / pageSize)) { pageIndex++; loadData(); } }); function loadDefault() { let html = '

' + '

敬请期待
'; $('.default-page').html(html); } function initToggleNav() { let isNavCollapsed = false; function handleNavToggle() { const $leftNav = $('.left-nav'); isNavCollapsed = !isNavCollapsed; if (isNavCollapsed) { } // 调整视频盒子布局 const gap = isNavCollapsed ? '18px' : '22px'; const width = isNavCollapsed ? 'calc(20% - 15px)' : 'calc(25% - 17px)'; $(".video-box").css('column-gap', gap); $(".video-box .item").css('width', width); // 动画效果 $leftNav.animate({ width: isNavCollapsed ? '67px' : '15.6%' }, 300); // 向iframe发送消息 document.getElementById('navFrame').contentWindow.postMessage( { type: 'toggleNav', collapsed: isNavCollapsed }, '*' ); } // 统一绑定事件 $('.toggleNav img').off('click').on('click', handleNavToggle); } //监听切换tab window.addEventListener('message', (event) => { if (event.data.type === 'tabChange') { $(".right-info").css('width', '0') $('.content-section').removeClass('active') .filter(`[data-tab="${event.data.tabId}"]`).addClass('active'); } else { $(".right-info").css('width', '19.8%') } }); // 手机端 $(".nav span").click(function () { $('.nav span').removeClass('active'); $(this).addClass('active'); const index = $(this).index(); if (index === 0) { news = true; scene = ''; $('.banner-contaier').css('display', 'block') } else { scene = $(this).attr('value'); news = false; $('.banner-contaier').css('display', 'none') } loadPhoneData(); }) $(".right-search").click(function () { window.locations.href = `search.html`; }) document.addEventListener('DOMContentLoaded', function () { const dots = document.querySelectorAll('#dots span'); // 创建点的HTML结构 for (let i = 0; i < 3; i++) { const dot = document.createElement('span'); document.getElementById('dots').appendChild(dot); } });