Authored by 王水玲

单品日

@@ -12,6 +12,7 @@ const singleDay = (req, res) => { @@ -12,6 +12,7 @@ const singleDay = (req, res) => {
12 module: 'activity', 12 module: 'activity',
13 page: 'single-day', 13 page: 'single-day',
14 title: '超级单品日', 14 title: '超级单品日',
  15 + isApp: req.yoho.isApp,
15 pageHeader: headerModel.setNav({ 16 pageHeader: headerModel.setNav({
16 navTitle: '超级单品日', 17 navTitle: '超级单品日',
17 navBtn: false 18 navBtn: false
@@ -8,11 +8,13 @@ const utils = '../../../utils'; @@ -8,11 +8,13 @@ const utils = '../../../utils';
8 const logger = global.yoho.logger; 8 const logger = global.yoho.logger;
9 const serviceAPI = global.yoho.ServiceAPI; 9 const serviceAPI = global.yoho.ServiceAPI;
10 const api = global.yoho.API; 10 const api = global.yoho.API;
  11 +const helpers = global.yoho.helpers;
  12 +const _ = require('lodash');
11 const resourcesProcess = require(`${utils}/resources-process`); 13 const resourcesProcess = require(`${utils}/resources-process`);
12 14
13 const getResourceData = () => { 15 const getResourceData = () => {
14 return serviceAPI.get('operations/api/v5/resource/get', { 16 return serviceAPI.get('operations/api/v5/resource/get', {
15 - content_code: '345c80537dca15611f37ae4863004bfe' 17 + content_code: 'c0acf0296a3c329678fb45da958d9951'
16 }, { 18 }, {
17 cache: true 19 cache: true
18 }).then((result) => { 20 }).then((result) => {
@@ -33,7 +35,15 @@ const getProductData = (tabName) => { @@ -33,7 +35,15 @@ const getProductData = (tabName) => {
33 cache: true 35 cache: true
34 }).then((result) => { 36 }).then((result) => {
35 if (result && result.code === 200) { 37 if (result && result.code === 200) {
36 - return result; 38 + result.data = result.data || [];
  39 +
  40 + _.forEach(result.data, (item) => {
  41 + item.url = helpers.urlFormat(`/product/pro_${item.productId}_${item.goodsId}/${item.cnAlphabet}.html`); // eslint-disable-line
  42 + item.url = helpers.appUrlFormat(item.url, 'go.productDetail', {
  43 + product_skn: item.productSkn
  44 + });
  45 + });
  46 + return result.data;
37 } else { 47 } else {
38 logger.error('get product data code no 200'); 48 logger.error('get product data code no 200');
39 return []; 49 return [];
@@ -50,7 +60,7 @@ const getTabData = () => { @@ -50,7 +60,7 @@ const getTabData = () => {
50 cache: true 60 cache: true
51 }).then((result) => { 61 }).then((result) => {
52 if (result && result.code === 200) { 62 if (result && result.code === 200) {
53 - return result; 63 + return result.data || [];
54 } else { 64 } else {
55 logger.error('get tab data code no 200'); 65 logger.error('get tab data code no 200');
56 return []; 66 return [];
@@ -2,30 +2,5 @@ @@ -2,30 +2,5 @@
2 <div class="banner"></div> 2 <div class="banner"></div>
3 <div class="swiper-tab"></div> 3 <div class="swiper-tab"></div>
4 4
5 - <div class="product-list">  
6 - <!--<ul>-->  
7 - <!--<li>-->  
8 - <!--<a href="">-->  
9 - <!--<img src=""/>-->  
10 - <!--<div class="product-info">-->  
11 - <!--<h3>AVIREX L-2 PATCH YING TIGERS男款上海别注夹克</h3>-->  
12 - <!--<p class="prompt-info">下单后25个工作日发货</p>-->  
13 - <!--<p class="price"><span class="sale-price">¥589</span><span class="market-price">¥1234</span></p>-->  
14 - <!--<p class="info-txt">#Yoho!Buy限定联名T恤#</p>-->  
15 - <!--</div>-->  
16 - <!--</a>-->  
17 - <!--</li>-->  
18 - <!--<li>-->  
19 - <!--<a href="">-->  
20 - <!--<img src=""/>-->  
21 - <!--<div class="product-info">-->  
22 - <!--<h3>AVIREX L-2 PATCH YING TIGERS男款上海别注夹克</h3>-->  
23 - <!--<p class="prompt-info">下单后25个工作日发货</p>-->  
24 - <!--<p class="price"><span class="sale-price">¥589</span><span class="market-price">¥1234</span></p>-->  
25 - <!--<p class="info-txt">#Yoho!Buy限定联名T恤#</p>-->  
26 - <!--</div>-->  
27 - <!--</a>-->  
28 - <!--</li>-->  
29 - <!--</ul>-->  
30 - </div> 5 + <div class="product-list"></div>
31 </div> 6 </div>
@@ -16,15 +16,21 @@ module.exports = { @@ -16,15 +16,21 @@ module.exports = {
16 siteUrl: '//m.yohobuy.com', 16 siteUrl: '//m.yohobuy.com',
17 assetUrl: '//localhost:5001', 17 assetUrl: '//localhost:5001',
18 domains: { 18 domains: {
19 - api: 'http://api.yoho.yohoops.org/',  
20 - service: 'http://service.yoho.yohoops.org/',  
21 - liveApi: 'http://api.live.yoho.cn/',  
22 - singleApi: 'http://single.yoho.cn/' 19 + //api: 'http://api.yoho.yohoops.org/',
  20 + // service: 'http://service.yoho.yohoops.org/',
  21 + // liveApi: 'http://api.live.yoho.cn/',
  22 + // singleApi: 'http://single.yoho.cn/'
  23 +
  24 + //api: 'http://api-test1.yohops.com:9999/',
  25 + service: 'http://service-test1.yohops.com:9999/',
  26 + //liveApi: 'http://testapi.live.yohops.com:9999/',
  27 + //singleApi: 'http://api-test1.yohops.com:9999/'
  28 +
  29 + api: 'http://dev-api.yohops.com:9999/',
  30 + //service: 'http://dev-service.yohops.com:9999/',
  31 + liveApi: 'http://testapi.live.yohops.com:9999/',
  32 + singleApi: 'http://api-test1.yohops.com:9999/'
23 33
24 - // api: 'http://api-test1.yohops.com:9999/',  
25 - // service: 'http://service-test1.yohops.com:9999/',  
26 - // liveApi: 'http://testapi.live.yohops.com:9999/',  
27 - // singleApi: 'http://api-test1.yohops.com:9999/',  
28 }, 34 },
29 subDomains: { 35 subDomains: {
30 host: '.m.yohobuy.com', 36 host: '.m.yohobuy.com',
@@ -7,6 +7,7 @@ var $ = require('yoho-jquery'), @@ -7,6 +7,7 @@ var $ = require('yoho-jquery'),
7 Swiper = require('yoho-swiper'), 7 Swiper = require('yoho-swiper'),
8 tip = require('../plugin/tip'), 8 tip = require('../plugin/tip'),
9 loading = require('../plugin/loading'), 9 loading = require('../plugin/loading'),
  10 + lazyload = require('yoho-jquery-lazyload'),
10 banner = require('../../template/resources/banner-top.hbs'), 11 banner = require('../../template/resources/banner-top.hbs'),
11 tab = require('../../template/activity/single-day/tab.hbs'), 12 tab = require('../../template/activity/single-day/tab.hbs'),
12 product = require('../../template/activity/single-day/product-list.hbs'); 13 product = require('../../template/activity/single-day/product-list.hbs');
@@ -23,7 +24,7 @@ var getProductData = function(index, tabName) { @@ -23,7 +24,7 @@ var getProductData = function(index, tabName) {
23 loading.showLoadingMask(); 24 loading.showLoadingMask();
24 $.ajax({ 25 $.ajax({
25 type: 'GET', 26 type: 'GET',
26 - url: '', 27 + url: '/activity/single-day/getProductData',
27 data: { 28 data: {
28 tab_name: tabName 29 tab_name: tabName
29 }, 30 },
@@ -32,6 +33,7 @@ var getProductData = function(index, tabName) { @@ -32,6 +33,7 @@ var getProductData = function(index, tabName) {
32 $('.product-tab').eq(index).append(product(data)); 33 $('.product-tab').eq(index).append(product(data));
33 } 34 }
34 35
  36 + lazyload($('img.lazy'));
35 getFlag = false; 37 getFlag = false;
36 loading.hideLoadingMask(); 38 loading.hideLoadingMask();
37 }, 39 },
@@ -52,9 +54,9 @@ var getInitData = function() { @@ -52,9 +54,9 @@ var getInitData = function() {
52 type: 'GET', 54 type: 'GET',
53 url: '/activity/single-day/getSingleData', 55 url: '/activity/single-day/getSingleData',
54 success: function(data) { 56 success: function(data) {
55 - var i = 0; 57 + var i = 0, $swiperTab;
56 58
57 - data[1] = ['限定名额', '首发', '热卖', '明星单品']; 59 + //data[1] = ['限定名额', '首发', '热卖', '明星单品'];
58 if (data[0]) { 60 if (data[0]) {
59 $('.banner').append(banner(data[0][0])); 61 $('.banner').append(banner(data[0][0]));
60 62
@@ -75,6 +77,8 @@ var getInitData = function() { @@ -75,6 +77,8 @@ var getInitData = function() {
75 if (data[1]) { 77 if (data[1]) {
76 $('.swiper-tab').append(tab(data[1])); 78 $('.swiper-tab').append(tab(data[1]));
77 79
  80 + $swiperTab = $('.swiper-tab li');
  81 +
78 new Swiper('.swiper-tab', { 82 new Swiper('.swiper-tab', {
79 slidesPerView: 'auto' 83 slidesPerView: 'auto'
80 }); 84 });
@@ -84,19 +88,19 @@ var getInitData = function() { @@ -84,19 +88,19 @@ var getInitData = function() {
84 } 88 }
85 89
86 getProductData(hash, tabName(hash)); 90 getProductData(hash, tabName(hash));
  91 + $swiperTab.eq(hash).addClass('active');
87 92
88 - $('.swiper-tab li')  
89 - .eq(hash)  
90 - .addClass('active')  
91 - .on('click', function() {  
92 - var index = $(this).index();  
93 -  
94 - if ($('.product-tab').eq(index).find('li').length > 0) {  
95 - return false;  
96 - } else {  
97 - getProductData(index, tabName(index));  
98 - }  
99 - }); 93 + $swiperTab.on('click', function() {
  94 + var index = $(this).index();
  95 +
  96 + $swiperTab.removeClass('active').eq(index).addClass('active');
  97 +
  98 + if ($('.product-tab').eq(index).find('li').length > 0) {
  99 + return false;
  100 + } else {
  101 + getProductData(index, tabName(index));
  102 + }
  103 + });
100 } 104 }
101 105
102 loading.hideLoadingMask(); 106 loading.hideLoadingMask();
@@ -3,6 +3,11 @@ @@ -3,6 +3,11 @@
3 3
4 .banner { 4 .banner {
5 width: 100%; 5 width: 100%;
  6 + height: 200px;
  7 +
  8 + .swiper-slide {
  9 + height: 200px;
  10 + }
6 } 11 }
7 12
8 .swiper-tab { 13 .swiper-tab {
@@ -22,6 +27,7 @@ @@ -22,6 +27,7 @@
22 line-height: 30px; 27 line-height: 30px;
23 color: #b0b0b0; 28 color: #b0b0b0;
24 width: auto; 29 width: auto;
  30 + font-size: 26px;
25 } 31 }
26 32
27 li:last-child { 33 li:last-child {
@@ -47,7 +53,7 @@ @@ -47,7 +53,7 @@
47 height: auto; 53 height: auto;
48 overflow: hidden; 54 overflow: hidden;
49 55
50 - img { 56 + .lazy {
51 width: 274px; 57 width: 274px;
52 height: 368px; 58 height: 368px;
53 float: left; 59 float: left;
@@ -61,21 +67,28 @@ @@ -61,21 +67,28 @@
61 float: left; 67 float: left;
62 position: relative; 68 position: relative;
63 border-bottom: 1px solid #e8e8e8; 69 border-bottom: 1px solid #e8e8e8;
  70 + padding-right: 15px;
  71 + box-sizing: border-box;
64 } 72 }
65 73
66 h3 { 74 h3 {
67 margin-top: 43px; 75 margin-top: 43px;
68 - font-size: 24px; 76 + font-size: 28px;
69 display: -webkit-box; 77 display: -webkit-box;
70 -webkit-box-orient: vertical; 78 -webkit-box-orient: vertical;
71 -webkit-line-clamp: 2; 79 -webkit-line-clamp: 2;
72 overflow: hidden; 80 overflow: hidden;
  81 + color: #444;
73 } 82 }
74 83
75 .prompt-info { 84 .prompt-info {
76 - font-size: 20px; 85 + font-size: 24px;
77 margin-top: 28px; 86 margin-top: 28px;
78 color: #d11226; 87 color: #d11226;
  88 + width: 100%;
  89 + overflow: hidden;
  90 + white-space: nowrap;
  91 + text-overflow: ellipsis;
79 } 92 }
80 93
81 .price { 94 .price {
@@ -83,8 +96,8 @@ @@ -83,8 +96,8 @@
83 } 96 }
84 97
85 .sale-price { 98 .sale-price {
86 - font-size: 20px;  
87 - color: #d11226; 99 + font-size: 24px;
  100 + color: #cf031e;
88 } 101 }
89 102
90 .no-price { 103 .no-price {
@@ -92,8 +105,8 @@ @@ -92,8 +105,8 @@
92 } 105 }
93 106
94 .market-price { 107 .market-price {
95 - font-size: 20px;  
96 - color: #a1a1a1; 108 + font-size: 24px;
  109 + color: #b0b0b0;
97 text-decoration: line-through; 110 text-decoration: line-through;
98 margin-left: 14px; 111 margin-left: 14px;
99 } 112 }
@@ -101,11 +114,12 @@ @@ -101,11 +114,12 @@
101 .info-txt { 114 .info-txt {
102 position: absolute; 115 position: absolute;
103 top: 298px; 116 top: 298px;
104 - font-size: 20px; 117 + font-size: 24px;
105 display: -webkit-box; 118 display: -webkit-box;
106 -webkit-box-orient: vertical; 119 -webkit-box-orient: vertical;
107 -webkit-line-clamp: 2; 120 -webkit-line-clamp: 2;
108 overflow: hidden; 121 overflow: hidden;
  122 + color: #454545;
109 } 123 }
110 } 124 }
111 } 125 }
1 -{{#each data}} 1 +{{#each this}}
2 <li > 2 <li >
3 <a href="{{url}}"> 3 <a href="{{url}}">
4 - <img src="{{image productLink 274 368}}"/> 4 + <img class="lazy" data-original="{{image productLink 274 368}}"/>
5 <div class="product-info"> 5 <div class="product-info">
6 <h3>{{productTitle}}</h3> 6 <h3>{{productTitle}}</h3>
7 - {{#intro}}<p class="prompt-info">{{intro}}</p>{{/intro}}  
8 - <p class="price"><span class="sale-price {{^marketPrice}}no-price{{/marketPrice}}">¥{{salePrice}}</span><span class="market-price">¥{{marketPrice}}</span></p> 7 + {{#salesPhrase}}
  8 + <p class="prompt-info">{{.}}</p>
  9 + {{/salesPhrase}}
  10 + <p class="price">
  11 + <span class="sale-price {{^marketPrice}}no-price{{/marketPrice}}">¥{{salesPrice}}</span>
  12 + {{#marketPrice}}
  13 + <span class="market-price">¥{{.}}</span>
  14 + {{/marketPrice}}
  15 + </p>
9 <p class="info-txt">{{productDesc}}</p> 16 <p class="info-txt">{{productDesc}}</p>
10 </div> 17 </div>
11 </a> 18 </a>