feat(portal): 门户左侧栏目导航+首页视觉升级+主题正名批次-PortalSideNav模型+attachCategoryNavigation注入doCategory/doArticle三件套categoryPath/navTopId/sideNav(站点快照树推导零新增查询,home/search不注入);7主题侧栏两栏markup+窄屏横滚+顶导航祖先高亮+二级下拉当前项高亮+面包屑全路径;cms_category.home_style全链路(news_grid 16条8x2日期前缀/media_focus形态)+PortalListData.Item补source来源徽标四处装配;Banner机制gallery展示位→galleryBanners四列大图轮播(自由字符串零DDL);页脚config 12新键(footer_addresses多校区/qr_*/social_*含URL校验,footerAddressLines由PortalSiteSnapshot.of拆行派生);新增展示型皮肤包campus-glow;fresh-mint2正名fresh-mint(theme.json/头注释同步);AttachmentService scene白名单加category(单页富文本贴图免清孤儿);新增PortalSideNavIT 8+PortalHomeBlocksIT 3,CategoryServiceIT/SiteServiceIT/PortalSsrIT/ThemeContractIT等单类独跑全绿;附sql/clear_cms_data.sql全量清库脚本(清cms_*六表留平台账号/主题包/上传文件,测试数据重走用)
build / build-push (push) Successful in 1m47s
build / build-push (push) Successful in 1m47s
This commit is contained in:
@@ -0,0 +1,117 @@
|
||||
/* campus-glow 皮肤包脚本:顶条日期 + 首页轮播 + 线上展厅画廊翻页 + 返回顶部,无任何外部依赖 */
|
||||
(function () {
|
||||
/* 顶条日期(本地时间,YYYY年M月D日 星期X) */
|
||||
var dateEl = document.getElementById('siteDate');
|
||||
if (dateEl) {
|
||||
var now = new Date();
|
||||
var week = ['日', '一', '二', '三', '四', '五', '六'][now.getDay()];
|
||||
dateEl.textContent = now.getFullYear() + '年' + (now.getMonth() + 1) + '月'
|
||||
+ now.getDate() + '日 星期' + week;
|
||||
}
|
||||
|
||||
/* 首页轮播 */
|
||||
(function () {
|
||||
var root = document.querySelector('.cg-banner');
|
||||
if (!root) return;
|
||||
var slides = root.querySelectorAll('.cg-banner-slide');
|
||||
var dots = root.querySelectorAll('.cg-banner-dots button');
|
||||
var prevBtn = root.querySelector('.cg-banner-arrow.prev');
|
||||
var nextBtn = root.querySelector('.cg-banner-arrow.next');
|
||||
if (!slides.length) return;
|
||||
var current = 0;
|
||||
var timer = null;
|
||||
var INTERVAL = 5000;
|
||||
|
||||
function show(index) {
|
||||
slides[current].classList.remove('active');
|
||||
if (dots[current]) dots[current].classList.remove('active');
|
||||
current = (index + slides.length) % slides.length;
|
||||
slides[current].classList.add('active');
|
||||
if (dots[current]) dots[current].classList.add('active');
|
||||
}
|
||||
function start() {
|
||||
stop();
|
||||
if (slides.length > 1) timer = window.setInterval(function () { show(current + 1); }, INTERVAL);
|
||||
}
|
||||
function stop() {
|
||||
if (timer) { window.clearInterval(timer); timer = null; }
|
||||
}
|
||||
|
||||
dots.forEach(function (dot, index) {
|
||||
dot.addEventListener('click', function () { show(index); start(); });
|
||||
});
|
||||
if (prevBtn) prevBtn.addEventListener('click', function () { show(current - 1); start(); });
|
||||
if (nextBtn) nextBtn.addEventListener('click', function () { show(current + 1); start(); });
|
||||
root.addEventListener('mouseenter', stop);
|
||||
root.addEventListener('mouseleave', start);
|
||||
root.addEventListener('focusin', stop);
|
||||
root.addEventListener('focusout', start);
|
||||
start();
|
||||
})();
|
||||
|
||||
/* 线上展厅画廊:按页翻动(每页 = 当前列数),到尾页回卷 */
|
||||
(function () {
|
||||
var stage = document.querySelector('.cg-gallery-stage');
|
||||
if (!stage) return;
|
||||
var track = stage.querySelector('.cg-gallery-track');
|
||||
var items = track ? track.children : [];
|
||||
var prevBtn = stage.querySelector('.cg-gallery-arrow.prev');
|
||||
var nextBtn = stage.querySelector('.cg-gallery-arrow.next');
|
||||
if (!track || items.length < 1) return;
|
||||
var page = 0;
|
||||
var timer = null;
|
||||
var INTERVAL = 4500;
|
||||
|
||||
function perView() {
|
||||
var w = window.innerWidth;
|
||||
if (w <= 640) return 1;
|
||||
if (w <= 992) return 2;
|
||||
return parseInt(stage.getAttribute('data-cols') || '4', 10) || 4;
|
||||
}
|
||||
function pages() {
|
||||
return Math.max(1, Math.ceil(items.length / perView()));
|
||||
}
|
||||
function update() {
|
||||
if (page >= pages()) page = 0;
|
||||
if (page < 0) page = pages() - 1;
|
||||
track.style.transform = 'translateX(-' + (page * 100) + '%)';
|
||||
}
|
||||
function start() {
|
||||
stop();
|
||||
if (pages() > 1) {
|
||||
timer = window.setInterval(function () { page++; update(); }, INTERVAL);
|
||||
}
|
||||
}
|
||||
function go(delta) { page += delta; update(); start(); }
|
||||
function stop() {
|
||||
if (timer) { window.clearInterval(timer); timer = null; }
|
||||
}
|
||||
|
||||
if (prevBtn) prevBtn.addEventListener('click', function () { go(-1); });
|
||||
if (nextBtn) nextBtn.addEventListener('click', function () { go(1); });
|
||||
stage.addEventListener('mouseenter', stop);
|
||||
stage.addEventListener('mouseleave', start);
|
||||
window.addEventListener('resize', function () { page = 0; update(); });
|
||||
|
||||
update();
|
||||
start();
|
||||
})();
|
||||
|
||||
/* 返回顶部:滚动一屏后出现,点击平滑回顶 */
|
||||
(function () {
|
||||
var btn = document.querySelector('.cg-backtop');
|
||||
if (!btn) return;
|
||||
function toggle() {
|
||||
if (window.scrollY > window.innerHeight * 0.6) {
|
||||
btn.classList.add('visible');
|
||||
} else {
|
||||
btn.classList.remove('visible');
|
||||
}
|
||||
}
|
||||
window.addEventListener('scroll', toggle, { passive: true });
|
||||
btn.addEventListener('click', function () {
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
});
|
||||
toggle();
|
||||
})();
|
||||
})();
|
||||
Reference in New Issue
Block a user