Showing
1 changed file
with
35 additions
and
4 deletions
@@ -468,9 +468,13 @@ define('channel', function(require, exports) { | @@ -468,9 +468,13 @@ define('channel', function(require, exports) { | ||
468 | } | 468 | } |
469 | }; | 469 | }; |
470 | 470 | ||
471 | - | 471 | + /** |
472 | + * ajax成功函数 渲染模板并改变状态 且调用回调函数 | ||
473 | + * @param {String} data 成功返回的JSON字符串 | ||
474 | + */ | ||
472 | ajaxOption.success = function(data) { | 475 | ajaxOption.success = function(data) { |
473 | - // console.log(data); | 476 | + console.log("ajax success"); |
477 | + console.log(data); | ||
474 | // console.log(status.loadCount); | 478 | // console.log(status.loadCount); |
475 | $(domOption.parent).append(data); | 479 | $(domOption.parent).append(data); |
476 | status.loadCount++; | 480 | status.loadCount++; |
@@ -481,11 +485,23 @@ define('channel', function(require, exports) { | @@ -481,11 +485,23 @@ define('channel', function(require, exports) { | ||
481 | } | 485 | } |
482 | } | 486 | } |
483 | 487 | ||
488 | + /** | ||
489 | + * ajax失败函数 | ||
490 | + */ | ||
484 | ajaxOption.error = function(err) { | 491 | ajaxOption.error = function(err) { |
492 | + console.log("ajax error"); | ||
485 | console.log(err); | 493 | console.log(err); |
486 | } | 494 | } |
487 | 495 | ||
496 | + /** | ||
497 | + * 发送ajax请求 | ||
498 | + * @param {Object} ajaxOption ajax配置对象 | ||
499 | + * @param {Object} domOption 页面Dom元素信息 | ||
500 | + * @param {String} template 模板字符串 | ||
501 | + * @param {Function} callback 回调函数 | ||
502 | + */ | ||
488 | function getMoreData(ajaxOption, domOption, template, callback) { | 503 | function getMoreData(ajaxOption, domOption, template, callback) { |
504 | + console.log("send ajax request"); | ||
489 | $.ajax({ | 505 | $.ajax({ |
490 | url: ajaxOption.url, | 506 | url: ajaxOption.url, |
491 | data: ajaxOption.data, | 507 | data: ajaxOption.data, |
@@ -513,7 +529,6 @@ define('channel', function(require, exports) { | @@ -513,7 +529,6 @@ define('channel', function(require, exports) { | ||
513 | type: status.loadCount | 529 | type: status.loadCount |
514 | } | 530 | } |
515 | 531 | ||
516 | - console.log("typt:" + status.loadCount); | ||
517 | status.isPullingData = true; | 532 | status.isPullingData = true; |
518 | $(domOption.pagination).hide(); | 533 | $(domOption.pagination).hide(); |
519 | getMoreData(ajaxOption, domOption, template, callback); | 534 | getMoreData(ajaxOption, domOption, template, callback); |
@@ -534,7 +549,23 @@ define('channel', function(require, exports) { | @@ -534,7 +549,23 @@ define('channel', function(require, exports) { | ||
534 | parent: "#content", | 549 | parent: "#content", |
535 | pagination: "#pageContent", | 550 | pagination: "#pageContent", |
536 | }, | 551 | }, |
537 | - template: "", | 552 | + template: "<div class=\"fluid-item layout-item tiled\">" |
553 | + + "<div class=\"image-box\">" | ||
554 | + + "<a href=\"javascript:;\">" | ||
555 | + + "<img src=\"../../res/images/yohood/center-3-1.png\" alt=\"\">" | ||
556 | + + "</a>" | ||
557 | + + "</div>" | ||
558 | + + "<div class=\"item-info\">" | ||
559 | + + "<a class=\"fluid-tag item-tag spotlight-activity\" href=\"javascript:;\">亮点活动</a>" | ||
560 | + + "<span class=\"item-time\">November 11, 2016</span>" | ||
561 | + + "</div>" | ||
562 | + + "<div class=\"content\">" | ||
563 | + + "<h2 class=\"volupia\">" | ||
564 | + + "<a href=\"/news/detail/id/169\">test te</a>" | ||
565 | + + "</h2>" | ||
566 | + + "<p class=\"text-content\">c</p>" | ||
567 | + + "</div>" | ||
568 | + + "</div>", | ||
538 | 569 | ||
539 | init: function() { | 570 | init: function() { |
540 | pageLoadMore(this.ajaxOption, this.domOption, this.template); | 571 | pageLoadMore(this.ajaxOption, this.domOption, this.template); |
-
Please register or login to post a comment