Authored by 王水玲

Merge branch 'release/4.6' of git.yoho.cn:fe/yohobuywap-node into release/4.6

@@ -12,12 +12,12 @@ const renderData = { @@ -12,12 +12,12 @@ const renderData = {
12 module: 'product' 12 module: 'product'
13 }; 13 };
14 14
15 -const yhChannelMap = {  
16 - boys: 1,  
17 - girls: 2,  
18 - kids: 3,  
19 - lifestyle: 4  
20 -}; 15 +// const yhChannelMap = {
  16 +// boys: 1,
  17 +// girls: 2,
  18 +// kids: 3,
  19 +// lifestyle: 4
  20 +// };
21 21
22 // 奥莱首页控制器 22 // 奥莱首页控制器
23 exports.index = (req, res) => { 23 exports.index = (req, res) => {
@@ -64,9 +64,12 @@ exports.activityList = (req, res) => { @@ -64,9 +64,12 @@ exports.activityList = (req, res) => {
64 let type = req.query.type || 2; 64 let type = req.query.type || 2;
65 let template = type === 2 ? 'outlet/will-end' : 'outlet/will-start'; 65 let template = type === 2 ? 'outlet/will-end' : 'outlet/will-start';
66 let page = type === 2 ? 'outlet-will-end' : 'outlet-will-start'; 66 let page = type === 2 ? 'outlet-will-end' : 'outlet-will-start';
67 - let yhChannel = req.query.yh_channel || yhChannelMap[req.yoho.channel];  
68 67
69 - outletModel.getNearlyActivity(yhChannel, type, categoryId).then(result => { 68 + if (!categoryId) {
  69 + throw new Error('No parent_id for OUTLET channel page!');
  70 + }
  71 +
  72 + outletModel.getRecentActivity(type, categoryId).then(result => {
70 res.render(template, Object.assign({ 73 res.render(template, Object.assign({
71 page: page, 74 page: page,
72 pageHeader: headerData, 75 pageHeader: headerData,
@@ -33,7 +33,7 @@ const getOutletResource = (channel, contentcode) => { @@ -33,7 +33,7 @@ const getOutletResource = (channel, contentcode) => {
33 return resourcesProcess(result.data.list); 33 return resourcesProcess(result.data.list);
34 } else { 34 } else {
35 log.error('奥莱资源位接口返回状态码 不是 200'); 35 log.error('奥莱资源位接口返回状态码 不是 200');
36 - return result; 36 + return [];
37 } 37 }
38 }); 38 });
39 }; 39 };
@@ -68,7 +68,7 @@ const getNavData = (categoryId) => { @@ -68,7 +68,7 @@ const getNavData = (categoryId) => {
68 return data; 68 return data;
69 } else { 69 } else {
70 log.error('奥莱导航接口返回状态码 不是 200', result); 70 log.error('奥莱导航接口返回状态码 不是 200', result);
71 - return result; 71 + return [];
72 } 72 }
73 }); 73 });
74 }; 74 };
@@ -115,7 +115,7 @@ const convertActicityData = (data) => { @@ -115,7 +115,7 @@ const convertActicityData = (data) => {
115 const getHomeActivity = (data) => { 115 const getHomeActivity = (data) => {
116 var params = { 116 var params = {
117 method: 'app.outlets.activityGet', 117 method: 'app.outlets.activityGet',
118 - platform: 2, 118 + platform: 3
119 }; 119 };
120 120
121 return api.get('', sign.apiSign(_.assign(params, data))).then(res => { 121 return api.get('', sign.apiSign(_.assign(params, data))).then(res => {
@@ -124,48 +124,51 @@ const getHomeActivity = (data) => { @@ -124,48 +124,51 @@ const getHomeActivity = (data) => {
124 }; 124 };
125 125
126 exports.getContent = (categoryId, channel, code) => { 126 exports.getContent = (categoryId, channel, code) => {
127 - let floorsData = {},  
128 - params = {  
129 - type: 0,  
130 - yh_channel: channel  
131 - }; 127 + let params = {
  128 + type: 0,
  129 + yh_channel: channel
  130 + };
132 131
133 const p = [getNavData(categoryId), getOutletResource(channel, code), getHomeActivity(params)]; 132 const p = [getNavData(categoryId), getOutletResource(channel, code), getHomeActivity(params)];
134 133
135 return Promise.all(p).then(data => { 134 return Promise.all(p).then(data => {
136 - floorsData.nav = data[0] || [];  
137 - floorsData.content = data[1] || [];  
138 - floorsData.activity = {data: data[2]};  
139 135
140 - return floorsData; 136 + return {
  137 + nav: data[0] || [],
  138 + content: data[1] || [],
  139 + activity: data[2]
  140 + };
141 }); 141 });
142 }; 142 };
143 143
144 144
145 exports.getActivity = (id) => { 145 exports.getActivity = (id) => {
146 return getActivityDetail(id).then(res => { 146 return getActivityDetail(id).then(res => {
147 - var data = {};  
148 147
149 - data.outletActivity = res;  
150 - data.productPool = res[0] && res[0].productPoolId || '';  
151 - data.saleType = 4;  
152 - return data; 148 + return {
  149 + outletActivity: res,
  150 + productPool: res[0] || res[0].productPoolId || '',
  151 + saleType: 4
  152 + };
153 }); 153 });
154 }; 154 };
155 155
156 -exports.getNearlyActivity = (channel, type, categoryId) => { 156 +/**
  157 + * 获取即将开始或即将结束的活动列表
  158 + * @param {Number} type 标明是即将开始还是即将技术
  159 + * @param {String} categoryId 父级菜单id,用于标明当前页面是奥莱页面
  160 + * @return {Object} 活动列表数据
  161 + */
  162 +exports.getRecentActivity = (type, categoryId) => {
157 var params = { 163 var params = {
158 type: type 164 type: type
159 }; 165 };
160 166
161 return Promise.all([getNavData(categoryId), getHomeActivity(params)]).then(res => { 167 return Promise.all([getNavData(categoryId), getHomeActivity(params)]).then(res => {
162 - var data = { 168 +
  169 + return {
163 nav: res[0] || [], 170 nav: res[0] || [],
164 - activity: {  
165 - data: res[1]  
166 - } 171 + activity: res[1]
167 }; 172 };
168 -  
169 - return data;  
170 }); 173 });
171 }; 174 };
1 <div class="outlet-page yoho-page"> 1 <div class="outlet-page yoho-page">
2 {{> product/outlet/nav}} 2 {{> product/outlet/nav}}
3 {{# activity}} 3 {{# activity}}
4 - {{#data}}  
5 - <a class="will-end-back" href="{{activityUrl}}" >  
6 - <img class="back-image" src="{{image coverUrl 640 300}}">  
7 - <div class="last-time"><i class="iconfont time-ico">&#xe603;</i><span>{{>product/outlet/countdown}}</span></div>  
8 - <div class="line-space">  
9 - <span class="num">{{promotionName}} </span>  
10 - <span class="title">{{title}}</span>  
11 - <img class="logo" src="{{image logoUrl 150 100}}"></img>  
12 - </div>  
13 - </a>  
14 - {{/data}} 4 + <a class="will-end-back" href="{{activityUrl}}" >
  5 + <img class="back-image" src="{{image coverUrl 640 300}}">
  6 + <div class="last-time"><i class="iconfont time-ico">&#xe603;</i><span>{{>product/outlet/countdown}}</span></div>
  7 + <div class="line-space">
  8 + <span class="num">{{promotionName}} </span>
  9 + <span class="title">{{title}}</span>
  10 + <img class="logo" src="{{image logoUrl 150 100}}"></img>
  11 + </div>
  12 + </a>
15 {{/ activity}} 13 {{/ activity}}
16 </div> 14 </div>
1 <div id="demo1"> 1 <div id="demo1">
2 - <!--<p>1 默认,服务端输出leftTime,把客户端时间干扰降到最低。单位秒</p>-->  
3 - <div class="cd cd-lite time" data-config="{'leftTime':{{leftTime}} }">— 仅剩<span class="left-day">${d}天</span>${h}时${m}分${s}秒 —</div>  
4 - <!--<div class="cd cd-medium" data-config="{'leftTime':82390943}">剩余时间:${h}时${m}分${s}秒</div>--> 2 + <!--默认,服务端输出leftTime,把客户端时间干扰降到最低。单位秒-->
  3 + <div class="cd cd-lite time hide" data-config="{'leftTime': {{leftTime}} }">— 仅剩<span class="left-day">${d}天</span>${h}时${m}分${s}秒 —</div>
  4 + <div class="cd cd-medium time hide" data-config="{'leftTime': {{leftTime}} }">仅剩<span class="left-day">${d}天</span>${h}时${m}分${s}秒</div>
5 </div> 5 </div>
6 6
7 <!--<div id="demo4">--> 7 <!--<div id="demo4">-->
8 - <!--<p>2 notify:cd.notify(xx, fn); 当倒计时还剩xx秒时调用fn,精准度为 1s</p>--> 8 + <!--&lt;!&ndash;notify:cd.notify(xx, fn); 当倒计时还剩xx秒时调用fn,精准度为 1s&ndash;&gt;-->
9 <!--<div class="cd cd-large cd-slide" data-config="{'leftTime':4}">剩余时间:<span class="clock">${h}时${m}分${s}秒</span></div>--> 9 <!--<div class="cd cd-large cd-slide" data-config="{'leftTime':4}">剩余时间:<span class="clock">${h}时${m}分${s}秒</span></div>-->
10 <!--</div>--> 10 <!--</div>-->
11 <!--<div id="demo6">--> 11 <!--<div id="demo6">-->
12 - <!--<p>3 使用本地时间(注意:stopPoint为UNIX时间戳,故单位是毫秒) & 使用js配置,不依赖DOM上的data-config</p>--> 12 + <!--&lt;!&ndash;使用本地时间(注意:stopPoint为UNIX时间戳,故单位是毫秒) & 使用js配置,不依赖DOM上的data-config&ndash;&gt;-->
13 <!--<div class="cd cd-large cd-slide" data-config="{'stopPoint':4529059200000,'effect':'slide'}">剩余时间:<span class="clock">${d}天${h}时${m}分${s}秒</span></div>--> 13 <!--<div class="cd cd-large cd-slide" data-config="{'stopPoint':4529059200000,'effect':'slide'}">剩余时间:<span class="clock">${d}天${h}时${m}分${s}秒</span></div>-->
14 <!--</div>--> 14 <!--</div>-->
1 <div class="active-list"> 1 <div class="active-list">
2 -{{#data}}  
3 <a class="back-ground-white {{#if hide}} hidden {{/if}}" href="{{activityUrl}}" > 2 <a class="back-ground-white {{#if hide}} hidden {{/if}}" href="{{activityUrl}}" >
4 <img class="back-image" src="{{image coverUrl 640 300}}"> 3 <img class="back-image" src="{{image coverUrl 640 300}}">
5 <div class="center-square"> 4 <div class="center-square">
6 - <img class="logo" src="{{image logoUrl 150 100}}"></img> 5 + <img class="logo" src="{{image logoUrl 85 55}}"></img>
7 <div class="title">{{title}}</div> 6 <div class="title">{{title}}</div>
8 <div class="num">{{promotionName}} </div> 7 <div class="num">{{promotionName}} </div>
9 {{>product/outlet/countdown}} 8 {{>product/outlet/countdown}}
10 </div> 9 </div>
11 </a> 10 </a>
12 -{{/data}}  
13 </div> 11 </div>
14 <div class="more-activity hide"><p>更多精彩活动</p><span class="iconfont count-down-icon">&#xe609;</span></div> 12 <div class="more-activity hide"><p>更多精彩活动</p><span class="iconfont count-down-icon">&#xe609;</span></div>
@@ -5,13 +5,17 @@ var $ = require('yoho-jquery'), @@ -5,13 +5,17 @@ var $ = require('yoho-jquery'),
5 Countdown = require('./outlet/countdown'), 5 Countdown = require('./outlet/countdown'),
6 tip = require('../plugin/tip'); 6 tip = require('../plugin/tip');
7 7
8 -var el = $('.cd-lite'); 8 +var $el = $('.cd-medium');
9 9
10 require('../common'); 10 require('../common');
11 11
12 -new Countdown.Countdown({  
13 - el: el  
14 -}); 12 +if ($el.length > 0) {
  13 + $el.each(function(){
  14 + Countdown.Countdown({
  15 + el: $(this)
  16 + })
  17 + })
  18 +}
15 19
16 $('.will-end-back').on('click', function() { 20 $('.will-end-back').on('click', function() {
17 tip.show('活动即将结束'); 21 tip.show('活动即将结束');
@@ -5,13 +5,17 @@ var $ = require('yoho-jquery'), @@ -5,13 +5,17 @@ var $ = require('yoho-jquery'),
5 Countdown = require('./outlet/countdown'), 5 Countdown = require('./outlet/countdown'),
6 tip = require('../plugin/tip'); 6 tip = require('../plugin/tip');
7 7
8 -var el = $('.cd-lite'); 8 +var $el = $('.cd-lite');
9 9
10 require('../common'); 10 require('../common');
11 11
12 -new Countdown.Countdown({  
13 - el: el  
14 -}); 12 +if ($el.length > 0) {
  13 + $el.each(function(){
  14 + Countdown.Countdown({
  15 + el: $(this)
  16 + })
  17 + })
  18 +}
15 19
16 $('.back-ground-white').on('click', function() { 20 $('.back-ground-white').on('click', function() {
17 tip.show('活动即将开始'); 21 tip.show('活动即将开始');
@@ -15,9 +15,11 @@ lazyLoad($('img.lazy')); @@ -15,9 +15,11 @@ lazyLoad($('img.lazy'));
15 15
16 16
17 if ($el.length > 0) { 17 if ($el.length > 0) {
18 - new Countdown.Countdown({  
19 - el: $el  
20 - }); 18 + $el.each(function(){
  19 + Countdown.Countdown({
  20 + el: $(this)
  21 + })
  22 + })
21 } 23 }
22 24
23 if ($('.swiper-container .swiper-slide').length > 1) { 25 if ($('.swiper-container .swiper-slide').length > 1) {
@@ -69,15 +71,16 @@ if ($('#index_nav').length > 0) { @@ -69,15 +71,16 @@ if ($('#index_nav').length > 0) {
69 }).goto($('#index_nav').find('.active').index()); 71 }).goto($('#index_nav').find('.active').index());
70 } 72 }
71 73
72 -if ($('.outlet-category-nav').length > 0) { 74 +if ($('#list-nav').length > 0) {
73 iscroll({ 75 iscroll({
74 - el: '.outlet-category-nav' 76 + el: '#list-nav'
75 }).goto(0); 77 }).goto(0);
76 } 78 }
77 79
78 if ($('.back-ground-white').length > 10) { 80 if ($('.back-ground-white').length > 10) {
79 $('.more-activity').show(); 81 $('.more-activity').show();
80 $('.back-ground-white').each(function(index, e) { 82 $('.back-ground-white').each(function(index, e) {
  83 + console.log(index);
81 if(index > 9) { 84 if(index > 9) {
82 $(e).hide(); 85 $(e).hide();
83 } 86 }
@@ -87,7 +90,7 @@ if ($('.back-ground-white').length > 10) { @@ -87,7 +90,7 @@ if ($('.back-ground-white').length > 10) {
87 $('.more-activity').click(function() { 90 $('.more-activity').click(function() {
88 $('.more-activity').hide(); 91 $('.more-activity').hide();
89 $('.back-ground-white').each(function(index, e) { 92 $('.back-ground-white').each(function(index, e) {
90 - if (index > 9) { 93 + if(index > 9) {
91 $(e).show(); 94 $(e).show();
92 } 95 }
93 }); 96 });
@@ -45,17 +45,17 @@ @@ -45,17 +45,17 @@
45 45
46 .center-square { 46 .center-square {
47 position: absolute; 47 position: absolute;
48 - top: 50px;  
49 - width: 70%;  
50 - margin-left: 15%;  
51 - height: 200px; 48 + margin-top: -106px;
  49 + margin-left: -193px;
  50 + width: 386px;
  51 + left: 50%;
  52 + top: 50%;
  53 + height: 212px;
52 } 54 }
53 55
54 .logo { 56 .logo {
55 - opacity: 1;  
56 - width: 100px;  
57 - height: auto;  
58 margin-bottom: 10px; 57 margin-bottom: 10px;
  58 + margin-top: 20px;
59 } 59 }
60 60
61 .num { 61 .num {
@@ -66,8 +66,10 @@ @@ -66,8 +66,10 @@
66 66
67 .title { 67 .title {
68 text-align: center; 68 text-align: center;
69 - font-size: 28px; 69 + font-size: 32px;
70 font-weight: bold; 70 font-weight: bold;
  71 + height: 40px;
  72 + line-height: 40px;
71 overflow: hidden; 73 overflow: hidden;
72 text-overflow: ellipsis; 74 text-overflow: ellipsis;
73 white-space: nowrap; 75 white-space: nowrap;