Authored by 王水玲

Merge branch 'release/4.9.2' of git.yoho.cn:fe/yohobuywap-node into release/4.9.2

... ... @@ -29,16 +29,19 @@ exports.index = (req, res, next) => {
exports.main = (req, res, next) => {
const isReplay = /^\/live\/replay\//.test(req.path);
const id = req.params.id;
const goDownload = req.query.no;
res.locals.liveRoom = id;
res.locals.module = 'activity';
res.locals.page = 'live-play';
res.locals.enableFoot = goDownload !== 1;
model.fetchInfo(id, isReplay)
.then(result => {
if (!result.data) {
return next();
}
res.render('live/play', result.data);
})
.catch(next);
... ...
... ... @@ -322,23 +322,23 @@ const getWxUserInfo = (params) => {
gzip: true,
timeout: 3000
})
.then((result) => {
if (_.isEmpty(result.openid)) {
return false;
}
url2 = url2 + '&access_token=' + result.access_token +
.then((result) => {
if (_.isEmpty(result.openid)) {
return false;
}
url2 = url2 + '&access_token=' + result.access_token +
'&openid=' + result.openid;
return api._requestFromAPI({
url: url2,
qs: {},
json: true,
gzip: true,
timeout: 3000
})
.then((result2) => {
return result2;
return api._requestFromAPI({
url: url2,
qs: {},
json: true,
gzip: true,
timeout: 3000
})
.then((result2) => {
return result2;
});
});
});
};
module.exports = {
... ...
... ... @@ -13,6 +13,9 @@
<p>加载中</p>
</div>
<div class="live-loading-cover" style="background-image: url('{{pic}}');"></div>
<a href="javascript: history.back();" class="live-btn-close">
<i class="iconfont">&#xe623</i>
</a>
</div>
<div id="live_touch_layer"></div>
... ... @@ -65,9 +68,6 @@
<a href="javascript:;" class="live-btn-share">
<i class="iconfont">&#xe600</i>
</a>
<a href="javascript: history.back();" class="live-btn-close">
<i class="iconfont">&#xe623</i>
</a>
</section>
</div>
{{/canPlay}}
... ... @@ -122,6 +122,7 @@
{{/notBegin}}
{{! footer}}
{{#enableFoot}}
<div class="float-layer" id="float-layer-app">
<div class="float-layer-left">
<span class="yoho-icon iconfont">&#xe60d;</span>
... ... @@ -135,6 +136,7 @@
立即下载
</a>
</div>
{{/enableFoot}}
</div>
<script>
var live_start_time = {{live_start_time}};//该直播开始时间
... ... @@ -142,7 +144,6 @@
var live_room = {{liveRoom}};//房间id,资讯id
var replay_total_likes = {{like_num}};//重播总计点赞数,取的是直播最终点赞数
var replay_user_nums = {{audience_num}};//重播观看人数,取的是直播时最终观看人数
var site_url = '';
var site_domain = 'http://api.live.yoho.cn/';
// share data
... ...
... ... @@ -57,7 +57,7 @@ const _processIndexData = (dataList) => {
if (list.ads) {
_.forEach(list.ads.data, (data) => {
formatData.ads.push({
src: data.src.replace('imageView', 'imageView2'),
src: data.src.replace('imageView/', 'imageView2/'),
url: data.url
});
});
... ... @@ -81,7 +81,7 @@ const _processIndexData = (dataList) => {
avatar.tags.push({
avatarUrl: `/guang/star/detail?tag=${tags.tagName}&openby:yohobuy{"action":"go.h5","params":{"id":"","share":"","shareparam":{},"islogin":"N","type":0,"updateflag":"N","url":"http://m.yohobuy.com/guang/star/detail","param":{"tag":"${tags.tagName}"}}}`, // eslint-disable-line
cover: tags.cover ? (tags.cover + '?imageView2/2/w/104/h/104/q/80') : tags.cover,
cover: tags.cover ? (tags.cover + '?imageView2/2/w/104/h/104') : tags.cover,
tagName: tags.tagName
});
});
... ... @@ -96,7 +96,7 @@ const _processIndexData = (dataList) => {
url: data.url,
title: data.title,
articeTxt: data.intro,
src: data.src + '/q/80',
src: data.src,
publishTime: helpers.dateFormat('MM月DD日 hh:mm', data.publishTime),
viewsNum: data.viewsNum
}, avatar));
... ... @@ -106,13 +106,13 @@ const _processIndexData = (dataList) => {
// 首页明星头像数据处理
if (list.tags) {
_.forEach(list.tags, (data) => {
_.forEach(list.tags, (data, index) => {
let url = `/guang/star/detail?tag=${data.tagName}&openby:yohobuy{"action":"go.h5","params":{"id":"","share":"","shareparam":{},"islogin":"N","type":0,"updateflag":"N","url":"http://m.yohobuy.com/guang/star/detail","param":{"tag":"${data.tagName}"}}}`; // eslint-disable-line
formatData.starAvatar.push({
// noLazy: index < 5,
//noLazy: index < 6,
url: url,
cover: data.cover ? (data.cover + '?imageView2/2/w/180/h/180/q/80') : data.cover
cover: data.cover ? (data.cover + '?imageView2/2/w/180/h/180') : data.cover
});
});
}
... ... @@ -213,7 +213,7 @@ const getSpecialData = () => {
return;
}
item.src += '/q/80';
// item.src += '/q/80';
if (key < 4) {
item.islazy = true;
... ...
... ... @@ -11,19 +11,22 @@
<ul class="clearfix swiper-wrapper">
{{# starAvatar}}
<li class="swiper-slide">
{{#if noLazy}}
<a href='{{url}}' class="star" style="background: url('{{image cover 180 180}}')">
</a>
{{else}}
<a href='{{url}}' class="star swiper-lazy" data-background="{{image cover 180 180}}">
<a href='{{url}}'>
{{#if noLazy}}
<img class="star" src="{{cover}}">
{{else}}
<img class="star swiper-lazy" data-src="{{cover}}">
{{/if}}
</a>
{{/if}}
</li>
{{/ starAvatar}}
</ul>
</div>
</div>
<ul class="star-info clearfix">
{{#each articles}}
<li data-id="{{id}}">
... ...
... ... @@ -40,6 +40,7 @@ passport.use(new LocalStrategy({
return done('登录参数错误', null);
}
let verifyEmail = helpers.verifyEmail(username);
// 国际号码验证取消
... ... @@ -58,7 +59,7 @@ passport.use(new LocalStrategy({
let shoppingKey = cookie.getShoppingKey(req);
AuthHelper.signinAes(area, username, password, shoppingKey).then((result) => {
AuthHelper.signin(area, username, password, shoppingKey).then((result) => {
if (result.code && result.code === 200 && result.data.uid) {
done(null, result.data);
} else {
... ...
... ... @@ -16,6 +16,12 @@ const LOGIN_SUCCSS = '登录成功';
const VERIFY_ERROR = '校验失败';
exports.beforeIn = (req, res, next) => {
res.set({
'Cache-Control': 'no-cache, no-store, must-revalidate',
Pragma: 'no-cache',
Expires: 0
});
if (!req.xhr && req.user.uid) {
return res.redirect(req.cookies.refer);
}
... ...
/**
* 登录注册密码加密
* 登录注册密码加密,uid加密
* @author: wsl<shuiling.wang@yoho.cn>
* @date: 2016/07/07
*/
'use strict';
const crypto = require('crypto');
const crypto = global.yoho.crypto;
/**
* 密码加密
**/
const aesPwd = (pwd) => {
let algorithm = 'aes-128-ecb';
let key = 'yoho9646yoho9646';
let clearEncoding = 'utf8';
let cipherEncoding = 'base64';
let iv = '';
let cipher = crypto.createCipheriv(algorithm, key, iv);
let cipherChunks = [];
cipherChunks.push(cipher.update(pwd, clearEncoding, cipherEncoding));
cipherChunks.push(cipher.final(cipherEncoding));
return crypto.encryption('yoho9646yoho9646', pwd);
};
return cipherChunks.join('');
/**
* uid加密
**/
const encryptionUid = (uid) => {
return crypto.encryption('yoho9646abcdefgh', uid + '');
};
module.exports = {
aesPwd
aesPwd,
encryptionUid
};
... ...
... ... @@ -64,9 +64,10 @@ class Auth {
return Auth.profile(uid).then((userInfo) => {
let token = sign.makeToken(uid);
let data = userInfo.data;
let encryptionUid = aes.encryptionUid(data.uid);
if (data) {
let uidCookie = `${data.profile_name}::${data.uid}::${data.vip_info.title}::${token}`;
let uidCookie = `${data.profile_name}::${encryptionUid}::${data.vip_info.title}::${token}`;
res.cookie('_UID', uidCookie, {
domain: 'yohobuy.com',
... ...
... ... @@ -308,15 +308,15 @@ const getSizeInfo = (sizeInfo) => {
dest.productDetail.enTitle = 'DETAILS';
dest.productDetail.desc = productIntro.replace(/\r\n\t/g, '').
replace(/<\/p>/g, '').
replace(/<img src=/g, '<img class="lazy" src="data:image/gif;' +
replace(/<\/p>/g, '').
replace(/<img src=/g, '<img class="lazy" src="data:image/gif;' +
'base64,R0lGODlhAQABAJEAAAAAAP///93d3f///yH5BAEAAAMALAAAAAABAAEAAAICVAEAOw=="' +
' data-original=').
replace(/<img border="0" src=/g, '<img border="0" class="lazy" ' +
replace(/<img border="0" src=/g, '<img border="0" class="lazy" ' +
'src="data:image/gif;base64,' +
'R0lGODlhAQABAJEAAAAAAP///93d3f///yH5BAEAAAMALAAAAAABAAEAAAICVAEAOw=="' +
' data-original=').
replace(/.jpg/g, '.jpg?imageMogr2/thumbnail/750x/quality/90');
replace(/.jpg/g, '.jpg?imageMogr2/thumbnail/750x/quality/90');
}
// 清空变量,释放内存
... ...
... ... @@ -14,12 +14,8 @@ module.exports = {
port: 6001,
siteUrl: '//m.yohobuy.com',
domains: {
// api: 'http://api-test3.yohops.com:9999/',
// service: 'http://service-test3.yohops.com:9999/',
// liveApi: 'http://testapi.live.yohops.com:9999/'
api: 'http://api.yoho.cn/',
service: 'http://service.yoho.cn/',
api: 'http://api-test3.yohops.com:9999/',
service: 'http://service-test3.yohops.com:9999/',
liveApi: 'http://testapi.live.yohops.com:9999/'
},
subDomains: {
... ... @@ -95,7 +91,7 @@ if (isProduction) {
useOneapm: true,
useCache: true,
interfaceShunt: {
open: true,
open: false,
url: 'http://123.206.2.55/strategy'
}
});
... ...
... ... @@ -8,28 +8,6 @@ function async_load(){
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-W958MG');
(function() {
var hm = document.createElement("script");
hm.src = "//static.yohobuy.com/js/analytics/analysis.js";
hm.async = 1;
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
}
window.addEventListener('load', async_load, false);
</script>
<script>
window._py = window._py||[];
window._py.push(['a', 'MC..o8vMMWxEXDCiqYckD81lUX']);
window._py.push(['domain','stats.ipinyou.com']);
window._py.push(['e','']);
if(typeof _goodsData!='undefined'){
window._py.push(['pi',_goodsData]);
}
-function(d){
var f = 'https:' == d.location.protocol;var c = d.createElement('script');c.type='text/javascript';c.async=1;
c.src=(f ? 'https' : 'http') + '://'+(f?'fm.ipinyou.com':'fm.p0y.cn')+'/j/t/adv.js';
var h = d.getElementsByTagName("script")[0];h.parentNode.insertBefore(c, h);
}(document);
</script>
\ No newline at end of file
... ...
{
"name": "m-yohobuy-node",
"version": "4.9.12",
"version": "4.9.21",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ... @@ -56,7 +56,7 @@
"uuid": "^2.0.2",
"winston": "^2.2.0",
"winston-daily-rotate-file": "^1.2.0",
"yoho-node-lib": "0.0.46"
"yoho-node-lib": "0.0.47"
},
"devDependencies": {
"autoprefixer": "^6.3.7",
... ...
... ... @@ -17,6 +17,7 @@ var prefixes = 'webkit moz ms o'.split(' '); //各浏览器前缀
var requestAnimationFrame = window.requestAnimationFrame;
var cancelAnimationFrame = window.cancelAnimationFrame;
var site_url = STATIC_RESOURCE_PATH;
var $btn_play;
var video_width = 375;
var video_height = 667;
... ... @@ -673,7 +674,7 @@ function insert_like(obj) {
}
}
now_like_nums = num;
if (now_like_nums > 100000) {
if (now_like_nums > 10000) {
$('#like_num').text((now_like_nums / 10000).toFixed(1) + '万');
} else {
$('#like_num').text(now_like_nums);
... ...
... ... @@ -28,10 +28,11 @@ var $window = $(window),
var mySwiper;
*/
var avatarKey, bannerLen, res, avatarSwiper, avatarSwiperClone, getIndexHtml, bannerSwiper,
$avatarClone, $avatarWrap, starIScroll;
var avatarKey, bannerLen, res, avatarSwiper, getIndexHtml, bannerSwiper,
$avatarWrap, starIScroll;
var swiperNum = $('.avatar-wrap .swiper-slide').width() / 2;
var swiperNum = $('.avatar-wrap .swiper-slide').width() / 2,
topBanner = $('.banner-top');
// var $gif = $('img[data-original*="gif"]');
... ... @@ -53,6 +54,7 @@ $('#yoho-header, .head-tab').on('touchmove', function() {
return false;
});
// inView(document.querySelectorAll('img[data-original*="gif"]'))
// .on('enter', function() {
// console.log(1);
... ... @@ -99,25 +101,26 @@ function bindAvatar(dom) {
avatarKey = dom.index();
if (!dom.hasClass('swiper-slide-active')) {
if (avatarKey >= (2 * bannerLen + 1)) {
avatarSwiperClone && avatarSwiperClone.slideTo(bannerLen + 1, 0);
avatarSwiper.slideTo(bannerLen + 1, 0);
} else if (avatarKey <= (bannerLen - 1)) {
avatarSwiperClone && avatarSwiperClone.slideTo(2 * bannerLen - 1, 0);
avatarSwiper.slideTo(2 * bannerLen - (bannerLen - avatarKey), 0);
} else {
avatarSwiperClone && avatarSwiperClone.slideTo(avatarKey, 200);
avatarSwiper.slideTo(avatarKey, 200);
}
// if (avatarKey >= (2 * bannerLen + 1)) {
// avatarSwiperClone && avatarSwiperClone.slideTo(bannerLen + 1, 0);
// avatarSwiper.slideTo(bannerLen + 1, 0);
// } else if (avatarKey <= (bannerLen - 1)) {
// avatarSwiperClone && avatarSwiperClone.slideTo(2 * bannerLen - 1, 0);
// avatarSwiper.slideTo(2 * bannerLen - (bannerLen - avatarKey), 0);
// } else {
// avatarSwiperClone && avatarSwiperClone.slideTo(avatarKey, 200);
// avatarSwiper.slideTo(avatarKey, 200);
// }
return false;
}
}
function setIndexAction() {
// $('.avatar').each(function(key, item) {
// $(item).addClass('avatar-' + key);
// });
// $('.avatar').each(function(key, item) {
// $(item).addClass('avatar-' + key);
// });
// 明星头像 swiper 初始化
if (bannerLen > 1) {
... ... @@ -185,13 +188,13 @@ function initAction() {
$avatarWrap = $('.avatar-wrap');
bannerLen = $('.avatar-wrap').find('.swiper-slide').length;
if ($avatarClone) {
$avatarClone.remove();
}
// if ($avatarClone) {
// $avatarClone.remove();
// }
$loadingTip.before($('.avatar-swiper').clone().addClass('avatar-clone').hide());
$avatarClone = $('.avatar-clone');
// $avatarClone = $('.avatar-clone');
$('img.lazy').lazyload({
effect: 'fadeIn'
... ... @@ -212,10 +215,10 @@ getIndexHtml = function() {
})
.done(function(data) {
if (data) {
if (avatarSwiperClone) {
avatarSwiperClone.destroy(true, true);
avatarSwiperClone = null;
}
// if (avatarSwiperClone) {
// avatarSwiperClone.destroy(true, true);
// avatarSwiperClone = null;
// }
$mainContent.html(data);
... ... @@ -228,6 +231,13 @@ getIndexHtml = function() {
});
};
// $(window).ready(function() {
// topBannerH = $('.banner-top').height();
// console.log('init'+topBannerH);
// });
// 下拉刷新,上拉加载
starIScroll = new PullRefresh('.star-main', {
pullDown: function() {
... ... @@ -239,15 +249,16 @@ starIScroll = new PullRefresh('.star-main', {
});
starIScroll.iScroll.on('scrollStart', function() {
// 下拉
// if (this.directionY === -1) {
// $loadingTip.slideDown();
// }
// $gif.css('display', 'none');
bannerSwiper && bannerSwiper.startAutoplay();
// 下拉
// if (this.directionY === -1) {
// $loadingTip.slideDown();
// }
// $gif.css('display', 'none');
bannerSwiper && bannerSwiper.stopAutoplay();
});
starIScroll.iScroll.on('scroll', function() {
starIScroll.iScroll.on('scroll', function() {
$window.trigger('scroll');
// var avatarOffsetT;
//
// if (this.directionY !== -1) {
... ... @@ -289,14 +300,18 @@ starIScroll.iScroll.on('scroll', function() {
// } else {
// $avatarClone.hide();
// }
});
});
starIScroll.iScroll.on('scrollEnd', function() {
// $loadingTip.slideUp();
// $gif.css('display', 'block');
bannerSwiper && bannerSwiper.stopAutoplay();
// $loadingTip.slideUp();
// $gif.css('display', 'block');
if (-this.y <= topBanner.height()) {
bannerSwiper && bannerSwiper.startAutoplay();
}
});
window.setCookie('guangStarUid', window.queryString.uid);
// $('img').on('load', function() {
... ... @@ -359,3 +374,6 @@ function articleImgAction(dom, key) {
}
}
*/
... ...
... ... @@ -131,8 +131,8 @@ var page = {
})
.done(function(res) {
if (res.code === 200) {
// $nextBtn.off();
location.href = res.redirect;
$nextBtn.off();
return;
}
... ...
... ... @@ -76,7 +76,7 @@ var page = {
})
.done(function(data) {
if (data.code === 200) {
$nextBtn.off();
// $nextBtn.off();
location.href = data.redirect;
} else {
tip.show(data.message);
... ...
... ... @@ -56,7 +56,7 @@ var page = {
})
.done(function(res) {
if (res.code === 200) {
$nextBtn.off();
// $nextBtn.off();
location.href = res.redirect;
return;
}
... ...
... ... @@ -203,8 +203,6 @@
padding-left: 1.75rem;
display: inline-block;
color: #ffffff;
border-radius: 0.3rem;
background-color: rgba(0, 0, 0, 0.32);
font-size: 0.6rem;
}
... ... @@ -224,7 +222,9 @@
font-size: 22px;
font-weight: lighter;
color: rgba(255,255,255,0.8);
background-color: rgba(0, 0, 0, 0.32);
overflow: hidden;
border-radius: 0.3rem;
}
.live-item2_2 {
... ... @@ -234,6 +234,7 @@
line-height: 1.2;
font-weight: normal;
color: #FFFFFF;
border-radius: 0.3rem;
}
.live-item2 img {
... ... @@ -242,7 +243,7 @@
top: 0;
display: inline-block;
width: 2.5rem;
height: 100%;
border-radius: 0.3rem;
}
.live-item2-head {
... ...
... ... @@ -2,3 +2,4 @@
@import "star";
@import "special";
@import "collocation";
... ...