Authored by microTT

首页自动加载传值增加

... ... @@ -436,10 +436,6 @@ define('channel', function(require, exports) {
}
}).init();
var ajaxCount = 0;
/**
* 通过ajax获取更多信息并渲染
* @param {Object} ajaxOption Ajax配置
... ... @@ -524,7 +520,7 @@ define('channel', function(require, exports) {
text += $.trim(childNodes[i].nodeValue);
} else if (childNodes[i].nodeType === 1) {
elemName = childNodes[i].nodeName.toUpperCase();
if (elemName.indexOf(searchElem) > -1){
if (elemName.indexOf(searchElem) > -1) {
text += method.searchTextNode(childNodes[i], text, maxLen);
}
}
... ... @@ -735,9 +731,7 @@ define('channel', function(require, exports) {
return;
}
ajaxOption.data = {
type: status.loadCount
}
ajaxOption.data.type = status.loadCount;
getMoreData(ajaxOption, domOption, template, callback);
... ... @@ -754,6 +748,18 @@ define('channel', function(require, exports) {
ajaxOption: {
url: "/default/LoadNews",
type: "post",
data: {
page: (function() {
var pathname = window.location.pathname.split("/");
pos = Array.prototype.indexOf.call(pathname, "page") + 1;
if (pos < 1) {
return 1;
} else {
return pathname[pos];
}
}())
}
},
domOption: {
... ...
... ... @@ -419,8 +419,7 @@ define('yohood', function(require, exports) {
// $('.slide-control').hide();
// }
//所有品牌
console.log($(".all_brand"));
//所有品牌
$(".all_brand").on("click", function() {
$("input[type=text]").val("");
$(".search-btn").click();
... ... @@ -450,42 +449,76 @@ define('yohood', function(require, exports) {
}
return s;
}
//搜素品牌
$('.search-wrap').find('input').on('keyup', function() {
$(".search-btn").trigger("click.search");
});
$(".search-btn").bind("click.search", function() {
var brand = $.trim($("input[type=text]").val());
var template = '<ul class="brand-list cooperation-list clearfix">{li}</ul>';
var noSearchTemplate = '<div class="no-search" style="display:block;"><p>未搜索到“{brand}”的相关品牌</p><a href="javascript:;" class="all_brand"><查看全部品牌</a></div>';
var html = '';
$.ajax({
type: "post",
url: "/brand/getbrand",
data: {
brand: encodeURIComponent(brand)
},
success: function(data) {
var brands = data.data;
if (data.code == 200 && brands != "") {
$.each(brands, function(k, v) {
html += '<li><a href="javascript:;" target="_blank" title="' + v.name + '"><div class="img-box" brand_id="' + v.id + '">' +
'<img class="grey-brand-logo" width="145" height="97" src="' + common.getImages(v.logo, 'source', 'blogimg', 'primary') + '" alt="" alt="' + v.name + '"></div>' +
'<p>' + cutString(v.name, 20) + '</p></a></li>';
});
$(".brand-content").html(template.replace('{li}', html));
} else {
$(".brand-content").html("");
$(".brand-content").html(noSearchTemplate.replace('{brand}', tools.escapeHTML(brand).replace(/\"/g, "“").replace(/\'/g, "‘")));
({
brandSort: function(brands, sortBase) {
var brandName = "",
i = 0,
len = 0;
if (brands === null || brands === undefined) {
return brands;
}
if (typeof sortBase !== "string" || sortBase === "") {
return brands;
}
for (i = 0, len = brands.length; i < len; i++) {
brandName = brands[i].name;
console.log(brand[i]);
if (brandName.indexOf(sortBase) === 0) {
brands.splice(i, 1).concat(brands);
}
}
$(".all_brand").on("click", function() {
$("input[type=text]").val("");
$(".search-btn").click();
return brands;
},
init: function() {
var that = this;
//搜素品牌
$('.search-wrap').find('input').on('keyup', function() {
$(".search-btn").trigger("click.search");
});
$(".search-btn").bind("click.search", function() {
var brand = $.trim($("input[type=text]").val());
var template = '<ul class="brand-list cooperation-list clearfix">{li}</ul>';
var noSearchTemplate = '<div class="no-search" style="display:block;"><p>未搜索到“{brand}”的相关品牌</p><a href="javascript:;" class="all_brand"><查看全部品牌</a></div>';
var html = '';
$.ajax({
type: "post",
url: "/brand/getbrand",
data: {
brand: encodeURIComponent(brand)
},
success: function(data) {
var brands = data.data;
if (data.code == 200 && brands != "") {
// brands = that.brandSort(brands, brand);
$.each(brands, function(k, v) {
html += '<li><a href="javascript:;" target="_blank" title="' + v.name + '"><div class="img-box" brand_id="' + v.id + '">' +
'<img class="grey-brand-logo" width="145" height="97" src="' + common.getImages(v.logo, 'source', 'blogimg', 'primary') + '" alt="" alt="' + v.name + '"></div>' +
'<p>' + cutString(v.name, 20) + '</p></a></li>';
});
$(".brand-content").html(template.replace('{li}', html));
} else {
$(".brand-content").html("");
$(".brand-content").html(noSearchTemplate.replace('{brand}', tools.escapeHTML(brand).replace(/\"/g, "“").replace(/\'/g, "‘")));
}
$(".all_brand").on("click", function() {
$("input[type=text]").val("");
$(".search-btn").click();
});
}
});
}
});
});
});
console.log(1);
}
}).init();
//品牌列表
$(".brand-list li .img-box").live("click", function(event) {
var brand_id = $(this).attr("brand_id");
... ...