Authored by 姜枫

Merge branch 'release/app-download'

'use strict';
module.exports = {
index: (req, res) => {
res.render('app-downloads', {
localCss: true
});
}
};
... ...
... ... @@ -9,7 +9,6 @@ const channels = {
exports.productLst = function(req, res, next) {
let keys = ['sort', 'misort', 'msort', 'gender', 'brand'],
enumParam = {},
params = {
uid: req.query.uid,
udid: req.query.udid,
... ... @@ -29,21 +28,17 @@ exports.productLst = function(req, res, next) {
if (params.specified_sort) {
if (params.brand) {
enumParam.brands = params.brand.split(',');
params.limit = enumParam.brands.length;
params.limit = params.brand.split(',').length;
} else if (params.sort) {
enumParam.sorts = params.sort.split(',');
params.limit = enumParam.sorts.length;
params.limit = params.sort.split(',').length;
} else if (params.misort) {
enumParam.misorts = params.misort.split(',');
params.limit = enumParam.misorts.length;
params.limit = params.misort.split(',').length;
} else if (params.msort) {
enumParam.msorts = params.msort.split(',');
params.limit = enumParam.msorts.length;
params.limit = params.msort.split(',').length;
}
}
model.productLst(params, enumParam).then((result) => {
model.productLst(params).then((result) => {
res.jsonp(result);
}).catch(next);
};
\ No newline at end of file
... ...
... ... @@ -41,6 +41,7 @@ exports.wechatShare = (req, res, next) => {
exports.feature = (req, res) => {
let mktCode = req.query.mkt_code || req.query.union_type || false;
let expires = req.query.expires;
let cover = req.query.cover;
if (mktCode) {
res.cookie('unionTypeYas', mktCode, { // 下载浮层
... ... @@ -55,7 +56,7 @@ exports.feature = (req, res) => {
expires && (options.expires = new Date(Date.now() + Number(expires)));
if (req.yoho.isWechat) {
if (req.yoho.isWechat || cover) {
// 微信中,不管是否已经种入cookie,直接覆盖
res.cookie('mkt_code', mktCode, options);
} else if (!req.cookies.mkt_code) {
... ...
... ... @@ -3,9 +3,6 @@
const api = global.yoho.API;
let _getProduct = function(o) {
if (!o) {
return {};
}
return {
small_sort_id: o.small_sort_id,
middle_sort_id: o.middle_sort_id,
... ... @@ -27,34 +24,16 @@ let _getProduct = function(o) {
};
module.exports = {
productLst: function(params, enumParam) {
productLst: function(params) {
return api.get('', Object.assign({
method: 'app.search.newPromotion'
}, params)).then(res => {
var data = new Array(Number(params.limit)),
var data = [],
lst = (res.data && res.data.product_list) || [];
for (var i = 0; i < data.length; i++) {
var o = lst[i] || {};
if (params.specified_sort) {
// 枚举类型
if (enumParam.brands && Number(enumParam.brands[i]) === Number(o.brand_id)) {
data[i] = _getProduct(o);
} else if (enumParam.sorts && Number(enumParam.sorts[i]) === Number(o.small_sort_id)) {
data[i] = _getProduct(o);
} else if (enumParam.misorts && Number(enumParam.misorts[i]) === Number(o.middle_sort_id)) {
data[i] = _getProduct(o);
} else if (enumParam.msorts && Number(enumParam.msorts[i]) === Number(o.max_sort_id)) {
data[i] = _getProduct(o);
} else {
lst.splice(i, 0, {});
data[i] = {};
}
} else {
data[i] = _getProduct(o);
}
}
lst.forEach(function(o) {
o && data.push(_getProduct(o));
});
return data;
});
}
... ...
... ... @@ -29,7 +29,7 @@ const share = require(`${cRoot}/share`);
const aliCloud = require(`${cRoot}/ali-cloud`);
const studentMarket = require(`${cRoot}/student-market`);
const individuation = require(`${cRoot}/individuation`);
const appDownloads = require(`${cRoot}/app-downloads`);
const redbag = require(`${cRoot}/redbag`);
// routers
... ... @@ -136,4 +136,6 @@ router.get('/redbag/2017', redbag.index);
// 获取活动页面个性化推荐商品数据
router.get('/individuation', individuation.productLst);
router.get('/app-downloads', appDownloads.index);
module.exports = router;
... ...
<div class="container">
<div id="no-download"></div>
<div class="banner"></div>
<div class="main">
<div class="slide-box">
<div class="swiper-wrapper clearfix">
<div class="yohobuy" tag="0">
<div class="swiper-yohobuy bg"></div>
<div class="ewm-area">
<img src="//cdn.yoho.cn/yohocn/160315/images/ewm-yohobuy.png" />
<div class="ewm-info"></div>
</div>
<span id="download" class="download-btn">点击下载 · Yoho!Buy有货</span>
</div>
</div>
</div>
<div class="slide-pagination clearfix">
</div>
</div>
<div class="footer">
CopyRight © 2007-2017 YOHO!新力传媒
</div>
<div class="mask">
<div class="wx-img1"></div>
<div class="wx-img2"></div>
<div class="wx-img3"></div>
</div>
</div>
... ...
... ... @@ -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.0/yas.js', '_yas'));
}(window, document, 'script', (document.location.protocol === 'https:' ? 'https:' : 'http:') + '//cdn.yoho.cn/yas-jssdk/2.2.1/yas.js', '_yas'));
var _hmt = _hmt || [];
... ... @@ -56,7 +56,7 @@
uid = uid === 0 ? '' : uid;
window._ozuid = uid; // 暴露ozuid
if (window._yas) {
window._yas(1 * new Date(), '2.2.0', 'yohobuy_m', uid, '', '');
window._yas(1 * new Date(), '2.2.1', 'yohobuy_m', uid, '', '');
}
// 非登录状态,加载百度统计
... ...
{
"name": "m-yohobuy-node",
"version": "5.3.18",
"version": "91.1.1",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...
/* eslint no-undef: "_yas" */
require('../../scss/activity/_app-downloads.css');
require('../../js/common');
var url = 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.home","params":{"gender":"1","channel":"2"}}';
var u = navigator.userAgent.toLowerCase();
var isiOS = u.indexOf('os') > -1 || u.indexOf('iphone') > -1 || u.indexOf('mac') > -1 || u.indexOf('ipad') > -1;
var appPath = url;
var ifr;
setTimeout(function() {
if (isiOS) {
window.location.href = appPath;
} else {
ifr = document.createElement('iframe');
ifr.src = appPath;
ifr.style.display = 'none';
document.body.appendChild(ifr);
}
}, 500);
//1: 男生,2-女生,3-潮童,4-创意生活
var CHANNELS = {
boys: 1,
girls: 2,
kids: 3,
lifestyle: 4
};
$('#download').click(function() {
var url;
var channel = window.cookie('_Channel');
if (isiOS) {
url = 'http://itunes.apple.com/us/app/id490655927?ls=1&mt=8';
} else {
url = 'http://yoho-apps.qiniudn.com/YohoBuy_YOHO.apk';
}
// 上报 nginx 数据
$.get('//m.yohobuy.com/activitylog.json?download2', function() {
});
// 上报 yas 数据
if (typeof _yas !== 'undefined') {
_yas.sendCustomInfo && _yas.sendCustomInfo({
op: 'YB_DOWNLOAD_C',
param: JSON.stringify({
C_ID: CHANNELS[channel],
TO_URL: encodeURIComponent(url)
})
}, true);
}
location.href = url;
});
... ...
body {
line-height: 1.5;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
table {
border-collapse: collapse;
border-spacing: 0
}
caption, th, td, b, strong {
text-align: left;
font-weight: normal
}
table, td, th {
vertical-align: middle
}
blockquote:before, blockquote:after, q:before, q:after {
content: ""
}
blockquote, q {
quotes: "" ""
}
a img {
border: none
}
em, cite {
font-style: normal
}
body {
background: #fff;
font: 12px/1.5 Tahoma, '宋体';
color: #000
}
h1, h2, h3, h4, h5, h6 {
font-weight: normal;
color: #111
}
a {
text-decoration: none;
cursor: pointer
}
dl, dt, dd, ol, ul, li {
list-style: none
}
.left {
float: left
}
.right {
float: right
}
.clearfix:before, .clearfix:after {
content: "";
display: table
}
.clearfix:after {
clear: both
}
.clearfix {
*zoom: 1
}
body.disable-default-action {
-webkit-touch-callout: none;
-webkit-user-select: none;
}
.loadding-area {
position: fixed;
top: 50%;
left: 50%;
width: 4rem;
height: 4rem;
margin-top: -2rem;
margin-left: -2rem;
border-radius: 10%;
background-color: rgba(0, 0, 0, 0.3);
z-index: 9999;
}
.loadding {
z-index: 999;
width: 1.1rem;
position: absolute;
top: 50%;
left: 50%;
margin: -0.55rem 0 0 -0.55rem;
}
.container {
max-width: 790px;
height: auto;
margin: 0 auto;
/*overflow: hidden;*/
}
.banner {
height: 6rem;
background: url(//cdn.yoho.cn/yohocn/160315/images/banner.png) no-repeat right;
background-size: contain;
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 99;
}
.main {
position: relative;
top: 3.5rem;
height: 20rem;
}
.slide-box {
overflow: hidden;
position: relative;
height: 20.78rem;
width: 100%;
}
.slide-box .swipe-wrap {
overflow: hidden;
position: relative;
height: 19.775rem;
}
/*.slide-box .swiper-wrapper {
padding: 0px 4.578rem;
}*/
.slide-box .swiper-slide {
float: left;
width: 16rem;
position: relative;
height: 20.78rem;
margin: 0;
padding: 0;
}
.slide-box .download-btn {
background-color: #d0021b;
color: #fff;
border-radius: 0.2rem;
width: 12.8rem;
height: 2rem;
line-height: 2rem;
font-family: arial, helvetica, '黑体';
font-size: 0.8rem;
text-align: center;
position: absolute;
bottom: 0px;
left: 50%;
margin-left: -6.4rem;
}
.slide-box .ewm-area {
width: 12.8rem;
height: 5.7rem;
position: absolute;
bottom: 2.45rem;
left: 50%;
margin-left: -6.4rem;
}
.slide-box .ewm-area img {
width: 4.6rem;
margin: 0 auto;
display: block;
}
.slide-box .ewm-area .yoho-txt01 {
background: url(//cdn.yoho.cn/yohocn/160315/images/txt01.png) no-repeat;
}
.slide-box .ewm-area .yoho-txt02 {
background: url(//cdn.yoho.cn/yohocn/160315/images/txt02.png) no-repeat;
}
.slide-box .ewm-area .yoho-txt01,
.slide-box .ewm-area .yoho-txt02 {
width: 3.3rem;
height: 0.7rem;
display: block;
margin: 0 auto;
background-size: contain;
}
.slide-box .ewm-area .ewm-info {
background: url(//cdn.yoho.cn/yohocn/160315/images/ewm-info.png) no-repeat;
width: 7rem;
height: 0.7rem;
margin: 0.4rem auto 0 auto;
background-size: contain;
clear: both;
}
.slide-box .ewm-area .ewm-yoho {
height: 5.4rem;
width: 4.6rem;
}
.swiper-yohobuy {
background: url(//cdn.yoho.cn/yohocn/160315/images/yohobuy.png) no-repeat;
}
.swiper-yoho {
background: url(//cdn.yoho.cn/yohocn/160315/images/yoho.png) no-repeat;
}
.swiper-show {
background: url(//cdn.yoho.cn/yohocn/160315/images/show.png) no-repeat;
}
.swiper-mars {
background: url(//cdn.yoho.cn/yohocn/160315/images/mars.png) no-repeat;
}
.slide-box .bg {
display: block;
margin: 0 auto;
width: 12.5rem;
height: 19.2rem;
background-size: contain;
}
.slide-pagination {
margin: 0.125rem 0 0 0;
text-align: center;
}
.slide-pagination .swiper-pagination-bullet {
margin: 0 0.1rem;
}
.swiper-pagination-bullet-active {
background: #696969;
}
.footer {
text-align: center;
color: #555;
line-height: 16px;
font-size: 0.35rem;
box-shadow: none;
position: relative;
top: 5.3rem;
}
.mask {
background: rgba(0, 0, 0, 0.8);
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
height: 41rem;
z-index: 999;
display: none;
}
.mask .wx-img1 {
width: 7rem;
height: 2rem;
background: url(//cdn.yoho.cn/yohocn/160315/images/wx-img1.png) no-repeat;
background-size: contain;
position: fixed;
top: 0.4rem;
right: 1rem;
}
.mask .wx-img2 {
width: 16rem;
height: 9rem;
background: url(//cdn.yoho.cn/yohocn/160315/images/wx-img2.png) no-repeat;
background-size: cover;
position: absolute;
bottom: 4rem;
right: 50%;
margin-right: -8rem;
}
.mask .wx-img3 {
width: 16rem;
height: 16rem;
background: url(//cdn.yoho.cn/yohocn/160315/images/wx-img3.png) no-repeat;
background-size: cover;
position: absolute;
top: 2rem;
right: 50%;
margin-right: -7.7rem;
display: none;
}
... ...
... ... @@ -153,6 +153,7 @@
background-size: contain;
}
.float-layer {
display: none;
height: 128px;
background: rgba(68, 68, 68, 0.95);
position: fixed;
... ...
... ... @@ -126,6 +126,7 @@
}
.float-layer {
display: none;
height: 44PX;
background: rgba(68, 68, 68, 0.95);
position: fixed;
... ...