Authored by 姜枫

Merge branch 'release/app-download'

  1 +'use strict';
  2 +
  3 +module.exports = {
  4 + index: (req, res) => {
  5 + res.render('app-downloads', {
  6 + localCss: true
  7 + });
  8 + }
  9 +};
@@ -9,7 +9,6 @@ const channels = { @@ -9,7 +9,6 @@ const channels = {
9 9
10 exports.productLst = function(req, res, next) { 10 exports.productLst = function(req, res, next) {
11 let keys = ['sort', 'misort', 'msort', 'gender', 'brand'], 11 let keys = ['sort', 'misort', 'msort', 'gender', 'brand'],
12 - enumParam = {},  
13 params = { 12 params = {
14 uid: req.query.uid, 13 uid: req.query.uid,
15 udid: req.query.udid, 14 udid: req.query.udid,
@@ -29,21 +28,17 @@ exports.productLst = function(req, res, next) { @@ -29,21 +28,17 @@ exports.productLst = function(req, res, next) {
29 28
30 if (params.specified_sort) { 29 if (params.specified_sort) {
31 if (params.brand) { 30 if (params.brand) {
32 - enumParam.brands = params.brand.split(',');  
33 - params.limit = enumParam.brands.length; 31 + params.limit = params.brand.split(',').length;
34 } else if (params.sort) { 32 } else if (params.sort) {
35 - enumParam.sorts = params.sort.split(',');  
36 - params.limit = enumParam.sorts.length; 33 + params.limit = params.sort.split(',').length;
37 } else if (params.misort) { 34 } else if (params.misort) {
38 - enumParam.misorts = params.misort.split(',');  
39 - params.limit = enumParam.misorts.length; 35 + params.limit = params.misort.split(',').length;
40 } else if (params.msort) { 36 } else if (params.msort) {
41 - enumParam.msorts = params.msort.split(',');  
42 - params.limit = enumParam.msorts.length; 37 + params.limit = params.msort.split(',').length;
43 } 38 }
44 } 39 }
45 40
46 - model.productLst(params, enumParam).then((result) => { 41 + model.productLst(params).then((result) => {
47 res.jsonp(result); 42 res.jsonp(result);
48 }).catch(next); 43 }).catch(next);
49 }; 44 };
@@ -41,6 +41,7 @@ exports.wechatShare = (req, res, next) => { @@ -41,6 +41,7 @@ exports.wechatShare = (req, res, next) => {
41 exports.feature = (req, res) => { 41 exports.feature = (req, res) => {
42 let mktCode = req.query.mkt_code || req.query.union_type || false; 42 let mktCode = req.query.mkt_code || req.query.union_type || false;
43 let expires = req.query.expires; 43 let expires = req.query.expires;
  44 + let cover = req.query.cover;
44 45
45 if (mktCode) { 46 if (mktCode) {
46 res.cookie('unionTypeYas', mktCode, { // 下载浮层 47 res.cookie('unionTypeYas', mktCode, { // 下载浮层
@@ -55,7 +56,7 @@ exports.feature = (req, res) => { @@ -55,7 +56,7 @@ exports.feature = (req, res) => {
55 56
56 expires && (options.expires = new Date(Date.now() + Number(expires))); 57 expires && (options.expires = new Date(Date.now() + Number(expires)));
57 58
58 - if (req.yoho.isWechat) { 59 + if (req.yoho.isWechat || cover) {
59 // 微信中,不管是否已经种入cookie,直接覆盖 60 // 微信中,不管是否已经种入cookie,直接覆盖
60 res.cookie('mkt_code', mktCode, options); 61 res.cookie('mkt_code', mktCode, options);
61 } else if (!req.cookies.mkt_code) { 62 } else if (!req.cookies.mkt_code) {
@@ -3,9 +3,6 @@ @@ -3,9 +3,6 @@
3 const api = global.yoho.API; 3 const api = global.yoho.API;
4 4
5 let _getProduct = function(o) { 5 let _getProduct = function(o) {
6 - if (!o) {  
7 - return {};  
8 - }  
9 return { 6 return {
10 small_sort_id: o.small_sort_id, 7 small_sort_id: o.small_sort_id,
11 middle_sort_id: o.middle_sort_id, 8 middle_sort_id: o.middle_sort_id,
@@ -27,34 +24,16 @@ let _getProduct = function(o) { @@ -27,34 +24,16 @@ let _getProduct = function(o) {
27 }; 24 };
28 25
29 module.exports = { 26 module.exports = {
30 - productLst: function(params, enumParam) { 27 + productLst: function(params) {
31 return api.get('', Object.assign({ 28 return api.get('', Object.assign({
32 method: 'app.search.newPromotion' 29 method: 'app.search.newPromotion'
33 }, params)).then(res => { 30 }, params)).then(res => {
34 - var data = new Array(Number(params.limit)), 31 + var data = [],
35 lst = (res.data && res.data.product_list) || []; 32 lst = (res.data && res.data.product_list) || [];
36 33
37 - for (var i = 0; i < data.length; i++) {  
38 - var o = lst[i] || {};  
39 -  
40 - if (params.specified_sort) {  
41 - // 枚举类型  
42 - if (enumParam.brands && Number(enumParam.brands[i]) === Number(o.brand_id)) {  
43 - data[i] = _getProduct(o);  
44 - } else if (enumParam.sorts && Number(enumParam.sorts[i]) === Number(o.small_sort_id)) {  
45 - data[i] = _getProduct(o);  
46 - } else if (enumParam.misorts && Number(enumParam.misorts[i]) === Number(o.middle_sort_id)) {  
47 - data[i] = _getProduct(o);  
48 - } else if (enumParam.msorts && Number(enumParam.msorts[i]) === Number(o.max_sort_id)) {  
49 - data[i] = _getProduct(o);  
50 - } else {  
51 - lst.splice(i, 0, {});  
52 - data[i] = {};  
53 - }  
54 - } else {  
55 - data[i] = _getProduct(o);  
56 - }  
57 - } 34 + lst.forEach(function(o) {
  35 + o && data.push(_getProduct(o));
  36 + });
58 return data; 37 return data;
59 }); 38 });
60 } 39 }
@@ -29,7 +29,7 @@ const share = require(`${cRoot}/share`); @@ -29,7 +29,7 @@ const share = require(`${cRoot}/share`);
29 const aliCloud = require(`${cRoot}/ali-cloud`); 29 const aliCloud = require(`${cRoot}/ali-cloud`);
30 const studentMarket = require(`${cRoot}/student-market`); 30 const studentMarket = require(`${cRoot}/student-market`);
31 const individuation = require(`${cRoot}/individuation`); 31 const individuation = require(`${cRoot}/individuation`);
32 - 32 +const appDownloads = require(`${cRoot}/app-downloads`);
33 const redbag = require(`${cRoot}/redbag`); 33 const redbag = require(`${cRoot}/redbag`);
34 34
35 // routers 35 // routers
@@ -136,4 +136,6 @@ router.get('/redbag/2017', redbag.index); @@ -136,4 +136,6 @@ router.get('/redbag/2017', redbag.index);
136 // 获取活动页面个性化推荐商品数据 136 // 获取活动页面个性化推荐商品数据
137 router.get('/individuation', individuation.productLst); 137 router.get('/individuation', individuation.productLst);
138 138
  139 +router.get('/app-downloads', appDownloads.index);
  140 +
139 module.exports = router; 141 module.exports = router;
  1 +<div class="container">
  2 + <div id="no-download"></div>
  3 + <div class="banner"></div>
  4 + <div class="main">
  5 + <div class="slide-box">
  6 + <div class="swiper-wrapper clearfix">
  7 + <div class="yohobuy" tag="0">
  8 + <div class="swiper-yohobuy bg"></div>
  9 + <div class="ewm-area">
  10 + <img src="//cdn.yoho.cn/yohocn/160315/images/ewm-yohobuy.png" />
  11 + <div class="ewm-info"></div>
  12 + </div>
  13 + <span id="download" class="download-btn">点击下载 · Yoho!Buy有货</span>
  14 + </div>
  15 + </div>
  16 + </div>
  17 + <div class="slide-pagination clearfix">
  18 + </div>
  19 + </div>
  20 + <div class="footer">
  21 + CopyRight © 2007-2017 YOHO!新力传媒
  22 + </div>
  23 + <div class="mask">
  24 + <div class="wx-img1"></div>
  25 + <div class="wx-img2"></div>
  26 + <div class="wx-img3"></div>
  27 + </div>
  28 +</div>
@@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
12 a.async = 1; 12 a.async = 1;
13 a.src = j; 13 a.src = j;
14 m.parentNode.insertBefore(a, m); 14 m.parentNode.insertBefore(a, m);
15 - }(window, document, 'script', (document.location.protocol === 'https:' ? 'https:' : 'http:') + '//cdn.yoho.cn/yas-jssdk/2.2.0/yas.js', '_yas')); 15 + }(window, document, 'script', (document.location.protocol === 'https:' ? 'https:' : 'http:') + '//cdn.yoho.cn/yas-jssdk/2.2.1/yas.js', '_yas'));
16 16
17 var _hmt = _hmt || []; 17 var _hmt = _hmt || [];
18 18
@@ -56,7 +56,7 @@ @@ -56,7 +56,7 @@
56 uid = uid === 0 ? '' : uid; 56 uid = uid === 0 ? '' : uid;
57 window._ozuid = uid; // 暴露ozuid 57 window._ozuid = uid; // 暴露ozuid
58 if (window._yas) { 58 if (window._yas) {
59 - window._yas(1 * new Date(), '2.2.0', 'yohobuy_m', uid, '', ''); 59 + window._yas(1 * new Date(), '2.2.1', 'yohobuy_m', uid, '', '');
60 } 60 }
61 61
62 // 非登录状态,加载百度统计 62 // 非登录状态,加载百度统计
1 { 1 {
2 "name": "m-yohobuy-node", 2 "name": "m-yohobuy-node",
3 - "version": "5.3.18", 3 + "version": "91.1.1",
4 "private": true, 4 "private": true,
5 "description": "A New Yohobuy Project With Express", 5 "description": "A New Yohobuy Project With Express",
6 "repository": { 6 "repository": {
  1 +/* eslint no-undef: "_yas" */
  2 +
  3 +require('../../scss/activity/_app-downloads.css');
  4 +require('../../js/common');
  5 +
  6 +var url = 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.home","params":{"gender":"1","channel":"2"}}';
  7 +var u = navigator.userAgent.toLowerCase();
  8 +var isiOS = u.indexOf('os') > -1 || u.indexOf('iphone') > -1 || u.indexOf('mac') > -1 || u.indexOf('ipad') > -1;
  9 +
  10 +var appPath = url;
  11 +var ifr;
  12 +
  13 +setTimeout(function() {
  14 + if (isiOS) {
  15 + window.location.href = appPath;
  16 + } else {
  17 + ifr = document.createElement('iframe');
  18 + ifr.src = appPath;
  19 + ifr.style.display = 'none';
  20 + document.body.appendChild(ifr);
  21 + }
  22 +}, 500);
  23 +
  24 +//1: 男生,2-女生,3-潮童,4-创意生活
  25 +var CHANNELS = {
  26 + boys: 1,
  27 + girls: 2,
  28 + kids: 3,
  29 + lifestyle: 4
  30 +};
  31 +
  32 +$('#download').click(function() {
  33 + var url;
  34 + var channel = window.cookie('_Channel');
  35 +
  36 + if (isiOS) {
  37 + url = 'http://itunes.apple.com/us/app/id490655927?ls=1&mt=8';
  38 + } else {
  39 + url = 'http://yoho-apps.qiniudn.com/YohoBuy_YOHO.apk';
  40 + }
  41 +
  42 + // 上报 nginx 数据
  43 + $.get('//m.yohobuy.com/activitylog.json?download2', function() {
  44 + });
  45 +
  46 + // 上报 yas 数据
  47 + if (typeof _yas !== 'undefined') {
  48 + _yas.sendCustomInfo && _yas.sendCustomInfo({
  49 + op: 'YB_DOWNLOAD_C',
  50 + param: JSON.stringify({
  51 + C_ID: CHANNELS[channel],
  52 + TO_URL: encodeURIComponent(url)
  53 + })
  54 + }, true);
  55 + }
  56 +
  57 + location.href = url;
  58 +});
  59 +
  1 +body {
  2 + line-height: 1.5;
  3 + -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  4 +}
  5 +
  6 +table {
  7 + border-collapse: collapse;
  8 + border-spacing: 0
  9 +}
  10 +
  11 +caption, th, td, b, strong {
  12 + text-align: left;
  13 + font-weight: normal
  14 +}
  15 +
  16 +table, td, th {
  17 + vertical-align: middle
  18 +}
  19 +
  20 +blockquote:before, blockquote:after, q:before, q:after {
  21 + content: ""
  22 +}
  23 +
  24 +blockquote, q {
  25 + quotes: "" ""
  26 +}
  27 +
  28 +a img {
  29 + border: none
  30 +}
  31 +
  32 +em, cite {
  33 + font-style: normal
  34 +}
  35 +
  36 +body {
  37 + background: #fff;
  38 + font: 12px/1.5 Tahoma, '宋体';
  39 + color: #000
  40 +}
  41 +
  42 +h1, h2, h3, h4, h5, h6 {
  43 + font-weight: normal;
  44 + color: #111
  45 +}
  46 +
  47 +a {
  48 + text-decoration: none;
  49 + cursor: pointer
  50 +}
  51 +
  52 +dl, dt, dd, ol, ul, li {
  53 + list-style: none
  54 +}
  55 +
  56 +.left {
  57 + float: left
  58 +}
  59 +
  60 +.right {
  61 + float: right
  62 +}
  63 +
  64 +.clearfix:before, .clearfix:after {
  65 + content: "";
  66 + display: table
  67 +}
  68 +
  69 +.clearfix:after {
  70 + clear: both
  71 +}
  72 +
  73 +.clearfix {
  74 + *zoom: 1
  75 +}
  76 +
  77 +body.disable-default-action {
  78 + -webkit-touch-callout: none;
  79 + -webkit-user-select: none;
  80 +}
  81 +
  82 +.loadding-area {
  83 + position: fixed;
  84 + top: 50%;
  85 + left: 50%;
  86 + width: 4rem;
  87 + height: 4rem;
  88 + margin-top: -2rem;
  89 + margin-left: -2rem;
  90 + border-radius: 10%;
  91 + background-color: rgba(0, 0, 0, 0.3);
  92 + z-index: 9999;
  93 +}
  94 +
  95 +.loadding {
  96 + z-index: 999;
  97 + width: 1.1rem;
  98 + position: absolute;
  99 + top: 50%;
  100 + left: 50%;
  101 + margin: -0.55rem 0 0 -0.55rem;
  102 +}
  103 +
  104 +.container {
  105 + max-width: 790px;
  106 + height: auto;
  107 + margin: 0 auto;
  108 + /*overflow: hidden;*/
  109 +}
  110 +
  111 +.banner {
  112 + height: 6rem;
  113 + background: url(//cdn.yoho.cn/yohocn/160315/images/banner.png) no-repeat right;
  114 + background-size: contain;
  115 + position: fixed;
  116 + top: 0;
  117 + left: 0;
  118 + right: 0;
  119 + z-index: 99;
  120 +}
  121 +
  122 +.main {
  123 + position: relative;
  124 + top: 3.5rem;
  125 + height: 20rem;
  126 +}
  127 +
  128 +.slide-box {
  129 + overflow: hidden;
  130 + position: relative;
  131 + height: 20.78rem;
  132 + width: 100%;
  133 +}
  134 +
  135 +.slide-box .swipe-wrap {
  136 + overflow: hidden;
  137 + position: relative;
  138 + height: 19.775rem;
  139 +}
  140 +
  141 +/*.slide-box .swiper-wrapper {
  142 + padding: 0px 4.578rem;
  143 +}*/
  144 +
  145 +.slide-box .swiper-slide {
  146 + float: left;
  147 + width: 16rem;
  148 + position: relative;
  149 + height: 20.78rem;
  150 + margin: 0;
  151 + padding: 0;
  152 +}
  153 +
  154 +.slide-box .download-btn {
  155 + background-color: #d0021b;
  156 + color: #fff;
  157 + border-radius: 0.2rem;
  158 + width: 12.8rem;
  159 + height: 2rem;
  160 + line-height: 2rem;
  161 + font-family: arial, helvetica, '黑体';
  162 + font-size: 0.8rem;
  163 + text-align: center;
  164 + position: absolute;
  165 + bottom: 0px;
  166 + left: 50%;
  167 + margin-left: -6.4rem;
  168 +}
  169 +
  170 +.slide-box .ewm-area {
  171 + width: 12.8rem;
  172 + height: 5.7rem;
  173 + position: absolute;
  174 + bottom: 2.45rem;
  175 + left: 50%;
  176 + margin-left: -6.4rem;
  177 +}
  178 +
  179 +.slide-box .ewm-area img {
  180 + width: 4.6rem;
  181 + margin: 0 auto;
  182 + display: block;
  183 +}
  184 +
  185 +.slide-box .ewm-area .yoho-txt01 {
  186 + background: url(//cdn.yoho.cn/yohocn/160315/images/txt01.png) no-repeat;
  187 +}
  188 +
  189 +.slide-box .ewm-area .yoho-txt02 {
  190 + background: url(//cdn.yoho.cn/yohocn/160315/images/txt02.png) no-repeat;
  191 +}
  192 +
  193 +.slide-box .ewm-area .yoho-txt01,
  194 +.slide-box .ewm-area .yoho-txt02 {
  195 + width: 3.3rem;
  196 + height: 0.7rem;
  197 + display: block;
  198 + margin: 0 auto;
  199 + background-size: contain;
  200 +}
  201 +
  202 +.slide-box .ewm-area .ewm-info {
  203 + background: url(//cdn.yoho.cn/yohocn/160315/images/ewm-info.png) no-repeat;
  204 + width: 7rem;
  205 + height: 0.7rem;
  206 + margin: 0.4rem auto 0 auto;
  207 + background-size: contain;
  208 + clear: both;
  209 +}
  210 +
  211 +.slide-box .ewm-area .ewm-yoho {
  212 + height: 5.4rem;
  213 + width: 4.6rem;
  214 +}
  215 +
  216 +.swiper-yohobuy {
  217 + background: url(//cdn.yoho.cn/yohocn/160315/images/yohobuy.png) no-repeat;
  218 +}
  219 +
  220 +.swiper-yoho {
  221 + background: url(//cdn.yoho.cn/yohocn/160315/images/yoho.png) no-repeat;
  222 +}
  223 +
  224 +.swiper-show {
  225 + background: url(//cdn.yoho.cn/yohocn/160315/images/show.png) no-repeat;
  226 +}
  227 +
  228 +.swiper-mars {
  229 + background: url(//cdn.yoho.cn/yohocn/160315/images/mars.png) no-repeat;
  230 +}
  231 +
  232 +.slide-box .bg {
  233 + display: block;
  234 + margin: 0 auto;
  235 + width: 12.5rem;
  236 + height: 19.2rem;
  237 + background-size: contain;
  238 +}
  239 +
  240 +.slide-pagination {
  241 + margin: 0.125rem 0 0 0;
  242 + text-align: center;
  243 +}
  244 +
  245 +.slide-pagination .swiper-pagination-bullet {
  246 + margin: 0 0.1rem;
  247 +}
  248 +
  249 +.swiper-pagination-bullet-active {
  250 + background: #696969;
  251 +}
  252 +
  253 +.footer {
  254 + text-align: center;
  255 + color: #555;
  256 + line-height: 16px;
  257 + font-size: 0.35rem;
  258 + box-shadow: none;
  259 + position: relative;
  260 + top: 5.3rem;
  261 +}
  262 +
  263 +.mask {
  264 + background: rgba(0, 0, 0, 0.8);
  265 + position: absolute;
  266 + left: 0;
  267 + right: 0;
  268 + top: 0;
  269 + bottom: 0;
  270 + height: 41rem;
  271 + z-index: 999;
  272 + display: none;
  273 +}
  274 +
  275 +.mask .wx-img1 {
  276 + width: 7rem;
  277 + height: 2rem;
  278 + background: url(//cdn.yoho.cn/yohocn/160315/images/wx-img1.png) no-repeat;
  279 + background-size: contain;
  280 + position: fixed;
  281 + top: 0.4rem;
  282 + right: 1rem;
  283 +}
  284 +
  285 +.mask .wx-img2 {
  286 + width: 16rem;
  287 + height: 9rem;
  288 + background: url(//cdn.yoho.cn/yohocn/160315/images/wx-img2.png) no-repeat;
  289 + background-size: cover;
  290 + position: absolute;
  291 + bottom: 4rem;
  292 + right: 50%;
  293 + margin-right: -8rem;
  294 +}
  295 +
  296 +.mask .wx-img3 {
  297 + width: 16rem;
  298 + height: 16rem;
  299 + background: url(//cdn.yoho.cn/yohocn/160315/images/wx-img3.png) no-repeat;
  300 + background-size: cover;
  301 + position: absolute;
  302 + top: 2rem;
  303 + right: 50%;
  304 + margin-right: -7.7rem;
  305 + display: none;
  306 +}
@@ -153,6 +153,7 @@ @@ -153,6 +153,7 @@
153 background-size: contain; 153 background-size: contain;
154 } 154 }
155 .float-layer { 155 .float-layer {
  156 + display: none;
156 height: 128px; 157 height: 128px;
157 background: rgba(68, 68, 68, 0.95); 158 background: rgba(68, 68, 68, 0.95);
158 position: fixed; 159 position: fixed;
@@ -126,6 +126,7 @@ @@ -126,6 +126,7 @@
126 } 126 }
127 127
128 .float-layer { 128 .float-layer {
  129 + display: none;
129 height: 44PX; 130 height: 44PX;
130 background: rgba(68, 68, 68, 0.95); 131 background: rgba(68, 68, 68, 0.95);
131 position: fixed; 132 position: fixed;