Authored by zhangxiaoru

recom

1 -//优惠券 by acgpiano 1 +// 优惠券 by acgpiano
2 'use strict'; 2 'use strict';
3 const headerModel = require('../../../doraemon/models/header'), // 头部model 3 const headerModel = require('../../../doraemon/models/header'), // 头部model
4 model = require('../models/coupons'); 4 model = require('../models/coupons');
@@ -15,7 +15,7 @@ const index = (req, res) => { @@ -15,7 +15,7 @@ const index = (req, res) => {
15 }); 15 });
16 }; 16 };
17 17
18 -//处理Ajax请求,status为使用状态 18 +// 处理Ajax请求,status为使用状态
19 const couponData = (req, res, next) => { 19 const couponData = (req, res, next) => {
20 model.couponData({ 20 model.couponData({
21 method: 'app.coupons.li', 21 method: 'app.coupons.li',
1 -//优惠券 by acgpiano  
2 -"use strict"; 1 +// 优惠券 by acgpiano
  2 +'use strict';
3 3
4 const api = global.yoho.API; 4 const api = global.yoho.API;
5 5
@@ -23,11 +23,11 @@ const couponData = (params) => { @@ -23,11 +23,11 @@ const couponData = (params) => {
23 <i></i> 23 <i></i>
24 <p>您还没有优惠券!</p> 24 <p>您还没有优惠券!</p>
25 <a href="/product/new">随便逛逛</a> 25 <a href="/product/new">随便逛逛</a>
26 - </div>` 26 + </div>`;
27 } 27 }
28 }); 28 });
29 -} 29 +};
30 30
31 module.exports = { 31 module.exports = {
32 couponData 32 couponData
33 -}  
  33 +};
@@ -105,5 +105,6 @@ module.exports = { @@ -105,5 +105,6 @@ module.exports = {
105 currencyDetail, 105 currencyDetail,
106 bannerData, 106 bannerData,
107 yohoCoin 107 yohoCoin
  108 +
108 // mayLike 109 // mayLike
109 }; 110 };
@@ -16,9 +16,9 @@ const mayLike = (uid, page, limit, gender, udid, recPos, channel) => { @@ -16,9 +16,9 @@ const mayLike = (uid, page, limit, gender, udid, recPos, channel) => {
16 rec_pos: recPos, 16 rec_pos: recPos,
17 yh_channel: channel 17 yh_channel: channel
18 }).then((result) => { 18 }).then((result) => {
19 - //console.log(result); 19 + // console.log(result);
20 }); 20 });
21 -} 21 +};
22 22
23 module.exports = { 23 module.exports = {
24 mayLike 24 mayLike
@@ -24,7 +24,7 @@ const outlet = require(`${cRoot}/outlet`); @@ -24,7 +24,7 @@ const outlet = require(`${cRoot}/outlet`);
24 // recommend-for-you controller 24 // recommend-for-you controller
25 const recommendForYou = require(`${cRoot}/recommend-for-you`); 25 const recommendForYou = require(`${cRoot}/recommend-for-you`);
26 26
27 -//recom 27 +// recom
28 const recom = require(`${cRoot}/recom`); 28 const recom = require(`${cRoot}/recom`);
29 29
30 // routers 30 // routers
@@ -37,7 +37,7 @@ router.get('/detail/consults', detail.consults); // 商品咨询页 @@ -37,7 +37,7 @@ router.get('/detail/consults', detail.consults); // 商品咨询页
37 router.get('/detail/consultform', auth, detail.consultform); // 商品咨询表单页 37 router.get('/detail/consultform', auth, detail.consultform); // 商品咨询表单页
38 router.get('/detail/comments', detail.comments); 38 router.get('/detail/comments', detail.comments);
39 router.post('/detail/consultsubmit', auth, detail.consultsubmit); // 商品咨询提交接口 39 router.post('/detail/consultsubmit', auth, detail.consultsubmit); // 商品咨询提交接口
40 -router.get('/recom/maylike', recom.mayLike);//你可能喜欢 40 +router.get('/recom/maylike', recom.mayLike);// 你可能喜欢
41 41
42 router.get('/sale', sale.index); 42 router.get('/sale', sale.index);
43 router.get('/sale/discount', sale.discount); 43 router.get('/sale/discount', sale.discount);
1 -//不要使用es6  
2 -"use strict"; 1 +// 不要使用es6
  2 +'use strict';
3 3
4 var $ = require('yoho-jquery'), 4 var $ = require('yoho-jquery'),
5 Hammer = require('yoho-hammer'), 5 Hammer = require('yoho-hammer'),
@@ -9,9 +9,11 @@ var $ = require('yoho-jquery'), @@ -9,9 +9,11 @@ var $ = require('yoho-jquery'),
9 var employ, 9 var employ,
10 statu = 0, 10 statu = 0,
11 page = 1, 11 page = 1,
12 - //防止重复请求 12 +
  13 + // 防止重复请求
13 AjaxFlag = 0, 14 AjaxFlag = 0,
14 - //上滑不请求 15 +
  16 + // 上滑不请求
15 direction = true; 17 direction = true;
16 18
17 var couponAJAX = function(statu, page) { 19 var couponAJAX = function(statu, page) {
@@ -35,7 +37,7 @@ var couponAJAX = function(statu, page) { @@ -35,7 +37,7 @@ var couponAJAX = function(statu, page) {
35 AjaxFlag = 0; 37 AjaxFlag = 0;
36 } 38 }
37 }); 39 });
38 -} 40 +};
39 41
40 var scrollHandler = function() { 42 var scrollHandler = function() {
41 if (direction && ($(window).scrollTop() + $(window).height() > $('body').height() - 100)) { 43 if (direction && ($(window).scrollTop() + $(window).height() > $('body').height() - 100)) {
@@ -43,14 +45,14 @@ var scrollHandler = function() { @@ -43,14 +45,14 @@ var scrollHandler = function() {
43 couponAJAX(statu, page); 45 couponAJAX(statu, page);
44 return; 46 return;
45 } 47 }
46 -} 48 +};
47 49
48 50
49 require('../common'); 51 require('../common');
50 52
51 ellipsis.init(); 53 ellipsis.init();
52 54
53 -//判断滑动方向 55 +// 判断滑动方向
54 $('body').on('touchstart', function(e) { 56 $('body').on('touchstart', function(e) {
55 var touch = e.originalEvent, 57 var touch = e.originalEvent,
56 startX = touch.changedTouches[0].pageX, 58 startX = touch.changedTouches[0].pageX,
@@ -62,12 +64,12 @@ $('body').on('touchstart', function(e) { @@ -62,12 +64,12 @@ $('body').on('touchstart', function(e) {
62 $('body').off('touchmove'); 64 $('body').off('touchmove');
63 } else if (touch.pageX - startX < -10) { 65 } else if (touch.pageX - startX < -10) {
64 $('body').off('touchmove'); 66 $('body').off('touchmove');
65 - }; 67 + }
66 if (touch.pageY - startY > 10) { 68 if (touch.pageY - startY > 10) {
67 direction = false; 69 direction = false;
68 } else if (touch.pageY - startY < -10) { 70 } else if (touch.pageY - startY < -10) {
69 direction = true; 71 direction = true;
70 - }; 72 + }
71 }); 73 });
72 }).on('touchend', function() { 74 }).on('touchend', function() {
73 $('body').off('touchmove'); 75 $('body').off('touchmove');