Showing
22 changed files
with
45 additions
and
17 deletions
@@ -108,6 +108,7 @@ const _pageArticleContent = (articleContent, isApp, gender) => { | @@ -108,6 +108,7 @@ const _pageArticleContent = (articleContent, isApp, gender) => { | ||
108 | let callArtGoodGroup = (ii, len2) => { | 108 | let callArtGoodGroup = (ii, len2) => { |
109 | if (ii < len2) { | 109 | if (ii < len2) { |
110 | let goods = art.goodsGroup.data[ii]; | 110 | let goods = art.goodsGroup.data[ii]; |
111 | + | ||
111 | if (goods) { | 112 | if (goods) { |
112 | let good = { | 113 | let good = { |
113 | thumb: goods.cover ? helpers.image(goods.cover.cover, 235, 314) : '', | 114 | thumb: goods.cover ? helpers.image(goods.cover.cover, 235, 314) : '', |
@@ -344,6 +345,7 @@ const index = (req, res, next) => { | @@ -344,6 +345,7 @@ const index = (req, res, next) => { | ||
344 | // 分享参数 | 345 | // 分享参数 |
345 | if (detail.getArticle.cover_image) { | 346 | if (detail.getArticle.cover_image) { |
346 | let shareInfo = _shareInfo(id, detail.getArticle); | 347 | let shareInfo = _shareInfo(id, detail.getArticle); |
348 | + | ||
347 | Object.assign(guang, shareInfo); | 349 | Object.assign(guang, shareInfo); |
348 | data.title = detail.getArticle.article_title + ' | Yoho!Buy有货 | 潮流购物逛不停'; | 350 | data.title = detail.getArticle.article_title + ' | Yoho!Buy有货 | 潮流购物逛不停'; |
349 | data.title_more = true; | 351 | data.title_more = true; |
@@ -18,6 +18,7 @@ const helpers = global.yoho.helpers; | @@ -18,6 +18,7 @@ const helpers = global.yoho.helpers; | ||
18 | const index = (req, res, next) => { | 18 | const index = (req, res, next) => { |
19 | let gender = req.query.gender || '1,2,3', | 19 | let gender = req.query.gender || '1,2,3', |
20 | items = []; | 20 | items = []; |
21 | + | ||
21 | return rssModel.getRssArticle(gender).then((result) => { | 22 | return rssModel.getRssArticle(gender).then((result) => { |
22 | if (!result) { | 23 | if (!result) { |
23 | return next(); | 24 | return next(); |
@@ -31,9 +32,10 @@ const index = (req, res, next) => { | @@ -31,9 +32,10 @@ const index = (req, res, next) => { | ||
31 | copyright: '2015 yoho.inc', | 32 | copyright: '2015 yoho.inc', |
32 | generator: 'http://m.yohobuy.com', | 33 | generator: 'http://m.yohobuy.com', |
33 | updated: new Date(), | 34 | updated: new Date(), |
34 | - }) | 35 | + }); |
36 | + | ||
35 | _.forEach(result, item => { | 37 | _.forEach(result, item => { |
36 | - item.url = item.url.indexOf('http') >= 0 ? item.url : 'http://'+item.url | 38 | + item.url = item.url.indexOf('http') >= 0 ? item.url : 'http://' + item.url; |
37 | feed.addItem({ | 39 | feed.addItem({ |
38 | title: item.title, | 40 | title: item.title, |
39 | link: `${item.url}&ref=rss`, | 41 | link: `${item.url}&ref=rss`, |
@@ -41,26 +43,27 @@ const index = (req, res, next) => { | @@ -41,26 +43,27 @@ const index = (req, res, next) => { | ||
41 | author: [{ | 43 | author: [{ |
42 | name: (item.author && item.author.name) || ' ' | 44 | name: (item.author && item.author.name) || ' ' |
43 | }], | 45 | }], |
44 | - date: new Date(item.publishTimeLong && parseFloat(item.publishTimeLong) || moment(item.publishTime, "MM月DD日 HH:mm")) | 46 | + date: new Date(item.publishTimeLong && parseFloat(item.publishTimeLong) || moment(item.publishTime, 'MM月DD日 HH:mm')) |
45 | }); | 47 | }); |
46 | }); | 48 | }); |
47 | if (req.params[0] && req.params[0] === '/atom') { | 49 | if (req.params[0] && req.params[0] === '/atom') { |
48 | return res.send(feed.render('atom-1.0')); | 50 | return res.send(feed.render('atom-1.0')); |
49 | } | 51 | } |
50 | - return res.send(feed.render('rss-2.0')) | 52 | + return res.send(feed.render('rss-2.0')); |
51 | }); | 53 | }); |
52 | }; | 54 | }; |
53 | const rss = (req, res, next, gmt) => { | 55 | const rss = (req, res, next, gmt) => { |
54 | let gender = req.query.gender || '1,2,3', | 56 | let gender = req.query.gender || '1,2,3', |
55 | items = []; | 57 | items = []; |
58 | + | ||
56 | res.setHeader('Content-Type', 'text/xml; charset=utf-8'); | 59 | res.setHeader('Content-Type', 'text/xml; charset=utf-8'); |
57 | return rssModel.getRssArticle(gender).then((result) => { | 60 | return rssModel.getRssArticle(gender).then((result) => { |
58 | if (!result) { | 61 | if (!result) { |
59 | return next(); | 62 | return next(); |
60 | } | 63 | } |
61 | _.forEach(result, item => { | 64 | _.forEach(result, item => { |
62 | - item.url = item.url.indexOf('http') >= 0 ? item.url : 'http://'+item.url; | ||
63 | - let time = new Date(item.publishTimeLong && parseFloat(item.publishTimeLong) || moment(item.publishTime, "MM月DD日 HH:mm")); | 65 | + item.url = item.url.indexOf('http') >= 0 ? item.url : 'http://' + item.url; |
66 | + let time = new Date(item.publishTimeLong && parseFloat(item.publishTimeLong) || moment(item.publishTime, 'MM月DD日 HH:mm')); | ||
64 | let format = gmt ? 'ddd, MM MMM YYYY hh:mm:ss +0800' : 'YYYY-MM-DD hh:mm:ss +0800'; | 67 | let format = gmt ? 'ddd, MM MMM YYYY hh:mm:ss +0800' : 'YYYY-MM-DD hh:mm:ss +0800'; |
65 | 68 | ||
66 | item.publishTime = moment(time).format(format); | 69 | item.publishTime = moment(time).format(format); |
@@ -45,7 +45,7 @@ const getRssArticle = (gender) => { | @@ -45,7 +45,7 @@ const getRssArticle = (gender) => { | ||
45 | if (typeof value.id !== 'undefined') { | 45 | if (typeof value.id !== 'undefined') { |
46 | build = guangProcess.formatArticle(value, false, false, true); | 46 | build = guangProcess.formatArticle(value, false, false, true); |
47 | build.author = build.author || {}; | 47 | build.author = build.author || {}; |
48 | - build.author.name = (build.author && build.author.name) || '' | 48 | + build.author.name = (build.author && build.author.name) || ''; |
49 | return _genIntro(value.id).then((intro) => { | 49 | return _genIntro(value.id).then((intro) => { |
50 | build.intro = intro; | 50 | build.intro = intro; |
51 | result.push(build); | 51 | result.push(build); |
@@ -56,6 +56,7 @@ const getRssArticle = (gender) => { | @@ -56,6 +56,7 @@ const getRssArticle = (gender) => { | ||
56 | resolve(result); | 56 | resolve(result); |
57 | } | 57 | } |
58 | }; | 58 | }; |
59 | + | ||
59 | return new Promise((resolve) => { | 60 | return new Promise((resolve) => { |
60 | artListFunc(0, article.data.list.artList.length, resolve); | 61 | artListFunc(0, article.data.list.artList.length, resolve); |
61 | }); | 62 | }); |
@@ -15,6 +15,7 @@ const suggestData = (req, res, next) => { | @@ -15,6 +15,7 @@ const suggestData = (req, res, next) => { | ||
15 | let udid = req.sessionID || 'yoho'; | 15 | let udid = req.sessionID || 'yoho'; |
16 | let page = req.query.page || 1; | 16 | let page = req.query.page || 1; |
17 | let limit = 10; | 17 | let limit = 10; |
18 | + | ||
18 | suggestModel.suggestData(uid, udid, page, limit).then((result) => { | 19 | suggestModel.suggestData(uid, udid, page, limit).then((result) => { |
19 | 20 | ||
20 | res.render('suggest', { | 21 | res.render('suggest', { |
@@ -9,7 +9,7 @@ exports.getQr = (params) => { | @@ -9,7 +9,7 @@ exports.getQr = (params) => { | ||
9 | 9 | ||
10 | try { | 10 | try { |
11 | uid = crypto.decrypt(PASSWORD, decodeURIComponent(params.token)); | 11 | uid = crypto.decrypt(PASSWORD, decodeURIComponent(params.token)); |
12 | - uid = parseInt(uid, 10) | 12 | + uid = parseInt(uid, 10); |
13 | } catch (e) { | 13 | } catch (e) { |
14 | uid = params.token; | 14 | uid = params.token; |
15 | } | 15 | } |
@@ -34,6 +34,7 @@ exports.cart = (req, res, next) => { | @@ -34,6 +34,7 @@ exports.cart = (req, res, next) => { | ||
34 | uid = req.user.uid || 0, | 34 | uid = req.user.uid || 0, |
35 | yhChannel = req.query.yh_channel || '1', | 35 | yhChannel = req.query.yh_channel || '1', |
36 | limit = 30; | 36 | limit = 30; |
37 | + | ||
37 | if (_.get(req, 'app.locals.wap.cart.removePrefer', false)) { | 38 | if (_.get(req, 'app.locals.wap.cart.removePrefer', false)) { |
38 | return res.send(''); | 39 | return res.send(''); |
39 | } | 40 | } |
@@ -422,6 +422,7 @@ const _cartCount = (uid, shoppingKey) => { | @@ -422,6 +422,7 @@ const _cartCount = (uid, shoppingKey) => { | ||
422 | }).then((result) => { | 422 | }).then((result) => { |
423 | if (result.code === 200) { | 423 | if (result.code === 200) { |
424 | var count = result.data.cart_goods_count || 0; | 424 | var count = result.data.cart_goods_count || 0; |
425 | + | ||
425 | if (count > 99) { | 426 | if (count > 99) { |
426 | count = '99+'; | 427 | count = '99+'; |
427 | } | 428 | } |
@@ -1512,6 +1512,7 @@ let getProductAsyncData = (data) => { | @@ -1512,6 +1512,7 @@ let getProductAsyncData = (data) => { | ||
1512 | return Promise.all([_getPromotionInfo(result.product_skn), _getFavorite(result.product_id, data.uid)]).then((res) => { | 1512 | return Promise.all([_getPromotionInfo(result.product_skn), _getFavorite(result.product_id, data.uid)]).then((res) => { |
1513 | result.promotionBoList = res[0]; | 1513 | result.promotionBoList = res[0]; |
1514 | var isFavorite = res[1]; | 1514 | var isFavorite = res[1]; |
1515 | + | ||
1515 | finalResult = _detailDataPkgAsync(result, data.uid, data.vipLevel, data.ua); | 1516 | finalResult = _detailDataPkgAsync(result, data.uid, data.vipLevel, data.ua); |
1516 | finalResult.isCollect = isFavorite; | 1517 | finalResult.isCollect = isFavorite; |
1517 | if (finalResult.cartInfo) { | 1518 | if (finalResult.cartInfo) { |
@@ -1777,6 +1778,7 @@ let _detailDataPkgAsync = (origin, uid, vipLevel, ua) => { | @@ -1777,6 +1778,7 @@ let _detailDataPkgAsync = (origin, uid, vipLevel, ua) => { | ||
1777 | 1778 | ||
1778 | // 限购商品有关的展示状态 | 1779 | // 限购商品有关的展示状态 |
1779 | let showStatus = 1; | 1780 | let showStatus = 1; |
1781 | + | ||
1780 | origin.showStatus && (showStatus = parseInt(result.data.showStatus, 10)); | 1782 | origin.showStatus && (showStatus = parseInt(result.data.showStatus, 10)); |
1781 | 1783 | ||
1782 | // 处理限购商品有关的按钮状态 | 1784 | // 处理限购商品有关的按钮状态 |
@@ -59,6 +59,7 @@ function getCouponStatus() { | @@ -59,6 +59,7 @@ function getCouponStatus() { | ||
59 | 59 | ||
60 | cates.forEach(function(obj) { | 60 | cates.forEach(function(obj) { |
61 | var e = document.getElementById(obj.couponID); | 61 | var e = document.getElementById(obj.couponID); |
62 | + | ||
62 | if (!e) { | 63 | if (!e) { |
63 | return; | 64 | return; |
64 | } | 65 | } |
@@ -492,6 +492,7 @@ $('#float-layer-close').on('touchend', function() { | @@ -492,6 +492,7 @@ $('#float-layer-close').on('touchend', function() { | ||
492 | if ($('#float-layer-btn') && $('#float-layer-btn')[0]) { | 492 | if ($('#float-layer-btn') && $('#float-layer-btn')[0]) { |
493 | var floatLayerBtnHammer = new Hammer($('#float-layer-btn')[0]); | 493 | var floatLayerBtnHammer = new Hammer($('#float-layer-btn')[0]); |
494 | var unionType = window.queryString.union_type || 367; | 494 | var unionType = window.queryString.union_type || 367; |
495 | + | ||
495 | floatLayerBtnHammer.on('tap', function(e) { | 496 | floatLayerBtnHammer.on('tap', function(e) { |
496 | 497 | ||
497 | window.downLoadApp(unionType); | 498 | window.downLoadApp(unionType); |
@@ -339,7 +339,8 @@ $reaMask.on('touchend', function(event) { | @@ -339,7 +339,8 @@ $reaMask.on('touchend', function(event) { | ||
339 | event.stopPropagation(); | 339 | event.stopPropagation(); |
340 | }); | 340 | }); |
341 | 341 | ||
342 | -$('.nav-tap').on('click', function(e){ | 342 | +$('.nav-tap').on('click', function(e) { |
343 | var $cur = $(e.target); | 343 | var $cur = $(e.target); |
344 | + | ||
344 | location.replace($cur.data('url')); | 345 | location.replace($cur.data('url')); |
345 | -}) | ||
346 | +}); |
@@ -75,6 +75,7 @@ if (navtabHammer) { | @@ -75,6 +75,7 @@ if (navtabHammer) { | ||
75 | if (gotoConsultHammer) { | 75 | if (gotoConsultHammer) { |
76 | gotoConsultHammer.on('tap', function() { | 76 | gotoConsultHammer.on('tap', function() { |
77 | var link = $(gotoConsultEle).find('a').attr('href'); | 77 | var link = $(gotoConsultEle).find('a').attr('href'); |
78 | + | ||
78 | link += (link.indexOf('?') >= 0 ? '&' : '?') + 'from=' + encodeURIComponent(location.href); | 79 | link += (link.indexOf('?') >= 0 ? '&' : '?') + 'from=' + encodeURIComponent(location.href); |
79 | location.href = link; | 80 | location.href = link; |
80 | }); | 81 | }); |
@@ -32,11 +32,12 @@ $content.on('focus', function() { | @@ -32,11 +32,12 @@ $content.on('focus', function() { | ||
32 | $content.val('请输入咨询内容'); | 32 | $content.val('请输入咨询内容'); |
33 | } | 33 | } |
34 | }); | 34 | }); |
35 | -var getUrlParam = function (paramName) { | ||
36 | - var reg = "[\\?|\\&]+" + paramName + "=([^&]*)[^&]?"; | ||
37 | - var exp = (window.location.href + "").match(reg); | ||
38 | - return exp ? exp[1] : ""; | ||
39 | -} | 35 | +var getUrlParam = function(paramName) { |
36 | + var reg = '[\\?|\\&]+' + paramName + '=([^&]*)[^&]?'; | ||
37 | + var exp = (window.location.href + '').match(reg); | ||
38 | + | ||
39 | + return exp ? exp[1] : ''; | ||
40 | +}; | ||
40 | 41 | ||
41 | // 提交表单请求 | 42 | // 提交表单请求 |
42 | $consultForm.on('submit', function() { | 43 | $consultForm.on('submit', function() { |
@@ -74,6 +75,7 @@ $consultForm.on('submit', function() { | @@ -74,6 +75,7 @@ $consultForm.on('submit', function() { | ||
74 | tip.show('提交成功~'); | 75 | tip.show('提交成功~'); |
75 | setTimeout(function() { | 76 | setTimeout(function() { |
76 | var from = getUrlParam('from'); | 77 | var from = getUrlParam('from'); |
78 | + | ||
77 | if (from) { | 79 | if (from) { |
78 | window.location = decodeURIComponent(from); | 80 | window.location = decodeURIComponent(from); |
79 | } else { | 81 | } else { |
@@ -8,6 +8,7 @@ module.exports = function(callback) { | @@ -8,6 +8,7 @@ module.exports = function(callback) { | ||
8 | var productId = $('#productId').val(); | 8 | var productId = $('#productId').val(); |
9 | var goodsId = $('#goodsId').val(); | 9 | var goodsId = $('#goodsId').val(); |
10 | var productSkn = $('#productSkn').val(); | 10 | var productSkn = $('#productSkn').val(); |
11 | + | ||
11 | if (productId && (goodsId || productSkn)) { | 12 | if (productId && (goodsId || productSkn)) { |
12 | $.ajax({ | 13 | $.ajax({ |
13 | type: 'POST', | 14 | type: 'POST', |
@@ -69,9 +70,11 @@ function render(data) { | @@ -69,9 +70,11 @@ function render(data) { | ||
69 | $('.student-value').text(data.studentPrice); | 70 | $('.student-value').text(data.studentPrice); |
70 | } else if (data.vipLevel) { | 71 | } else if (data.vipLevel) { |
71 | var li = $('.vip-level>li').first().remove(); | 72 | var li = $('.vip-level>li').first().remove(); |
73 | + | ||
72 | for (var i = 0; i < data.vipLevel.list.length; i++) { | 74 | for (var i = 0; i < data.vipLevel.list.length; i++) { |
73 | var item = data.vipLevel.list[i]; | 75 | var item = data.vipLevel.list[i]; |
74 | var itemLi = li.clone(); | 76 | var itemLi = li.clone(); |
77 | + | ||
75 | if (item.currentLevel) { | 78 | if (item.currentLevel) { |
76 | itemLi.addClass('current-level'); | 79 | itemLi.addClass('current-level'); |
77 | } | 80 | } |
@@ -84,9 +87,11 @@ function render(data) { | @@ -84,9 +87,11 @@ function render(data) { | ||
84 | 87 | ||
85 | var shortText = $('#goodsDiscount>.short-text').remove(); | 88 | var shortText = $('#goodsDiscount>.short-text').remove(); |
86 | var liText = $('#goodsDiscount>.discount-folder>.folder-item').remove(); | 89 | var liText = $('#goodsDiscount>.discount-folder>.folder-item').remove(); |
90 | + | ||
87 | for (var i = 0; i < data.goodsDiscount.list.length; i++) { | 91 | for (var i = 0; i < data.goodsDiscount.list.length; i++) { |
88 | var discount = data.goodsDiscount.list[i]; | 92 | var discount = data.goodsDiscount.list[i]; |
89 | var itemText = i === 0 ? shortText.clone() : liText.clone(); | 93 | var itemText = i === 0 ? shortText.clone() : liText.clone(); |
94 | + | ||
90 | if (discount.text) { | 95 | if (discount.text) { |
91 | if (i === 0) { | 96 | if (i === 0) { |
92 | itemText.text(discount.text).append('<span class="icon-down iconfont dropdown"></span>').prependTo('#goodsDiscount'); | 97 | itemText.text(discount.text).append('<span class="icon-down iconfont dropdown"></span>').prependTo('#goodsDiscount'); |
@@ -48,7 +48,9 @@ function request() { | @@ -48,7 +48,9 @@ function request() { | ||
48 | 48 | ||
49 | if (preferenceUrl) { | 49 | if (preferenceUrl) { |
50 | $.get(preferenceUrl).then(function(html) { | 50 | $.get(preferenceUrl).then(function(html) { |
51 | - if (typeof html !== 'string') { return; } | 51 | + if (typeof html !== 'string') { |
52 | + return; | ||
53 | + } | ||
52 | 54 | ||
53 | $recommendForYou.html(html.replace(/https?:/gi, '')).show(); | 55 | $recommendForYou.html(html.replace(/https?:/gi, '')).show(); |
54 | lazyLoad($recommendForYou.find('img.lazy')); | 56 | lazyLoad($recommendForYou.find('img.lazy')); |
@@ -75,6 +75,7 @@ setTimeout(() => { | @@ -75,6 +75,7 @@ setTimeout(() => { | ||
75 | if (data.isDepositAdvance === 'Y') { | 75 | if (data.isDepositAdvance === 'Y') { |
76 | // 定金预售商品 | 76 | // 定金预售商品 |
77 | var tip = require('../plugin/tip'); | 77 | var tip = require('../plugin/tip'); |
78 | + | ||
78 | setTimeout(function() { | 79 | setTimeout(function() { |
79 | $('#addtoCart').text('立即购买').off('touchstart').on('touchstart', function() { | 80 | $('#addtoCart').text('立即购买').off('touchstart').on('touchstart', function() { |
80 | tip.show('定金预售商品只能在APP端购买'); | 81 | tip.show('定金预售商品只能在APP端购买'); |
@@ -245,6 +245,7 @@ function search(opt, params, isScroll) { | @@ -245,6 +245,7 @@ function search(opt, params, isScroll) { | ||
245 | 245 | ||
246 | /* TODO tar add 161125 sale dicount no yh_channel*/ | 246 | /* TODO tar add 161125 sale dicount no yh_channel*/ |
247 | var discount = $('#discount').val(); | 247 | var discount = $('#discount').val(); |
248 | + | ||
248 | if (discount === 'discount') { | 249 | if (discount === 'discount') { |
249 | delete setting.yh_channel; | 250 | delete setting.yh_channel; |
250 | } | 251 | } |
@@ -409,6 +409,7 @@ function search(opt) { | @@ -409,6 +409,7 @@ function search(opt) { | ||
409 | } else { | 409 | } else { |
410 | if (nav.reload) { | 410 | if (nav.reload) { |
411 | var goodList = []; | 411 | var goodList = []; |
412 | + | ||
412 | $(data).each(function(i, goodInfo) { | 413 | $(data).each(function(i, goodInfo) { |
413 | if ($(goodInfo).hasClass('good-info')) { | 414 | if ($(goodInfo).hasClass('good-info')) { |
414 | goodList.push(goodInfo); | 415 | goodList.push(goodInfo); |
-
Please register or login to post a comment