Authored by lijing

品牌搜索

@@ -77,29 +77,8 @@ let search = (req, res, next) => { @@ -77,29 +77,8 @@ let search = (req, res, next) => {
77 77
78 }; 78 };
79 79
80 -  
81 -/**  
82 - * 添加品牌搜索记录  
83 - * @author sefon 2016-5-13 14:21:53  
84 - */  
85 -let addBrandSearch = (req, res, next) => {  
86 -  
87 - let param = {  
88 -  
89 - uid: req.user.uid || 6228593, // TODO  
90 -  
91 - brandName: req.query.brandName || '1'  
92 -  
93 - };  
94 -  
95 - indexModel.branchSearch(param).then(result => {  
96 - res.render('brand/search', result);  
97 - }).catch(next);  
98 -  
99 -};  
100 -  
101 module.exports = { 80 module.exports = {
102 index, 81 index,
103 search, 82 search,
104 - addBrandSearch 83 + delBrandHistory
105 }; 84 };
@@ -291,7 +291,23 @@ const branchSearchHistory = (params) => { @@ -291,7 +291,23 @@ const branchSearchHistory = (params) => {
291 291
292 }, { code: 200 }).then(result => { 292 }, { code: 200 }).then(result => {
293 293
294 - return result; 294 + let resu = {
  295 + data: {
  296 + list: [
  297 + {
  298 + name: '111',
  299 + searchTime: '111'
  300 + },
  301 + {
  302 + name: '22',
  303 + searchTime: '22'
  304 + }
  305 + ]
  306 + }
  307 + };
  308 +
  309 + // console.log(resu);
  310 + return resu;
295 311
296 }); 312 });
297 }; 313 };
@@ -332,9 +348,8 @@ const branchSearch = (params) => { @@ -332,9 +348,8 @@ const branchSearch = (params) => {
332 showDownloadApp: true, 348 showDownloadApp: true,
333 pageFooter: true, 349 pageFooter: true,
334 hot: [], 350 hot: [],
335 - brandList: [  
336 -  
337 - ] 351 + history: [],
  352 + brandList: []
338 }; 353 };
339 354
340 if (result && result[0] && result[0].data) { 355 if (result && result[0] && result[0].data) {
@@ -347,25 +362,21 @@ const branchSearch = (params) => { @@ -347,25 +362,21 @@ const branchSearch = (params) => {
347 362
348 let build = []; 363 let build = [];
349 364
350 - if (key != '') {  
351 -  
352 - brandList[key].forEach(row => {  
353 -  
354 - build.push({  
355 - name: row.brand_name,  
356 - isHot: row.is_hot === 'Y' ? true : false,  
357 - isNew: row.is_show_new === 'Y' ? true : false,  
358 - url: helpers.urlFormat('', null, row.brand_domain),  
359 - brandId: row.id,  
360 - brandDomain: row.brand_domain,  
361 - searchName: row.brand_name_en + row.brand_name_cn  
362 - });  
363 -  
364 - obj[key] = build; 365 + brandList[key].forEach(row => {
365 366
  367 + build.push({
  368 + name: row.brand_name,
  369 + isHot: row.is_hot === 'Y' ? true : false,
  370 + isNew: row.is_show_new === 'Y' ? true : false,
  371 + url: helpers.urlFormat('', null, row.brand_domain),
  372 + brandId: row.id,
  373 + brandDomain: row.brand_domain,
  374 + searchName: row.brand_name_en + row.brand_name_cn
366 }); 375 });
367 376
368 - } 377 + obj[key] = build;
  378 +
  379 + });
369 380
370 } 381 }
371 382
@@ -389,6 +400,14 @@ const branchSearch = (params) => { @@ -389,6 +400,14 @@ const branchSearch = (params) => {
389 400
390 } 401 }
391 402
  403 + if (result && result[1] && result[1].data) {
  404 +
  405 + let hisList = result[1].data;
  406 +
  407 + resu.history.push(hisList);
  408 +
  409 + }
  410 +
392 return resu; 411 return resu;
393 412
394 }); 413 });
@@ -23,6 +23,6 @@ router.get('/channel/bottomBanner', channel.bottomBanner); @@ -23,6 +23,6 @@ router.get('/channel/bottomBanner', channel.bottomBanner);
23 23
24 router.get('/brands', brandController.index); // 品牌首页 24 router.get('/brands', brandController.index); // 品牌首页
25 router.get('/brands/search', brandController.search); // 品牌搜索页 25 router.get('/brands/search', brandController.search); // 品牌搜索页
26 -router.post('/brands/search', brandController.addBrandSearch); // 添加品牌搜索记录 26 +router.get('/delBrandHistory', brandController.delBrandHistory); // 删除品牌搜索记录
27 27
28 module.exports = router; 28 module.exports = router;
@@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
14 </div> 14 </div>
15 15
16 <div class="search-brand-page"> 16 <div class="search-brand-page">
17 - <div class="search-items"> 17 + <div class="search-items">{{log history}}
18 {{#if history}} 18 {{#if history}}
19 <div class="net-history hide"> 19 <div class="net-history hide">
20 <div class="history-search net-search hide"> 20 <div class="history-search net-search hide">