'code-error-modified'
Showing
10 changed files
with
100 additions
and
48 deletions
| @@ -118,8 +118,10 @@ const _pageArticleContent = (articleContent, isApp, gender) => { | @@ -118,8 +118,10 @@ const _pageArticleContent = (articleContent, isApp, gender) => { | ||
| 118 | let arr = []; | 118 | let arr = []; |
| 119 | 119 | ||
| 120 | goods.list.forEach((mini) => { | 120 | goods.list.forEach((mini) => { |
| 121 | - skns.push(mini.id); | ||
| 122 | - arr[mini.id] = mini.src; | 121 | + if (mini) { |
| 122 | + skns.push(mini.id); | ||
| 123 | + arr[mini.id] = mini.src; | ||
| 124 | + } | ||
| 123 | }); | 125 | }); |
| 124 | 126 | ||
| 125 | // 通过SKN获取商品信息 | 127 | // 通过SKN获取商品信息 |
| @@ -139,12 +139,9 @@ exports.intro = (req, res, next) => { | @@ -139,12 +139,9 @@ exports.intro = (req, res, next) => { | ||
| 139 | exports.preference = (req, res, next) => { | 139 | exports.preference = (req, res, next) => { |
| 140 | preferenceModel({ | 140 | preferenceModel({ |
| 141 | productskn: req.query.productSkn, | 141 | productskn: req.query.productSkn, |
| 142 | - yhchannel: req.yoho.channel, | ||
| 143 | - brandId: req.query.brandId | 142 | + limit: '20' // 后期值需要修改的话得手动改 |
| 144 | }).then((result) => { | 143 | }).then((result) => { |
| 145 | - res.render('detail/preference', Object.assign({ | ||
| 146 | - layout: false | ||
| 147 | - }, result)); | 144 | + res.send(result); |
| 148 | }).catch(next); | 145 | }).catch(next); |
| 149 | }; | 146 | }; |
| 150 | 147 |
| @@ -48,18 +48,11 @@ const _formatProduct = (data) => { | @@ -48,18 +48,11 @@ const _formatProduct = (data) => { | ||
| 48 | }; | 48 | }; |
| 49 | 49 | ||
| 50 | module.exports = (data) => { | 50 | module.exports = (data) => { |
| 51 | - let finalResult = {}; | ||
| 52 | - | ||
| 53 | return api.get('', { | 51 | return api.get('', { |
| 54 | - method: 'h5.preference.Search', | ||
| 55 | - productskn: data.productskn, | ||
| 56 | - yhchannel: yhchannelMap[data.yhchannel], | ||
| 57 | - brandId: data.brandId | 52 | + method: 'app.product.preference', |
| 53 | + product_skn: data.productskn, | ||
| 54 | + limit: data.limit || '20' | ||
| 58 | }).then(result => { | 55 | }).then(result => { |
| 59 | - if (result) { | ||
| 60 | - finalResult.recommendList = _formatProduct(result); | ||
| 61 | - } | ||
| 62 | - | ||
| 63 | - return finalResult; | 56 | + return result; |
| 64 | }); | 57 | }); |
| 65 | }; | 58 | }; |
| @@ -62,7 +62,12 @@ const cachePage = { | @@ -62,7 +62,12 @@ const cachePage = { | ||
| 62 | 62 | ||
| 63 | // 品牌一览 | 63 | // 品牌一览 |
| 64 | '/brands': 5 * MINUTE, | 64 | '/brands': 5 * MINUTE, |
| 65 | - '/brands/search': 1 * MINUTE | 65 | + '/brands/search': 1 * MINUTE, |
| 66 | + | ||
| 67 | + //活动 | ||
| 68 | + '/activity/single-day': 1 * MINUTE, | ||
| 69 | + '/activity/shopCollect': 1 * MINUTE, | ||
| 70 | + '/activity/live': 1 * MINUTE | ||
| 66 | 71 | ||
| 67 | }; | 72 | }; |
| 68 | 73 |
| @@ -64,8 +64,9 @@ module.exports = { | @@ -64,8 +64,9 @@ module.exports = { | ||
| 64 | }, | 64 | }, |
| 65 | loggers: { | 65 | loggers: { |
| 66 | infoFile: { | 66 | infoFile: { |
| 67 | + close: true, | ||
| 67 | name: 'info', | 68 | name: 'info', |
| 68 | - level: 'info', | 69 | + level: 'error', |
| 69 | filename: 'logs/info.log', | 70 | filename: 'logs/info.log', |
| 70 | maxFiles: 7 | 71 | maxFiles: 7 |
| 71 | }, | 72 | }, |
| @@ -78,12 +79,12 @@ module.exports = { | @@ -78,12 +79,12 @@ module.exports = { | ||
| 78 | }, | 79 | }, |
| 79 | udp: { // send by udp | 80 | udp: { // send by udp |
| 80 | measurement: 'yohobuy_wap_node_log', | 81 | measurement: 'yohobuy_wap_node_log', |
| 81 | - level: 'debug', // logger level | 82 | + level: 'error', // logger level |
| 82 | host: 'influxdblog.web.yohoops.org', // influxdb host | 83 | host: 'influxdblog.web.yohoops.org', // influxdb host |
| 83 | port: '4444' // influxdb port | 84 | port: '4444' // influxdb port |
| 84 | }, | 85 | }, |
| 85 | console: { | 86 | console: { |
| 86 | - level: 'debug', | 87 | + level: 'error', |
| 87 | colorize: 'all', | 88 | colorize: 'all', |
| 88 | prettyPrint: true | 89 | prettyPrint: true |
| 89 | } | 90 | } |
| @@ -19,7 +19,7 @@ var singleDay = { | @@ -19,7 +19,7 @@ var singleDay = { | ||
| 19 | opt = { | 19 | opt = { |
| 20 | $productList: $('.product-list'), | 20 | $productList: $('.product-list'), |
| 21 | $swiper: $('.swiper-tab'), | 21 | $swiper: $('.swiper-tab'), |
| 22 | - getFlag: false, | 22 | + getFlag: [], |
| 23 | previousScrollTop: 0, | 23 | previousScrollTop: 0, |
| 24 | winH: $(window).height(), | 24 | winH: $(window).height(), |
| 25 | noResult: '<p class="no-result">未找到相关商品</p>', | 25 | noResult: '<p class="no-result">未找到相关商品</p>', |
| @@ -113,6 +113,7 @@ var singleDay = { | @@ -113,6 +113,7 @@ var singleDay = { | ||
| 113 | 113 | ||
| 114 | for (i; i < data[1].length; i++) { | 114 | for (i; i < data[1].length; i++) { |
| 115 | self.$productList.append('<ul class="product-tab" data-page="0"></ul>'); | 115 | self.$productList.append('<ul class="product-tab" data-page="0"></ul>'); |
| 116 | + self.getFlag[i] = false; | ||
| 116 | } | 117 | } |
| 117 | 118 | ||
| 118 | self.$productTab = $('.product-tab'); | 119 | self.$productTab = $('.product-tab'); |
| @@ -130,6 +131,9 @@ var singleDay = { | @@ -130,6 +131,9 @@ var singleDay = { | ||
| 130 | 131 | ||
| 131 | if (self.$productTab.eq(index).find('li').length > 0) { | 132 | if (self.$productTab.eq(index).find('li').length > 0) { |
| 132 | self.$productTab.hide().eq(index).fadeIn(); | 133 | self.$productTab.hide().eq(index).fadeIn(); |
| 134 | + $('img.lazy').lazyload({ | ||
| 135 | + effect: 'fadeIn' | ||
| 136 | + }); | ||
| 133 | } else { | 137 | } else { |
| 134 | self.getProductData({ | 138 | self.getProductData({ |
| 135 | index: index, | 139 | index: index, |
| @@ -154,12 +158,12 @@ var singleDay = { | @@ -154,12 +158,12 @@ var singleDay = { | ||
| 154 | var page; | 158 | var page; |
| 155 | var curProductTab = self.$productTab.eq(params.index); | 159 | var curProductTab = self.$productTab.eq(params.index); |
| 156 | 160 | ||
| 157 | - if (self.getFlag) { | 161 | + if (self.getFlag[params.index]) { |
| 158 | return false; | 162 | return false; |
| 159 | } | 163 | } |
| 160 | 164 | ||
| 161 | page = +curProductTab.attr('data-page') + 1; | 165 | page = +curProductTab.attr('data-page') + 1; |
| 162 | - self.getFlag = true; | 166 | + self.getFlag[params.index] = true; |
| 163 | loading.showLoadingMask(); | 167 | loading.showLoadingMask(); |
| 164 | 168 | ||
| 165 | $.ajax({ | 169 | $.ajax({ |
| @@ -175,15 +179,15 @@ var singleDay = { | @@ -175,15 +179,15 @@ var singleDay = { | ||
| 175 | curProductTab.find('.no-result').hide(); | 179 | curProductTab.find('.no-result').hide(); |
| 176 | curProductTab.append(product(data)); | 180 | curProductTab.append(product(data)); |
| 177 | curProductTab.attr('data-page', page); | 181 | curProductTab.attr('data-page', page); |
| 178 | - self.getFlag = false; | 182 | + self.getFlag[params.index] = false; |
| 179 | } else { | 183 | } else { |
| 180 | if (page === 1) { | 184 | if (page === 1) { |
| 181 | if (curProductTab.find('.no-result').length === 0) { | 185 | if (curProductTab.find('.no-result').length === 0) { |
| 182 | curProductTab.append(self.noResult); | 186 | curProductTab.append(self.noResult); |
| 183 | } | 187 | } |
| 184 | - self.getFlag = false; | 188 | + self.getFlag[params.index] = false; |
| 185 | } else { | 189 | } else { |
| 186 | - self.getFlag = true; | 190 | + self.getFlag[params.index] = true; |
| 187 | } | 191 | } |
| 188 | } | 192 | } |
| 189 | 193 | ||
| @@ -199,7 +203,7 @@ var singleDay = { | @@ -199,7 +203,7 @@ var singleDay = { | ||
| 199 | error: function() { | 203 | error: function() { |
| 200 | tip.show('网络断开连接了~'); | 204 | tip.show('网络断开连接了~'); |
| 201 | loading.hideLoadingMask(); | 205 | loading.hideLoadingMask(); |
| 202 | - self.getFlag = false; | 206 | + self.getFlag[params.index] = false; |
| 203 | } | 207 | } |
| 204 | }); | 208 | }); |
| 205 | } | 209 | } |
| @@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | -var Swiper = require('yoho-swiper'), | 8 | +var lazyLoad = require('yoho-jquery-lazyload'), |
| 9 | $ = require('yoho-jquery'); | 9 | $ = require('yoho-jquery'); |
| 10 | 10 | ||
| 11 | var $recommendForYou = $('.recommend-for-you'), | 11 | var $recommendForYou = $('.recommend-for-you'), |
| @@ -14,6 +14,40 @@ var $recommendForYou = $('.recommend-for-you'), | @@ -14,6 +14,40 @@ var $recommendForYou = $('.recommend-for-you'), | ||
| 14 | end = false, | 14 | end = false, |
| 15 | requesting = false; | 15 | requesting = false; |
| 16 | 16 | ||
| 17 | +var RECID = (new Date().getTime() + '_H5_YOHOBUY_' + Math.floor(Math.random() * 1000000 + 1000000) + | ||
| 18 | + '_' + Math.floor(Math.random() * 1000000 + 1000000)); | ||
| 19 | + | ||
| 20 | +var getChannel, C_ID, uuidVal, goodid, goodIds = [], prdLoad; | ||
| 21 | + | ||
| 22 | +getChannel = function functionName() { | ||
| 23 | + var name = window.cookie('_Channel'); | ||
| 24 | + | ||
| 25 | + return { | ||
| 26 | + boys: 1, | ||
| 27 | + girls: 2, | ||
| 28 | + kids: 3, | ||
| 29 | + lifestyle: 4 | ||
| 30 | + }[name] || 1; | ||
| 31 | +}; | ||
| 32 | + | ||
| 33 | +C_ID = getChannel(); | ||
| 34 | + | ||
| 35 | +function yasRequest(PRD_ID, PRD_NUM, ACTION_ID) { | ||
| 36 | + if (window._yas && window._yas.sendCustomInfo) { | ||
| 37 | + window._yas.sendCustomInfo({ | ||
| 38 | + op: 'YB_CHOOSE_FOR_YOU_Y', | ||
| 39 | + param: JSON.stringify({ | ||
| 40 | + REC_POSE: 100013, | ||
| 41 | + REC_ID: RECID, | ||
| 42 | + PRD_ID: PRD_ID, | ||
| 43 | + PRD_NUM: PRD_NUM, | ||
| 44 | + C_ID: C_ID, | ||
| 45 | + ACTION_ID: ACTION_ID, | ||
| 46 | + PAGE_NUM: 1 | ||
| 47 | + }) | ||
| 48 | + }, true); | ||
| 49 | + } | ||
| 50 | +} | ||
| 17 | 51 | ||
| 18 | function request() { | 52 | function request() { |
| 19 | if (requesting || end) { | 53 | if (requesting || end) { |
| @@ -24,25 +58,32 @@ function request() { | @@ -24,25 +58,32 @@ function request() { | ||
| 24 | 58 | ||
| 25 | if (preferenceUrl) { | 59 | if (preferenceUrl) { |
| 26 | $.get(preferenceUrl).then(function(html) { | 60 | $.get(preferenceUrl).then(function(html) { |
| 27 | - if ($(html).find('.swiper-slide').length < 5) { | ||
| 28 | - $recommendForYou.hide(); | ||
| 29 | - } else { | ||
| 30 | - $recommendForYou.html(html).show(); | ||
| 31 | - if ($('#swiper-recommend').length) { | ||
| 32 | - new Swiper('#swiper-recommend', { | ||
| 33 | - slidesPerView: 'auto', | ||
| 34 | - grabCursor: true, | ||
| 35 | - slideElement: 'a', | ||
| 36 | - lazyLoading: true, | ||
| 37 | - watchSlidesVisibility: true | ||
| 38 | - }); | 61 | + $recommendForYou.html(html).show(); |
| 62 | + lazyLoad($recommendForYou.find('img.lazy')); | ||
| 63 | + | ||
| 64 | + // 为你优选埋点- 加载 | ||
| 65 | + | ||
| 66 | + $('.goods-container').find('.good-info').each(function() { | ||
| 67 | + goodid = $(this).data('good-id'); | ||
| 68 | + | ||
| 69 | + if (goodid) { | ||
| 70 | + goodIds.push(goodid); | ||
| 39 | } | 71 | } |
| 40 | - } | 72 | + }); |
| 73 | + | ||
| 74 | + prdLoad = JSON.stringify(goodIds).replace(/\[|\]|/g, ''); | ||
| 75 | + | ||
| 76 | + yasRequest(prdLoad, goodIds.length, 0); | ||
| 41 | 77 | ||
| 42 | - requesting = false; | ||
| 43 | - end = true; | 78 | + // 点击商品 |
| 79 | + $('.good-info').on('click', function() { | ||
| 80 | + var PRD_ID = $(this).data('good-id'), | ||
| 81 | + PRD_NUM = $(this).index(); | ||
| 44 | 82 | ||
| 45 | - window.rePosFooter(); | 83 | + yasRequest(PRD_ID, PRD_NUM, 1); |
| 84 | + | ||
| 85 | + // return false; | ||
| 86 | + }); | ||
| 46 | 87 | ||
| 47 | }).fail(function() { | 88 | }).fail(function() { |
| 48 | $recommendForYou.hide(); | 89 | $recommendForYou.hide(); |
| @@ -59,3 +100,5 @@ function scrollHandler() { | @@ -59,3 +100,5 @@ function scrollHandler() { | ||
| 59 | $(window).scroll(function() { | 100 | $(window).scroll(function() { |
| 60 | window.requestAnimationFrame(scrollHandler); | 101 | window.requestAnimationFrame(scrollHandler); |
| 61 | }); | 102 | }); |
| 103 | + | ||
| 104 | + |
| @@ -6,7 +6,6 @@ | @@ -6,7 +6,6 @@ | ||
| 6 | background: #fff; | 6 | background: #fff; |
| 7 | box-sizing: border-box; | 7 | box-sizing: border-box; |
| 8 | overflow: hidden; | 8 | overflow: hidden; |
| 9 | - background: #fff; | ||
| 10 | margin-bottom: 30px; | 9 | margin-bottom: 30px; |
| 11 | 10 | ||
| 12 | li { | 11 | li { |
| @@ -33,6 +32,7 @@ | @@ -33,6 +32,7 @@ | ||
| 33 | .shop-area { | 32 | .shop-area { |
| 34 | background: #fff; | 33 | background: #fff; |
| 35 | border-bottom: 1px solid #e0e0e0; | 34 | border-bottom: 1px solid #e0e0e0; |
| 35 | + min-width: 750px; | ||
| 36 | } | 36 | } |
| 37 | } | 37 | } |
| 38 | 38 |
| @@ -917,6 +917,13 @@ $basicBtnC: #eb0313; | @@ -917,6 +917,13 @@ $basicBtnC: #eb0313; | ||
| 917 | 917 | ||
| 918 | .recommend-for-you { | 918 | .recommend-for-you { |
| 919 | border-bottom: none; | 919 | border-bottom: none; |
| 920 | + | ||
| 921 | + .tag-container { | ||
| 922 | + overflow: hidden; | ||
| 923 | + width: 100%; | ||
| 924 | + height: 0.7rem; | ||
| 925 | + position: static; | ||
| 926 | + } | ||
| 920 | } | 927 | } |
| 921 | 928 | ||
| 922 | .yoho-tip { | 929 | .yoho-tip { |
-
Please register or login to post a comment