Authored by biao

update for banner in the me page

... ... @@ -3,9 +3,9 @@
* @author: 赵彪<bill.zhao@yoho.cn>
* @date: 2016/7/26
*/
'use strict';
// const api = global.yoho.API;
const api = global.yoho.ServiceAPI;
const channelMap = require('../../../config/channel-type').channelMap;
... ...
... ... @@ -17,15 +17,18 @@ const index = (req, res) => {
const page = req.query.page;
const uid = req.user.uid;
orderModel.getOrderData(uid, type, page).then(result => {
Promise.all([orderModel.getOrderData(uid, type, page), mcHandler.getMeThumb()]).then(result => {
const pageData = result[0];
const thumb = result[1];
res.display('index', {
page: 'order',
isMe: true,
content: Object.assign({
nav: mcHandler.getMeCrumb(),
navigation: mcHandler.getSideMenu('我的订单'),
banner: 'http://placehold.it/{width}x{height}'
}, result)
banner: thumb
}, pageData)
});
});
};
... ... @@ -34,15 +37,19 @@ const detail = (req, res) => {
const code = req.query.code;
const uid = req.user.uid;
orderModel.getOrderDetail(uid, code).then(result => {
Promise.all([orderModel.getOrderDetail(uid, code), mcHandler.getMeThumb()]).then(result => {
const pageData = result[0];
const thumb = result[1];
res.display('index', {
isMe: true,
page: 'order-detail',
content: Object.assign({
nav: mcHandler.getMeCrumb(),
navigation: mcHandler.getSideMenu('订单详情'),
banner: 'http://placehold.it/{width}x{height}'
}, result)
banner: thumb
}, pageData)
});
});
};
... ...
... ... @@ -12,6 +12,24 @@ const blk = global.yoho;
const url = blk.helpers.urlFormat;
const meCode = require('../../../config/channel-type').meCode;
const api = global.yoho.ServiceAPI;
// 获取个人中心资源位
const getMeThumb = () => {
const data = {
client_type: 'web',
content_code: meCode
};
return api.get('operations/api/v5/resource/home', data, {
cache: true,
code: 200
}).then(result => {
return result.data.list[0].data[0].src;
});
};
// 左侧菜单
const navigation = [
{
... ... @@ -76,5 +94,6 @@ const getSideMenu = focus => {
module.exports = {
getMeCrumb,
getMeThumb,
getSideMenu
};
... ...