Authored by zhangxiaoru

yohocoin

@@ -8,21 +8,36 @@ @@ -8,21 +8,36 @@
8 8
9 const myCurrencyModel = require('../models/myCurrency'); 9 const myCurrencyModel = require('../models/myCurrency');
10 const headerModel = require('../../../doraemon/models/header'); // 头部model 10 const headerModel = require('../../../doraemon/models/header'); // 头部model
  11 +const _ = require('lodash');
11 12
12 const myCurrency = (req, res, next) => { 13 const myCurrency = (req, res, next) => {
13 let uid = req.user.uid || 8039759; 14 let uid = req.user.uid || 8039759;
  15 + let contentCode = '05afedf76886d732573f10f7451a1703';
  16 + let gender = req.query.gender || '1,3';
  17 + let lifestyleHomePage = '';
14 18
15 - myCurrencyModel.myCurrency(uid).then(result => { 19 + if(gender === '3,3') {
  20 + lifestyleHomePage = true;
  21 + } else {
  22 + lifestyleHomePage = false;
  23 + }
  24 +
  25 + myCurrencyModel.myCurrency(uid, contentCode).then(result => {
16 26
17 res.render('currency-new', { 27 res.render('currency-new', {
18 module: 'home', 28 module: 'home',
19 - page: 'currency',  
20 - pageHeader: headerModel.setNav({ 29 + page: 'currency-new',
  30 + pageHeader: _.assign(headerModel.setNav({
21 navTitle: '有货币' 31 navTitle: '有货币'
  32 + }), {
  33 + currencyPage: true,
  34 + navBtn: false
22 }), 35 }),
23 title: '有货币', 36 title: '有货币',
24 pageFooter: true, 37 pageFooter: true,
25 - yohoCoin: result 38 + yohoCoin: result.yohoCoin,
  39 + banner: result.banner,
  40 + lifestyleHomePage: lifestyleHomePage
26 }); 41 });
27 }).catch(next); 42 }).catch(next);
28 }; 43 };
@@ -37,11 +52,15 @@ const currencyDetail = (req, res, next) => { @@ -37,11 +52,15 @@ const currencyDetail = (req, res, next) => {
37 res.render('currency-detail', { 52 res.render('currency-detail', {
38 module: 'home', 53 module: 'home',
39 page: 'currency-detail', 54 page: 'currency-detail',
40 - pageHeader: headerModel.setNav({ 55 + pageHeader: _.assign(headerModel.setNav({
41 navTitle: '有货币明细' 56 navTitle: '有货币明细'
  57 + }), {
  58 + currencyDetailPage: true,
  59 + navBtn: false
42 }), 60 }),
43 title: '有货币明细', 61 title: '有货币明细',
44 pageFooter: true, 62 pageFooter: true,
  63 +
45 money: result.money 64 money: result.money
46 }); 65 });
47 }).catch(next); 66 }).catch(next);
@@ -64,6 +83,6 @@ let ajaxCurrencyDetail = (req, res, next) => { @@ -64,6 +83,6 @@ let ajaxCurrencyDetail = (req, res, next) => {
64 module.exports = { 83 module.exports = {
65 myCurrency, 84 myCurrency,
66 currencyDetail, 85 currencyDetail,
67 - ajaxCurrencyDetail 86 + ajaxCurrencyDetail,
68 }; 87 };
69 88
1 'use strict'; 1 'use strict';
2 2
3 - 3 +const serviceAPI = global.yoho.ServiceAPI;
4 const api = global.yoho.API; 4 const api = global.yoho.API;
5 const _ = require('lodash'); 5 const _ = require('lodash');
6 const camelCase = global.yoho.camelCase; 6 const camelCase = global.yoho.camelCase;
7 const logger = global.yoho.logger; 7 const logger = global.yoho.logger;
8 8
9 -const myCurrency = (uid) => { 9 +const yohoCoin = (uid) => {
10 return api.get('', { 10 return api.get('', {
11 method: 'app.yoho.yohocoin', 11 method: 'app.yoho.yohocoin',
12 uid: uid 12 uid: uid
@@ -20,18 +20,34 @@ const myCurrency = (uid) => { @@ -20,18 +20,34 @@ const myCurrency = (uid) => {
20 }); 20 });
21 }; 21 };
22 22
23 -// const banner = (CODE_YOHOCOIN_BANNER) => {  
24 -// return api.get('', {  
25 -// content_code: 'CODE_YOHOCOIN_BANNER',  
26 -// }).then((result) => {  
27 -// console.log(content_code)  
28 -// if(result && result.code === 200) {  
29 -// return camelCase(result.data);  
30 -// } else {  
31 -// logger.error('youho币总数 cood 不是 200');  
32 -// }  
33 -// })  
34 -// }; 23 +const bannerData = (contentCode) => {
  24 +
  25 + return serviceAPI.get('operations/api/v5/resource/get', {
  26 + content_code: contentCode
  27 + }).then((result) => {
  28 + //console.log(result)
  29 +
  30 + if (result && result.code === 200) {
  31 +
  32 + return result.data
  33 +
  34 + } else {
  35 + logger.error('banner is not 200');
  36 + return {};
  37 + }
  38 + });
  39 +};
  40 +
  41 +const myCurrency = (uid, contentCode) => {
  42 + return Promise.all([yohoCoin(uid), bannerData(contentCode)])
  43 + .then((result) => {
  44 +
  45 + return {
  46 + yohoCoin: result[0],
  47 + banner: result[1]
  48 + };
  49 + });
  50 +};
35 51
36 const currencyDetail = (uid, page, limit) => { 52 const currencyDetail = (uid, page, limit) => {
37 return api.get('', { 53 return api.get('', {
@@ -40,7 +56,7 @@ const currencyDetail = (uid, page, limit) => { @@ -40,7 +56,7 @@ const currencyDetail = (uid, page, limit) => {
40 page: page, 56 page: page,
41 limit: limit 57 limit: limit
42 }).then((result) => { 58 }).then((result) => {
43 - // console.log(result) 59 +
44 if (result && result.code === 200) { 60 if (result && result.code === 200) {
45 let total = parseInt(result.data.page_total, 10) + 1; 61 let total = parseInt(result.data.page_total, 10) + 1;
46 62
@@ -70,7 +86,24 @@ const currencyDetail = (uid, page, limit) => { @@ -70,7 +86,24 @@ const currencyDetail = (uid, page, limit) => {
70 }); 86 });
71 }; 87 };
72 88
  89 +const mayLike = (uid, page, limit, udid, gender, recPos, channel) => {
  90 + return api.get('', {
  91 + method: 'app.search.newLast7day',
  92 + uid: uid,
  93 + page: page,
  94 + limit: limit,
  95 + udid: udid,
  96 + rec_pos: recPos,
  97 + yh_channel: channel
  98 + }).then((result) => {
  99 + console.log(result)
  100 + });
  101 +}
  102 +
73 module.exports = { 103 module.exports = {
74 myCurrency, 104 myCurrency,
75 - currencyDetail 105 + currencyDetail,
  106 + bannerData,
  107 + yohoCoin,
  108 + mayLike
76 }; 109 };
@@ -19,11 +19,17 @@ @@ -19,11 +19,17 @@
19 </div> 19 </div>
20 <div class="banner"> 20 <div class="banner">
21 {{#banner}} 21 {{#banner}}
  22 + {{#data}}
22 <a href="{{url}}"> 23 <a href="{{url}}">
23 - <img src="{{img}}" alt="img"> 24 + <img src="{{image src 640 200 2}}" alt="img">
24 </a> 25 </a>
  26 + {{/data}}
25 {{/banner}} 27 {{/banner}}
26 </div> 28 </div>
27 29
28 - {{!-- {{> home/maybe_like}} --}} 30 + {{#if lifestyleHomePage}}
  31 + {{> home/maybe-like-lifestyle}}
  32 + {{else}}
  33 + {{> home/maybe-like}}
  34 + {{/if}}
29 </div> 35 </div>
  1 +<div class="yoho-coin-page yoho-page">
  2 + {{# yohoCoin}}
  3 + <p class="coin-num">
  4 + <em>{{coinNum}}</em>
  5 + YOHO币
  6 + </p>
  7 +
  8 + <section>
  9 + <p class="title">YOHO币</p>
  10 + <hr>
  11 + <p>
  12 + <span class="sub-title">YOHO币是什么,有什么用?</span>
  13 + YOHO币是有货商城的虚拟货币,与现金比例1:1,没有任何使用期限,YOHO币可直接用于有货线上购物使用,不可转让他人,不可兑换为现金。使用YOHO币支付的金额不可计入消费金额。
  14 + </p>
  15 + <p>
  16 + <span class="sub-title">如何查看自己的YOHO币?</span>
  17 + <span class="path">登录 > 个人中心 > 我的YOHO币</span>
  18 + </p>
  19 + <p>
  20 + <span class="sub-title">YOHO币如何购买支付?</span>
  21 + 在购买支付页面输入您要使用的YOHO币金额即可完成支付
  22 +
  23 + <div class="remark">
  24 + <span></span>
  25 + 如果超过了我们约定的期限的非正常退货,我们将会于您的退款金额中直接扣除赠送YOHO币等值的金额。赠送给您的YOHO币还将保留在您的账户中,敬请谅解。
  26 + </div>
  27 + </p>
  28 + </section>
  29 + {{/ yohoCoin}}
  30 +</div>
  1 +<div class="maybe-like">
  2 + <ul id="maybe-like-nav" class="maybe-like-nav clearfix">
  3 + <li class="maybe-like-nav-item focus">新品到着</li>
  4 + <li class="maybe-like-nav-item">人气单品</li>
  5 + </ul>
  6 +
  7 + <div id="goods-list">
  8 + {{# goodsContainer}}
  9 + <div class="goods-list {{^show}}hide{{/show}}">
  10 + {{# goods}}
  11 + {{> good}}
  12 + {{/ goods}}
  13 + </div>
  14 + {{/ goodsContainer}}
  15 + </div>
  16 +
  17 + <div id="load-more-info" class="load-more-info">
  18 + <div class="loading status hide">
  19 + 正在加载...
  20 + </div>
  21 + <span class="no-more status hide">没有更多啦</span>
  22 + </div>
  23 +</div>
  1 +<div class="maybe-like">
  2 + <p class="title">
  3 + <i class="icon"></i>
  4 + <span>你可能喜欢</span>
  5 + </p>
  6 + <div id="goods-list" class="goods-list clearfix"></div>
  7 +</div>
  8 +<div class="load-more-img hide" id="load-more-img">
  9 + <a href="">
  10 + <img src="">
  11 + </a>
  12 +</div>
  1 +<div class="maybe-like">
  2 + <p class="title">
  3 + <i class="icon"></i>
  4 + <span>你可能喜欢</span>
  5 + </p>
  6 + <div id="goods-list" class="goods-list clearfix"></div>
  7 +</div>
  8 +<div class="load-more-img hide" id="load-more-img">
  9 + <a href="">
  10 + <img src="">
  11 + </a>
  12 +</div>
@@ -4,6 +4,254 @@ @@ -4,6 +4,254 @@
4 * @date: 2015/10/12 4 * @date: 2015/10/12
5 */ 5 */
6 6
  7 +// module.exports = function(specificGender) {
  8 +// var $ = require('yoho-jquery'),
  9 +// Hammer = require('yoho-hammer'),
  10 +// ellipsis = require('yoho-mlellipsis'),
  11 +// tip = require('../plugin/tip'),
  12 +// loading = require('../plugin/loading'),
  13 +// lazyLoad = require('yoho-jquery-lazyload');
  14 +
  15 +// var navHammer,
  16 +// winH = $(window).height(),
  17 +// $goodList = $('#goods-list'),
  18 +// searching = false,
  19 +// page = 0,
  20 +// gender = null,
  21 +// num,
  22 +// url,
  23 +// RECPOSE = '';
  24 +
  25 +// // The kidsType can be specified by the parameter. Add by @ZhaoBiao
  26 +// var kidsType = specificGender === 'kids' || $('.mobile-wrap').hasClass('kids-wrap') ? true : false,
  27 +// lifestyleType = specificGender === 'lifestyle' ||
  28 +// $('.mobile-wrap').hasClass('lifestyle-wrap') ? true : false,
  29 +
  30 +// yohoCoinType = $('.coin').length ? true : false;
  31 +// var $curNav,
  32 +// index,
  33 +// $navList = $('#maybe-like-nav');
  34 +
  35 +// var $footer;
  36 +
  37 +// var bottomBannerLoaded;
  38 +
  39 +// ellipsis.init();
  40 +
  41 +// // ajax url
  42 +// if (kidsType) {
  43 +
  44 +// url = '/product/recom/maylikekids';
  45 +// } else if (lifestyleType) {
  46 +
  47 +// //有货币页面加载男生首页的数据
  48 +// url = specificGender === 'lifestyle' ? '/product/recom/maylike?gender=1,3&rec_pos=100001' : '/product/recom/maylikelife';
  49 +// } else if (yohoCoinType) {
  50 +
  51 +// gender = (specificGender === 'boys' || $('.mobile-wrap').hasClass('boys-wrap')) ?
  52 +// '1,3&rec_pos=100009' : '2,3&rec_pos=100009',
  53 +// url = '/product/recom/maylike?gender=' + gender;
  54 +// RECPOSE = 110009;
  55 +
  56 +// } else if (logisticType) { //物流页面
  57 +// gender = (specificGender === 'boys' || $('.mobile-wrap').hasClass('boys-wrap')) ?
  58 +// '1,3&rec_pos=100006' : '2,3&rec_pos=100006',
  59 +// url = '/product/recom/maylike?gender=' + gender;
  60 +// RECPOSE = 110006;
  61 +
  62 +// } else {
  63 +// gender = (specificGender === 'boys' || $('.mobile-wrap').hasClass('boys-wrap')) ?
  64 +// '1,3&rec_pos=100001' : '2,3&rec_pos=100002',
  65 +// url = '/product/recom/maylike?gender=' + gender;
  66 +// }
  67 +
  68 +
  69 +// // 首页男生和女生,推荐位ID,埋点
  70 +// if (window.location.pathname === '/boys') {
  71 +// RECPOSE = 110001;
  72 +// } else if (window.location.pathname === '/girls') {
  73 +// RECPOSE = 110002;
  74 +// }
  75 +
  76 +// $curNav = $navList.children('.focus');
  77 +
  78 +// if (lifestyleType) {
  79 +// navHammer = $navList[0] ? new Hammer($navList[0]) : null;
  80 +// if (navHammer) {
  81 +// navHammer.on('tap', function(e) {
  82 +// var $this = $(e.target).closest('li'),
  83 +// $goods = $('.goods-list'),
  84 +// $content;
  85 +
  86 +// e.preventDefault();
  87 +// if ($this.hasClass('focus')) {
  88 +// return;
  89 +// }
  90 +
  91 +// index = $this.index();
  92 +
  93 +// $this.addClass('focus');
  94 +// $curNav.removeClass('focus');
  95 +
  96 +// $goods.not('.hide').addClass('hide');
  97 +// $content = $goods.eq(index);
  98 +// $content.removeClass('hide');
  99 +
  100 +// $curNav = $this;
  101 +
  102 +// $(document).trigger('scroll'); // Trigger lazyLoad
  103 +// e.srcEvent.stopPropagation();
  104 +// });
  105 +// }
  106 +// }
  107 +
  108 +// loading.init($('.maybe-like'));
  109 +
  110 +// function search() {
  111 +// if (searching) {
  112 +// return;
  113 +// }
  114 +// searching = true;
  115 +
  116 +// loading.showLoadingMask();
  117 +
  118 +// // num = $goodList.find('.good-info').length;
  119 +// $.ajax({
  120 +// type: 'GET',
  121 +// url: url,
  122 +// data: {
  123 +// page: page + 1
  124 +// },
  125 +// success: function(data) {
  126 +// var PRDID = [];
  127 +
  128 +// if (data === ' ') {
  129 +// loading.hideLoadingMask();
  130 +
  131 +// // 有货币页面不加载底部
  132 +// if (gender && !specificGender) {
  133 +// if (bottomBannerLoaded) {
  134 +// return;
  135 +// }
  136 +// url = '/channel/bottomBanner';
  137 +// $.ajax({
  138 +// type: 'GET',
  139 +// url: url,
  140 +// data: {
  141 +// gender: gender
  142 +// },
  143 +// success: function(res) {
  144 +// res = res.data;
  145 +// bottomBannerLoaded = true;
  146 +// if (res && res.img) {
  147 +// $('#load-more-img').show();
  148 +// $('#load-more-img a').attr('href', res.url);
  149 +// $('#load-more-img a > img').attr('src', res.img);
  150 +// }
  151 +// }
  152 +// });
  153 +
  154 +// }
  155 +// return;
  156 +// } else {
  157 +// searching = false;
  158 +// }
  159 +
  160 +// // 加载到数据后,去除bottom样式,使得footer能够随着页面长度的增加改变位置
  161 +// if (data.length > 1) {
  162 +// $footer ? null : $footer = $('#yoho-footer');
  163 +// $footer.hasClass('bottom') ? $footer.removeClass('bottom') : null;
  164 +// }
  165 +
  166 +// num = $goodList.find('.good-info').length;
  167 +
  168 +// $goodList.append(data);
  169 +
  170 +// // 2015/10/31 fei.hong: 修复第一页分页不显示图片的问题
  171 +// if (num === 0) {
  172 +// lazyLoad($goodList.find('.good-info').find('img.lazy'));
  173 +// } else {
  174 +// lazyLoad($goodList.find('.good-info:gt(' + (num - 1) + ')').find('img.lazy'));
  175 +// }
  176 +
  177 +// loading.hideLoadingMask();
  178 +// page++;
  179 +
  180 +// $('.good-detail-text .name').each(function() {
  181 +// var $this = $(this),
  182 +// $title = $this.find('a');
  183 +
  184 +// $title[0].mlellipsis(2);
  185 +// });
  186 +
  187 +// // 为您优选埋点 start
  188 +// PRDID = [];
  189 +// $(data).closest('.good-info').each(function() {
  190 +// PRDID.push($(this).data('id'));
  191 +// });
  192 +// window.givePoint({
  193 +// REC_POSE: RECPOSE,
  194 +// PRD_ID: PRDID.join(','),
  195 +// PRD_NUM: $(data).closest('.good-info').length,
  196 +// ACTION_ID: 0,
  197 +// page_num: page
  198 +// });
  199 +
  200 +// // 为您优选埋点 end
  201 +// },
  202 +// error: function() {
  203 +// tip.show('网络断开连接了~');
  204 +// searching = false;
  205 +// loading.hideLoadingMask();
  206 +// }
  207 +// });
  208 +// }
  209 +
  210 +// $('.maybe-like p').on('touchstart', function() {
  211 +// search();
  212 +// });
  213 +
  214 +// function scrollHandler() {
  215 +// if ($(window).scrollTop() + winH >= $(document).height() - 200) {
  216 +// search();
  217 +// }
  218 +// }
  219 +
  220 +// // 优惠券页面直接加载你可能喜欢。add by @zhaobiao
  221 +// if (specificGender) {
  222 +// search();
  223 +// }
  224 +
  225 +// // srcoll to load more
  226 +// $(window).scroll(function() {
  227 +// window.requestAnimationFrame(scrollHandler);
  228 +// });
  229 +
  230 +// // 为您优选埋点
  231 +// $('.maybe-like .goods-list').on('click', 'a', function() {
  232 +
  233 +// var pageNum = 50;
  234 +
  235 +// index = $(this).closest('.good-info').index() + 1;
  236 +
  237 +// window.givePoint({
  238 +// REC_POSE: RECPOSE,
  239 +// PRD_ID: $(this).closest('.good-info').data('id'),
  240 +// PRD_NUM: index % pageNum === 0 ? pageNum : index % pageNum,
  241 +// ACTION_ID: 1,
  242 +// page_num: Math.ceil(index / pageNum)
  243 +// });
  244 +// return true;
  245 +// });
  246 +// };
  247 +
  248 +
  249 +/**
  250 + * “你可能喜欢”模块JS
  251 + * @author: liangzhifeng<zhifeng.liang@yoho.cn>
  252 + * @date: 2015/10/12
  253 + */
  254 +
7 module.exports = function(specificGender) { 255 module.exports = function(specificGender) {
8 var $ = require('yoho-jquery'), 256 var $ = require('yoho-jquery'),
9 Hammer = require('yoho-hammer'), 257 Hammer = require('yoho-hammer'),
@@ -20,37 +268,55 @@ module.exports = function(specificGender) { @@ -20,37 +268,55 @@ module.exports = function(specificGender) {
20 gender = null, 268 gender = null,
21 num, 269 num,
22 url, 270 url,
23 - RECPOSE = ''; 271 + RECPOSE = '110001';
24 272
25 - // The kidsType can be specified by the parameter. Add by @ZhaoBiao 273 + //The kidsType can be specified by the parameter. Add by @ZhaoBiao
26 var kidsType = specificGender === 'kids' || $('.mobile-wrap').hasClass('kids-wrap') ? true : false, 274 var kidsType = specificGender === 'kids' || $('.mobile-wrap').hasClass('kids-wrap') ? true : false,
27 lifestyleType = specificGender === 'lifestyle' || 275 lifestyleType = specificGender === 'lifestyle' ||
28 - $('.mobile-wrap').hasClass('lifestyle-wrap') ? true : false;  
29 - 276 + $('.mobile-wrap').hasClass('lifestyle-wrap') ? true : false,
  277 + yohoCoinType = $('.coin').length ? true : false,
  278 + logisticType = $('.logistic-page').length ? true : false;
30 var $curNav, 279 var $curNav,
31 index, 280 index,
32 $navList = $('#maybe-like-nav'); 281 $navList = $('#maybe-like-nav');
33 282
34 var $footer; 283 var $footer;
35 284
36 - var bottomBannerLoaded;  
37 -  
38 ellipsis.init(); 285 ellipsis.init();
39 286
40 - // ajax url 287 + //ajax url
41 if (kidsType) { 288 if (kidsType) {
  289 +
42 url = '/product/recom/maylikekids'; 290 url = '/product/recom/maylikekids';
43 } else if (lifestyleType) { 291 } else if (lifestyleType) {
44 292
45 - // 有货币页面加载男生首页的数据  
46 - url = specificGender === 'lifestyle' ? '/product/recom/maylike?gender=1,3' : '/product/recom/maylikelife'; 293 + //有货币页面加载男生首页的数据
  294 + url = specificGender === 'lifestyle' ? '/product/recom/maylike?gender=1,3&rec_pos=100001' : '/product/recom/maylikelife';
  295 + } else if (yohoCoinType) {
  296 +
  297 + gender = (specificGender === 'boys' || $('.mobile-wrap').hasClass('boys-wrap')) ?
  298 + '1,3&rec_pos=100009' : '2,3&rec_pos=100009',
  299 + url = '/product/recom/maylike?gender=' + gender;
  300 + RECPOSE = 110009;
  301 +
  302 + } else if (logisticType) { //物流页面
  303 + gender = (specificGender === 'boys' || $('.mobile-wrap').hasClass('boys-wrap')) ?
  304 + '1,3&rec_pos=100006' : '2,3&rec_pos=100006',
  305 + url = '/product/recom/maylike?gender=' + gender;
  306 + RECPOSE = 110006;
  307 +
47 } else { 308 } else {
48 gender = (specificGender === 'boys' || $('.mobile-wrap').hasClass('boys-wrap')) ? 309 gender = (specificGender === 'boys' || $('.mobile-wrap').hasClass('boys-wrap')) ?
49 - '1,3' : '2,3'; 310 + '1,3&rec_pos=100001' : '2,3&rec_pos=100002',
50 url = '/product/recom/maylike?gender=' + gender; 311 url = '/product/recom/maylike?gender=' + gender;
51 } 312 }
52 313
53 - // 首页男生和女生,推荐位ID,埋点 314 + //日韩馆-你可能喜欢的
  315 + if ($('.mobile-wrap').hasClass('yoho-channel-page')) {
  316 + url = '/product/recom/newPreference?template_id=' + $.queryString().template_id;
  317 + }
  318 +
  319 + //首页男生和女生,推荐位ID,埋点
54 if (window.location.pathname === '/boys') { 320 if (window.location.pathname === '/boys') {
55 RECPOSE = 110001; 321 RECPOSE = 110001;
56 } else if (window.location.pathname === '/girls') { 322 } else if (window.location.pathname === '/girls') {
@@ -60,7 +326,7 @@ module.exports = function(specificGender) { @@ -60,7 +326,7 @@ module.exports = function(specificGender) {
60 $curNav = $navList.children('.focus'); 326 $curNav = $navList.children('.focus');
61 327
62 if (lifestyleType) { 328 if (lifestyleType) {
63 - navHammer = $navList[0] ? new Hammer($navList[0]) : null; 329 + navHammer = $navList[0] ? new Hammer($navList[0]) : undefined;
64 if (navHammer) { 330 if (navHammer) {
65 navHammer.on('tap', function(e) { 331 navHammer.on('tap', function(e) {
66 var $this = $(e.target).closest('li'), 332 var $this = $(e.target).closest('li'),
@@ -83,7 +349,7 @@ module.exports = function(specificGender) { @@ -83,7 +349,7 @@ module.exports = function(specificGender) {
83 349
84 $curNav = $this; 350 $curNav = $this;
85 351
86 - $(document).trigger('scroll'); // Trigger lazyLoad 352 + $(document).trigger('scroll'); //Trigger lazyLoad
87 e.srcEvent.stopPropagation(); 353 e.srcEvent.stopPropagation();
88 }); 354 });
89 } 355 }
@@ -99,7 +365,7 @@ module.exports = function(specificGender) { @@ -99,7 +365,7 @@ module.exports = function(specificGender) {
99 365
100 loading.showLoadingMask(); 366 loading.showLoadingMask();
101 367
102 - // num = $goodList.find('.good-info').length; 368 + //num = $goodList.find('.good-info').length;
103 $.ajax({ 369 $.ajax({
104 type: 'GET', 370 type: 'GET',
105 url: url, 371 url: url,
@@ -108,40 +374,36 @@ module.exports = function(specificGender) { @@ -108,40 +374,36 @@ module.exports = function(specificGender) {
108 }, 374 },
109 success: function(data) { 375 success: function(data) {
110 var PRDID = []; 376 var PRDID = [];
111 -  
112 if (data === ' ') { 377 if (data === ' ') {
  378 + searching = false;
113 loading.hideLoadingMask(); 379 loading.hideLoadingMask();
114 380
115 // 有货币页面不加载底部 381 // 有货币页面不加载底部
116 if (gender && !specificGender) { 382 if (gender && !specificGender) {
117 - if (bottomBannerLoaded) {  
118 - return; 383 + if (gender === '1,3') {
  384 + url = '/boys/bottomBanner';
  385 + } else {
  386 + url = '/girls/bottomBanner';
119 } 387 }
120 - url = '/channel/bottomBanner';  
121 $.ajax({ 388 $.ajax({
122 type: 'GET', 389 type: 'GET',
123 url: url, 390 url: url,
124 - data: {  
125 - gender: gender  
126 - },  
127 - success: function(res) {  
128 - res = res.data;  
129 - bottomBannerLoaded = true;  
130 - if (res && res.img) { 391 + success: function(data) {
  392 + if (data && data.img) {
131 $('#load-more-img').show(); 393 $('#load-more-img').show();
132 - $('#load-more-img a').attr('href', res.url);  
133 - $('#load-more-img a > img').attr('src', res.img); 394 + $('#load-more-img a').attr('href', data.url);
  395 + $('#load-more-img a > img').attr('src', data.img);
134 } 396 }
  397 + },
  398 + error: function() {
135 } 399 }
136 }); 400 });
137 401
138 } 402 }
139 return; 403 return;
140 - } else {  
141 - searching = false;  
142 } 404 }
143 405
144 - // 加载到数据后,去除bottom样式,使得footer能够随着页面长度的增加改变位置 406 + //加载到数据后,去除bottom样式,使得footer能够随着页面长度的增加改变位置
145 if (data.length > 1) { 407 if (data.length > 1) {
146 $footer ? null : $footer = $('#yoho-footer'); 408 $footer ? null : $footer = $('#yoho-footer');
147 $footer.hasClass('bottom') ? $footer.removeClass('bottom') : null; 409 $footer.hasClass('bottom') ? $footer.removeClass('bottom') : null;
@@ -158,6 +420,7 @@ module.exports = function(specificGender) { @@ -158,6 +420,7 @@ module.exports = function(specificGender) {
158 lazyLoad($goodList.find('.good-info:gt(' + (num - 1) + ')').find('img.lazy')); 420 lazyLoad($goodList.find('.good-info:gt(' + (num - 1) + ')').find('img.lazy'));
159 } 421 }
160 422
  423 + searching = false;
161 loading.hideLoadingMask(); 424 loading.hideLoadingMask();
162 page++; 425 page++;
163 426
@@ -168,20 +431,18 @@ module.exports = function(specificGender) { @@ -168,20 +431,18 @@ module.exports = function(specificGender) {
168 $title[0].mlellipsis(2); 431 $title[0].mlellipsis(2);
169 }); 432 });
170 433
171 - // 为您优选埋点 start  
172 - PRDID = []; 434 + //为您优选埋点 start
173 $(data).closest('.good-info').each(function() { 435 $(data).closest('.good-info').each(function() {
174 PRDID.push($(this).data('id')); 436 PRDID.push($(this).data('id'));
175 }); 437 });
176 window.givePoint({ 438 window.givePoint({
177 - REC_POSE: RECPOSE,  
178 - PRD_ID: PRDID.join(','),  
179 - PRD_NUM: $(data).closest('.good-info').length,  
180 - ACTION_ID: 0,  
181 - page_num: page 439 + 'REC_POSE': RECPOSE,
  440 + 'PRD_ID': PRDID.join(','),
  441 + 'PRD_NUM': $(data).closest('.good-info').length,
  442 + 'ACTION_ID': 0,
  443 + 'page_num': RECPOSE === 110009 ? 1 : page
182 }); 444 });
183 -  
184 - // 为您优选埋点 end 445 + //为您优选埋点 end
185 }, 446 },
186 error: function() { 447 error: function() {
187 tip.show('网络断开连接了~'); 448 tip.show('网络断开连接了~');
@@ -191,7 +452,7 @@ module.exports = function(specificGender) { @@ -191,7 +452,7 @@ module.exports = function(specificGender) {
191 }); 452 });
192 } 453 }
193 454
194 - $('.maybe-like p').on('touchstart', function() { 455 + $('.maybe-like p').on('touchstart', function(e) {
195 search(); 456 search();
196 }); 457 });
197 458
@@ -206,24 +467,21 @@ module.exports = function(specificGender) { @@ -206,24 +467,21 @@ module.exports = function(specificGender) {
206 search(); 467 search();
207 } 468 }
208 469
209 - // srcoll to load more 470 + //srcoll to load more
210 $(window).scroll(function() { 471 $(window).scroll(function() {
211 window.requestAnimationFrame(scrollHandler); 472 window.requestAnimationFrame(scrollHandler);
212 }); 473 });
213 474
214 - // 为您优选埋点 475 + //为您优选埋点 http://redmine.yoho.cn/issues/10116
215 $('.maybe-like .goods-list').on('click', 'a', function() { 476 $('.maybe-like .goods-list').on('click', 'a', function() {
216 -  
217 - var pageNum = 50;  
218 -  
219 - index = $(this).closest('.good-info').index() + 1;  
220 - 477 + var index = $(this).closest('.good-info').index() + 1,
  478 + pageNum = 50;
221 window.givePoint({ 479 window.givePoint({
222 - REC_POSE: RECPOSE,  
223 - PRD_ID: $(this).closest('.good-info').data('id'),  
224 - PRD_NUM: index % pageNum === 0 ? pageNum : index % pageNum,  
225 - ACTION_ID: 1,  
226 - page_num: Math.ceil(index / pageNum) 480 + 'REC_POSE': RECPOSE,
  481 + 'PRD_ID': $(this).closest('.good-info').data('id'),
  482 + 'PRD_NUM': index % pageNum === 0 ? pageNum : index % pageNum,
  483 + 'ACTION_ID': 1,
  484 + 'page_num': Math.ceil(index / pageNum)
227 }); 485 });
228 return true; 486 return true;
229 }); 487 });
  1 +/**
  2 + * 新有货币界面
  3 + */
  4 +var $ = require('yoho-jquery');
  5 +require('../common');
  6 +
  7 +function getGender() {
  8 + return window.cookie('_Channel') || 'boys';
  9 +}
  10 +
  11 +require('../channel/maybe-like')(getGender());