Authored by biao

update for channle

const model = require('../models');
exports.index = (req, res) => {
res.send(model.getContent());
}
... ...
/**
* sub app channel
* @author: biao<bill.zhao@yoho.cn>
* @date: 2016/06/29
*/
var express = require('express'),
path = require('path'),
hbs = require('express-handlebars');
var app = express();
// set view engin
var doraemon = path.join(__dirname, '../../doraemon/views'); //parent view root
app.set('views', path.join(__dirname, 'views/action'));
app.engine('.hbs', hbs({
extname: '.hbs',
defaultLayout: 'layout',
layoutsDir: doraemon,
partialsDir: ['./views/partial', `${doraemon}/partial`],
helpers: 'helpers'
}));
// router
app.use(require('./router'));
module.exports = app;
\ No newline at end of file
... ...
const getContent = () => {
const content = {
content: [
{
slider: [
{
img: '//img10.static.yhbimg.com/yhb-img01/2016/06/23/13/01ebff30179db84975c42a4f3c8b1f4d44.jpg?imageView2/1/w/1150/h/450',
link: '/'
},
{
img: '//img10.static.yhbimg.com/yhb-img01/2016/06/23/13/01ebff30179db84975c42a4f3c8b1f4d44.jpg?imageView2/1/w/1150/h/450',
link: '/'
}
]
},
{
brandsAd: [
{
img: '//img10.static.yhbimg.com/yhb-img01/2016/06/23/13/01ebff30179db84975c42a4f3c8b1f4d44.jpg?imageView2/1/w/1150/h/450',
name: '',
des: ''
}
]
},
{
floorZh: '新品抢鲜看',
floorEn: 'NEW ARRIVALS',
newArrivals: [
{
img: '//img10.static.yhbimg.com/yhb-img01/2016/06/23/13/01ebff30179db84975c42a4f3c8b1f4d44.jpg?imageView2/1/w/1150/h/450',
name: '',
link: ''
},
]
},
{
floorZh: '经典品牌',
floorEn: 'CLASSIC BRANDS',
classicBrands: [
{
big: [
{
img: '//img10.static.yhbimg.com/yhb-img01/2016/06/23/13/01ebff30179db84975c42a4f3c8b1f4d44.jpg?imageView2/1/w/1150/h/450',
link: ''
}
],
small: [
{
img: '//img10.static.yhbimg.com/yhb-img01/2016/06/23/13/01ebff30179db84975c42a4f3c8b1f4d44.jpg?imageView2/1/w/1150/h/450',
link: ''
}
]
},
]
},
{
floorZh: '潮流标志',
floorEn: 'STYLE ICON',
styleIcon: [
{
img: '//img10.static.yhbimg.com/yhb-img01/2016/06/23/13/01ebff30179db84975c42a4f3c8b1f4d44.jpg?imageView2/1/w/1150/h/450',
name: '',
des: '',
link: ''
}
]
},
{
adBanner: {
img: '',
link: ''
}
},
{
floorZh: '资讯',
floorEn: 'EDITORIAL',
editorial: {
big: {
img: '',
link: ''
},
small: [
{
img: '',
link: ''
}
]
}
}
]
};
return content;
}
module.exports = {
getContent: getContent
};
... ...
/**
* router of sub app channel
* @author: biao<bill.zhao@yoho.cn>
* @date: 2016/06/29
*/
'use strict';
const router = require('express').Router();
const cRoot = './controllers';
// Your controller here
const index = require(`${cRoot}`).index;
router.get('/', index);
module.exports = router;
... ...
{{# content}}
{{> banner}}
{{/ content}}
... ...
<div class="blk-slider">
{{# slider}}
{{img}}
{{/ slider}}
</div>
... ...
... ... @@ -9,4 +9,5 @@ module.exports = app => {
// 公共服务
// 业务模块
app.get('/', require('./apps/channel'));
};
... ...
const requestHeaderData = () => {
return Promise.resolve('head');
};
module.exports = {
requestHeaderData: requestHeaderData
}
... ...