Merge branch 'hotfix/search' into 'master'
搜索shop_id参数问题 See merge request !20
Showing
2 changed files
with
5 additions
and
2 deletions
@@ -117,7 +117,8 @@ const list = (req, res, next) => { | @@ -117,7 +117,8 @@ const list = (req, res, next) => { | ||
117 | title: title, | 117 | title: title, |
118 | goodList: params, | 118 | goodList: params, |
119 | firstPageGoodsList: result[2].list || [], | 119 | firstPageGoodsList: result[2].list || [], |
120 | - pageFooter: true | 120 | + pageFooter: true, |
121 | + shopId: params.shop_id || '' | ||
121 | }); | 122 | }); |
122 | }).catch(next); | 123 | }).catch(next); |
123 | } | 124 | } |
@@ -182,7 +183,8 @@ const search = (req, res, next) => { | @@ -182,7 +183,8 @@ const search = (req, res, next) => { | ||
182 | params.limit = 24; | 183 | params.limit = 24; |
183 | searchModel.getSearchData(params).then((result) => { | 184 | searchModel.getSearchData(params).then((result) => { |
184 | 185 | ||
185 | - if (result && result.list && parseInt(params.page) === 1 && parseInt(params.start) > 0) { | 186 | + if (result && result.list && result.list.length > params.start && |
187 | + parseInt(params.page) === 1 && parseInt(params.start) > 0) { | ||
186 | // 首屏渲染时,使用 'start' 参数裁减已渲染数据 | 188 | // 首屏渲染时,使用 'start' 参数裁减已渲染数据 |
187 | result.list = result.list.slice(params.start || 0); | 189 | result.list = result.list.slice(params.start || 0); |
188 | } | 190 | } |
@@ -5,6 +5,7 @@ | @@ -5,6 +5,7 @@ | ||
5 | <i class="search-icon iconfont"></i> | 5 | <i class="search-icon iconfont"></i> |
6 | <input type="text" value="{{default}}" name="query" class="buriedpoint" data-bp-id="shop-search_input_1" autocomplete="off"> | 6 | <input type="text" value="{{default}}" name="query" class="buriedpoint" data-bp-id="shop-search_input_1" autocomplete="off"> |
7 | <input type="hidden" value="search" name="from"> | 7 | <input type="hidden" value="search" name="from"> |
8 | + <input type="hidden" name="shop_id" value="{{@root.shopId}}"> | ||
8 | <i class="clear-input iconfont hide"></i> | 9 | <i class="clear-input iconfont hide"></i> |
9 | <span id="search" class="search buriedpoint" type="submit" data-bp-id="shop-search_btn_0">搜索</span> | 10 | <span id="search" class="search buriedpoint" type="submit" data-bp-id="shop-search_btn_0">搜索</span> |
10 | </form> | 11 | </form> |
-
Please register or login to post a comment