Authored by OF1706

search api

@@ -10,6 +10,7 @@ const api = global.yoho.API; @@ -10,6 +10,7 @@ const api = global.yoho.API;
10 const helpers = global.yoho.helpers; 10 const helpers = global.yoho.helpers;
11 const searchApi = require('./search-api'); 11 const searchApi = require('./search-api');
12 const headerModel = require('../../../doraemon/models/header'); 12 const headerModel = require('../../../doraemon/models/header');
  13 +
13 // const searchHandler = require('./search-handler'); 14 // const searchHandler = require('./search-handler');
14 const _ = require('lodash'); 15 const _ = require('lodash');
15 const needParams = ['query', 'msort', 'misort']; 16 const needParams = ['query', 'msort', 'misort'];
@@ -136,4 +137,4 @@ const getSuggest = (params) => { @@ -136,4 +137,4 @@ const getSuggest = (params) => {
136 module.exports = { 137 module.exports = {
137 handleSuggest, 138 handleSuggest,
138 getSuggest 139 getSuggest
139 -}  
  140 +};
@@ -115,7 +115,7 @@ const serachFilterBrands = (req, res, next) => { @@ -115,7 +115,7 @@ const serachFilterBrands = (req, res, next) => {
115 const suggestHistory = (req, res, next) => { 115 const suggestHistory = (req, res, next) => {
116 search.getSuggest(req.query).then(result => { 116 search.getSuggest(req.query).then(result => {
117 117
118 - if(req.query.json === '1') { 118 + if (req.query.json === '1') {
119 return res.send(result); 119 return res.send(result);
120 } 120 }
121 121
@@ -141,7 +141,7 @@ const suggestHistory = (req, res, next) => { @@ -141,7 +141,7 @@ const suggestHistory = (req, res, next) => {
141 const suggestRecommend = (req, res, next) => { 141 const suggestRecommend = (req, res, next) => {
142 search.getSuggest(req.query).then(result => { 142 search.getSuggest(req.query).then(result => {
143 143
144 - if(req.query.json === '1') { 144 + if (req.query.json === '1') {
145 return res.send(result); 145 return res.send(result);
146 } 146 }
147 147
@@ -164,4 +164,4 @@ module.exports = { @@ -164,4 +164,4 @@ module.exports = {
164 serachFilterBrands, 164 serachFilterBrands,
165 suggestHistory, 165 suggestHistory,
166 suggestRecommend 166 suggestRecommend
167 -}  
  167 +};
@@ -27,9 +27,9 @@ module.exports = { @@ -27,9 +27,9 @@ module.exports = {
27 // service: 'http://service.yoho.cn/', 27 // service: 'http://service.yoho.cn/',
28 28
29 // gray 29 // gray
30 - //singleApi: 'http://single.gray.yohops.com/',  
31 - //api: 'http://api.gray.yohops.com/',  
32 - //service: 'http://service.gray.yohops.com/', 30 + // singleApi: 'http://single.gray.yohops.com/',
  31 + // api: 'http://api.gray.yohops.com/',
  32 + // service: 'http://service.gray.yohops.com/',
33 33
34 // dev 34 // dev
35 // api: 'http://dev-api.yohops.com:9999/', 35 // api: 'http://dev-api.yohops.com:9999/',
@@ -7,7 +7,7 @@ var $ = require('yoho-jquery'), @@ -7,7 +7,7 @@ var $ = require('yoho-jquery'),
7 handlebars = require('yoho-handlebars'); 7 handlebars = require('yoho-handlebars');
8 8
9 var $head = $('.head-wrapper'), 9 var $head = $('.head-wrapper'),
10 - $searchForm = $('#search-form'), //头部搜索栏 10 + $searchForm = $('#search-form'), // 头部搜索栏
11 $searchKey = $searchForm.find('.search-key'), 11 $searchKey = $searchForm.find('.search-key'),
12 $searchSug = $head.find('.search-suggest'); 12 $searchSug = $head.find('.search-suggest');
13 13
@@ -99,4 +99,4 @@ $searchKey.keyup(function(e) { @@ -99,4 +99,4 @@ $searchKey.keyup(function(e) {
99 setTimeout(function() { 99 setTimeout(function() {
100 $searchSug.hide(); 100 $searchSug.hide();
101 }, 200); 101 }, 200);
102 -});  
  102 +});