Authored by 郭成尧

sale全频道框架

... ... @@ -10,9 +10,12 @@ const headerModel = require('../../../doraemon/models/header');
const mRoot = '../models';
// sale 页 model
const sale = require(`${mRoot}/sale`);
// const sale = require(`${mRoot}/sale`);
const saleDiscount = require(`${mRoot}/sale-discount`);
// const saleDiscount = require(`${mRoot}/sale-discount`);
// 开发用模拟数据
const simulation = require(`${mRoot}/simulation`);
/**
* sale 首页
... ... @@ -32,16 +35,16 @@ exports.index = (req, res) => {
response.devEnv = true;
// 假数据输出
// res.render('sale/index', Object.assign(response, sale.outputDevData()));
res.render('sale/index', Object.assign(response, simulation.saleIndex()));
// 真实数据输出
return sale.getSaleDate().then(result => {
/* return sale.getSaleDate().then(result => {
response.result = result;
response.resultShow = JSON.stringify(result, null, 4);
res.render('sale/index', response);
});
});*/
})
.catch(() => {
res.render('error', { devEnv: true, pageErr: true });
... ... @@ -63,13 +66,112 @@ exports.discount = (req, res) => {
response.footerTop = true;
response.devEnv = true;
return saleDiscount.getSaleDiscountData()
// 假数据输出
res.render('sale/discount', Object.assign(response, simulation.discount()));
/* return saleDiscount.getSaleDiscountData()
.then(result => {
response.result = result;
response.resultShow = JSON.stringify(result, null, 4);
res.render('sale/discount', response);
});
});*/
})
.catch(() => {
res.render('error', { devEnv: true, pageErr: true });
});
};
/**
* VIP会员专享
* @param {[type]} req [description]
* @param {[type]} res [description]
* @return {[type]} [description]
*/
exports.vip = (req, res) => {
headerModel.requestHeaderData()
.then(response => {
response = headerModel.setHeaderData(response.data, 'vip');
response.module = 'product';
response.page = 'sale';
response.footerTop = true;
response.devEnv = true;
// 假数据输出
res.render('sale/other', Object.assign(response, simulation.other()));
/* return saleVip.getSaleVipData()
.then(result => {
response.result = result;
response.resultShow = JSON.stringify(result, null, 4);
res.render('sale/other', response);
});*/
})
.catch(() => {
res.render('error', { devEnv: true, pageErr: true });
});
};
/**
* 断码专区
* @param {[type]} req [description]
* @param {[type]} res [description]
* @return {[type]} [description]
*/
exports.breakingYards = (req, res) => {
headerModel.requestHeaderData()
.then(response => {
response = headerModel.setHeaderData(response.data, 'breakingYards');
response.module = 'product';
response.page = 'sale';
response.footerTop = true;
response.devEnv = true;
// 假数据输出
res.render('sale/other', Object.assign(response, simulation.other()));
/* return breakingYards.getSaleBreakingYardsData()
.then(result => {
response.result = result;
response.resultShow = JSON.stringify(result, null, 4);
res.render('sale/other', response);
});*/
})
.catch(() => {
res.render('error', { devEnv: true, pageErr: true });
});
};
/**
* 断码专区
* @param {[type]} req [description]
* @param {[type]} res [description]
* @return {[type]} [description]
*/
exports.newSale = (req, res) => {
headerModel.requestHeaderData()
.then(response => {
response = headerModel.setHeaderData(response.data, 'newSale');
response.module = 'product';
response.page = 'sale';
response.footerTop = true;
response.devEnv = true;
// 假数据输出
res.render('sale/other', Object.assign(response, simulation.other()));
/* return newSale.getSaleNewSaleData()
.then(result => {
response.result = result;
response.resultShow = JSON.stringify(result, null, 4);
res.render('sale/other', response);
});*/
})
.catch(() => {
... ...
... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2016-05-19 10:20:08
* @Last Modified by: Targaryen
* @Last Modified time: 2016-05-19 11:34:38
* @Last Modified time: 2016-05-19 16:49:04
*/
'use strict';
... ... @@ -24,254 +24,6 @@ const handleSaleData = (origin) => {
};
/**
* 输出开发用假数据
* @return {[type]} [description]
*/
exports.outputDevData = () => {
return {
module: 'product',
page: 'sale',
topBanner: {
list: [
{
bannerHeight: 200,
href: 'http://www.yoho.cn',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/830/h/327'
},
{
bannerHeight: 200,
href: 'http://www.yoho.cn',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/830/h/327'
},
{
bannerHeight: 200,
href: 'http://www.yoho.cn',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/830/h/327'
}
]
},
activityEnter: [
{
link: 'www.baidu.com',
icon: 'dasdasdas',
title: '我是标题',
desc: '参加活动'
},
{
link: 'www.baidu.com',
icon: 'dasdasdas',
title: '我是标题',
desc: '参加活动'
},
{
link: 'www.baidu.com',
icon: 'dasdasdas',
title: '我是标题',
desc: '参加活动'
}
],
brandSale: [
{
big: [
{
link: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
time: '低于一小时',
brand: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/80/h/50',
discount: '1折起'
},
{
link: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
time: '低于一小时',
brand: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/80/h/50',
discount: '1折起'
},
{
link: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
time: '低于一小时',
brand: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/80/h/50',
discount: '1折起'
}
],
normal: [
{
link: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
time: '剩余22小时',
title: 'yoho!buy 新品大促销,全场100折'
},
{
link: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
time: '剩余22小时',
title: 'yoho!buy 新品大促销,全场100折'
},
{
link: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
time: '剩余22小时',
title: 'yoho!buy 新品大促销,全场100折'
},
{
link: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
time: '剩余22小时',
title: 'yoho!buy 新品大促销,全场100折'
},
{
link: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
time: '剩余22小时',
title: 'yoho!buy 新品大促销,全场100折'
},
{
link: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
time: '剩余22小时',
title: 'yoho!buy 新品大促销,全场100折'
}
]
}
],
saleCategory: [
{
title: 'VIP会员专享',
navItem: [
{
vip: true,
url: '/sa/ds',
title: '今日推荐'
},
{
incompleteSize: true,
url: '/sa/ds',
title: '上装'
},
{
newDiscount: true,
url: '/sa/ds',
title: '裤装'
},
{
vip: true,
url: '/sa/ds',
title: '鞋履'
},
{
vip: true,
url: '/sa/ds',
title: '配饰'
}
],
saleImage: [
{
href: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
name: '测试商品',
originPrice: '11321',
price: '213',
vip: true
},
{
href: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
name: '测试商品',
originPrice: '11321',
price: '213',
vip: true
},
{
href: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
name: '测试商品',
originPrice: '11321',
price: '213',
vip: true
},
{
href: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
name: '测试商品',
originPrice: '11321',
price: '213',
vip: true
},
{
href: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
name: '测试商品',
originPrice: '11321',
price: '213',
vip: true
},
{
href: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
name: '测试商品',
originPrice: '11321',
price: '213',
vip: true
},
{
href: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
name: '测试商品',
originPrice: '11321',
price: '213',
vip: true
},
{
href: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
name: '测试商品',
originPrice: '11321',
price: '213',
vip: true
}
]
},
{
title: '断码区',
navItem: [
{
vip: true,
url: '/sa/ds',
title: '今日推荐'
},
{
incompleteSize: true,
url: '/sa/ds',
title: '上装'
},
{
newDiscount: true,
url: '/sa/ds',
title: '裤装'
},
{
vip: true,
url: '/sa/ds',
title: '鞋履'
},
{
vip: true,
url: '/sa/ds',
title: '配饰'
}
]
}
]
};
};
/**
* 获取首页数据
* @return {[type]} [description]
*/
... ...
/*
* @Author: Targaryen
* @Date: 2016-05-19 16:48:43
* @Last Modified by: Targaryen
* @Last Modified time: 2016-05-19 17:02:34
*/
'use strict';
/**
* 输出开发用假数据 首页
* @return {[type]} [description]
*/
exports.saleIndex = () => {
return {
module: 'product',
page: 'sale',
topBanner: {
list: [{
bannerHeight: 200,
href: 'http://www.yoho.cn',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/830/h/327'
}, {
bannerHeight: 200,
href: 'http://www.yoho.cn',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/830/h/327'
}, {
bannerHeight: 200,
href: 'http://www.yoho.cn',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/830/h/327'
}]
},
activityEnter: [{
link: 'www.baidu.com',
icon: 'dasdasdas',
title: '我是标题',
desc: '参加活动'
}, {
link: 'www.baidu.com',
icon: 'dasdasdas',
title: '我是标题',
desc: '参加活动'
}, {
link: 'www.baidu.com',
icon: 'dasdasdas',
title: '我是标题',
desc: '参加活动'
}],
brandSale: [{
big: [{
link: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
time: '低于一小时',
brand: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/80/h/50',
discount: '1折起'
}, {
link: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
time: '低于一小时',
brand: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/80/h/50',
discount: '1折起'
}, {
link: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
time: '低于一小时',
brand: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/80/h/50',
discount: '1折起'
}],
normal: [{
link: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
time: '剩余22小时',
title: 'yoho!buy 新品大促销,全场100折'
}, {
link: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
time: '剩余22小时',
title: 'yoho!buy 新品大促销,全场100折'
}, {
link: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
time: '剩余22小时',
title: 'yoho!buy 新品大促销,全场100折'
}, {
link: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
time: '剩余22小时',
title: 'yoho!buy 新品大促销,全场100折'
}, {
link: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
time: '剩余22小时',
title: 'yoho!buy 新品大促销,全场100折'
}, {
link: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
time: '剩余22小时',
title: 'yoho!buy 新品大促销,全场100折'
}]
}],
saleCategory: [{
title: 'VIP会员专享',
navItem: [{
vip: true,
url: '/sa/ds',
title: '今日推荐'
}, {
incompleteSize: true,
url: '/sa/ds',
title: '上装'
}, {
newDiscount: true,
url: '/sa/ds',
title: '裤装'
}, {
vip: true,
url: '/sa/ds',
title: '鞋履'
}, {
vip: true,
url: '/sa/ds',
title: '配饰'
}],
saleImage: [{
href: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
name: '测试商品',
originPrice: '11321',
price: '213',
vip: true
}, {
href: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
name: '测试商品',
originPrice: '11321',
price: '213',
vip: true
}, {
href: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
name: '测试商品',
originPrice: '11321',
price: '213',
vip: true
}, {
href: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
name: '测试商品',
originPrice: '11321',
price: '213',
vip: true
}, {
href: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
name: '测试商品',
originPrice: '11321',
price: '213',
vip: true
}, {
href: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
name: '测试商品',
originPrice: '11321',
price: '213',
vip: true
}, {
href: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
name: '测试商品',
originPrice: '11321',
price: '213',
vip: true
}, {
href: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
name: '测试商品',
originPrice: '11321',
price: '213',
vip: true
}]
}, {
title: '断码区',
navItem: [{
vip: true,
url: '/sa/ds',
title: '今日推荐'
}, {
incompleteSize: true,
url: '/sa/ds',
title: '上装'
}, {
newDiscount: true,
url: '/sa/ds',
title: '裤装'
}, {
vip: true,
url: '/sa/ds',
title: '鞋履'
}, {
vip: true,
url: '/sa/ds',
title: '配饰'
}]
}]
};
};
/**
* 专场折扣
* @return {[type]} [description]
*/
exports.discount = () => {
return {};
};
/**
* sale 下其他页面
* @return {[type]} [description]
*/
exports.other = () => {
return {};
};
... ...
... ... @@ -19,5 +19,8 @@ const sale = require(`${cRoot}/sale`);
// router.get('/detail/:id/:gid', detail.index);
router.get('/sale/index', sale.index);
router.get('/sale/discount', sale.discount);
router.get('/sale/vip', sale.vip);
router.get('/sale/breakingYards', sale.breakingYards);
router.get('/sale/newSale', sale.newSale);
module.exports = router;
... ...
<div class="sale-arena-page yoho-page">
<p>coding here arena</p>
</div>
<div>keep coding</div>
\ No newline at end of file
... ...