diff --git a/custom/public/img/home-banner-01-en.jpg b/custom/public/img/home-banner-01-en.jpg
new file mode 100644
index 000000000..59001d4f0
Binary files /dev/null and b/custom/public/img/home-banner-01-en.jpg differ
diff --git a/custom/public/img/home-banner-01.jpg b/custom/public/img/home-banner-01.jpg
new file mode 100644
index 000000000..1aa0563c4
Binary files /dev/null and b/custom/public/img/home-banner-01.jpg differ
diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini
index 867f26b7e..7bd439888 100755
--- a/options/locale/locale_en-US.ini
+++ b/options/locale/locale_en-US.ini
@@ -297,6 +297,7 @@ openi_experience_officer_plan=OpenI AI experience officer growth plan
more_benefits=, More benefits
org_see=See
more_notice=More notices
+vedio_detail=Video details
[explore]
repos = Repositories
diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini
index cf8ca3be6..6f4de25ad 100755
--- a/options/locale/locale_zh-CN.ini
+++ b/options/locale/locale_zh-CN.ini
@@ -300,6 +300,7 @@ openi_experience_officer_plan=启智社区体验官成长计划
more_benefits=,超多福利大放送
org_see=。查看
more_notice=更多通知
+vedio_detail=详细介绍视频
[explore]
repos=项目
diff --git a/public/home/home.js b/public/home/home.js
index 4028987e0..8744eec09 100755
--- a/public/home/home.js
+++ b/public/home/home.js
@@ -17,38 +17,6 @@ var swiperNewMessage = new Swiper(".newslist", {
disableOnInteraction: false,
},
});
-var swiperEvent = new Swiper(".event-list", {
- slidesPerView: 1,
- spaceBetween: 30,
- // pagination: {
- // el: ".swiper-pagination",
- // clickable: true,
- // },
- autoplay: {
- delay: 2500,
- disableOnInteraction: false,
- },
- breakpoints: {
- 768: {
- slidesPerView: 2,
- },
- 1024: {
- slidesPerView: 3,
- },
- 1200: {
- slidesPerView: 3,
- },
- 1440: {
- slidesPerView: 4,
- },
- 1840: {
- slidesPerView: 4,
- },
- 1920: {
- slidesPerView: 4,
- },
- },
-});
var swiperRepo = new Swiper(".homepro-list", {
slidesPerView: 1,
@@ -579,23 +547,56 @@ function queryRecommendData(){
function displayActivity(json){
var activityDiv = document.getElementById("recommendactivity");
- if (!activityDiv) return;
+ if (!activityDiv) return;
var html = "";
if (json != null && json.length > 0){
for(var i = 0; i < json.length;i++){
- var record = json[i]
- html += "
";
+ var record = json[i];
+ var name = isZh ? (record["name"] || '') : (record["name_en"] || record["name"]);
+ html += "
";
}
+ var swiperEvent = new Swiper(".event-list", {
+ slidesPerView: 1,
+ spaceBetween: 30,
+ // pagination: {
+ // el: ".swiper-pagination",
+ // clickable: true,
+ // },
+ autoplay: {
+ delay: 2500,
+ disableOnInteraction: false,
+ },
+ breakpoints: {
+ 768: {
+ slidesPerView: Math.min(2, json.length),
+ },
+ 1024: {
+ slidesPerView: Math.min(3, json.length),
+ },
+ 1200: {
+ slidesPerView: Math.min(3, json.length),
+ },
+ 1440: {
+ slidesPerView: Math.min(4, json.length),
+ },
+ 1840: {
+ slidesPerView: Math.min(4, json.length),
+ },
+ 1920: {
+ slidesPerView: Math.min(4, json.length),
+ },
+ },
+ });
+ activityDiv.innerHTML = html;
+ swiperEvent.updateSlides();
+ swiperEvent.updateProgress();
}
- activityDiv.innerHTML = html;
- swiperEvent.updateSlides();
- swiperEvent.updateProgress();
}
function displayRepo(json){
@@ -605,7 +606,8 @@ function displayRepo(json){
var repoMap = {};
for (var i = 0, iLen = json.length; i < iLen; i++) {
var repo = json[i];
- var label = repo.Label;
+ var labelSearch = repo.Label;
+ var label = isZh ? repo.Label : repo.Label_en;
if (repoMap[label]) {
repoMap[label].push(repo);
} else {
@@ -615,16 +617,14 @@ function displayRepo(json){
for (var label in repoMap) {
var repos = repoMap[label];
- html += `
`;
+ html += `
`;
for (var i = 0, iLen = repos.length; i < iLen; i++) {
if (i >= 4) break;
var repo = repos[i];
//
${repo["NumStars"]}
${repo["NumForks"]}
html += `
-
-
-
+
${repo["Description"]}
`;
@@ -755,8 +755,9 @@ function getNotice() {
var noticeEl = noticeEls.eq(i);
var noticeObj = noticeList[i];
if (noticeObj) {
+ var title = isZh ? noticeObj.Title : (noticeObj.Title_en || noticeObj.Title);
noticeEl.attr('href', noticeObj.Link);
- noticeEl.find('span').text(isZh ? noticeObj.Title : (noticeObj.Title_en || noticeObj.Title));
+ noticeEl.find('span').text(title).attr('title', title);
noticeEl.show();
} else {
noticeEl.hide();
@@ -805,5 +806,48 @@ function getRecommendModule() {
});
}
+function initHomeTopBanner() {
+ var homeSlideTimer = null;
+ var homeSlideDuration = 8000;
+ function homeSlide(direction) {
+ var slidePages = $('._hm-pg-c ._hm-pg');
+ var currentPage = slidePages.filter('._hm-pg-show');
+ var currentIndex = currentPage.index();
+ var next = direction == 'left' ? currentIndex - 1 : currentIndex + 1;
+ if (next < 0) next = slidePages.length - 1;
+ if (next == slidePages.length) next = 0;
+ slidePages.removeClass('_hm-pg-show');
+ slidePages.eq(next).addClass('_hm-pg-show');
+ }
+
+ function startSlide() {
+ homeSlideTimer && clearTimeout(homeSlideTimer);
+ homeSlideTimer = setTimeout(function() {
+ homeSlide('right');
+ startSlide();
+ }, homeSlideDuration);
+ }
+
+ function stopSlide() {
+ homeSlideTimer && clearTimeout(homeSlideTimer);
+ }
+
+ $('._hm-slide-btn').on('click', function () {
+ if ($(this).hasClass('_hm-slide-btn-left')) {
+ homeSlide('left');
+ } else {
+ homeSlide('right');
+ }
+ startSlide();
+ });
+ $('._hm-pg #homenews').on('mouseenter', function() {
+ stopSlide();
+ }).on('mouseleave', function() {
+ startSlide();
+ });
+ setTimeout(function() { startSlide(); }, 500);
+}
+
+initHomeTopBanner();
getNotice();
getRecommendModule();
diff --git a/templates/base/footer_content.tmpl b/templates/base/footer_content.tmpl
index 7e1ac7786..a017bf367 100755
--- a/templates/base/footer_content.tmpl
+++ b/templates/base/footer_content.tmpl
@@ -96,6 +96,11 @@
{{.i18n.Tr "home.powerdby"}}
Trustie确实{{.i18n.Tr "、Gitea"}}
-
+
+
+
diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl
index 4ab9da231..f4766bc9d 100755
--- a/templates/base/head.tmpl
+++ b/templates/base/head.tmpl
@@ -240,6 +240,7 @@ var _hmt = _hmt || [];
}
}
if (isShowNoticeTag){
+ if (!document.getElementById("notic_content")) return;
if(isNewNotice){
document.getElementById("notic_content").style.display='block'
}else{
diff --git a/templates/base/head_home.tmpl b/templates/base/head_home.tmpl
index a77d7b00a..6456e2a4a 100644
--- a/templates/base/head_home.tmpl
+++ b/templates/base/head_home.tmpl
@@ -247,6 +247,7 @@ var _hmt = _hmt || [];
}
}
if (isShowNoticeTag){
+ if (!document.getElementById("notic_content")) return;
if(isNewNotice){
document.getElementById("notic_content").style.display='block'
}else{
diff --git a/templates/base/head_notice.tmpl b/templates/base/head_notice.tmpl
index 43c581e6e..9bd35bcb6 100644
--- a/templates/base/head_notice.tmpl
+++ b/templates/base/head_notice.tmpl
@@ -1,5 +1,5 @@
{{if not .IsCourse}}
- {{ if .notices}}
+ {{ if (and .notices (not .PageIsHome)) }}