Authored by xuqi

筛选请求处理

... ... @@ -885,5 +885,52 @@ module.exports = function(flag) {
}
]
};
case 'search':
return [
{
thumb: 'http://img13.static.yhbimg.com/goodsimg/2015/03/03/08/0244a127c89c1f77ab47f55891e45be1e6.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
name: 'HALFGIRL 插肩棒球服短裙套装',
isLike: true,
price: 478,
salePrice: 208,
isSale: true,
isFew: true,
isNew: false,
url: ''
},
{
thumb: 'http://img13.static.yhbimg.com/goodsimg/2015/03/02/08/023f696cf1ae78688bc6c8edeccc480c2c.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
name: 'GAWS DIGI 丛林数码印花拼接卫衣',
isLike: false,
price: 1268,
salePrice: 589,
isSale: true,
isFew: true,
isNew: false,
url: ''
},
{
thumb: 'http://img10.static.yhbimg.com/goodsimg/2015/01/08/07/012f23fc2390ccd634082d34cc2982bf4c.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
name: 'CLOTtee 撞色连帽外套',
isLike: false,
price: 488,
salePrice: 139,
isSale: true,
isFew: true,
isNew: false,
url: ''
},
{
thumb: 'http://img11.static.yhbimg.com/goodsimg/2015/03/02/09/0139514beb37bf2bf321eafd1a915117f5.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
name: '黄伟文Wyman X yohood联名商品YYYOHOOD连帽卫衣',
isLike: false,
price: 589,
salePrice: 148,
isSale: false,
isFew: false,
isNew: true,
url: ''
}
];
}
};
\ No newline at end of file
... ...
... ... @@ -14,4 +14,7 @@ module.exports = function(app) {
app.get('/tag', tag.show); //标签页
app.get('/tpl', template.show); //模板页
app.get('/tpl/readTpl', template.readTpl); //读取模板
app.get('/tpl/classification', template.readClassification); //读取分类数据
app.get('/tpl/search', template.search); //筛选查询
};
\ No newline at end of file
... ...
... ... @@ -3,7 +3,13 @@
* @author: xuqi(qi.xu@yoho.cn)
* @date: 2015/4/14
*/
var data = require('../../public/js/data')('tpl');
var datas = require('../../public/js/data'),
data = datas('tpl'),
classification = datas('classification'),
search = datas('search'),
fs = require('fs'),
path = require('path'),
tplPath = path.normalize(path.join(__dirname, '../partials/common/good-info.html'));;
exports.show = function(req, res) {
res.render('pages/template', {
... ... @@ -12,4 +18,36 @@ exports.show = function(req, res) {
css: '../css/template.css',
usejs: 'template/footer'
});
};
exports.readTpl = function(req, res) {
fs.readFile(tplPath, 'utf8', function(err, data) {
if (err) {
res.send({
success: false
});
}
res.send({
success: true,
data: data
});
});
};
exports.readClassification = function(req, res) {
res.send({
success: true,
data: classification
});
};
exports.search = function(req, res) {
res.send({
success: true,
data: {
end: false, //数据是否结束
goods: search //商品数据
}
});
};
\ No newline at end of file
... ...