标签:des style blog http color io os ar for
//动态加载 var totalPages = 0; function FlushYangtuos(page) { if (totalPages == 0) { page == 1; } $.getJSON("@Url.Action("FlushYangtuos")", { "cateId": cateId, "pageId": page }, function (data) { totalPages = parseInt(data.TotalPages); var result = ""; if (totalPages > 0) { $.each(data.Data, function (i, field) { var obj = data.Data[i]; result += ‘‘ + ‘<div class="fall-item">‘; if (!!obj.moreico) result += ‘<div class="moreico"></div>‘; result += ‘‘ + ‘<a class="zplink" href="‘ + obj.href + ‘">‘ + ‘<img src="‘ + obj.imgSrc + ‘" />‘ + ‘<div class="fall-tit">‘ + obj.title + ‘</div>‘ + ‘<p>‘ + obj.describe + ‘</p>‘ + ‘</a>‘ + ‘<div class="fall-bm"><span class="copy">复制链接分享</span><span class="fall-like tolike">支持</span><span class="fall-num">‘ + obj.support + ‘</span></div>‘ + ‘</div>‘; }); $("#ProductReviews").html(result); } }); if (totalPages != 0) { setPage(document.getElementById("pages"), totalPages, page); } } $(function () { FlushYangtuos(1);
public class FlushYangtuosModel { public FlushYangtuosModel() { //IPagedList<ProductReview> Data = null; } public object Data { set; get; } public int TotalPages { get; set; } public int TotalCount { get; set; } public int PageSize { get; set; } public int PageNumber { get; set; } public int PageIndex { get; set; } public int Count { get; set; } }
public ActionResult GetProductReviews(int cateId = 0, int page = 1) { page--; if (cateId == 0) return HttpNotFound(); //the 1 fllowed stand for ProductReviewState.Passed var rs = _productReviewService.GetAllProductReview(cateId , page); var data = rs .Select(x => { var nickname = account.Nickname; return new { Id = x.Id, Time = x.CreatedTime.ToString("yyyy-MM-dd"), PicUrl = _pictureService.GetPictureUrl(_pictureService.GetPictureById(avatarPictureId), _mediaSettings.AvatarPictureSize, true), Nickname = nickname }; }) .ToList(); return Json( new FlushYangtuosModel { Data = data, TotalPages = rs.TotalPages, TotalCount = rs.TotalCount, PageSize = rs.PageSize, PageNumber = rs.PageNumber, PageIndex = rs.PageIndex, Count = rs.Count } , JsonRequestBehavior.AllowGet); }
标签:des style blog http color io os ar for
原文地址:http://www.cnblogs.com/sonage/p/3999495.html