Authored by zhangxiaoru

merge

... ... @@ -13,7 +13,7 @@ exports.index = (req, res, next) => {
uid = req.user.uid;
}
var param = {
let param = {
contentCode: req.query.code
};
... ... @@ -35,7 +35,8 @@ exports.index = (req, res, next) => {
navTitle: '领券中心'
}),
content: result,
noLoginUrl: result.noLoginUrl
noLoginUrl: result.noLoginUrl,
appPath: 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.couponCenter", "params":{"share":"/operations/api/v5/webshare/getShare","share_id":"1037","title":"领券中心"}}' //eslint-disable-line
});
}).catch(next);
};
... ...
... ... @@ -11,6 +11,15 @@ const _ = require('lodash');
const singleDay = (req, res) => {
let title = req.query.title;
delete req.query.openapp;
let shareParams = req.query.share_id ? '"share":"/operations/api/v5/webshare/getShare","shareparam":{"share_id":"' +
req.query.share_id + '"},' : '';
let appPathUrl = _.split(req.originalUrl, '?')[0] || '';
let appPath = 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.h5",' + shareParams +
'"params":{"url":"http://m.yohobuy.com' + appPathUrl +
'","param":' + JSON.stringify(req.query) + '}}';
res.render('single-day/single-day', {
module: 'activity',
page: 'single-day',
... ... @@ -22,7 +31,8 @@ const singleDay = (req, res) => {
navTitle: title || '超级单品日',
navBtn: false
}),
pageFooter: false
pageFooter: false,
appPath: appPath
});
};
... ...
... ... @@ -90,7 +90,8 @@ let index = (req, res, next) => {
channelList: result[0].channelList,
yohood: result[0].yohood,
double11: result[0].double11,
background: result[1]
background: result[1],
appPath: 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.home","params":{"channel":"1"}}'
});
}).catch(next);
};
... ... @@ -123,7 +124,8 @@ let boys = (req, res, next) => {
gender: 'boys',
// title: '男生 | Yoho!Buy有货 | 潮流购物逛不停',
boysHomePage: true
boysHomePage: true,
appPath: 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.home","params":{"channel":"1"}}'
}).catch(next); // TODO 我们在路由处理的最上层的方法处理catch
};
... ... @@ -135,7 +137,8 @@ let girls = (req, res, next) => {
gender: 'girls',
// title: '女生 | Yoho!Buy有货 | 潮流购物逛不停',
girlsHomePage: true
girlsHomePage: true,
appPath: 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.home","params":{"channel":"2"}}'
}).catch(next);
};
... ... @@ -148,7 +151,8 @@ let kids = (req, res, next) => {
gender: 'kids',
// title: '潮童 | Yoho!Buy有货 | 潮流购物逛不停',
kidsHomePage: true
kidsHomePage: true,
appPath: 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.home","params":{"channel":"3"}}'
}).catch(next);
};
... ... @@ -160,7 +164,8 @@ let lifestyle = (req, res, next) => {
gender: 'lifestyle',
// title: '创意生活 | Yoho!Buy有货 | 潮流购物逛不停',
lifestyleHomePage: true
lifestyleHomePage: true,
appPath: 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.home","params":{"channel":"4"}}'
}).catch(next);
};
... ...
... ... @@ -65,7 +65,7 @@ const _baseShop = (req, res, shopInfo, shopId) => {
};
/**
* TODO TAR 店铺和品牌收藏状态调用新的接口
*
* 基础模板收藏
*/
const baseShopFav = (req, res) => {
... ... @@ -183,7 +183,7 @@ const shopAppCookie = (req, res) => {
};
/**
* TODO TAR 店铺和品牌收藏状态调用新的接口
*
* 前端请求判断shop是否收藏
*/
const shopFav = (req, res) => {
... ... @@ -212,6 +212,15 @@ const shopFav = (req, res) => {
const category = (req, res, next) => {
let params = Object.assign({}, req.query);
/* 勿修改,唤起 APP 使用 */
let appParams = Object.assign({}, req.query, {
title: req.query.sort_name || ''
});
let appPath = 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.list","params":' +
JSON.stringify(appParams) +
'}';
// 获取第一页数据做服务端渲染
let initialData = _.assign({
gender: params.gender,
... ... @@ -242,7 +251,8 @@ const category = (req, res, next) => {
showDownloadApp: true,
pageFooter: true,
category: true,
localCss: true
localCss: true,
appPath: appPath
});
}).catch(next);
};
... ... @@ -344,7 +354,7 @@ const brand = (req, res, next) => {
};
/**
* TODO TAR 店铺和品牌收藏状态调用新的接口
*
* @param req
* @param res
*/
... ...
... ... @@ -32,13 +32,19 @@ const newDetail = {
result.id = id;
result.goodsId = goodsId;
let appParams = {product_skn: result.productSkn};
let appPath = 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.productDetail","params":' +
JSON.stringify(appParams) +
'}';
res.render('detail/new/detail', {
pageHeader: headerData,
result: result,
page: 'new-detail',
title: result.goodsName,
pageFooter: true,
localCss: true
localCss: true,
appPath: appPath
});
}).catch(next);
},
... ...
... ... @@ -188,7 +188,9 @@ const shop = {
description: shopInfo.shop_name + '|Yoho!Buy有货' + shopInfo.shop_name + '潮流服饰官方授权店!100%品牌正品保证,支持货到付款。',
shopId: shopId,
shopPage: true,
_noLazy: true
_noLazy: true,
appPath: 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.shop","params":{"shop_template_type":"1","shop_id":"' +
shopId + '","shop_name":"' + baseShop.shopName + '"}}'
});
});
} else {
... ... @@ -218,7 +220,9 @@ const shop = {
keywords: result.seoTitle + ',' + result.seoTitle + '服装服饰,' + result.seoTitle + '潮流服装服饰',
description: result.seoTitle + '|Yoho!Buy有货' + result.seoTitle + '潮流服饰官方授权店!100%品牌正品保证,支持货到付款。',
shopId: shopId,
shopPage: true
shopPage: true,
appPath: 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.shop","params":{"shop_template_type":"1","shop_id":"' +
shopId + '","shop_name":"' + result.seoTitle + '"}}'
});
});
... ...
... ... @@ -16,15 +16,15 @@ module.exports = {
siteUrl: '//m.yohobuy.com',
assetUrl: '//localhost:5001',
domains: {
// api: 'http://api.yoho.cn/',
// service: 'http://service.yoho.cn/',
// liveApi: 'http://api.live.yoho.cn/',
// singleApi: 'http://single.yoho.cn/'
api: 'http://api.yoho.cn/',
service: 'http://service.yoho.cn/',
liveApi: 'http://api.live.yoho.cn/',
singleApi: 'http://single.yoho.cn/'
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/'
// 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/'
// favApi: 'http://192.168.102.31:8092/brower',
// api: 'http://192.168.102.205:8080/gateway/',
... ...
... ... @@ -72,7 +72,7 @@
<link rel="apple-touch-startup-image" sizes="320x460" href="http://static.yohobuy.com/m/v1/img/startup/startup.png" media="screen and (max-device-width: 320)">
</head>
<body class="{{pageStyle}} {{#if isWechat}}wechat-body{{/if}} {{#if width750}}width750{{/if}} {{#if isPassportPage}}passport-body{{/if}} {{#if isStarIndexPage}}star-index-bg{{/if}} {{#if isStarDetailPage}}star-class-body{{/if}} {{#if isInstallmentPage}}installment-body{{/if}}">
<div class="main-wrap">
<div class="main-wrap" id="main-wrap" {{#if appPath}}data-apppath='{{appPath}}'{{/if}}>
{{#if systemUpdate}}
{{> updata}}
{{/if}}
... ...
... ... @@ -21,6 +21,9 @@ var _ChannelVary = {
lifestyle: 4
};
// 尝试打开 APP
require('./common/open-app');
function cookie(name) {
var cookies = document.cookie,
cookieVal;
... ...
/**
* 移动端尝试打开 app
*/
const qs = require('yoho-qs');
const getAppPath = () => {
return document.getElementById('main-wrap').dataset.apppath || 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.home","params":{"gender":"1","channel":"2"}}';
};
if (qs.openapp) {
const u = navigator.userAgent.toLowerCase();
const isiOS = u.indexOf('os') > -1 || u.indexOf('iphone') > -1 || u.indexOf('mac') > -1 || u.indexOf('ipad') > -1;
let appPath = getAppPath();
let ifr;
if (isiOS) {
window.location.href = appPath;
} else {
ifr = document.createElement('iframe');
ifr.src = appPath;
ifr.style.display = 'none';
document.body.appendChild(ifr);
}
// let time = Date.now();
// window.setTimeout(function() {
// document.body.removeChild(ifr);
// if (Date.now() - time < 2200) {
// window.location.href = 'http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho';
// }
// }, 2000);
}
... ...