Authored by yyq

Merge branch 'feature/spread' into release/5.9

@@ -9,7 +9,7 @@ const spreadModel = require('../models/spread'); @@ -9,7 +9,7 @@ const spreadModel = require('../models/spread');
9 9
10 10
11 exports.index = (req, res, next) => { 11 exports.index = (req, res, next) => {
12 - req.ctx(spreadModel).getIndexData(req.user.uid).then(result => { 12 + req.ctx(spreadModel).getIndexData(req.user.uid, req.query.page).then(result => {
13 res.render('spread', { 13 res.render('spread', {
14 page: 'spread', 14 page: 'spread',
15 spread: result 15 spread: result
@@ -35,7 +35,17 @@ module.exports = class extends global.yoho.BaseModel { @@ -35,7 +35,17 @@ module.exports = class extends global.yoho.BaseModel {
35 resData.list = list; 35 resData.list = list;
36 } 36 }
37 37
38 - Object.assign(resData, setPager(_.get(resList, 'data.total', 1), {page: page})); 38 + let totalPage = _.get(resList, 'data.pageSize', 1);
  39 +
  40 + if (+totalPage > 1) {
  41 + resData.pager = setPager(totalPage, {page: page});
  42 +
  43 + Object.assign(resData.pager, {
  44 + count: _.get(resList, 'data.total', 0),
  45 + curPage: _.get(resList, 'data.currPage', 1),
  46 + totalPages: totalPage
  47 + })
  48 + }
39 } 49 }
40 50
41 return resData; 51 return resData;