Authored by 沈志敏

Merge branch 'develop' of git.yoho.cn:fe/yohoblk-wap into develop

... ... @@ -15,13 +15,11 @@ let channel = {
cache: true,
code: 200
}).then(result => {
return result.data ? processResources(result.data) : [];
return result && result.data ? processResources(result.data) : [];
});
},
getSidebarData() {
return service.get('operations/api/v6/category/getCategory', {
parent_id: 1155
}, {
return service.get('operations/api/v6/category/getCategory', {}, {
cache: true,
code: 200
}).then(global.yoho.camelCase);
... ...
... ... @@ -21,7 +21,11 @@ module.exports = () => {
yoho.channel = channel;
// 判断请求是否来自app
yoho.isApp = /yh_blk/i.test(req.get('Referer'));
let userAgent = req.get('User-Agent');
yoho.isApp = /yh_blk/i.test(req.get('User-Agent'));
yoho.isiOS = /\(i[^;]+;( U;)? CPU.+Mac OS X/i.test(userAgent);
yoho.isAndroid = /Android/i.test(userAgent);
Object.assign(res.locals, yoho);
Object.assign(req.yoho, yoho);
... ...
... ... @@ -15,9 +15,9 @@
(function(d,c){var e=d.documentElement,a="orientationchange" in window?"orientationchange":"resize",b=function(){var f=e.clientWidth;if(!f){return}if(f>=750){e.style.fontSize="40px"}else{e.style.fontSize=40*(f/750)+"px"}};if(!d.addEventListener){return}b();c.addEventListener(a,b,false);d.addEventListener("DOMContentLoaded",b,false)})(document,window);
</script>
{{#if devEnv}}
<link rel="stylesheet" href="//localhost:5004/css/index.css">
<link rel="stylesheet" href="//172.16.10.123:5004/css/index.css">
{{#unless noLocalCSS}}
<link rel="stylesheet" href="//localhost:5004/{{module}}.{{page}}.css">
<link rel="stylesheet" href="//172.16.10.123:5004/{{module}}.{{page}}.css">
{{/unless}}
{{^}}
<link rel="stylesheet" href="//cdn.yoho.cn/yohoblk-wap/{{version}}/index.css">
... ... @@ -26,18 +26,15 @@
{{/unless}}
{{/if}}
</head>
<body {{#if isPassportPage}}class=passport-body{{/if}} {{#if isStarIndexPage}} class="star-index-bg"{{/if}} {{#if isStarDetailPage}}class="star-class-body"{{/if}}>
<body class="{{#if isApp}}app{{/if}} {{#if isiOS}}ios{{/if}} {{#if isAndroid}}android{{/if}}">
<div class="main-wrap">
{{{body}}}
</div>
{{#wechatShare}}
<script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
{{/wechatShare}}
{{#if devEnv}}
<script src="//localhost:5004/libs.js"></script>
<script src="//172.16.10.123:5004/libs.js"></script>
{{#unless noLocalJS}}
<script src="//localhost:5004/{{module}}.{{page}}.js"></script>
<script src="//172.16.10.123:5004/{{module}}.{{page}}.js"></script>
{{/unless}}
{{^}}
<script src="//cdn.yoho.cn/yohoblk-wap/{{version}}/libs.js"></script>
... ...
... ... @@ -218,15 +218,15 @@ const matchHeader = (url) => {
module.exports = (url) => {
if (yoho.isApp) {
let path = url.split('?')[0];
let [path, qs] = url.split('?');
qs = parse(qs);
// 个人中心收藏
if (/\/me\/collection$/.test(path)) {
let u = url.split('?')[1];
let header = titleMap[5];
u = parse(u);
if (u.tab === 'brand') {
if (qs.tab === 'brand') {
header.defaultSelectedIndex = '1';
}
return yoho.goPageView({
... ... @@ -257,6 +257,9 @@ module.exports = (url) => {
// 首页
if (/\/$/.test(path)) {
yoho.goSetChannel({
channel: qs.channel || 'men'
});
return yoho.goTab({
index: 0
});
... ...
... ... @@ -276,6 +276,12 @@ const yoho = {
}
},
/**
* 跳转到收藏管理
* @param args {""}
* @param success
* @param fail
*/
goPageView(args, success, fail) {
if (this.isApp) {
window.yohoInterface.triggerEvent(success || function() {}, fail || function() {}, {
... ... @@ -288,6 +294,23 @@ const yoho = {
},
/**
* 设置频道
* @param args {"channel": "men"}
* @param success
* @param fail
*/
goSetChannel(args, success, fail) {
if (this.isApp) {
window.yohoInterface.triggerEvent(success || function() {}, fail || function() {}, {
method: 'go.setChannel',
arguments: args
});
} else {
tip(tipInfo);
}
},
/**
* 原生调用 JS 方法
* @param name 方法名
* @param callback 回调
... ...
... ... @@ -77,6 +77,12 @@ ul {
margin-right: 50px;
}
.ellipsis {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
@define-mixin line-clamp {
display: -webkit-box;
-webkit-box-orient: vertical;
... ... @@ -85,7 +91,7 @@ ul {
}
@for $i from 1 to 3 {
.line-clamp-$i {
.line-clamp-$i {
-webkit-line-clamp: $(i);
@mixin line-clamp;
}
... ...
... ... @@ -6,7 +6,7 @@
<!-- 分割线 -->
</div>
</template>
<a class="item" href="{{item.sortUrl}}">
<a class="item ellipsis" href="{{item.sortUrl}}">
{{item.sortNameEn}}{{item.sortName}}
</a>
</template>
... ...
... ... @@ -33,14 +33,14 @@
right: 0;
left: 0;
z-index: 210;
padding-top: 60px;
padding-top: 5px;
padding-left: 30px;
padding-right: 30px;
width: 100%;
height: 120px;
height: 80px;
line-height: 60px;
font-size: 48px;
background-color: transparent;
background-color: #fff;
.icon,
.header-title {
vertical-align: middle;
... ... @@ -66,7 +66,17 @@
}
.header-gap {
height: 120px;
height: 40px;
background-color: #fff;
}
.app.ios {
.header {
padding-top: 55px;
}
.header-gap {
height: 120px;
}
}
</style>
... ...
... ... @@ -56,7 +56,7 @@
padding: 55px 20px 10px;
}
.ios {
.app.ios {
.top-box {
top: 40px;
}
... ...