Authored by 沈志敏

5.2 微信商城(WAP页面页头优化)11328

... ... @@ -7,6 +7,7 @@
'use strict';
const headerModel = require('../../../doraemon/models/header'); // 头部model
const footerModel = require('../../../doraemon/models/footer_tab'); // 底部tab
const indexModel = require('../models/brand');
/**
... ... @@ -16,17 +17,11 @@ const indexModel = require('../models/brand');
* @param int channel 1表示男生频道, 2表示女生频道, 3表示潮童频道, 4表示创意生活频道
*/
let index = (req, res, next) => {
let headerData = headerModel.setNav({
navTitle: '品牌一览'
});
let responseData = {
pageHeader: headerData,
module: 'channel',
page: 'brand',
title: '品牌一览 | Yoho!Buy有货 | 潮流购物逛不停',
//pageFooter: true
title: req.yoho.isWechat ? '品牌一览' : '品牌一览 | Yoho!Buy有货 | 潮流购物逛不停',
showFooterTab: footerModel.getUrlData('category')
};
let param = {
... ... @@ -59,7 +54,7 @@ let search = (req, res, next) => {
pageHeader: headerData,
module: 'channel',
page: 'brand',
title: '品牌一览 | Yoho!Buy有货 | 潮流购物逛不停',
title: req.yoho.isWechat ? '品牌一览' : '品牌一览 | Yoho!Buy有货 | 潮流购物逛不停',
pageFooter: true
};
... ...
... ... @@ -3,7 +3,7 @@
*/
'use strict';
const cateModel = require('../models/cate');
const headerModel = require('../../../doraemon/models/header');
const footerModel = require('../../../doraemon/models/footer_tab'); // 底部tab
const helpers = global.yoho.helpers;
let index = (req, res, next) => {
... ... @@ -12,15 +12,13 @@ let index = (req, res, next) => {
module: 'channel',
page: 'cate',
title: '商品分类',
pageHeader: headerModel.setNav({
navTitle: '商品分类'
}),
pageFooter: false,
category: {
nav: result.nav,
list: result.list,
searchUrl: helpers.urlFormat('/search', null, 'search')
}
},
showFooterTab: footerModel.getUrlData('category')
});
}).catch(next);
};
... ...
... ... @@ -6,6 +6,7 @@
'use strict';
const _ = require('lodash');
const channelModel = require('../models/channel');
const footerModel = require('../../../doraemon/models/footer_tab'); // 底部tab
const helpers = global.yoho.helpers;
... ... @@ -16,13 +17,7 @@ let _renderData = {
searchUrl: helpers.urlFormat('/search', null, 'search')
},
maybeLike: true,
showFooterTab: {
indexUrl: helpers.urlFormat('/?go=1'), // 首页
categoryUrl: helpers.urlFormat('/cate'), // 分类
guangUrl: helpers.urlFormat('', null, 'guang'), // 逛首页
shoppingCartUrl: helpers.urlFormat('/cart/index/index'), // 购物车
mineUrl: helpers.urlFormat('/home') // 个人中心
},
showFooterTab: footerModel.getUrlData('home'),
pageFooter: true
};
... ... @@ -38,6 +33,7 @@ let _channelPage = (req, res, data) => {
gender: data.gender,
uid: _.toString(req.user.uid)
}).then(result => {
_renderData.homeHeader.isWechat = req.yoho.isWechat;
res.render('channel', Object.assign({}, _renderData, data, result));
});
};
... ... @@ -86,7 +82,7 @@ let switchChannel = (req, res, next) => {
let boys = (req, res, next) => {
_channelPage(req, res, {
gender: 'boys',
title: '男生首页',
title: req.yoho.isWechat ? '男生' : '男生首页',
boysHomePage: true
}).catch(next); // TODO 我们在路由处理的最上层的方法处理catch
};
... ... @@ -97,7 +93,7 @@ let boys = (req, res, next) => {
let girls = (req, res, next) => {
_channelPage(req, res, {
gender: 'girls',
title: '女生首页',
title: req.yoho.isWechat ? '女生' : '女生首页',
girlsHomePage: true
}).catch(next);
};
... ... @@ -109,7 +105,7 @@ let girls = (req, res, next) => {
let kids = (req, res, next) => {
_channelPage(req, res, {
gender: 'kids',
title: '潮童首页',
title: req.yoho.isWechat ? '潮童' : '潮童首页',
kidsHomePage: true
}).catch(next);
};
... ... @@ -120,7 +116,7 @@ let kids = (req, res, next) => {
let lifestyle = (req, res, next) => {
_channelPage(req, res, {
gender: 'lifestyle',
title: '创意生活首页',
title: req.yoho.isWechat ? '创意生活' : '创意生活首页',
lifestyleHomePage: true
}).catch(next);
};
... ...
... ... @@ -116,8 +116,6 @@ const getBrandByChannel = (channel) => {
searchUrl: helpers.urlFormat('/brands/search', null),
brandPage: true,
// pageFooter: true,
showDownloadApp: true,
brandType: '全部品牌',
secondBrandType: '新入驻品牌',
thirdBrandType: '热门品牌',
... ... @@ -436,6 +434,7 @@ const branchSearch = (params) => {
return api.all([
getBrandForSearch(params.channel),
// branchSearchHistory(params),
branchSearchHot(),
... ... @@ -542,6 +541,7 @@ const delBrandSearchHistory = (param) => {
});
};
/**
* [异步获取用户最近搜索词]
*/
... ... @@ -570,7 +570,7 @@ const branchSearchHistoryAsync = (uid) => {
return build;
});
}
};
module.exports = {
getBrandByChannel,
... ...
... ... @@ -37,25 +37,23 @@ const bottomBannerCode = contentCodeConfig.bottom;
* 频道选择页 默认数据
* @type {Object}
*/
const channelList = [
{
href: '/boys',
title: '男生',
entitle: 'BOYS'
}, {
href: '/girls',
title: '女生',
entitle: 'GIRLS'
}, {
href: '/kids',
title: '潮童',
entitle: 'KIDS'
}, {
href: '/lifestyle',
title: '创意生活',
entitle: 'LIFESTYLE'
}
];
const channelList = [{
href: '/boys',
title: '男生',
entitle: 'BOYS'
}, {
href: '/girls',
title: '女生',
entitle: 'GIRLS'
}, {
href: '/kids',
title: '潮童',
entitle: 'KIDS'
}, {
href: '/lifestyle',
title: '创意生活',
entitle: 'LIFESTYLE'
}];
/**
* 获取二级菜单顶部颜色
... ... @@ -136,8 +134,8 @@ const _getChannelResource = (params) => {
if (result && result.code === 200 && result.data && result.data.list) {
for (let item of result.data.list) {
item.template_name === 'single_image' &&
item.data.length === 1 &&
(item.singleOne = true);
item.data.length === 1 &&
(item.singleOne = true);
}
return resourcesProcess(result.data.list);
} else {
... ...
... ... @@ -101,3 +101,4 @@
{{/channel}}
</div>
{{> footer-tab}}
\ No newline at end of file
... ...
... ... @@ -45,3 +45,4 @@
</div>
{{/ category}}
</div>
{{> footer-tab}}
\ No newline at end of file
... ...
... ... @@ -25,7 +25,7 @@
{{> channel/banner-bottom}}
{{/bannerBottom}}
{{> channel/footer-tab}}
{{> footer-tab}}
<div class="overlay"></div>
</div>
... ...
<div class="home-header clearfix" {{# bgColor}}style="background-color:{{.}};background-image:none"{{/ bgColor}}>
<span class="nav-btn iconfont">&#xe60b;</span>
<span class="logo"></span>
<span class="search-btn iconfont"><a href="{{searchUrl}}">&#xe60f;</a></span>
{{#unless isWechat}}
<span class="nav-btn iconfont">&#xe60b;</span>
<span class="logo"></span>
<span class="search-btn iconfont"><a href="{{searchUrl}}">&#xe60f;</a></span>
{{^}}
<span class="nav-btn iconfont">&#xe60b;</span>
<div class="search-input">
<a href="{{searchUrl}}">
<i class="search-icon iconfont">&#xe60f;</i>
<p>休闲/运动鞋</p>
</a>
</div>
{{/unless}}
</div>
... ...
... ... @@ -8,6 +8,7 @@
const mRoot = '../models';
const indexModel = require(`${mRoot}/index`);
const headerModel = require('../../../doraemon/models/header'); // 头部model
const footerModel = require('../../../doraemon/models/footer_tab'); // 底部tab
const guangProcess = require(`${global.utils}/guang-process`);
const stringProcess = require(`${global.utils}/string-process`);
const Promise = require('bluebird');
... ... @@ -76,7 +77,11 @@ const editor = (req, res, next) => {
const pageData = (req, res, next) => {
/* 判断是不是AJAX请求 */
if (!req.xhr) {
res.json({ code: 400, message: '非法请求', data: '' });
res.json({
code: 400,
message: '非法请求',
data: ''
});
return;
}
... ... @@ -94,11 +99,19 @@ const pageData = (req, res, next) => {
udid = req.sessionID;
if (!stringProcess.isNumeric(sortId)) {
res.json({ code: 400, message: '参数错误', data: '' });
res.json({
code: 400,
message: '参数错误',
data: ''
});
return;
}
if (!page && !isNaN(page)) {
res.json({ code: 400, message: '参数错误', data: '' });
res.json({
code: 400,
message: '参数错误',
data: ''
});
return;
}
if (!authorId && isNaN(authorId)) {
... ... @@ -106,9 +119,15 @@ const pageData = (req, res, next) => {
}
return indexModel.getPageData(gender, sortId, uid, udid, page, tag, authorId, isApp, showAuthor, isTab).then(data => {
if (data) {
res.render('index/page', Object.assign(data, { layout: false }));
res.render('index/page', Object.assign(data, {
layout: false
}));
} else {
res.json({ code: 400, message: '', data: '' });
res.json({
code: 400,
message: '',
data: ''
});
}
}).catch(next);
... ... @@ -121,25 +140,17 @@ const pageData = (req, res, next) => {
* @param next
*/
const index = (req, res, next) => {
let headerData = headerModel.setNav({
navTitle: '逛'
});
let responseData = {
pageHeader: headerData,
module: 'guang',
page: 'index',
title: '逛 | Yoho!Buy有货 | 潮流购物逛不停',
pageFooter: true
title: req.yoho.isWechat ? '逛' : '逛 | Yoho!Buy有货 | 潮流购物逛不停',
showFooterTab: footerModel.getUrlData('guang')
};
let param = {
uid: req.user.uid,
udid: req.user.udid,
type: req.query.type || '0',
gender: req.query.gender || '1,3'
};
... ... @@ -165,7 +176,7 @@ const tag = (req, res, next) => {
pageHeader: headerData,
module: 'guang',
page: 'index-editor',
title: tagTitle + ' | Yoho!Buy有货 | 潮流购物逛不停'
title: req.yoho.isWechat ? tagTitle : tagTitle + ' | Yoho!Buy有货 | 潮流购物逛不停'
};
let param = {
... ...
... ... @@ -44,4 +44,5 @@
</div>
<input id="gender" type="hidden" value={{gender}}>
{{/ guang}}
</div>
\ No newline at end of file
</div>
{{> footer-tab}}
\ No newline at end of file
... ...
... ... @@ -7,6 +7,7 @@
'use strict';
const headerModel = require('../../../doraemon/models/header'); // 头部model
const footerModel = require('../../../doraemon/models/footer_tab'); // 底部tab
const indexModel = require('../models/index');
/**
... ... @@ -22,11 +23,6 @@ exports.index = (req, res, next) => {
udid: require('md5')(req.ip)
};
let headerData = headerModel.setNav({
navTitle: '个人中心',
backUrl: '//m.yohobuy.com/?go=1'
});
indexModel.index(params).then(result => {
if (result) {
res.render('home', Object.assign(result, {
... ... @@ -34,11 +30,11 @@ exports.index = (req, res, next) => {
module: 'home',
page: 'index',
title: 'Yoho!Buy 有货',
pageHeader: headerData,
pageFooter: true,
pageChannel: {
boys: true
}
},
showFooterTab: footerModel.getUrlData('mine')
}));
}
}).catch(next);
... ... @@ -206,4 +202,3 @@ exports.preferential = (req, res, next) => {
}).catch(next);
};
... ...
... ... @@ -14,15 +14,13 @@ const orderDetailData = (req, res, next) => {
let orderCode = req.query.order_code;
orderDetailModel.orderDetailData(uid, orderCode).then(result => {
result.serviceUrl = 'http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409&info=';
res.render('orderDetail', {
module: 'home',
page: 'order-detail',
pageHeader: headerModel.setNav({
navTitle: '订单详情',
navBtn: false,
orderDetail: true,
serviceUrl: 'http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409&info=',
navBtn: false
}),
title: '订单详情',
pageFooter: true,
... ...
... ... @@ -84,7 +84,9 @@ const _getAddressData = (params) => {
return api.get('', {
method: 'app.address.gethidden',
uid: params.uid
}, {code: 200});
}, {
code: 200
});
} else {
return false;
}
... ... @@ -98,7 +100,6 @@ const _getAddressData = (params) => {
const index = (params) => {
let finalResult = {
myIndexPage: true,
showDownloadApp: true,
navHome: true,
pageFooter: true,
refundExchangeNum: 0,
... ...
... ... @@ -132,5 +132,5 @@
{{> common/suspend-cart}}
</div>
{{> download-app}}
{{> footer-tab}}
... ...
... ... @@ -37,6 +37,7 @@
<span >订单状态:{{statusStr}}</span>
<span>下单时间:<b class="createTime">{{createTime}}</b></span>
</p>
<a href="{{serviceUrl}}" target="_blank" class="iconfont icon-right">&#xe63c;</a>
</div>
{{#if logisticsUrl}}
<a class="logistics sub" href="{{logisticsUrl}}">
... ...
... ... @@ -35,7 +35,8 @@ exports.index = (req, res, next) => {
outletModel.getContent(categoryId, yhChannel, contentcode).then(result => {
res.render('outlet', Object.assign({
pageHeader: headerData
pageHeader: headerData,
title: req.yoho.isWechat ? '奥莱' : 'OUTLET',
}, result));
}).catch(next);
};
... ...
/**
* common head model
* @author: biao<bill.zhao@yoho.cn>
* @date: 2016/05/12
*/
'use strict';
const helpers = global.yoho.helpers;
exports.getUrlData = function(type) {
const urlData = {
indexUrl: helpers.urlFormat('/?go=1'), // 首页
categoryUrl: helpers.urlFormat('/cate'), // 分类
guangUrl: helpers.urlFormat('', null, 'guang'), // 逛首页
shoppingCartUrl: helpers.urlFormat('/cart/index/index'), // 购物车
mineUrl: helpers.urlFormat('/home') // 个人中心
};
switch (type) {
case 'home':
urlData.boysHomePage = true;
break;
case 'category':
urlData.categoryPage = true;
break;
case 'guang':
urlData.guangHome = true;
break;
case 'shoppingCart':
urlData.shoppingCartPage = true;
break;
case 'mine':
urlData.minePage = true;
break;
}
return urlData;
};
... ...
... ... @@ -47,7 +47,9 @@
{{/if}}
{{#unless isApp}}
{{> header}}
{{#unless isWechat}}
{{> header}}
{{/unless}}
{{/unless}}
{{{body}}}
... ...
... ... @@ -36,9 +36,6 @@
{{channel}} <span class="iconfont">&#xe616;</span>
</span>
{{/saleNav}}
{{#orderDetail}}
<a href="{{serviceUrl}}" target="_blank" class="iconfont nav-home">&#xe63c;</a>
{{/orderDetail}}
</header>
{{#if saleNav.list}}
<div class="sale-nav-select">
... ...
@import "search";
.brand-page {
.re-pos-search {
top: 170px !important;
top: 80px !important;
}
.hide-when-loading {
... ... @@ -17,7 +17,6 @@
color: #aeaeae;
z-index: 3;
position: fixed;
top: 90px;
border-bottom: 1px solid #e1e1e1;
background-color: #fff;
... ... @@ -210,7 +209,7 @@
}
.banner-top {
padding-top: 258px;
padding-top: 168px;
background-color: #f8f8f8;
}
... ...
... ... @@ -3,6 +3,7 @@
line-height: 90px;
background-image: linear-gradient(#323232, #414141);
position: relative;
overflow: hidden;
.iconfont {
color: #fff;
... ... @@ -47,6 +48,30 @@
}
}
.search-input {
margin-left: 97px;
margin-top: 16px;
width: 490px;
height: 60px;
background: #f8f8f8;
border-radius: 50px;
.search-icon {
position: absolute;
top: 0;
bottom: 0;
left: 110px;
color: #999;
}
p {
color: #999;
padding-left: 50px;
height: 60px;
line-height: 60px;
}
}
.iconfont.highlight {
background: rgba(200, 200, 200, 0.4);
}
... ...
... ... @@ -49,6 +49,11 @@
.iconfont {
left: 0;
}
.icon-right {
right: 25px;
left: auto;
}
}
.logistics {
... ...