fix new product list banner
Showing
3 changed files
with
16 additions
and
7 deletions
@@ -17,7 +17,7 @@ const list = { | @@ -17,7 +17,7 @@ const list = { | ||
17 | // 列表页 | 17 | // 列表页 |
18 | index: (req, res, next) => { | 18 | index: (req, res, next) => { |
19 | let q = req.query; | 19 | let q = req.query; |
20 | - let channel = req.cookies._Channel || 'men'; | 20 | + let channel = req.cookies._Channel || req.query._Channel || 'men'; |
21 | 21 | ||
22 | q.page = parseInt(q.page || 1, 10); | 22 | q.page = parseInt(q.page || 1, 10); |
23 | q.order = q.order || 's_n_desc'; | 23 | q.order = q.order || 's_n_desc'; |
@@ -69,9 +69,11 @@ const list = { | @@ -69,9 +69,11 @@ const list = { | ||
69 | // 新品到着 | 69 | // 新品到着 |
70 | newPage: (req, res, next) => { | 70 | newPage: (req, res, next) => { |
71 | let q = req.query; | 71 | let q = req.query; |
72 | + let channel = req.cookies._Channel || req.query._Channel || 'men'; | ||
72 | 73 | ||
73 | q.page = parseInt(q.page || 1, 10); | 74 | q.page = parseInt(q.page || 1, 10); |
74 | q.order = q.order || 's_n_desc'; | 75 | q.order = q.order || 's_n_desc'; |
76 | + q.channel = channel; | ||
75 | 77 | ||
76 | let retData = { | 78 | let retData = { |
77 | module: 'product', | 79 | module: 'product', |
@@ -79,7 +81,8 @@ const list = { | @@ -79,7 +81,8 @@ const list = { | ||
79 | title: '新品' | 81 | title: '新品' |
80 | }; | 82 | }; |
81 | 83 | ||
82 | - Promise.all([Resouces.newProductBanner(), Search.queryAllSort(), Search.queryNewProduct(q)]).then(result => { | 84 | + Promise.all([Resouces.newProductBanner(channel), Search.queryAllSort(), |
85 | + Search.queryNewProduct(q)]).then(result => { | ||
83 | let banner = result[0]; | 86 | let banner = result[0]; |
84 | let sortData = camelCase(result[1]); | 87 | let sortData = camelCase(result[1]); |
85 | let listData = result[2]; | 88 | let listData = result[2]; |
@@ -14,10 +14,16 @@ const Resources = { | @@ -14,10 +14,16 @@ const Resources = { | ||
14 | * 获取新品到着-列表页-banner 资源位 | 14 | * 获取新品到着-列表页-banner 资源位 |
15 | * @returns {Promise.<T>} | 15 | * @returns {Promise.<T>} |
16 | */ | 16 | */ |
17 | - newProductBanner() { | 17 | + newProductBanner(channel) { |
18 | + | ||
19 | + let codes = { | ||
20 | + men: '3d3127b220073fbcda738c8ba26561e5', | ||
21 | + women: '2aaf9519b31d1f21c537032f496e7450', | ||
22 | + lifestyle: '422bfdb9b410598e11c3e72bd4ee664e' | ||
23 | + }; | ||
18 | 24 | ||
19 | let params = { | 25 | let params = { |
20 | - content_code: 'a7989369aa86681c678bc40f171b8f1d' | 26 | + content_code: codes[channel] |
21 | }; | 27 | }; |
22 | 28 | ||
23 | return api.get('/operations/api/v5/resource/get', params).then(result => { | 29 | return api.get('/operations/api/v5/resource/get', params).then(result => { |
@@ -16,10 +16,10 @@ | @@ -16,10 +16,10 @@ | ||
16 | </div> | 16 | </div> |
17 | <div class="right"> | 17 | <div class="right"> |
18 | {{!-- 新品banner --}} | 18 | {{!-- 新品banner --}} |
19 | - {{# banner}} | 19 | + {{#if banner.src}} |
20 | <div class="banner-img" | 20 | <div class="banner-img" |
21 | - style="height: 200px;margin-bottom:30px; background:url({{image src 850 200 2}}) no-repeat top center;"></div> | ||
22 | - {{/banner}} | 21 | + style="height: 200px;margin-bottom:30px; background:url({{image banner.src 850 200 2}}) no-repeat top center;"></div> |
22 | + {{/if}} | ||
23 | {{!-- 已选中条件 --}} | 23 | {{!-- 已选中条件 --}} |
24 | {{#filter}} | 24 | {{#filter}} |
25 | {{> list/filter-area}} | 25 | {{> list/filter-area}} |
-
Please register or login to post a comment