Authored by 郭成尧

Merge branch 'master' into feature/address4

... ... @@ -76,7 +76,7 @@ exports.receive = (req, res, next) => {
}
if (!uid) {
return res.json({
return res.jsonp({
code: 400,
message: '抱歉,您暂未登录!'
});
... ... @@ -85,6 +85,6 @@ exports.receive = (req, res, next) => {
model.receiveCoupon({
couponID: req.query.couponID
}, uid).then(result => {
res.json(result);
res.jsonp(result);
}).catch(next);
};
... ...
... ... @@ -50,7 +50,7 @@ const index = (req, res, next) => {
return res.send(feed.render('atom-1.0'));
}
return res.send(feed.render('rss-2.0'));
});
}).catch(next);
};
const rss = (req, res, next, gmt) => {
let gender = req.query.gender || '1,2,3',
... ... @@ -72,7 +72,7 @@ const rss = (req, res, next, gmt) => {
layout: false,
items: result
});
});
}).catch(next);
};
module.exports = {
... ...
... ... @@ -295,6 +295,8 @@ const wechat = {
const sina = {
login: (req, res, next) => {
// 设置为原链接标识originalUrl
req.session.originalUrl = 'true';
req.session.authState = uuid.v4();
return passport.authenticate('sina', {
state: req.session.authState
... ... @@ -321,6 +323,8 @@ const sina = {
const qq = {
login: (req, res, next) => {
// 设置为原链接标识originalUrl
req.session.originalUrl = 'true';
req.session.authState = uuid.v4();
return passport.authenticate('qq', {
state: req.session.authState
... ... @@ -348,6 +352,8 @@ const qq = {
const alipay = {
login: (req, res, next) => {
// 设置为原链接标识originalUrl
req.session.originalUrl = 'true';
return passport.authenticate('alipay')(req, res, next);
},
callback: (req, res, next) => {
... ...
... ... @@ -388,7 +388,7 @@ exports.password = (req, res, next) => {
let mobile = _.get(req.session, 'smsLogin.mobile');
let area = _.get(req.session, 'smsLogin.area');
let password = (req.body.password || '').trim();
let registerCode = +req.body.registerCode || 0;
let registerCode = req.body.registerCode || '';
if (!password) {
data.message = PASSWORD_REQUIRED;
... ...
... ... @@ -72,7 +72,15 @@ const _newGoods = (req, res, next) => {
let banner = _.get(result, 'ads[0]', {});
let handPick = _.get(result, 'ads[1]', {});
// console.log(handPick)
if (handPick.data) {
if (handPick.data.length > 2) {
handPick.three = true;
} else if (handPick.data.length === 2) {
handPick.two = true;
} else if (handPick.data.length === 1) {
handPick.one = true;
}
}
res.render('new/index', {
module: 'product',
... ...
... ... @@ -38,8 +38,14 @@
{{/if}}
{{!--精选抢先看--}}
{{#if handPick.data}}
{{> 'new/handpick' swiper=handPick.data}}
{{#if handPick.three}}
{{> 'new/handpick-three' swiper=handPick.data}}
{{/if}}
{{#if handPick.two}}
{{> 'new/handpick-two' swiper=handPick.data}}
{{/if}}
{{#if handPick.one}}
{{> 'new/handpick-one' swiper=handPick.data}}
{{/if}}
{{!--最新上架--}}
... ...
... ... @@ -8,17 +8,17 @@
</header>
<main class="panel-body">
<!-- Slider main container -->
<div class="handpick-swiper swiper-container">
<div class="handpick-swiper-one swiper-container">
<!-- Additional required wrapper -->
<div class="swiper-wrapper">
<!-- Slides -->
{{#each swiper}}
{{# swiper}}
<div class="swiper-slide">
<a href="{{url}}">
<img class="swiper-lazy" data-src="{{image2 src w=332 h=194 q=60}}" alt="">
<img src="{{image2 src w=690 h=220 q=60}}" alt="">
</a>
</div>
{{/each}}
{{/swiper}}
</div>
</div>
</main>
... ...
{{!-- 新品到着: 精选 --}}
<div id="handpick" class="panel handpick">
<header class="panel-header">
<h4>精选抢先看</h4>
{{!--<a href="#javascript" class="panel-header-r more">
<i class="iconfont">&#xe606;</i>
</a>--}}
</header>
<main class="panel-body">
<!-- Slider main container -->
<div class="handpick-swiper-three swiper-container">
<!-- Additional required wrapper -->
<div class="swiper-wrapper">
<!-- Slides -->
{{# swiper}}
<div class="swiper-slide">
<a href="{{url}}">
<img class="swiper-lazy" data-src="{{image2 src w=330 h=220 q=60}}" alt="">
</a>
</div>
{{/swiper}}
</div>
</div>
</main>
</div>
\ No newline at end of file
... ...
{{!-- 新品到着: 精选 --}}
<div id="handpick" class="panel handpick">
<header class="panel-header">
<h4>精选抢先看</h4>
{{!--<a href="#javascript" class="panel-header-r more">
<i class="iconfont">&#xe606;</i>
</a>--}}
</header>
<main class="panel-body">
<!-- Slider main container -->
<div class="handpick-swiper-two swiper-container">
<!-- Additional required wrapper -->
<div class="swiper-wrapper">
<!-- Slides -->
{{# swiper}}
<div class="swiper-slide">
<a href="{{url}}">
<img src="{{image2 src w=330 h=220 q=60}}" alt="">
</a>
</div>
{{/swiper}}
</div>
</div>
</main>
</div>
\ No newline at end of file
... ...
... ... @@ -17,21 +17,21 @@ module.exports = {
assetUrl: '//127.0.0.1:5001',
testCode: 'yoho4946abcdef#$%&!@',
domains: {
// api: 'http://api-test3.yohops.com:9999/',
// service: 'http://service-test3.yohops.com:9999/',
// liveApi: 'http://testapi.live.yohops.com:9999/',
// singleApi: 'http://api-test3.yohops.com:9999/',
// imSocket: 'ws://im.yohobuy.com:10240',
// imCs: 'http://im.yohobuy.com/api',
// imServer: 'http://im.yohobuy.com/server'
api: 'http://api-test3.yohops.com:9999/',
service: 'http://service-test3.yohops.com:9999/',
liveApi: 'http://testapi.live.yohops.com:9999/',
singleApi: 'http://api-test3.yohops.com:9999/',
imSocket: 'ws://im.yohobuy.com:10240',
imCs: 'http://im.yohobuy.com/api',
imServer: 'http://im.yohobuy.com/server'
api: 'http://api.yoho.cn/',
service: 'http://service.yoho.cn/',
liveApi: 'http://api.live.yoho.cn/',
singleApi: 'http://single.yoho.cn/',
imSocket: 'wss://imsocket.yohobuy.com:443',
imCs: 'https://imhttp.yohobuy.com/api',
imServer: 'https://imhttp.yohobuy.com/server'
// api: 'http://api.yoho.cn/',
// service: 'http://service.yoho.cn/',
// liveApi: 'http://api.live.yoho.cn/',
// singleApi: 'http://single.yoho.cn/',
// imSocket: 'wss://imsocket.yohobuy.com:443',
// imCs: 'https://imhttp.yohobuy.com/api',
// imServer: 'https://imhttp.yohobuy.com/server'
},
subDomains: {
host: '.m.yohobuy.com',
... ... @@ -76,7 +76,7 @@ module.exports = {
port: '4444' // influxdb port
},
console: {
level: 'debug',
level: 'info',
colorize: 'all',
prettyPrint: true
}
... ...
... ... @@ -12,7 +12,7 @@
a.async = 1;
a.src = j;
m.parentNode.insertBefore(a, m);
}(window, document, 'script', (document.location.protocol === 'https:' ? 'https:' : 'http:') + '//cdn.yoho.cn/yas-jssdk/2.2.2/yas.js', '_yas'));
}(window, document, 'script', (document.location.protocol === 'https:' ? 'https:' : 'http:') + '//cdn.yoho.cn/yas-jssdk/2.2.4/yas.js', '_yas'));
var _hmt = _hmt || [];
... ... @@ -59,23 +59,20 @@
window._yas(1 * new Date(), '2.2.2', 'yohobuy_m', uid, '', '');
}
// 非登录状态,加载百度统计
if (!uid) {
setTimeout(function() {
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?65dd99e0435a55177ffda862198ce841";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?e5b83a487a4458aa5abca43f5779b764";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
}, 1000);
}
setTimeout(function() {
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?65dd99e0435a55177ffda862198ce841";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?e5b83a487a4458aa5abca43f5779b764";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
}, 1000);
}());
</script>
... ...
{
"name": "m-yohobuy-node",
"version": "5.4.3",
"version": "5.4.7",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...
... ... @@ -147,6 +147,13 @@ page = {
if (res.newer) {
res.redirect = res.redirect + '&registerCode=' + res.registerCode;
// 暂时跳注册 TODO
// tip.show('请先注册!');
// setTimeout(function(){
// location.href = '//m.yohobuy.com/reg.html';
// }, 2000);
// return;
}
location.href = res.redirect;
... ...
... ... @@ -20,7 +20,7 @@ setTimeout(function() {
}, 3000);
page = {
smsCode: window.queryString.smsCode,
registerCode: window.queryString.registerCode,
init: function() {
this.domInit();
this.bindEvent();
... ... @@ -40,7 +40,7 @@ page = {
});
$nextBtn.on('click', function() {
if (!self.smsCode) {
if (!self.registerCode) {
return tip.show('非法请求');
}
self.setPasswordAndLogin();
... ... @@ -82,7 +82,7 @@ page = {
$nextBtn.prop('disabled', true);
$.post('/passport/sms_login/password.json', {
password: password,
smsCode: self.smsCode
registerCode: self.registerCode
})
.done(function(res) {
if (res.code === 200) {
... ...
... ... @@ -14,7 +14,7 @@ let $callback = $.Callbacks(); // eslint-disable-line
// 是否继续加载数据
let isScroll = true;
new Swiper('.handpick-swiper', {
new Swiper('.handpick-swiper-three', {
// Optional parameters
lazyLoading: true,
lazyLoadingInPrevNext: true,
... ...
/* 精选抢先看 */
.handpick {
.panel-body {
padding-top: 30px;
padding-bottom: 30px;
}
.swiper-wrapper {
align-items: center;
}
.swiper-container {
height: 220px;
height: 185px;
}
.swiper-slide {
width: 300px;
height: 173px;
height: 185px;
background-color: #444;
border-radius: 6px;
overflow: hidden;
}
}
.handpick-swiper-two {
.swiper-slide {
margin-left: 30px;
width: 277px;
}
}
.handpick-swiper-one {
.swiper-slide {
width: 580px;
margin-left: 30px;
}
}
\ No newline at end of file
... ...
... ... @@ -18,7 +18,7 @@ const removeHtml = (str) => {
* [html转为转义]
*/
const htmlToEscape = (html) => {
return html.replace(/[<>&"]/g, (e) => {
return (html || '').replace(/[<>&"]/g, (e) => {
return _htmlMap[e];
});
};
... ... @@ -27,7 +27,7 @@ const htmlToEscape = (html) => {
* [转义符转为html]
*/
const escapeToHtml = (str) => {
return str.replace(/&(lt|gt|nbsp|amp|quot);/g, (match, e) => {
return (str || '').replace(/&(lt|gt|nbsp|amp|quot);/g, (match, e) => {
return _EscapeMap[e];
});
};
... ...