Authored by lijing

VIP

//优惠券 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: req.user.uid,
status: req.body.status || 0,
page: req.body.page || 1,
limit: 10,
... ...
// 帮助 by acgpiano
'use strict';
const headerModel = require('../../../doraemon/models/header'), // 头部model
model = require('../models/help');
exports.index = (req, res, next) => {
model.getHelpList().then(result => {
res.render('help', {
module: 'home',
page: 'help',
pageHeader: headerModel.setNav({
navTitle: '帮助中心'
}),
title: '帮助中心',
pageFooter: true,
iHelp: result,
});
}).catch(next);
};
exports.helpDetail = (req, res, next) => {
model.getHelpDetail(req.query.code).then(result => {
res.render('help-detail', {
module: 'home',
page: 'help-detail',
pageHeader: headerModel.setNav({
navTitle: req.query.name
}),
title: req.query.name,
pageFooter: true,
detail: result,
});
}).catch(next);
};
... ...
... ... @@ -60,7 +60,6 @@ const currencyDetail = (req, res, next) => {
}),
title: '有货币明细',
pageFooter: true,
money: result.money
});
}).catch(next);
... ...
//优惠券 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
};
... ...
// 帮助 by acgpiano
'use strict';
const api = global.yoho.API;
// 获取帮助列表
exports.getHelpList = () => {
return api.get('', {
method: 'app.help.li'
}).then(result => {
if (result && result.code === 200 && result.data) {
let final = [];
for (let name of result.data) {
final.push({
name: name.caption,
code: name.code,
});
}
return final;
}
});
};
// 获取帮助详情
exports.getHelpDetail = (code) => {
return api.get('', {
method: 'app.help.detail',
code: code,
}).then(result => {
return result.replace(/^<!DOCTYPE.*<body>/g, '').
replace(/<\/body>.*<\/html>/g, '');
});
};
... ...
... ... @@ -61,7 +61,7 @@ const currencyDetail = (uid, page, limit) => {
let total = parseInt(result.data.page_total, 10) + 1;
if (page && page < total) {
return myCurrency(uid).then(list => {
return yohoCoin(uid).then(list => {
if (list.yohocoinNum && list.yohocoinNum === 0) {
result.data = _.assign(result.data, {
... ... @@ -86,24 +86,25 @@ const currencyDetail = (uid, page, limit) => {
});
};
const mayLike = (uid, page, limit, udid, gender, recPos, channel) => {
return api.get('', {
method: 'app.search.newLast7day',
uid: uid,
page: page,
limit: limit,
udid: udid,
rec_pos: recPos,
yh_channel: channel
}).then((result) => {
console.log(result);
});
};
// const mayLike = (uid, page, limit, udid, gender, recPos, channel) => {
// return api.get('', {
// method: 'app.search.newLast7day',
// uid: uid,
// page: page,
// limit: limit,
// udid: udid,
// rec_pos: recPos,
// yh_channel: channel
// }).then((result) => {
// console.log(result);
// });
// };
module.exports = {
myCurrency,
currencyDetail,
bannerData,
yohoCoin,
mayLike
yohoCoin
// mayLike
};
... ...
... ... @@ -18,6 +18,7 @@ const orderController = require(`${cRoot}/order`);
const orderDetailController = require(`${cRoot}/orderDetail`);
const currencyController = require(`${cRoot}/myCurrency`);
const coupons = require(`${cRoot}/coupons`);
const help = require(`${cRoot}/help`);
// const myDetail = require(`${cRoot}/myDetail);
... ... @@ -70,4 +71,8 @@ router.post('/favoriteDel', favorite.favoriteDelete);
router.get('/coupons', coupons.index);
router.post('/couponData', coupons.couponData);
// 帮助中心
router.get('/help', help.index);
router.get('/helpDetail', help.helpDetail);
module.exports = router;
... ...
{{{detail}}}
\ No newline at end of file
... ...
<div class="iHelp">
<ul>
{{#iHelp}}
<li><a href="//m.yohobuy.com/home/helpDetail?code={{code}}&name={{name}}"><span>{{name}}</span><i class="iconfont num">&#xe604;</i></a></li>
{{/iHelp}}
</ul>
</div>
\ No newline at end of file
... ...
'use strict';
const mRoot = '../models';
const headerModel = require('../../../doraemon/models/header'); // 头部model
const mayLikeModel = require('../models/recom');
const mayLike = (req, res, next) => {
let uid = req.user.uid || 8039759;
let page = req.body.page || 1;
let limit = 50;
let gender = req.query.gender || '1,3';
let udid = req.sessionID || 'yoho';
let recPos = 100009;
let channel = req.query.channel || 1;
mayLikeModel.mayLike(uid, page, limit, gender, udid, recPos, channel).then((result) => {
// res.render('../common/goods', {
// layout: false
// });
}).catch(next);
};
module.exports = {
mayLike
};
... ...
'use strict';
const serviceAPI = global.yoho.ServiceAPI;
const api = global.yoho.API;
const _ = require('lodash');
const camelCase = global.yoho.camelCase;
const logger = global.yoho.logger;
const mayLike = (uid, page, limit, gender, udid, recPos, channel) => {
return api.get('', {
method: 'app.search.newLast7day',
uid: uid,
page: page,
limit: limit,
udid: udid,
rec_pos: recPos,
yh_channel: channel
}).then((result) => {
// console.log(result);
});
};
module.exports = {
mayLike
};
... ...
... ... @@ -24,6 +24,9 @@ const outlet = require(`${cRoot}/outlet`);
// recommend-for-you controller
const recommendForYou = require(`${cRoot}/recommend-for-you`);
// recom
const recom = require(`${cRoot}/recom`);
// routers
// /pro_136349_455445/HEARTSOFARMianMaShuJiaoXiuXianKuPS1684.html
... ... @@ -34,6 +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('/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);
... ...
require('../common');
... ...
require('../common');
... ...
... ... @@ -3,3 +3,4 @@
@import "address/index";
@import "favorite";
@import "coupons";
@import "ihelp";
... ...
... ... @@ -10,7 +10,6 @@
@import "address-modify";
@import "online-service";
@import "my-guang";
@import "ihelp";
@import "browse-record";
@import "logistic";
@import "pay";
... ...