Authored by 周少峰

test data, shop-entry

@@ -33,7 +33,8 @@ const getProductList = (params) => { @@ -33,7 +33,8 @@ const getProductList = (params) => {
33 */ 33 */
34 const getSortList = (params) => { 34 const getSortList = (params) => {
35 let finalParams = { 35 let finalParams = {
36 - method: 'app.sort.get' 36 + //method: 'web.regular.groupsort'
  37 + method: 'app.search.li'
37 }; 38 };
38 39
39 Object.assign(finalParams, params); 40 Object.assign(finalParams, params);
1 -/*  
2 - * @Author: Targaryen  
3 - * @Date: 2016-05-30 16:20:03  
4 - * @Last Modified by: Targaryen  
5 - * @Last Modified time: 2016-06-08 19:56:39 1 +/**
  2 + * search
  3 + * @Author: sefon 2016-7-12 16:31:56
6 */ 4 */
7 5
8 'use strict'; 6 'use strict';
9 -// const utils = '../../../utils'; 7 +const utils = '../../../utils';
10 const api = global.yoho.API; 8 const api = global.yoho.API;
11 const searchApi = require('./search-api'); 9 const searchApi = require('./search-api');
12 const headerModel = require('../../../doraemon/models/header'); 10 const headerModel = require('../../../doraemon/models/header');
  11 +const productProcess = require(`${utils}/product-process`);
  12 +const publicHandler = require('./public-handler');
13 13
14 // const _ = require('lodash'); 14 // const _ = require('lodash');
15 // 15 //
16 // const log = global.yoho.logger; 16 // const log = global.yoho.logger;
17 17
18 /** 18 /**
19 - * 获取奥莱首页数据 19 + * 获取搜索数据
20 * @param {[type]} origin [description] 20 * @param {[type]} origin [description]
21 * @return {[type]} [description] 21 * @return {[type]} [description]
22 */ 22 */
@@ -29,11 +29,27 @@ exports.getSearchData = (params) => { @@ -29,11 +29,27 @@ exports.getSearchData = (params) => {
29 let finalResult = { 29 let finalResult = {
30 headerData: Object.assign(result[0].headerData, { 30 headerData: Object.assign(result[0].headerData, {
31 header: true 31 header: true
32 - }) 32 + }),
  33 + search: {}
33 }; 34 };
34 35
35 - // 处理搜索结果数据 36 + // 获取商品数据和顶部筛选条件
  37 + if (result[1].code === 200) {
  38 + finalResult.search.leftContent = publicHandler.handleSaleSortData(result[1].data.filter.group_sort, params);
  39 + finalResult.search.pathNav = publicHandler.handlePathNavData(result[1].data.filter.group_sort, params);
  40 +
  41 + }
36 42
  43 + // 获取左侧类目数据
  44 + if (result[2].code === 200) {
  45 + Object.assign(finalResult.search, {
  46 + filters: publicHandler.handleSaleFilterData(result[2].data.filter, params),
  47 + opts: publicHandler.handleSaleOptsData(params, result[2].data.total),
  48 + totalCount: result[2].data.total,
  49 + footPager: publicHandler.handlePagerData(result[2].data.total, params),
  50 + goods: productProcess.processProductList(result[2].data.product_list)
  51 + });
  52 + }
37 return finalResult; 53 return finalResult;
38 }); 54 });
39 }; 55 };
1 <div class="product-page yoho-page"> 1 <div class="product-page yoho-page">
2 - {{# saleList}}  
3 - {{> sale/sale-banner}}  
4 - 2 + {{# search}}
5 <div class="center-content clearfix"> 3 <div class="center-content clearfix">
6 {{# pathNav}} 4 {{# pathNav}}
7 {{> common/path-nav}} 5 {{> common/path-nav}}
8 {{/ pathNav}} 6 {{/ pathNav}}
9 -  
10 - {{# saleTitle}}  
11 - <div class="header-title">  
12 - {{name}}  
13 - <p class="line-through"></p>  
14 - <p class="count-wrap">  
15 - <span class="count">{{count}}个结果</span>  
16 - </p>  
17 - </div>  
18 - {{/ saleTitle}} 7 +
19 8
20 <div class="list-left pull-left"> 9 <div class="list-left pull-left">
21 {{> product/left-content}} 10 {{> product/left-content}}
22 </div> 11 </div>
23 12
24 <div class="list-right pull-right"> 13 <div class="list-right pull-right">
  14 + {{# sortIntro}}
  15 + <div class="sort-intro clearfix">
  16 + <div class="texts pull-left">
  17 + <p class="name">{{name}}</p>
  18 + <p class="en-name">{{enName}}</p>
  19 + <p class="desc">{{{description}}}</p>
  20 + <div class="key-entry">
  21 + {{#each keyEntry}}
  22 + <a href="{{url}}">{{name}}</a>
  23 + {{/each}}
  24 + </div>
  25 + </div>
  26 + <img class="pull-right img" src="{{img}}">
  27 + </div>
  28 + {{/ sortIntro}}
  29 + {{> list/shop-entry}}
25 {{> product/standard-content}} 30 {{> product/standard-content}}
26 </div> 31 </div>
27 </div> 32 </div>
28 - {{/ saleList}} 33 + {{/search}}
29 </div> 34 </div>
  1 +<div class="shop-entry-area">
  2 + {{# shopEntry}}
  3 + <div class="shop-entry clearfix">
  4 + <a class="pull-left" href="{{home}}">
  5 + <img class="logo" src="{{logo}}">
  6 + </a>
  7 +
  8 + <div class="name pull-left">
  9 + <a class="shop-name" href="{{home}}">{{shopName}}</a>
  10 + <p class="sorts">
  11 + {{#each sort}}
  12 + <a href="{{href}}">{{name}}</a>
  13 +
  14 + {{#unless @last}}
  15 + /
  16 + {{/unless}}
  17 + {{/each}}
  18 + </p>
  19 + </div>
  20 +
  21 + <a class="entry-btn pull-right" href="{{home}}">
  22 + 进入品牌店铺
  23 + <span class="iconfont">&#xe601;</span>
  24 + </a>
  25 + </div>
  26 + {{/ shopEntry}}
  27 +</div>
@@ -14,7 +14,8 @@ module.exports = { @@ -14,7 +14,8 @@ module.exports = {
14 port: 6002, 14 port: 6002,
15 siteUrl: 'http://www.yohobuy.com', 15 siteUrl: 'http://www.yohobuy.com',
16 domains: { 16 domains: {
17 - api: 'http://devapi.yoho.cn:58078/', 17 + //api: 'http://devapi.yoho.cn:58078/',
  18 + api: 'http://testapi.yoho.cn:28078/',
18 service: 'http://devservice.yoho.cn:58077/', 19 service: 'http://devservice.yoho.cn:58077/',
19 search: 'http://192.168.102.216:8080/yohosearch/' 20 search: 'http://192.168.102.216:8080/yohosearch/'
20 }, 21 },
@@ -3,3 +3,24 @@ @@ -3,3 +3,24 @@
3 * @author: sefon 2016-7-12 15:28:22 3 * @author: sefon 2016-7-12 15:28:22
4 */ 4 */
5 5
  6 +var $ = require('yoho-jquery'),
  7 + lazyLoad = require('yoho-jquery-lazyload');
  8 +
  9 +var product = require('./index/product');
  10 +
  11 +require('../plugins/filter');
  12 +require('../plugins/sort-pager');
  13 +
  14 +product.init(4);
  15 +
  16 +
  17 +
  18 +
  19 +
  20 +
  21 +
  22 +
  23 +
  24 +lazyLoad($('img.lazy'), {
  25 + failure_limit: 20
  26 +});