Browse Source

home page

tags/v1.22.11.3^2
chenshihai 3 years ago
parent
commit
f7bc918b4d
4 changed files with 41 additions and 41 deletions
  1. +38
    -40
      public/home/home.js
  2. +1
    -0
      templates/base/head.tmpl
  3. +1
    -0
      templates/base/head_home.tmpl
  4. +1
    -1
      templates/base/head_notice.tmpl

+ 38
- 40
public/home/home.js View File

@@ -17,38 +17,6 @@ var swiperNewMessage = new Swiper(".newslist", {
disableOnInteraction: false, 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", { var swiperRepo = new Swiper(".homepro-list", {
slidesPerView: 1, slidesPerView: 1,
@@ -579,13 +547,13 @@ function queryRecommendData(){


function displayActivity(json){ function displayActivity(json){
var activityDiv = document.getElementById("recommendactivity"); var activityDiv = document.getElementById("recommendactivity");
if (!activityDiv) return;
if (!activityDiv) return;
var html = ""; var html = "";
if (json != null && json.length > 0){ if (json != null && json.length > 0){
for(var i = 0; i < json.length;i++){ for(var i = 0; i < json.length;i++){
var record = json[i]; var record = json[i];
var name = isZh ? (record["name"] || '') : (record["name_en"] || record["name"]); var name = isZh ? (record["name"] || '') : (record["name_en"] || record["name"]);
html += "<div class=\"swiper-slide\">";
html += "<div class=\"swiper-slide\" style=\"text-align:center;\">";
html += "<a href=\"" + record["image_link"] + "\">"; html += "<a href=\"" + record["image_link"] + "\">";
html += " <div class=\"image ui card\"><img src=\"" + record["url"] + "\">"; html += " <div class=\"image ui card\"><img src=\"" + record["url"] + "\">";
html += ' <div class="image-name" title="' + name + '">' + name + "</div>"; html += ' <div class="image-name" title="' + name + '">' + name + "</div>";
@@ -593,10 +561,42 @@ function displayActivity(json){
html += "</a>"; html += "</a>";
html += "</div>"; html += "</div>";
} }
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){ function displayRepo(json){
@@ -624,9 +624,7 @@ function displayRepo(json){
// <i class="ri-star-line"></i>${repo["NumStars"]}<i class="ri-git-branch-line am-ml-10"></i>${repo["NumForks"]}</span> <div class="ui tags nowrap am-mt-10"></div> // <i class="ri-star-line"></i>${repo["NumStars"]}<i class="ri-git-branch-line am-ml-10"></i>${repo["NumForks"]}</span> <div class="ui tags nowrap am-mt-10"></div>
html += `<div class="ui fluid card" style="border-radius:6px;"> html += `<div class="ui fluid card" style="border-radius:6px;">
<div class="content"> <div class="content">
<span class="right floated meta">
<img class="left floated mini ui image" src="${repo["Avatar"]}">
</span>
<img class="left floated mini ui image" src="${repo["Avatar"]}">
<a class="header nowrap" style="color:rgb(50, 145, 248);font-size:14px;" href="/${repo["OwnerName"]}/${repo["Name"]}" title="${repo["Alias"]}"> + ${repo["Alias"]}</a> <a class="header nowrap" style="color:rgb(50, 145, 248);font-size:14px;" href="/${repo["OwnerName"]}/${repo["Name"]}" title="${repo["Alias"]}"> + ${repo["Alias"]}</a>
<div class="description nowrap-2" style="rgba(136,136,136,1);;font-size:12px;" title="${repo["Description"]}">${repo["Description"]}</div> <div class="description nowrap-2" style="rgba(136,136,136,1);;font-size:12px;" title="${repo["Description"]}">${repo["Description"]}</div>
`; `;


+ 1
- 0
templates/base/head.tmpl View File

@@ -240,6 +240,7 @@ var _hmt = _hmt || [];
} }
} }
if (isShowNoticeTag){ if (isShowNoticeTag){
if (!document.getElementById("notic_content")) return;
if(isNewNotice){ if(isNewNotice){
document.getElementById("notic_content").style.display='block' document.getElementById("notic_content").style.display='block'
}else{ }else{


+ 1
- 0
templates/base/head_home.tmpl View File

@@ -247,6 +247,7 @@ var _hmt = _hmt || [];
} }
} }
if (isShowNoticeTag){ if (isShowNoticeTag){
if (!document.getElementById("notic_content")) return;
if(isNewNotice){ if(isNewNotice){
document.getElementById("notic_content").style.display='block' document.getElementById("notic_content").style.display='block'
}else{ }else{


+ 1
- 1
templates/base/head_notice.tmpl View File

@@ -1,5 +1,5 @@
{{if not .IsCourse}} {{if not .IsCourse}}
{{ if .notices}}
{{ if (and .notices (not .PageIsHome)) }}
<div class="notic_content" id ="notic_content" style="display: block; position: relative"> <div class="notic_content" id ="notic_content" style="display: block; position: relative">
<div class="ui container"> <div class="ui container">
<marquee behavior="scroll" direction="left"> <marquee behavior="scroll" direction="left">


Loading…
Cancel
Save