...
|
...
|
@@ -468,9 +468,13 @@ define('channel', function(require, exports) { |
|
|
}
|
|
|
};
|
|
|
|
|
|
|
|
|
/**
|
|
|
* ajax成功函数 渲染模板并改变状态 且调用回调函数
|
|
|
* @param {String} data 成功返回的JSON字符串
|
|
|
*/
|
|
|
ajaxOption.success = function(data) {
|
|
|
// console.log(data);
|
|
|
console.log("ajax success");
|
|
|
console.log(data);
|
|
|
// console.log(status.loadCount);
|
|
|
$(domOption.parent).append(data);
|
|
|
status.loadCount++;
|
...
|
...
|
@@ -481,11 +485,23 @@ define('channel', function(require, exports) { |
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* ajax失败函数
|
|
|
*/
|
|
|
ajaxOption.error = function(err) {
|
|
|
console.log("ajax error");
|
|
|
console.log(err);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 发送ajax请求
|
|
|
* @param {Object} ajaxOption ajax配置对象
|
|
|
* @param {Object} domOption 页面Dom元素信息
|
|
|
* @param {String} template 模板字符串
|
|
|
* @param {Function} callback 回调函数
|
|
|
*/
|
|
|
function getMoreData(ajaxOption, domOption, template, callback) {
|
|
|
console.log("send ajax request");
|
|
|
$.ajax({
|
|
|
url: ajaxOption.url,
|
|
|
data: ajaxOption.data,
|
...
|
...
|
@@ -513,7 +529,6 @@ define('channel', function(require, exports) { |
|
|
type: status.loadCount
|
|
|
}
|
|
|
|
|
|
console.log("typt:" + status.loadCount);
|
|
|
status.isPullingData = true;
|
|
|
$(domOption.pagination).hide();
|
|
|
getMoreData(ajaxOption, domOption, template, callback);
|
...
|
...
|
@@ -534,7 +549,23 @@ define('channel', function(require, exports) { |
|
|
parent: "#content",
|
|
|
pagination: "#pageContent",
|
|
|
},
|
|
|
template: "",
|
|
|
template: "<div class=\"fluid-item layout-item tiled\">"
|
|
|
+ "<div class=\"image-box\">"
|
|
|
+ "<a href=\"javascript:;\">"
|
|
|
+ "<img src=\"../../res/images/yohood/center-3-1.png\" alt=\"\">"
|
|
|
+ "</a>"
|
|
|
+ "</div>"
|
|
|
+ "<div class=\"item-info\">"
|
|
|
+ "<a class=\"fluid-tag item-tag spotlight-activity\" href=\"javascript:;\">亮点活动</a>"
|
|
|
+ "<span class=\"item-time\">November 11, 2016</span>"
|
|
|
+ "</div>"
|
|
|
+ "<div class=\"content\">"
|
|
|
+ "<h2 class=\"volupia\">"
|
|
|
+ "<a href=\"/news/detail/id/169\">test te</a>"
|
|
|
+ "</h2>"
|
|
|
+ "<p class=\"text-content\">c</p>"
|
|
|
+ "</div>"
|
|
|
+ "</div>",
|
|
|
|
|
|
init: function() {
|
|
|
pageLoadMore(this.ajaxOption, this.domOption, this.template);
|
...
|
...
|
|