...
|
...
|
@@ -10,9 +10,12 @@ const editorialModel = require('../models/editorial'); |
|
|
|
|
|
const index = (req, res, next) => {
|
|
|
let pageNum = req.query.page || 1;
|
|
|
let limit = req.query.limit || 20;
|
|
|
let type = req.query.type || 0;
|
|
|
|
|
|
editorialModel.getIndexData(type).then((result) => {
|
|
|
// let gender = req.query.brand || 1;
|
|
|
|
|
|
editorialModel.getIndexData(type, pageNum, limit).then((result) => {
|
|
|
res.display('index', {
|
|
|
module: 'editorial',
|
|
|
page: 'index',
|
...
|
...
|
@@ -47,10 +50,20 @@ const index = (req, res, next) => { |
|
|
}).catch(next);
|
|
|
};
|
|
|
|
|
|
// const getChannelData = (channel, tag, title) => {
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
const list = (req, res) => {
|
|
|
let pageNum = req.query.page || 1;
|
|
|
let limit = req.query.limit || 20;
|
|
|
let tag = req.params.tag || '暗黑';
|
|
|
let authorId = req.params.authorId || 0;
|
|
|
|
|
|
// let curChannel = getChannelData(req.channel, req.query.query);
|
|
|
|
|
|
editorialModel.getListData().then((result) => {
|
|
|
editorialModel.getListData(pageNum, limit, tag, authorId).then((result) => {
|
|
|
res.display('list', {
|
|
|
module: 'editorial',
|
|
|
page: 'list',
|
...
|
...
|
@@ -68,7 +81,7 @@ const list = (req, res) => { |
|
|
name: '资讯'
|
|
|
}
|
|
|
],
|
|
|
pathTitle: '户外',
|
|
|
pathTitle: req.query.query,
|
|
|
msg: result,
|
|
|
paginationOpts: {
|
|
|
page: pageNum, // current page: http://host/?page=2
|
...
|
...
|
@@ -85,206 +98,154 @@ const list = (req, res) => { |
|
|
});
|
|
|
};
|
|
|
|
|
|
const detail = (req, res) => {
|
|
|
|
|
|
// editorialModel.getListData().then( => {
|
|
|
res.display('detail', {
|
|
|
module: 'editorial',
|
|
|
page: 'detail',
|
|
|
title: '资讯详情',
|
|
|
editorialDetail: {
|
|
|
nav: [
|
|
|
{
|
|
|
link: '/editorial?type=0',
|
|
|
pathTitle: '首页',
|
|
|
name: 'MEN首页'
|
|
|
},
|
|
|
{
|
|
|
link: '/editorial?type=1',
|
|
|
pathTitle: '资讯',
|
|
|
name: '资讯'
|
|
|
}
|
|
|
],
|
|
|
header: {
|
|
|
title: '黑白搭配,穿衣灵感,黑白搭配,穿衣灵感,黑白搭配,穿衣灵感,黑白搭配,穿衣灵感,黑白搭配,穿衣灵感,黑白搭配,穿衣灵感',
|
|
|
avatar: '//devlup.com/wp-content/uploads/2013/07/images.jpg',
|
|
|
name: '二京赋',
|
|
|
time: '2016/07/05 19:36',
|
|
|
click: '26',
|
|
|
commentNum: '45'
|
|
|
},
|
|
|
const detail = (req, res, next) => {
|
|
|
let id = req.params.id || 52571;
|
|
|
|
|
|
content: {
|
|
|
pic: {
|
|
|
img: '#'
|
|
|
},
|
|
|
text: {
|
|
|
articleText: '我服务而恢复力而柔软如个为福建和爱我发'
|
|
|
},
|
|
|
relatedReco: {
|
|
|
relatedTitle: '推荐搭配',
|
|
|
goods: [
|
|
|
{
|
|
|
img: 'http://placehold.it/274x366',
|
|
|
link: '',
|
|
|
name: 'Fred Perry Bomber jacket',
|
|
|
price: '1015.00'
|
|
|
},
|
|
|
{
|
|
|
img: 'http://placehold.it/274x366',
|
|
|
link: '',
|
|
|
name: 'Fred Perry Bomber jacket',
|
|
|
price: '1015.00'
|
|
|
},
|
|
|
{
|
|
|
img: 'http://placehold.it/274x366',
|
|
|
link: '',
|
|
|
name: 'Fred Perry Bomber jacket',
|
|
|
price: '1015.00'
|
|
|
},
|
|
|
{
|
|
|
img: 'http://placehold.it/274x366',
|
|
|
link: '',
|
|
|
name: 'Fred Perry Bomber jacket',
|
|
|
price: '1015.00'
|
|
|
},
|
|
|
{
|
|
|
img: 'http://placehold.it/274x366',
|
|
|
link: '',
|
|
|
name: 'Fred Perry Bomber jacket',
|
|
|
price: '1015.00'
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
relatedGoods: {
|
|
|
relatedTitle: '推荐搭配',
|
|
|
goods: [
|
|
|
{
|
|
|
img: 'http://placehold.it/274x366',
|
|
|
link: '',
|
|
|
name: 'Fred Perry Bomber jacket',
|
|
|
price: '1015.00'
|
|
|
},
|
|
|
{
|
|
|
img: 'http://placehold.it/274x366',
|
|
|
link: '',
|
|
|
name: 'Fred Perry Bomber jacket',
|
|
|
price: '1015.00'
|
|
|
},
|
|
|
{
|
|
|
img: 'http://placehold.it/274x366',
|
|
|
link: '',
|
|
|
name: 'Fred Perry Bomber jacket',
|
|
|
price: '1015.00'
|
|
|
},
|
|
|
{
|
|
|
img: 'http://placehold.it/274x366',
|
|
|
link: '',
|
|
|
name: 'Fred Perry Bomber jacket',
|
|
|
price: '1015.00'
|
|
|
}
|
|
|
]
|
|
|
}
|
|
|
},
|
|
|
brands: {
|
|
|
relatedTitle: '推荐搭配',
|
|
|
relatedBrands: [
|
|
|
{
|
|
|
url: 'http://placehold.it/274x366',
|
|
|
thumb: 'wed',
|
|
|
name: 'Fred Perry'
|
|
|
},
|
|
|
{
|
|
|
url: 'http://placehold.it/274x366',
|
|
|
thumb: 'wed',
|
|
|
name: 'Fred Perry'
|
|
|
},
|
|
|
{
|
|
|
url: 'http://placehold.it/274x366',
|
|
|
thumb: 'wed',
|
|
|
name: 'Fred Perry'
|
|
|
},
|
|
|
{
|
|
|
url: 'http://placehold.it/274x366',
|
|
|
thumb: 'wed',
|
|
|
name: 'Fred Perry'
|
|
|
},
|
|
|
{
|
|
|
url: 'http://placehold.it/274x366',
|
|
|
thumb: 'wed',
|
|
|
name: 'Fred Perry'
|
|
|
},
|
|
|
editorialModel.getDetailData(id).then((result) => {
|
|
|
res.display('detail', {
|
|
|
module: 'editorial',
|
|
|
page: 'detail',
|
|
|
title: '资讯详情',
|
|
|
editorialDetail: {
|
|
|
nav: [
|
|
|
{
|
|
|
url: 'http://placehold.it/274x366',
|
|
|
thumb: 'wed',
|
|
|
name: 'Fred Perry'
|
|
|
link: '/editorial?type=0',
|
|
|
pathTitle: '首页',
|
|
|
name: 'MEN首页'
|
|
|
},
|
|
|
{
|
|
|
url: 'http://placehold.it/274x366',
|
|
|
thumb: 'wed',
|
|
|
name: 'Fred Perry'
|
|
|
link: '/editorial?type=1',
|
|
|
pathTitle: '资讯',
|
|
|
name: '资讯'
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
userInfo: {
|
|
|
likeNum: '10'
|
|
|
|
|
|
},
|
|
|
share: {
|
|
|
shareImg: 'hjchsk',
|
|
|
shareDesc: 'wjhdfwe',
|
|
|
weixinUrl: 'http://www.baidu.com'
|
|
|
},
|
|
|
tag: [
|
|
|
{
|
|
|
name: '户外'
|
|
|
},
|
|
|
{
|
|
|
name: '户外'
|
|
|
},
|
|
|
{
|
|
|
name: '户外'
|
|
|
},
|
|
|
{
|
|
|
name: '户外'
|
|
|
],
|
|
|
header: result.head,
|
|
|
content: result.content,
|
|
|
tags: result.tags,
|
|
|
userInfo: result.head,
|
|
|
comment: result.comment,
|
|
|
brands: result.brands,
|
|
|
article: {
|
|
|
nextChapter: '来来来,让我们好好聊聊',
|
|
|
lastChapter: '除了黑白灰'
|
|
|
},
|
|
|
{
|
|
|
name: '户外'
|
|
|
|
|
|
// content: {
|
|
|
// goods: [
|
|
|
// {
|
|
|
// img: 'http://placehold.it/274x366',
|
|
|
// link: '',
|
|
|
// name: 'Fred Perry Bomber jacket',
|
|
|
// price: '1015.00'
|
|
|
// }
|
|
|
// ]
|
|
|
// },
|
|
|
// relatedGoods: {
|
|
|
// relatedTitle: '推荐搭配',
|
|
|
// goods: [
|
|
|
// {
|
|
|
// img: 'http://placehold.it/274x366',
|
|
|
// link: '',
|
|
|
// name: 'Fred Perry Bomber jacket',
|
|
|
// price: '1015.00'
|
|
|
// }
|
|
|
//
|
|
|
// ]
|
|
|
// }
|
|
|
// },
|
|
|
// brands: [
|
|
|
// {
|
|
|
// url: 'http://placehold.it/274x366',
|
|
|
// thumb: 'wed',
|
|
|
// name: 'Fred Perry'
|
|
|
// },
|
|
|
// {
|
|
|
// url: 'http://placehold.it/274x366',
|
|
|
// thumb: 'wed',
|
|
|
// name: 'Fred Perry'
|
|
|
// },
|
|
|
// {
|
|
|
// url: 'http://placehold.it/274x366',
|
|
|
// thumb: 'wed',
|
|
|
// name: 'Fred Perry'
|
|
|
// },
|
|
|
// {
|
|
|
// url: 'http://placehold.it/274x366',
|
|
|
// thumb: 'wed',
|
|
|
// name: 'Fred Perry'
|
|
|
// }
|
|
|
// ],
|
|
|
share: {
|
|
|
shareImg: 'hjchsk',
|
|
|
shareDesc: 'wjhdfwe',
|
|
|
weixinUrl: 'http://www.baidu.com'
|
|
|
}
|
|
|
|
|
|
],
|
|
|
nextChapter: 'hbrfbhwej',
|
|
|
lastChapter: 'fwehjfdw',
|
|
|
comment: {
|
|
|
commentNum: '4',
|
|
|
list: [
|
|
|
{
|
|
|
avatar: '#',
|
|
|
name: 'rcfse',
|
|
|
content: 'cec',
|
|
|
time: 'efrf'
|
|
|
},
|
|
|
{
|
|
|
avatar: '#',
|
|
|
name: 'rcfse',
|
|
|
content: 'cec',
|
|
|
time: 'efrf'
|
|
|
}
|
|
|
|
|
|
]
|
|
|
},
|
|
|
helpers: {
|
|
|
// import component, path depends on your project
|
|
|
pagination: require('../../../doraemon/components/pagination/pagination').createPagination
|
|
|
}
|
|
|
},
|
|
|
helpers: {
|
|
|
// import component, path depends on your project
|
|
|
pagination: require('../../../doraemon/components/pagination/pagination').createPagination
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
}).catch(next);
|
|
|
};
|
|
|
|
|
|
// });
|
|
|
let setCollect = (req, res, next) => {
|
|
|
let uid = req.user.uid;
|
|
|
let id = req.params.id || 52571;
|
|
|
|
|
|
editorialModel.setCollect(id, uid).then((result) => {
|
|
|
res.json(result);
|
|
|
}).catch(next);
|
|
|
};
|
|
|
|
|
|
let cancelCollect = (req, res, next) => {
|
|
|
let uid = req.user.uid;
|
|
|
let id = req.params.id || 52571;
|
|
|
|
|
|
editorialModel.setCollect(id, uid).then((result) => {
|
|
|
res.json(result);
|
|
|
}).catch(next);
|
|
|
};
|
|
|
|
|
|
// 点赞
|
|
|
let setPraise = (req, res, next) => {
|
|
|
let udid = req.user.uid;
|
|
|
let id = req.params.id || 52571;
|
|
|
|
|
|
editorialModel.setPraise(id, udid).then((result) => {
|
|
|
res.json(result);
|
|
|
}).catch(next);
|
|
|
};
|
|
|
|
|
|
let cancelPraise = (req, res, next) => {
|
|
|
let udid = req.user.uid;
|
|
|
let id = req.params.id || 52571;
|
|
|
|
|
|
editorialModel.cancelPraise(id, udid).then((result) => {
|
|
|
res.json(result);
|
|
|
}).catch(next);
|
|
|
};
|
|
|
|
|
|
let addComment = (req, res, next) => {
|
|
|
let uid = req.user.uid;
|
|
|
let id = req.params.id || 52571;
|
|
|
let content = req.body.content;
|
|
|
|
|
|
editorialModel.setCollect(id, uid, content).then((result) => {
|
|
|
res.json(result);
|
|
|
}).catch(next);
|
|
|
};
|
|
|
|
|
|
module.exports = {
|
|
|
index, // 资讯页
|
|
|
list,
|
|
|
detail
|
|
|
detail,
|
|
|
setCollect,
|
|
|
cancelCollect,
|
|
|
setPraise,
|
|
|
cancelPraise,
|
|
|
addComment
|
|
|
}; |
...
|
...
|
|