Authored by zhangxiaoru

recom

//优惠券 by acgpiano
// 优惠券 by acgpiano
'use strict';
const headerModel = require('../../../doraemon/models/header'), // 头部model
model = require('../models/coupons');
model = require('../models/coupons');
const index = (req, res) => {
res.render('coupons', {
... ... @@ -15,11 +15,11 @@ const index = (req, res) => {
});
};
//处理Ajax请求,status为使用状态
// 处理Ajax请求,status为使用状态
const couponData = (req, res, next) => {
model.couponData({
method: 'app.coupons.li',
uid: 20000382,
uid: 20000382,
status: req.body.status || 0,
page: req.body.page || 1,
limit: 10,
... ...
//优惠券 by acgpiano
"use strict";
// 优惠券 by acgpiano
'use strict';
const api = global.yoho.API;
... ... @@ -23,11 +23,11 @@ const couponData = (params) => {
<i></i>
<p>您还没有优惠券!</p>
<a href="/product/new">随便逛逛</a>
</div>`
</div>`;
}
});
}
};
module.exports = {
couponData
}
\ No newline at end of file
};
... ...
... ... @@ -105,5 +105,6 @@ module.exports = {
currencyDetail,
bannerData,
yohoCoin
// mayLike
};
... ...
... ... @@ -24,4 +24,4 @@ const mayLike = (req, res, next) => {
module.exports = {
mayLike
};
\ No newline at end of file
};
... ...
... ... @@ -7,7 +7,7 @@ const camelCase = global.yoho.camelCase;
const logger = global.yoho.logger;
const mayLike = (uid, page, limit, gender, udid, recPos, channel) => {
return api.get('', {
return api.get('', {
method: 'app.search.newLast7day',
uid: uid,
page: page,
... ... @@ -16,10 +16,10 @@ const mayLike = (uid, page, limit, gender, udid, recPos, channel) => {
rec_pos: recPos,
yh_channel: channel
}).then((result) => {
//console.log(result);
// console.log(result);
});
}
};
module.exports = {
mayLike
};
\ No newline at end of file
};
... ...
... ... @@ -24,7 +24,7 @@ const outlet = require(`${cRoot}/outlet`);
// recommend-for-you controller
const recommendForYou = require(`${cRoot}/recommend-for-you`);
//recom
// recom
const recom = require(`${cRoot}/recom`);
// routers
... ... @@ -37,7 +37,7 @@ router.get('/detail/consults', detail.consults); // 商品咨询页
router.get('/detail/consultform', auth, detail.consultform); // 商品咨询表单页
router.get('/detail/comments', detail.comments);
router.post('/detail/consultsubmit', auth, detail.consultsubmit); // 商品咨询提交接口
router.get('/recom/maylike', recom.mayLike);//你可能喜欢
router.get('/recom/maylike', recom.mayLike);// 你可能喜欢
router.get('/sale', sale.index);
router.get('/sale/discount', sale.discount);
... ...
//不要使用es6
"use strict";
// 不要使用es6
'use strict';
var $ = require('yoho-jquery'),
Hammer = require('yoho-hammer'),
... ... @@ -9,9 +9,11 @@ var $ = require('yoho-jquery'),
var employ,
statu = 0,
page = 1,
//防止重复请求
// 防止重复请求
AjaxFlag = 0,
//上滑不请求
// 上滑不请求
direction = true;
var couponAJAX = function(statu, page) {
... ... @@ -35,7 +37,7 @@ var couponAJAX = function(statu, page) {
AjaxFlag = 0;
}
});
}
};
var scrollHandler = function() {
if (direction && ($(window).scrollTop() + $(window).height() > $('body').height() - 100)) {
... ... @@ -43,14 +45,14 @@ var scrollHandler = function() {
couponAJAX(statu, page);
return;
}
}
};
require('../common');
ellipsis.init();
//判断滑动方向
// 判断滑动方向
$('body').on('touchstart', function(e) {
var touch = e.originalEvent,
startX = touch.changedTouches[0].pageX,
... ... @@ -62,12 +64,12 @@ $('body').on('touchstart', function(e) {
$('body').off('touchmove');
} else if (touch.pageX - startX < -10) {
$('body').off('touchmove');
};
}
if (touch.pageY - startY > 10) {
direction = false;
} else if (touch.pageY - startY < -10) {
direction = true;
};
}
});
}).on('touchend', function() {
$('body').off('touchmove');
... ... @@ -92,4 +94,4 @@ $(window).scroll(function() {
window.requestAnimationFrame(scrollHandler);
});
couponAJAX(statu, page);
\ No newline at end of file
couponAJAX(statu, page);
... ...