Authored by liangxs

奥莱活动楼层

@@ -17,7 +17,7 @@ exports.index = (req, res) => { @@ -17,7 +17,7 @@ exports.index = (req, res) => {
17 let channel = req.query.channel || req.cookies._Channel || 'boys'; 17 let channel = req.query.channel || req.cookies._Channel || 'boys';
18 let headerData = headerModel.setNavHeader('OUTLET', channel, true, '', null); 18 let headerData = headerModel.setNavHeader('OUTLET', channel, true, '', null);
19 19
20 - outletModel.getContent().then(result => { 20 + outletModel.getContent(channel).then(result => {
21 res.render('outlet', Object.assign({ 21 res.render('outlet', Object.assign({
22 pageHeader: headerData, 22 pageHeader: headerData,
23 pageFooter: true 23 pageFooter: true
@@ -40,14 +40,17 @@ exports.activity = (req, res) => { @@ -40,14 +40,17 @@ exports.activity = (req, res) => {
40 }; 40 };
41 41
42 exports.willBeEnd = (req, res) => { 42 exports.willBeEnd = (req, res) => {
43 - outletModel.willBeEnd().then(result => {  
44 - console.log(result); 43 + let channel = req.query.channel || req.cookies._Channel || 'boys';
  44 +
  45 + outletModel.getNearlyActivity(channel, 2).then(result => {
45 res.render('outlet/will-end', Object.assign(renderData, result)); 46 res.render('outlet/will-end', Object.assign(renderData, result));
46 }); 47 });
47 }; 48 };
48 49
49 exports.willBeCome = (req, res) => { 50 exports.willBeCome = (req, res) => {
50 - outletModel.willBeCome().then(result => { 51 + let channel = req.query.channel || req.cookies._Channel || 'boys';
  52 +
  53 + outletModel.getNearlyActivity(channel, 3).then(result => {
51 res.render('outlet/will-start', Object.assign(renderData, result)); 54 res.render('outlet/will-start', Object.assign(renderData, result));
52 }); 55 });
53 }; 56 };
@@ -116,8 +116,6 @@ const getActivityDetail = (id) => { @@ -116,8 +116,6 @@ const getActivityDetail = (id) => {
116 116
117 const convertActicityData = (data) => { 117 const convertActicityData = (data) => {
118 const formatData = []; 118 const formatData = [];
119 - var showMore = false;  
120 - var i;  
121 119
122 data = data || []; 120 data = data || [];
123 _.forEach(data, (item) => { 121 _.forEach(data, (item) => {
@@ -127,48 +125,43 @@ const convertActicityData = (data) => { @@ -127,48 +125,43 @@ const convertActicityData = (data) => {
127 logoUrl: item.logoUrl, 125 logoUrl: item.logoUrl,
128 title: item.title, 126 title: item.title,
129 promotionName: item.promotionName, 127 promotionName: item.promotionName,
130 - startLeftTime: item.startLeftTime, 128 + leftTime: item.startLeftTime > 0 ? item.startLeftTime : item.endLeftTime,
131 hide: false 129 hide: false
132 }); 130 });
133 }); 131 });
134 132
135 -  
136 - if (formatData.length > 10) {  
137 - for (i = 10; i < formatData.length; i++) {  
138 - formatData[i].hide = true;  
139 - }  
140 - showMore = true;  
141 - }  
142 -  
143 - return {data: formatData, showMore: showMore}; 133 + return formatData;
144 }; 134 };
145 135
146 -const getHomeActivity = (id) => { 136 +const getHomeActivity = (data) => {
147 var params = { 137 var params = {
148 method: 'app.outlets.activityGet', 138 method: 'app.outlets.activityGet',
149 platform: 2, 139 platform: 2,
150 size: 0, 140 size: 0,
151 - yh_channel: 1,  
152 - type: 0,  
153 sort: 2, 141 sort: 2,
154 client_type: 'h5' 142 client_type: 'h5'
155 }; 143 };
156 144
157 - return api.get('', sign.apiSign(params)).then(res => {  
158 - if (id === 0) {  
159 - return convertActicityData(res.data);  
160 - }  
161 - return res.data; 145 + return api.get('', sign.apiSign(_.assign(params, data))).then(res => {
  146 + return convertActicityData(res.data);
162 }); 147 });
163 }; 148 };
164 149
165 -exports.getContent = () => {  
166 - let floorsData = {}; 150 +exports.getContent = (channel) => {
  151 + let floorsData = {},
  152 + params = {
  153 + type: 0,
  154 + id: 0
  155 + };
167 156
168 - return Promise.all([getNavData(), getOutletResource(), getHomeActivity(0), getGoodsList()]).then(data => { 157 + if (channel === 'boys') {
  158 + params.yh_channel = 1;
  159 + }
  160 +
  161 + return Promise.all([getNavData(), getOutletResource(), getHomeActivity(params), getGoodsList()]).then(data => {
169 floorsData.nav = data[0] || []; 162 floorsData.nav = data[0] || [];
170 floorsData.content = data[1] || []; 163 floorsData.content = data[1] || [];
171 - floorsData.activity = data[2] || []; 164 + floorsData.activity = {data: data[2]};
172 floorsData.goods = data[3]; 165 floorsData.goods = data[3];
173 166
174 return floorsData; 167 return floorsData;
@@ -186,20 +179,16 @@ exports.getActivity = (id) => { @@ -186,20 +179,16 @@ exports.getActivity = (id) => {
186 }); 179 });
187 }; 180 };
188 181
189 -exports.willBeEnd = () => {  
190 - return getHomeActivity().then(res => {  
191 - var data = {  
192 - activity: {  
193 - data: res  
194 - }  
195 - }; 182 +exports.getNearlyActivity = (channel, type) => {
  183 + var params = {
  184 + type: type
  185 + };
196 186
197 - return data;  
198 - });  
199 -}; 187 + if (channel === 'boys') {
  188 + params.yh_channel = 1;
  189 + }
200 190
201 -exports.willBeCome = () => {  
202 - return getHomeActivity().then(res => { 191 + return getHomeActivity(params).then(res => {
203 var data = { 192 var data = {
204 activity: { 193 activity: {
205 data: res 194 data: res
1 <div class="outlet-page"> 1 <div class="outlet-page">
2 {{log activity}} 2 {{log activity}}
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">{{startLeftTime}}</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 + {{> resources/acivity-outlets}}
15 {{/ activity}} 5 {{/ activity}}
16 </div> 6 </div>
1 <div id="demo1"> 1 <div id="demo1">
2 - <p>1 默认,服务端输出leftTime,把客户端时间干扰降到最低。单位秒</p>  
3 - <div class="cd cd-lite" data-config="{'leftTime':10}">剩余时间:${d}天${h}时${m}分${s}秒</div>  
4 - <div class="cd cd-medium" data-config="{'leftTime':10}">剩余时间:${h}时${m}分${s}秒</div> 2 + <!--<p>1 默认,服务端输出leftTime,把客户端时间干扰降到最低。单位秒</p>-->
  3 + <div class="cd cd-lite time" data-config="{'leftTime':{{leftTime}} }">— 仅剩${d}天${h}时${m}分${s}秒 —</div>
  4 + <!--<div class="cd cd-medium" data-config="{'leftTime':82390943}">剩余时间:${h}时${m}分${s}秒</div>-->
5 </div> 5 </div>
6 6
7 -<div id="demo4">  
8 - <p>2 notify:cd.notify(xx, fn); 当倒计时还剩xx秒时调用fn,精准度为 1s</p>  
9 - <div class="cd cd-large cd-slide" data-config="{'leftTime':4}">剩余时间:<span class="clock">${h}时${m}分${s}秒</span></div>  
10 -</div>  
11 -<div id="demo6">  
12 - <p>3 使用本地时间(注意:stopPoint为UNIX时间戳,故单位是毫秒) & 使用js配置,不依赖DOM上的data-config</p>  
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>  
  7 +<!--<div id="demo4">-->
  8 + <!--<p>2 notify:cd.notify(xx, fn); 当倒计时还剩xx秒时调用fn,精准度为 1s</p>-->
  9 + <!--<div class="cd cd-large cd-slide" data-config="{'leftTime':4}">剩余时间:<span class="clock">${h}时${m}分${s}秒</span></div>-->
  10 +<!--</div>-->
  11 +<!--<div id="demo6">-->
  12 + <!--<p>3 使用本地时间(注意:stopPoint为UNIX时间戳,故单位是毫秒) & 使用js配置,不依赖DOM上的data-config</p>-->
  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>-->
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 <img class="logo" src="{{image logoUrl 150 100}}"></img> 5 <img class="logo" src="{{image logoUrl 150 100}}"></img>
6 <div class="title">{{title}}</div> 6 <div class="title">{{title}}</div>
7 <div class="num">{{promotionName}} </div> 7 <div class="num">{{promotionName}} </div>
8 - <div class="time">{{startLeftTime}}</div> 8 + {{>product/outlet/countdown}}
9 </div> 9 </div>
10 </a> 10 </a>
11 {{/data}} 11 {{/data}}
1 var $ = require('yoho-jquery'), 1 var $ = require('yoho-jquery'),
2 Swiper = require('yoho-swiper'), 2 Swiper = require('yoho-swiper'),
3 - lazyLoad = require('yoho-jquery-lazyload'); 3 + lazyLoad = require('yoho-jquery-lazyload'),
  4 + Countdown = require('./outlet/countdown');
  5 +
  6 +var el = $('.cd-lite');
4 7
5 // var nav = require('./outlet/nav'); 8 // var nav = require('./outlet/nav');
6 9
@@ -12,8 +15,9 @@ lazyLoad($('img.lazy')); @@ -12,8 +15,9 @@ lazyLoad($('img.lazy'));
12 // navClass: '.outlet-nav' 15 // navClass: '.outlet-nav'
13 // }) 16 // })
14 17
15 -  
16 - 18 +new Countdown.Countdown({
  19 + el: el
  20 +});
17 21
18 if ($('.swiper-container .swiper-slide').length > 1) { 22 if ($('.swiper-container .swiper-slide').length > 1) {
19 new Swiper('.swiper-container', { 23 new Swiper('.swiper-container', {
@@ -42,7 +42,7 @@ @@ -42,7 +42,7 @@
42 42
43 .center-square { 43 .center-square {
44 position: absolute; 44 position: absolute;
45 - background: #fffefa; 45 + background: rgba(255, 255, 255, 0.5);
46 opacity: 0.9; 46 opacity: 0.9;
47 top: 50px; 47 top: 50px;
48 width: 70%; 48 width: 70%;
@@ -54,6 +54,7 @@ @@ -54,6 +54,7 @@
54 opacity: 1; 54 opacity: 1;
55 width: 100px; 55 width: 100px;
56 height: auto; 56 height: auto;
  57 + margin-bottom: 10px;
57 } 58 }
58 59
59 .num { 60 .num {