Merge remote-tracking branch 'remotes/origin/feature/detail-comment-plus' into release/5.2
Showing
1 changed file
with
13 additions
and
8 deletions
@@ -745,7 +745,8 @@ lazyLoad($('#details-html img')); | @@ -745,7 +745,8 @@ lazyLoad($('#details-html img')); | ||
745 | function fetchComment() { | 745 | function fetchComment() { |
746 | var commentPage = {}, // 每个类型的分页页码 | 746 | var commentPage = {}, // 每个类型的分页页码 |
747 | currentType = '7', // 当前评论展示的类型 | 747 | currentType = '7', // 当前评论展示的类型 |
748 | - consultPage = 1; | 748 | + consultPage = 1, |
749 | + cNumReady = false; // 只第一次请求后更新数量 | ||
749 | 750 | ||
750 | var commentsTpl = require('hbs/product/comment-item.hbs'), | 751 | var commentsTpl = require('hbs/product/comment-item.hbs'), |
751 | consultsTpl = require('hbs/product/consult-item.hbs'), | 752 | consultsTpl = require('hbs/product/consult-item.hbs'), |
@@ -790,15 +791,19 @@ function fetchComment() { | @@ -790,15 +791,19 @@ function fetchComment() { | ||
790 | 791 | ||
791 | // 更新总数显示 | 792 | // 更新总数显示 |
792 | // $commentNum.text(res[0].total); | 793 | // $commentNum.text(res[0].total); |
793 | - $(filter).each(function(idx, fit) { | ||
794 | - if (fit.num) { | ||
795 | - $('.comments [data-comment-type=' + fit.filterId + '] em').text(fit.num); | ||
796 | 794 | ||
797 | - if (fit.filterId === '7') { // 全部数量 | ||
798 | - $('.consult-comment .block-title .comment-num').text(fit.num); | 795 | + if (filter && filter.length && !cNumReady) { |
796 | + cNumReady = true; | ||
797 | + $(filter).each(function(idx, fit) { | ||
798 | + if (fit.num) { | ||
799 | + $('.comments [data-comment-type=' + fit.filterId + '] em').text(fit.num); | ||
800 | + | ||
801 | + if (fit.filterId === '7') { // 全部数量 | ||
802 | + $('.consult-comment .block-title .comment-num').text(fit.num); | ||
803 | + } | ||
799 | } | 804 | } |
800 | - } | ||
801 | - }); | 805 | + }); |
806 | + } | ||
802 | 807 | ||
803 | $ul.append(commentsTpl({ | 808 | $ul.append(commentsTpl({ |
804 | comments: res | 809 | comments: res |
-
Please register or login to post a comment