Authored by lijing

品牌搜索

... ... @@ -77,29 +77,8 @@ let search = (req, res, next) => {
};
/**
* 添加品牌搜索记录
* @author sefon 2016-5-13 14:21:53
*/
let addBrandSearch = (req, res, next) => {
let param = {
uid: req.user.uid || 6228593, // TODO
brandName: req.query.brandName || '1'
};
indexModel.branchSearch(param).then(result => {
res.render('brand/search', result);
}).catch(next);
};
module.exports = {
index,
search,
addBrandSearch
delBrandHistory
};
... ...
... ... @@ -291,7 +291,23 @@ const branchSearchHistory = (params) => {
}, { code: 200 }).then(result => {
return result;
let resu = {
data: {
list: [
{
name: '111',
searchTime: '111'
},
{
name: '22',
searchTime: '22'
}
]
}
};
// console.log(resu);
return resu;
});
};
... ... @@ -332,9 +348,8 @@ const branchSearch = (params) => {
showDownloadApp: true,
pageFooter: true,
hot: [],
brandList: [
]
history: [],
brandList: []
};
if (result && result[0] && result[0].data) {
... ... @@ -347,25 +362,21 @@ const branchSearch = (params) => {
let build = [];
if (key != '') {
brandList[key].forEach(row => {
build.push({
name: row.brand_name,
isHot: row.is_hot === 'Y' ? true : false,
isNew: row.is_show_new === 'Y' ? true : false,
url: helpers.urlFormat('', null, row.brand_domain),
brandId: row.id,
brandDomain: row.brand_domain,
searchName: row.brand_name_en + row.brand_name_cn
});
obj[key] = build;
brandList[key].forEach(row => {
build.push({
name: row.brand_name,
isHot: row.is_hot === 'Y' ? true : false,
isNew: row.is_show_new === 'Y' ? true : false,
url: helpers.urlFormat('', null, row.brand_domain),
brandId: row.id,
brandDomain: row.brand_domain,
searchName: row.brand_name_en + row.brand_name_cn
});
}
obj[key] = build;
});
}
... ... @@ -389,6 +400,14 @@ const branchSearch = (params) => {
}
if (result && result[1] && result[1].data) {
let hisList = result[1].data;
resu.history.push(hisList);
}
return resu;
});
... ...
... ... @@ -23,6 +23,6 @@ router.get('/channel/bottomBanner', channel.bottomBanner);
router.get('/brands', brandController.index); // 品牌首页
router.get('/brands/search', brandController.search); // 品牌搜索页
router.post('/brands/search', brandController.addBrandSearch); // 添加品牌搜索记录
router.get('/delBrandHistory', brandController.delBrandHistory); // 删除品牌搜索记录
module.exports = router;
... ...
... ... @@ -14,7 +14,7 @@
</div>
<div class="search-brand-page">
<div class="search-items">
<div class="search-items">{{log history}}
{{#if history}}
<div class="net-history hide">
<div class="history-search net-search hide">
... ...