Authored by ccbikai

完善 App 对接

... ... @@ -6,11 +6,11 @@
*/
module.exports = app => {
app.use('/', require('./apps/channel'));
app.use('/api', require('./apps/api'));
app.use('/product', require('./apps/product'));
app.use('/home', require('./apps/home'));
app.use('/news', require('./apps/news'));
app.use('/', require('./apps/channel')); // 一级频道模块
app.use('/api', require('./apps/api')); // 各模块公有 API
app.use('/product', require('./apps/product')); // 商品模块
app.use('/home', require('./apps/home')); // 个人中心
app.use('/news', require('./apps/news')); // 资讯
// 组件示例
if (!app.locals.proEnv) {
... ...
... ... @@ -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">
... ... @@ -35,9 +35,9 @@
<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>
... ...
... ... @@ -19,7 +19,7 @@ const titleMap = {
action: ''
},
title: {
des: '标题1',
des: 'BLK',
action: ''
}
},
... ... @@ -29,11 +29,11 @@ const titleMap = {
action: ''
},
title: {
des: '标题2',
des: 'BLK',
action: ''
},
right: {
action: ''
action: origin + '/home'
}
},
3: {
... ... @@ -93,28 +93,23 @@ const matchHeader = (url) => {
headerid: '-1' // 默认不显示头部
};
if (/\/product\/new/.test(url)) {
header = titleMap[1];
// header.xxx = '111';// 匹配到头类型以后,可修改里边的内容
return header;
}
if (/\/brands/.test(url) || /\/cate/.test(url)) {
header = titleMap[4];
header = titleMap[2];
alert(JSON.stringify(header));
return header;
}
if (/\/home\/mydetails$/.test(url)) {
if (/\/home\/mydetails/.test(url)) {
header = titleMap[1];
header.title.des = '个人信息';
return header;
}
if (/\/home\/orders/.test(url)) {
var des = '',
u = url.split('?')[1],
u = parse(u);
let des = '';
let u = url.split('?')[1];
u = parse(u);
if (u.type === '1') {
des = '我的订单';
... ... @@ -141,15 +136,15 @@ const matchHeader = (url) => {
header.ltitle = {
des: '商品',
action: origin + '/home/favorite'
}
};
header.rtitle = {
des: '品牌',
action: origin + '/home/favorite?tab=brand'
}
};
header.right = {
des: '编辑',
action: 'editModel'
}
};
return header;
}
... ... @@ -177,7 +172,7 @@ const matchHeader = (url) => {
header.right = {
des: '提交',
action: 'saveFeedback'
}
};
return header;
}
... ... @@ -193,13 +188,20 @@ const matchHeader = (url) => {
module.exports = (url) => {
if (yoho.isApp) {
let data = {
// 品牌 品类
// if (/\/brands/.test(url) || /\/cate/.test(url)) {
// return yoho.goTab({index: 1});
// }
// 个人中心首页
if (/\/home$/.test(url)) {
return yoho.goTab({index: 4});
}
yoho.goNewPage({
header: matchHeader(url),
url: /^(https?:)?\/\//i.test(url) ? url : origin + url
};
// console.log(data);
yoho.goNewPage(data);
});
} else {
location.href = url;
}
... ...
... ... @@ -34,7 +34,7 @@ const yoho = {
* @param success 调用成功的回调方法
* @param fail 调用失败的回调方法
*/
goTap(args, success, fail) {
goTab(args, success, fail) {
if (this.isApp) {
window.yohoInterface.triggerEvent(success || nullFun, fail || nullFun, {
method: 'go.tab',
... ...
... ... @@ -33,8 +33,13 @@
<style>
@import "../../scss/common/color";
html {
font-size: 60px !important;
}
.sidebar {
width: 100%;
margin-top: 40px;
background: $white;
overflow-x: hidden;
... ...
... ... @@ -476,7 +476,11 @@
this.entity.isCollect = 'N';
} else if (result.code === 403) {
// 未登陆
yoho.goLogin();
yoho.goLogin('', function() {
alert('登录成功回调')
}, function() {
alert('登录失败回调')
});
}
});
} else {
... ...