Merge remote-tracking branch 'origin/release/5.1' into release/5.1
Showing
8 changed files
with
223 additions
and
116 deletions
@@ -41,12 +41,7 @@ const getListData = (req, res, next) => { | @@ -41,12 +41,7 @@ const getListData = (req, res, next) => { | ||
41 | navTitle: '明星原创' | 41 | navTitle: '明星原创' |
42 | }), | 42 | }), |
43 | pageFooter: true, | 43 | pageFooter: true, |
44 | - ps: { | ||
45 | - sName: '明星潮品', | ||
46 | - pName: '原创潮牌', | ||
47 | - star: result.star, | ||
48 | - plus: result.plus | ||
49 | - } | 44 | + ps: result |
50 | }); | 45 | }); |
51 | }).catch(next); | 46 | }).catch(next); |
52 | } else { | 47 | } else { |
@@ -60,12 +55,7 @@ const getListData = (req, res, next) => { | @@ -60,12 +55,7 @@ const getListData = (req, res, next) => { | ||
60 | navTitle: '国际优选' | 55 | navTitle: '国际优选' |
61 | }), | 56 | }), |
62 | pageFooter: true, | 57 | pageFooter: true, |
63 | - ps: { | ||
64 | - sName: '设计师', | ||
65 | - pName: '经典潮牌', | ||
66 | - star: result.star, | ||
67 | - plus: result.plus | ||
68 | - } | 58 | + ps: result |
69 | }); | 59 | }); |
70 | }).catch(next); | 60 | }).catch(next); |
71 | } | 61 | } |
@@ -79,6 +69,8 @@ const getDetailData = (req, res, next) => { | @@ -79,6 +69,8 @@ const getDetailData = (req, res, next) => { | ||
79 | let isApp = req.query.app_version || req.query.appVersion || false; | 69 | let isApp = req.query.app_version || req.query.appVersion || false; |
80 | let clientType = req.body.client_type || ''; | 70 | let clientType = req.body.client_type || ''; |
81 | let version = req.body.app_version || ''; | 71 | let version = req.body.app_version || ''; |
72 | + let userAgent = req.get('User-Agent'); | ||
73 | + let isWeixin = userAgent.includes('MicroMessenger'); // 标识是否是微信访问 | ||
82 | 74 | ||
83 | if (clientType.toLowerCase() === 'ios' && version) { | 75 | if (clientType.toLowerCase() === 'ios' && version) { |
84 | clientType = 'iphone'; | 76 | clientType = 'iphone'; |
@@ -90,15 +82,26 @@ const getDetailData = (req, res, next) => { | @@ -90,15 +82,26 @@ const getDetailData = (req, res, next) => { | ||
90 | 82 | ||
91 | plustarModel.getDetailData(id, uid, udid, gender, isApp, clientType).then((result) => { | 83 | plustarModel.getDetailData(id, uid, udid, gender, isApp, clientType).then((result) => { |
92 | result.brandIntro = htmlProcess.removeHtml(result.brandIntro); | 84 | result.brandIntro = htmlProcess.removeHtml(result.brandIntro); |
93 | - res.render('plustar/detail', { | ||
94 | - module: 'guang', | ||
95 | - page: 'plustar-detail', | ||
96 | - title: result.brandName, | ||
97 | - pageHeader: headerModel.setNav({ | ||
98 | - navTitle: result.brandName | ||
99 | - }), | ||
100 | - ps: result | ||
101 | - }); | 85 | + |
86 | + if (!isApp & !isWeixin) { | ||
87 | + res.render('plustar/detail', { | ||
88 | + module: 'guang', | ||
89 | + page: 'plustar-detail', | ||
90 | + title: result.brandName, | ||
91 | + pageHeader: headerModel.setNav({ | ||
92 | + navTitle: result.brandName | ||
93 | + }), | ||
94 | + ps: result | ||
95 | + }); | ||
96 | + } else { | ||
97 | + res.render('plustar/detail', { | ||
98 | + module: 'guang', | ||
99 | + page: 'plustar-detail', | ||
100 | + title: result.brandName, | ||
101 | + ps: result | ||
102 | + }); | ||
103 | + } | ||
104 | + | ||
102 | }).catch(next); | 105 | }).catch(next); |
103 | }; | 106 | }; |
104 | 107 |
@@ -5,6 +5,15 @@ const _ = require('lodash'); | @@ -5,6 +5,15 @@ const _ = require('lodash'); | ||
5 | const logger = global.yoho.logger; | 5 | const logger = global.yoho.logger; |
6 | const camelCase = global.yoho.camelCase; | 6 | const camelCase = global.yoho.camelCase; |
7 | const helpers = global.yoho.helpers; | 7 | const helpers = global.yoho.helpers; |
8 | +const htmlProcess = require(`${global.utils}/html-process`); | ||
9 | + | ||
10 | +const privateKeyList = { | ||
11 | + android: 'fd4ad5fcfa0de589ef238c0e7331b585', | ||
12 | + iphone: 'a85bb0674e08986c6b115d5e3a4884fa', | ||
13 | + ipad: 'ad9fcda2e679cf9229e37feae2cdcf80', | ||
14 | + web: '0ed29744ed318fd28d2c07985d3ba633', | ||
15 | + h5: 'fd4ad5fcfa0de589ef238c0e7331b585' | ||
16 | +}; | ||
8 | 17 | ||
9 | const formaData = (data, gender) => { | 18 | const formaData = (data, gender) => { |
10 | let build = []; | 19 | let build = []; |
@@ -61,7 +70,7 @@ const getContentData = (gender, type, channel, isRecommend) => { | @@ -61,7 +70,7 @@ const getContentData = (gender, type, channel, isRecommend) => { | ||
61 | if (result && result.code === 200) { | 70 | if (result && result.code === 200) { |
62 | return formaData(result.data.data.list[0].data, gender); | 71 | return formaData(result.data.data.list[0].data, gender); |
63 | } else { | 72 | } else { |
64 | - logger.error('列表 list data return code is not 200'); | 73 | + logger.error('list data return code is not 200'); |
65 | return {}; | 74 | return {}; |
66 | } | 75 | } |
67 | }); | 76 | }); |
@@ -69,19 +78,45 @@ const getContentData = (gender, type, channel, isRecommend) => { | @@ -69,19 +78,45 @@ const getContentData = (gender, type, channel, isRecommend) => { | ||
69 | 78 | ||
70 | const getListData = (gender, recom, all) => { | 79 | const getListData = (gender, recom, all) => { |
71 | return Promise.all([getContentData(gender, recom), getContentData(gender, all)]).then((result) => { | 80 | return Promise.all([getContentData(gender, recom), getContentData(gender, all)]).then((result) => { |
72 | - return { | ||
73 | - star: result[0], | ||
74 | - plus: result[1] | ||
75 | - }; | 81 | + let ps = []; |
82 | + | ||
83 | + if (result[0]) { | ||
84 | + ps.push({ | ||
85 | + focus: true, | ||
86 | + name: '设计师', | ||
87 | + list: result[0] | ||
88 | + }); | ||
89 | + } | ||
90 | + | ||
91 | + if (result[1]) { | ||
92 | + ps.push({ | ||
93 | + name: '经典潮牌', | ||
94 | + list: result[1] | ||
95 | + }); | ||
96 | + } | ||
97 | + return ps; | ||
76 | }); | 98 | }); |
77 | }; | 99 | }; |
78 | 100 | ||
79 | const getBrandsData = (gender, starBrand, originalBrand, channel, isRecommend) => { | 101 | const getBrandsData = (gender, starBrand, originalBrand, channel, isRecommend) => { |
80 | return Promise.all([getContentData(gender, starBrand, isRecommend, channel), getContentData(gender, originalBrand, isRecommend, channel)]).then((result) => { | 102 | return Promise.all([getContentData(gender, starBrand, isRecommend, channel), getContentData(gender, originalBrand, isRecommend, channel)]).then((result) => { |
81 | - return { | ||
82 | - star: result[0], | ||
83 | - plus: result[1] | ||
84 | - }; | 103 | + let ps = []; |
104 | + | ||
105 | + if (result[1]) { | ||
106 | + ps.push({ | ||
107 | + focus: true, | ||
108 | + name: '原创潮牌', | ||
109 | + list: result[1] | ||
110 | + }); | ||
111 | + } | ||
112 | + | ||
113 | + if (result[0]) { | ||
114 | + ps.push({ | ||
115 | + name: '明星潮品', | ||
116 | + list: result[0] | ||
117 | + }); | ||
118 | + } | ||
119 | + return ps; | ||
85 | }); | 120 | }); |
86 | }; | 121 | }; |
87 | 122 | ||
@@ -153,7 +188,7 @@ const getNewProduct = (brandId, gender, url) => { | @@ -153,7 +188,7 @@ const getNewProduct = (brandId, gender, url) => { | ||
153 | studentPrice: list.sales_price * 0.9, | 188 | studentPrice: list.sales_price * 0.9, |
154 | is_soon_sold_out: list.is_soon_sold_out === 'Y', | 189 | is_soon_sold_out: list.is_soon_sold_out === 'Y', |
155 | isShowSaleTagDis: list.sales_price * 2 < list.market_price, | 190 | isShowSaleTagDis: list.sales_price * 2 < list.market_price, |
156 | - url: '/product/pro_' + list.product_id + '_' + | 191 | + url: '//m.yohobuy.com/product/pro_' + list.product_id + '_' + |
157 | list.goods_list[0].goods_id + '/' + list.cn_alphabet + '.html', | 192 | list.goods_list[0].goods_id + '/' + list.cn_alphabet + '.html', |
158 | tags: tag | 193 | tags: tag |
159 | }); | 194 | }); |
@@ -179,14 +214,15 @@ const getNewProduct = (brandId, gender, url) => { | @@ -179,14 +214,15 @@ const getNewProduct = (brandId, gender, url) => { | ||
179 | }; | 214 | }; |
180 | 215 | ||
181 | // 相关资讯 | 216 | // 相关资讯 |
182 | -const getRelatedEditorial = (brandId, uid, udid, clientType) => { | 217 | +const getRelatedEditorial = (brandId, uid, udid, clientType, isApp) => { |
183 | 218 | ||
184 | return serviceAPI.get('guang/service/v1/article/getArticleByBrand', { | 219 | return serviceAPI.get('guang/service/v1/article/getArticleByBrand', { |
185 | brand_id: brandId, | 220 | brand_id: brandId, |
186 | uid: uid, | 221 | uid: uid, |
187 | udid: udid, | 222 | udid: udid, |
188 | client_type: clientType, | 223 | client_type: clientType, |
189 | - limit: 3 | 224 | + limit: 3, |
225 | + private_key: privateKeyList[clientType] | ||
190 | }).then((result) => { | 226 | }).then((result) => { |
191 | 227 | ||
192 | if (result && result.code === 200) { | 228 | if (result && result.code === 200) { |
@@ -194,9 +230,13 @@ const getRelatedEditorial = (brandId, uid, udid, clientType) => { | @@ -194,9 +230,13 @@ const getRelatedEditorial = (brandId, uid, udid, clientType) => { | ||
194 | let list = []; | 230 | let list = []; |
195 | 231 | ||
196 | _.forEach(result.data, function(data) { | 232 | _.forEach(result.data, function(data) { |
233 | + if (isApp) { | ||
234 | + data.url = data.url + ''; | ||
235 | + } | ||
236 | + | ||
197 | list.push({ | 237 | list.push({ |
198 | id: data.id, | 238 | id: data.id, |
199 | - url: data.url, | 239 | + url: isApp ? `${helpers.https(data.url)}&openby:yohobuy={"action":"go.h5","params":{"param":{"id":"${data.id}"},"shareparam":{"id":"${data.id}"},"share":"/guang/api/v1/share/guang","id":${data.id},"type":1,"url":"http:${helpers.urlFormat('/info/index', null, 'guang')}","islogin":"N"}}` : data.url, |
200 | title: data.title, | 240 | title: data.title, |
201 | text: data.intro, | 241 | text: data.intro, |
202 | img: helpers.image(data.src, 640, 640), | 242 | img: helpers.image(data.src, 640, 640), |
@@ -206,6 +246,8 @@ const getRelatedEditorial = (brandId, uid, udid, clientType) => { | @@ -206,6 +246,8 @@ const getRelatedEditorial = (brandId, uid, udid, clientType) => { | ||
206 | }); | 246 | }); |
207 | }); | 247 | }); |
208 | 248 | ||
249 | + | ||
250 | + | ||
209 | return list; | 251 | return list; |
210 | } else { | 252 | } else { |
211 | logger.error('editorial data return code is not 200'); | 253 | logger.error('editorial data return code is not 200'); |
@@ -219,7 +261,8 @@ const isCollection = (uid, brandId, clientType) => { | @@ -219,7 +261,8 @@ const isCollection = (uid, brandId, clientType) => { | ||
219 | return serviceAPI.get('shops/service/v1/favorite/getUidBrandFav', { | 261 | return serviceAPI.get('shops/service/v1/favorite/getUidBrandFav', { |
220 | uid: uid, | 262 | uid: uid, |
221 | brandId: brandId, | 263 | brandId: brandId, |
222 | - client_type: clientType | 264 | + client_type: clientType, |
265 | + private_key: privateKeyList[clientType] | ||
223 | }).then((result) => { | 266 | }).then((result) => { |
224 | 267 | ||
225 | if (result && result.code === 200) { | 268 | if (result && result.code === 200) { |
@@ -245,6 +288,7 @@ const getDetailData = (id, uid, udid, gender, isApp, clientType) => { | @@ -245,6 +288,7 @@ const getDetailData = (id, uid, udid, gender, isApp, clientType) => { | ||
245 | if (result && result.code === 200) { | 288 | if (result && result.code === 200) { |
246 | 289 | ||
247 | let list = result.data || []; | 290 | let list = result.data || []; |
291 | + let jumpToApp; | ||
248 | 292 | ||
249 | list = camelCase(list); | 293 | list = camelCase(list); |
250 | let url; | 294 | let url; |
@@ -259,12 +303,22 @@ const getDetailData = (id, uid, udid, gender, isApp, clientType) => { | @@ -259,12 +303,22 @@ const getDetailData = (id, uid, udid, gender, isApp, clientType) => { | ||
259 | url = '//' + brandDomain + '.m.yohobuy.com'; | 303 | url = '//' + brandDomain + '.m.yohobuy.com'; |
260 | } | 304 | } |
261 | 305 | ||
262 | - return Promise.all([isCollection(uid, brandId, clientType), getRelatedEditorial(brandId, uid, udid, clientType), getNewProduct(brandId, gender, url)]).then((result) => { | 306 | + if (isApp & !uid) { |
307 | + jumpToApp = 1; | ||
308 | + } | ||
309 | + | ||
310 | + return Promise.all([isCollection(uid, brandId, clientType), getRelatedEditorial(brandId, uid, udid, clientType, isApp), getNewProduct(brandId, gender, url)]).then((resultData) => { | ||
263 | 311 | ||
264 | list = _.assign(list, { | 312 | list = _.assign(list, { |
265 | - isLike: result[0], | ||
266 | - infos: result[1], | ||
267 | - newArrival: result[2] | 313 | + |
314 | + isLike: resultData[0], | ||
315 | + infos: resultData[1], | ||
316 | + newArrival: resultData[2], | ||
317 | + jumpToApp: jumpToApp, | ||
318 | + shareLink: '//guang.m.yohobuy.com/plustar/brandinfo?id=' + id, | ||
319 | + shareTitle: list.brandName, | ||
320 | + shareImg: list.brandIco, | ||
321 | + shareDesc: htmlProcess.removeHtml(list.brandIntro) | ||
268 | }); | 322 | }); |
269 | 323 | ||
270 | return list; | 324 | return list; |
1 | <div class="ps-list-page ps-page yoho-page"> | 1 | <div class="ps-list-page ps-page yoho-page"> |
2 | - {{# ps}} | ||
3 | - <ul id="nav-tab" class="nav-tab clearfix"> | ||
4 | - <li class="star-nav focus">{{sName}}</li> | ||
5 | - <li class="plus-nav">{{pName}}</li> | ||
6 | - </ul> | ||
7 | - <div id="ps-content" class="ps-content"> | ||
8 | - <ul class="star-content content"> | ||
9 | - {{# star}} | ||
10 | - {{> ps_item}} | ||
11 | - {{/ star}} | 2 | + <div class="ps-list-page ps-page yoho-page"> |
3 | + {{#if ps}} | ||
4 | + <ul id="nav-tab" class="nav-tab clearfix"> | ||
5 | + {{# ps}} | ||
6 | + <li {{#if focus}} class="focus" {{/if}} >{{name}}</li> | ||
7 | + {{/ps}} | ||
12 | </ul> | 8 | </ul> |
13 | - <ul class="plus-content content hide"> | ||
14 | - {{# plus}} | ||
15 | - {{> ps_item}} | ||
16 | - {{/ plus}} | ||
17 | - </ul> | ||
18 | - </div> | ||
19 | - {{/ ps}} | 9 | + <div id="ps-content" class="ps-content"> |
10 | + {{# ps}} | ||
11 | + <ul class="content{{#if focus}}{{^}} hide {{/if}}"> | ||
12 | + {{# list}} | ||
13 | + {{> ps_item}} | ||
14 | + {{/ list}} | ||
15 | + </ul> | ||
16 | + {{/ps}} | ||
17 | + </div> | ||
18 | + {{/if}} | ||
19 | + </div> | ||
20 | </div> | 20 | </div> |
@@ -327,8 +327,6 @@ function givePoint(parameter) { | @@ -327,8 +327,6 @@ function givePoint(parameter) { | ||
327 | 327 | ||
328 | window._yas.sendCustomInfo({ | 328 | window._yas.sendCustomInfo({ |
329 | op: 'YB_CHOOSE_FOR_YOU_Y', | 329 | op: 'YB_CHOOSE_FOR_YOU_Y', |
330 | - apf: (queryString().app_version || queryString().appVersion) ? true : false, | ||
331 | - ts: new Date().getTime(), | ||
332 | param: JSON.stringify(parameter) | 330 | param: JSON.stringify(parameter) |
333 | }, true); | 331 | }, true); |
334 | } | 332 | } |
@@ -65,8 +65,6 @@ plusstar = { | @@ -65,8 +65,6 @@ plusstar = { | ||
65 | if (window._yas && window._yas.sendCustomInfo) { | 65 | if (window._yas && window._yas.sendCustomInfo) { |
66 | window._yas.sendCustomInfo({ | 66 | window._yas.sendCustomInfo({ |
67 | op: 'YB_FASHION_TAB_C', | 67 | op: 'YB_FASHION_TAB_C', |
68 | - apf: isApp, | ||
69 | - ts: new Date().getTime(), | ||
70 | param: JSON.stringify($.extend(speckParamApp, { | 68 | param: JSON.stringify($.extend(speckParamApp, { |
71 | C_ID: CID, | 69 | C_ID: CID, |
72 | TAB_ID: $liDom.index() + 1 | 70 | TAB_ID: $liDom.index() + 1 |
@@ -75,8 +73,6 @@ plusstar = { | @@ -75,8 +73,6 @@ plusstar = { | ||
75 | 73 | ||
76 | window._yas.sendCustomInfo({ | 74 | window._yas.sendCustomInfo({ |
77 | op: 'YB_FASHION_HOME_L', | 75 | op: 'YB_FASHION_HOME_L', |
78 | - apf: isApp, | ||
79 | - ts: new Date().getTime(), | ||
80 | param: JSON.stringify($.extend(speckParamApp, { | 76 | param: JSON.stringify($.extend(speckParamApp, { |
81 | C_ID: CID, | 77 | C_ID: CID, |
82 | TAB_ID: that.ParentLiDom.index() + 1 | 78 | TAB_ID: that.ParentLiDom.index() + 1 |
@@ -131,8 +127,6 @@ plusstar = { | @@ -131,8 +127,6 @@ plusstar = { | ||
131 | index = $dom.index() + 1; | 127 | index = $dom.index() + 1; |
132 | window._yas.sendCustomInfo({ | 128 | window._yas.sendCustomInfo({ |
133 | op: 'YB_FASHION_FLR_C', | 129 | op: 'YB_FASHION_FLR_C', |
134 | - apf: isApp, | ||
135 | - ts: new Date().getTime(), | ||
136 | param: JSON.stringify($.extend(speckParamApp, { | 130 | param: JSON.stringify($.extend(speckParamApp, { |
137 | C_ID: CID, | 131 | C_ID: CID, |
138 | TAB_ID: that.ParentLiDom.index() + 1, | 132 | TAB_ID: that.ParentLiDom.index() + 1, |
@@ -150,8 +144,6 @@ plusstar = { | @@ -150,8 +144,6 @@ plusstar = { | ||
150 | 144 | ||
151 | window._yas.sendCustomInfo({ | 145 | window._yas.sendCustomInfo({ |
152 | op: 'YB_FASHION_FLR_C', | 146 | op: 'YB_FASHION_FLR_C', |
153 | - apf: isApp, | ||
154 | - ts: new Date().getTime(), | ||
155 | param: JSON.stringify($.extend(speckParamApp, { | 147 | param: JSON.stringify($.extend(speckParamApp, { |
156 | C_ID: CID, | 148 | C_ID: CID, |
157 | TAB_ID: that.ParentLiDom.index() + 1, | 149 | TAB_ID: that.ParentLiDom.index() + 1, |
@@ -168,8 +160,6 @@ plusstar = { | @@ -168,8 +160,6 @@ plusstar = { | ||
168 | // 潮流优选首页加载时 | 160 | // 潮流优选首页加载时 |
169 | window._yas.sendCustomInfo({ | 161 | window._yas.sendCustomInfo({ |
170 | op: 'YB_FASHION_HOME_L', | 162 | op: 'YB_FASHION_HOME_L', |
171 | - apf: isApp, | ||
172 | - ts: new Date().getTime(), | ||
173 | param: JSON.stringify($.extend(speckParamApp, { | 163 | param: JSON.stringify($.extend(speckParamApp, { |
174 | C_ID: CID, | 164 | C_ID: CID, |
175 | TAB_ID: that.ParentLiDom.index() + 1 | 165 | TAB_ID: that.ParentLiDom.index() + 1 |
@@ -5,24 +5,14 @@ var $ = require('yoho-jquery'), | @@ -5,24 +5,14 @@ var $ = require('yoho-jquery'), | ||
5 | var $navs = $('#nav-tab > li'), | 5 | var $navs = $('#nav-tab > li'), |
6 | $contents = $('#ps-content > .content'); | 6 | $contents = $('#ps-content > .content'); |
7 | 7 | ||
8 | -var mySwiper; | ||
9 | - | ||
10 | require('../common'); | 8 | require('../common'); |
11 | 9 | ||
12 | lazyLoad($('img.lazy')); | 10 | lazyLoad($('img.lazy')); |
13 | 11 | ||
14 | -$('.star-content li').each(function(key, item) { | ||
15 | - $(item).find('.swiper-container').addClass('swiper-' + key); | ||
16 | - | ||
17 | - mySwiper = new Swiper('.swiper-' + key, { | ||
18 | - lazyLoading: true, | ||
19 | - pagination: '.swiper-' + key + ' .pagination-inner' | ||
20 | - }); | ||
21 | -}); | ||
22 | - | ||
23 | -$('#nav-tab').bind('contextmenu', function(e) { | 12 | +$('#nav-tab').bind('contextmenu', function() { |
24 | return false; | 13 | return false; |
25 | }); | 14 | }); |
15 | + | ||
26 | $('#nav-tab').on('touchend touchcancel', function(e) { | 16 | $('#nav-tab').on('touchend touchcancel', function(e) { |
27 | var $this = $(e.target).closest('li'); | 17 | var $this = $(e.target).closest('li'); |
28 | 18 | ||
@@ -30,11 +20,26 @@ $('#nav-tab').on('touchend touchcancel', function(e) { | @@ -30,11 +20,26 @@ $('#nav-tab').on('touchend touchcancel', function(e) { | ||
30 | return; | 20 | return; |
31 | } | 21 | } |
32 | 22 | ||
33 | - $navs.toggleClass('focus'); | ||
34 | - $contents.toggleClass('hide'); | 23 | + $navs.removeClass('focus'); |
24 | + $this.addClass('focus'); | ||
25 | + $contents.addClass('hide'); | ||
26 | + $contents.eq($this.index()).removeClass('hide'); | ||
27 | + | ||
28 | + if (typeof $this.swiper === 'undefined') { // 解决隐藏式,swiper不渲染 | ||
29 | + $this.swiper = false; | ||
30 | + $contents.find('li').each(function(key, item) { | ||
31 | + $(item).find('.swiper-container').addClass('swiper-' + key); | ||
32 | + | ||
33 | + new Swiper('.swiper-' + key, { | ||
34 | + lazyLoading: true, | ||
35 | + pagination: '.swiper-' + key + ' .pagination-inner' | ||
36 | + }); | ||
37 | + }); | ||
38 | + } | ||
35 | 39 | ||
36 | $(document).trigger('scroll'); // Trigger lazyLoad | 40 | $(document).trigger('scroll'); // Trigger lazyLoad |
37 | }); | 41 | }); |
42 | + | ||
38 | $('#nav-tab').on('touchstart', function(e) { | 43 | $('#nav-tab').on('touchstart', function(e) { |
39 | var target = e.target || e.srcElement; | 44 | var target = e.target || e.srcElement; |
40 | 45 |
@@ -26,7 +26,12 @@ var dateText = 0, | @@ -26,7 +26,12 @@ var dateText = 0, | ||
26 | newHour = 0, | 26 | newHour = 0, |
27 | newMinus = 0; | 27 | newMinus = 0; |
28 | 28 | ||
29 | -var skuFlag; | 29 | +var skuFlag, |
30 | + hideNum, | ||
31 | + hideIndex; | ||
32 | + | ||
33 | +var oneIndex = 0, | ||
34 | + twoIndex = 0; | ||
30 | 35 | ||
31 | require('../common'); | 36 | require('../common'); |
32 | 37 | ||
@@ -113,23 +118,29 @@ $( | @@ -113,23 +118,29 @@ $( | ||
113 | 118 | ||
114 | // 如果秒杀库存为0 | 119 | // 如果秒杀库存为0 |
115 | if (data.secKillSku[i].storageNum === 0) { | 120 | if (data.secKillSku[i].storageNum === 0) { |
116 | - skuFlag = 0; | 121 | + $(this).addClass('zero-stock'); |
122 | + oneIndex = $(this).index() + 1; | ||
123 | + twoIndex = $(this).parent('ul').index() - 2; | ||
124 | + $('.chose-panel .color-list ul:eq(' + oneIndex + ') li:eq(' + twoIndex + ')').addClass('zero-stock'); | ||
117 | } | 125 | } |
126 | + | ||
118 | } else { | 127 | } else { |
119 | 128 | ||
120 | // alert("没有匹配"); | 129 | // alert("没有匹配"); |
121 | } | 130 | } |
122 | } | 131 | } |
123 | if (skuFlag === 0) { | 132 | if (skuFlag === 0) { |
124 | - $(this).addClass('zero-stock').attr('data-num', '1'); | ||
125 | - var oneIndex = $(this).index() + 1; | ||
126 | - var twoIndex = $(this).parent('ul').index() - 2; | 133 | + $(this).addClass('zero-stock').attr('data-num', '0').addClass('hide'); |
134 | + oneIndex = $(this).index() + 1; | ||
135 | + twoIndex = $(this).parent('ul').index() - 2; | ||
127 | 136 | ||
128 | - $('.chose-panel .color-list ul:eq(' + oneIndex + ') li:eq(' + twoIndex + ')').addClass('zero-stock'); | 137 | + $('.chose-panel .color-list ul:eq(' + oneIndex + ') li:eq(' + twoIndex + ')').addClass('zero-stock').addClass('hide'); |
129 | } | 138 | } |
130 | } | 139 | } |
131 | ); | 140 | ); |
132 | 141 | ||
142 | + seckHide();// 非秒杀库存置灰 | ||
143 | + | ||
133 | $('.price-date').append( | 144 | $('.price-date').append( |
134 | '<div class="seckill-time seckill-time-border">' + | 145 | '<div class="seckill-time seckill-time-border">' + |
135 | '<span>距结束 </span>' + | 146 | '<span>距结束 </span>' + |
@@ -200,3 +211,47 @@ $( | @@ -200,3 +211,47 @@ $( | ||
200 | 211 | ||
201 | } | 212 | } |
202 | ); | 213 | ); |
214 | + | ||
215 | +function seckHide() { | ||
216 | + $('.chose-panel .size-list ul').each( | ||
217 | + function() { | ||
218 | + hideNum = 0; | ||
219 | + $(this).find('li').each( | ||
220 | + function() { | ||
221 | + if ($(this).hasClass('hide')) { | ||
222 | + oneIndex = $(this).index() + 1; | ||
223 | + twoIndex = $(this).parent('ul').index() - 2; | ||
224 | + $('.color-list ul:eq(' + oneIndex + ') li:eq(' + twoIndex + ')').hide(); | ||
225 | + } else { | ||
226 | + hideNum++; | ||
227 | + } | ||
228 | + } | ||
229 | + ); | ||
230 | + if (hideNum === 0) { | ||
231 | + hideIndex = $(this).index() - 2; | ||
232 | + $('.color-list ul:first li:eq(' + hideIndex + ')').hide(); | ||
233 | + } | ||
234 | + } | ||
235 | + ); | ||
236 | + | ||
237 | + $('.chose-panel .color-list ul').each( | ||
238 | + function() { | ||
239 | + hideNum = 0; | ||
240 | + $(this).find('li').each( | ||
241 | + function() { | ||
242 | + if ($(this).hasClass('hide')) { | ||
243 | + oneIndex = $(this).index() + 1; | ||
244 | + twoIndex = $(this).parent('ul').index() - 2; | ||
245 | + $('.size-list ul:eq(' + oneIndex + ') li:eq(' + twoIndex + ')').hide(); | ||
246 | + } else { | ||
247 | + hideNum++; | ||
248 | + } | ||
249 | + } | ||
250 | + ); | ||
251 | + if (hideNum === 0) { | ||
252 | + hideIndex = $(this).index() - 2; | ||
253 | + $('.size-list ul:first li:eq(' + hideIndex + ')').hide(); | ||
254 | + } | ||
255 | + } | ||
256 | + ); | ||
257 | +} |
1 | .ps-list-page { | 1 | .ps-list-page { |
2 | background-color: #f0f0f0; | 2 | background-color: #f0f0f0; |
3 | 3 | ||
4 | - .nav-tab, .ps-content { | 4 | + .nav-tab, |
5 | + .ps-content { | ||
5 | width: 100%; | 6 | width: 100%; |
6 | } | 7 | } |
7 | 8 | ||
8 | .nav-tab { | 9 | .nav-tab { |
9 | - /*height: 60px;*/ | 10 | + height: 80px; |
10 | padding: 10px 0; | 11 | padding: 10px 0; |
11 | background-color: #fff; | 12 | background-color: #fff; |
12 | - } | ||
13 | 13 | ||
14 | - .star-nav, .plus-nav { | ||
15 | - box-sizing: border-box; | ||
16 | - float: left; | ||
17 | - width: 50%; | ||
18 | - height: 60px; | ||
19 | - line-height: 60px; | ||
20 | - font-size: 16PX; | ||
21 | - text-align: center; | ||
22 | - color: #ccc; | 14 | + li { |
15 | + box-sizing: border-box; | ||
16 | + float: left; | ||
17 | + width: 50%; | ||
18 | + height: 60px; | ||
19 | + line-height: 60px; | ||
20 | + font-size: 16PX; | ||
21 | + text-align: center; | ||
22 | + color: #ccc; | ||
23 | + border-right: 1px solid #ccc; | ||
23 | 24 | ||
24 | - &.focus { | ||
25 | - color: #000; | 25 | + &.focus { |
26 | + color: #000; | ||
27 | + } | ||
28 | + | ||
29 | + &:last-child { | ||
30 | + border-right: none; | ||
31 | + } | ||
26 | } | 32 | } |
27 | } | 33 | } |
28 | - .bytouch{ | ||
29 | - background:#eee; | ||
30 | - } | ||
31 | - .star-nav { | ||
32 | - border-right: 1px solid #ccc; | 34 | + |
35 | + .bytouch { | ||
36 | + background: #eee; | ||
33 | } | 37 | } |
34 | 38 | ||
35 | .plus-star-row { | 39 | .plus-star-row { |
@@ -42,15 +46,14 @@ | @@ -42,15 +46,14 @@ | ||
42 | > a { | 46 | > a { |
43 | display: block; | 47 | display: block; |
44 | height: 310px; | 48 | height: 310px; |
49 | + | ||
45 | > img { | 50 | > img { |
46 | - width: 100%; | ||
47 | - height: 100%; | 51 | + width: 100%; |
52 | + height: 100%; | ||
48 | } | 53 | } |
49 | } | 54 | } |
50 | } | 55 | } |
51 | 56 | ||
52 | - | ||
53 | - | ||
54 | .content.hide { | 57 | .content.hide { |
55 | display: none; | 58 | display: none; |
56 | } | 59 | } |
@@ -85,7 +88,8 @@ | @@ -85,7 +88,8 @@ | ||
85 | border-top: 1px solid #e0e0e0; | 88 | border-top: 1px solid #e0e0e0; |
86 | background-color: #fff; | 89 | background-color: #fff; |
87 | 90 | ||
88 | - &.header, &.related-infos { | 91 | + &.header, |
92 | + &.related-infos { | ||
89 | border-top: none; | 93 | border-top: none; |
90 | } | 94 | } |
91 | 95 | ||
@@ -166,7 +170,7 @@ | @@ -166,7 +170,7 @@ | ||
166 | display: inline-block; | 170 | display: inline-block; |
167 | height: 100%; | 171 | height: 100%; |
168 | width: 40px; | 172 | width: 40px; |
169 | - transition: transform .1s ease-in; | 173 | + transition: transform 0.1s ease-in; |
170 | } | 174 | } |
171 | 175 | ||
172 | &.spread .icon { | 176 | &.spread .icon { |
@@ -178,7 +182,7 @@ | @@ -178,7 +182,7 @@ | ||
178 | padding-left: 0 30px; | 182 | padding-left: 0 30px; |
179 | 183 | ||
180 | .new-arrival-content { | 184 | .new-arrival-content { |
181 | - padding: 0 0 20px 0; | 185 | + padding-bottom: 20px; |
182 | width: 614px; | 186 | width: 614px; |
183 | margin: 0 auto; | 187 | margin: 0 auto; |
184 | } | 188 | } |
@@ -219,7 +223,6 @@ | @@ -219,7 +223,6 @@ | ||
219 | margin-right: 30px; | 223 | margin-right: 30px; |
220 | margin-top: 10px; | 224 | margin-top: 10px; |
221 | } | 225 | } |
222 | - | ||
223 | } | 226 | } |
224 | 227 | ||
225 | .new-arrival-header { | 228 | .new-arrival-header { |
@@ -234,7 +237,6 @@ | @@ -234,7 +237,6 @@ | ||
234 | } | 237 | } |
235 | } | 238 | } |
236 | 239 | ||
237 | - | ||
238 | .related-info-title { | 240 | .related-info-title { |
239 | margin: 0 29px; | 241 | margin: 0 29px; |
240 | border: 1px solid #e0e0e0; | 242 | border: 1px solid #e0e0e0; |
-
Please register or login to post a comment