Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Voorivex/9ba0a251eb4747fab649283920b9d026 to your computer and use it in GitHub Desktop.
Save Voorivex/9ba0a251eb4747fab649283920b9d026 to your computer and use it in GitHub Desktop.
function h(b, e) {
url = d.one(".J_ajaxUrl").val();
var f = "keyword=" + (d.one(".J_Tagword") ? d.one(".J_Tagword").val() : d.one(".J_SearchKeyword").val()) + "&searchType=" + e;
url.indexOf("?") > 0 ? url += "&" : url += "?",
c({
url: url + f + "&current=" + b,
type: "post",
dataType: "json",
data: {},
success: function(b) {
if (200 == b.code) {
var c = b.data;
c.typeTotals;
if (c.count > 0) {
var g = [];
c.results.length > 0 ? (a.each(c.results, function(a) {
"0" == e ? g.push("<li>", '<h2><a href="' + a.link + '" target="_blank">' + a.title + "</a></h2>", '<div class="desc">' + a.content + "</div>", '<span class="time" style="margin-right: 10px">' + a.typeName + "</span>", '<span class="time">更新时间: ' + a.gmtModifiedStr + "</span>", "</li>") : g.push("<li>", '<h2><a href="' + a.link + '" target="_blank">' + a.title + "</a></h2>", '<div class="desc">' + a.content + "</div>", '<span class="time">更新时间: ' + a.gmtModifiedStr + "</span>", "</li>")
}),
d.all("ul", ".J_SearchList").html(g.join(""))) : d.all("ul", ".J_SearchList").html('<p style="margin-top:50px;font-size: 16px;">该类目下没有符合条件的搜索结果</p>'),
a.each(d.all(".J_typeTotal"), function(a, b) {
var e = d.all(a);
e.parent();
0 == b ? e.text(c.count) : e.text(c[l[b] + "Count"])
}),
0 == e ? k.changeTotalPage(Math.ceil(c.count / c.size)) : k.changeTotalPage(Math.ceil(c[l[e] + "Count"] / c.size)),
k.setCurrentPage(c.current),
d.all(window).scrollTop(0)
} else
d.all("li", ".J_typeList").show(),
d.all(".J_typeTotal").text(0),
k.changeTotalPage(1),
d.one("#platformId") && "1" == d.one("#platformId").val() ? d.all("ul", ".J_SearchList").html('<p style="margin-top:50px;font-size: 16px;">没有符合条件的搜索结果</p>') : d.all("ul", ".J_SearchList").html('<p style="margin-top:50px;font-size: 16px;">没有符合条件的搜索结果</p><p style="margin-top:10px;color: #0089cd;"><a target="_blank" href="https://open.taobao.com/doc2/docSearch?' + f + '">搜索淘宝开放平台 --\x3e</a></p>')
}
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment