Browse Source

提交代码。

Signed-off-by: zouap <zouap@pcl.ac.cn>
pull/1788/head
zouap 3 years ago
parent
commit
77a2cb0cdb
4 changed files with 28 additions and 8 deletions
  1. +11
    -7
      public/home/search.js
  2. +5
    -0
      routers/search.go
  3. +2
    -0
      templates/explore/search_new.tmpl
  4. +10
    -1
      web_src/less/openi.less

+ 11
- 7
public/home/search.js View File

@@ -139,8 +139,8 @@ function search(){
if(currentSearchTableName != "dataset"){
doSearch("dataset",currentSearchKeyword,1,pageSize,true,"",false);
}
if(currentSearchTableName != "dataset"){
doSearch("dataset",currentSearchKeyword,1,pageSize,true,"",false);
if(currentSearchTableName != "pr"){
doSearch("pr",currentSearchKeyword,1,pageSize,true,"",false);
}
}
}
@@ -487,7 +487,7 @@ function setIssueOrPrInnerHtml(data,path){
if(recordMap["is_closed"] != null && (!(recordMap["is_closed"]) || recordMap["is_closed"]=="f")){
html += "开启中";
}else{
html += "关闭";
html += "关闭";
}
html +=" &nbsp;&nbsp;&nbsp;&nbsp;<i class=\"ri-message-2-line am-ml-10\"></i> " + recordMap["num_comments"];
html +=" <span class=\"am-ml-10\">&nbsp;&nbsp;</span>&nbsp;&nbsp;最后更新于 <span class=\"time-since poping up\" title=\"\" data-content=\"\" data-variation=\"inverted tiny\">" + getTime(recordMap["updated_unix"],currentTime) +"</span>";
@@ -640,7 +640,7 @@ var repoAndOrgZH={
"5":"分钟前",
"6":"秒前",
"7":"天前",
"8":"月前",
"8":"月前",
"9":"年前"
};

@@ -691,18 +691,22 @@ function page(current){

function goPage(){
var goNum = $('#inputpage').val();
if (goNum<=0){
alert("请输入大于0的数值");
showTip("请输入大于0的数值","warning");
}
else if(goNum<=totalPage){
page(goNum);
}
else{
alert("不能超出总页数!");
showTip("不能超出总页数!","warning");
}
}

function showTip(tip, type) {
var $tip = $('#tipmsg');
$tip.stop(true).prop('class', 'alert alert-' + type).html(tip).css('margin-left', - $tip.outerWidth() / 2).fadeIn(500).delay(2000).fadeOut(500);
}

function setPage(currentPage){
console.log("totalPage=" + totalPage);
var html ="";


+ 5
- 0
routers/search.go View File

@@ -350,6 +350,7 @@ func makePrivateRepo(repos models.RepositoryList, res *SearchRes, keyword string
record["avatar"] = setting.RepositoryAvatarFallbackImage
}
record["updated_unix"] = repo.UpdatedUnix
record["updated_html"] = timeutil.TimeSinceUnix(repo.UpdatedUnix, "zh-CN")
lang, err := repo.GetTopLanguageStats(1)
if err == nil && len(lang) > 0 {
record["lang"] = lang[0].Language
@@ -440,6 +441,10 @@ func makeRepoResult(sRes *elastic.SearchResult, Key string, OnlyReturnNum bool)
}
}
record["updated_unix"] = recordSource["updated_unix"]
timeInt, err := strconv.ParseInt(recordSource["updated_unix"].(string), 10, 64)
if err == nil {
record["updated_html"] = timeutil.TimeSinceUnix(timeutil.TimeStamp(timeInt), "zh-CN")
}
record["lang"] = recordSource["lang"]
record["is_private"] = false
result = append(result, record)


+ 2
- 0
templates/explore/search_new.tmpl View File

@@ -102,4 +102,6 @@
<script src="/home/search.js?v={{MD5 AppVer}}" type="text/javascript"></script>
<div class="am-mt-30"></div>

<div id="tipmsg"></div>

{{template "base/footer" .}}

+ 10
- 1
web_src/less/openi.less View File

@@ -876,4 +876,13 @@ display: block;
font-size: 24px;
text-align: left;
font-family: SourceHanSansSC-medium;
}
}


#tipmsg {
position: absolute;
top: 50px;
left: 50%;
display: none;
z-index: 9999;
}

Loading…
Cancel
Save