...
|
...
|
@@ -20,9 +20,7 @@ const getFavoriteTabs = (type) => { |
|
|
type = type || 'product';
|
|
|
|
|
|
return TABS.map((item) => {
|
|
|
if (item.type === type) {
|
|
|
item.active = true;
|
|
|
}
|
|
|
item.active = item.type === type;
|
|
|
item.url = helpers.urlFormat('/home/favorite', {type: item.type});
|
|
|
return item;
|
|
|
});
|
...
|
...
|
@@ -149,13 +147,13 @@ const favoriteBrandList = (uid, page, limit, type)=> { |
|
|
})();
|
|
|
};
|
|
|
|
|
|
const favoriteArticleList = (uid, udid, page, limit, type)=> {
|
|
|
const favoriteArticleListAsync = (uid, udid, page, limit)=> {
|
|
|
return co(function*() {
|
|
|
let result = {articles: [], pager: {}};
|
|
|
let article = yield favoriteApi.favoriteArticleData(uid, udid, page, limit);
|
|
|
let articles = yield favoriteApi.favoriteArticleData(uid, udid, page, limit);
|
|
|
|
|
|
if (!article.data && !article.data.data) {
|
|
|
article.data.data.forEach((item, i)=> {
|
|
|
if (!articles.data && !articles.data.data) {
|
|
|
articles.data.data.forEach((item)=> {
|
|
|
result.articles.push({
|
|
|
id: item.id,
|
|
|
name: item.title,
|
...
|
...
|
@@ -165,11 +163,11 @@ const favoriteArticleList = (uid, udid, page, limit, type)=> { |
|
|
});
|
|
|
});
|
|
|
|
|
|
let total = article.data.total || 0;
|
|
|
let pageTotal = article.data.totalPage || 0;
|
|
|
let page = article.data.page || 0;
|
|
|
let total = articles.data.total || 0;
|
|
|
let pageTotal = articles.data.totalPage || 0;
|
|
|
let pageNum = articles.data.page || 0;
|
|
|
|
|
|
result.pager = getPager(page, total, pageTotal);
|
|
|
result.pager = getPager(pageNum, total, pageTotal);
|
|
|
} else {
|
|
|
result.articles = {empty: '你尚未收藏任何文章!'};
|
|
|
}
|
...
|
...
|
@@ -261,5 +259,5 @@ const getSortInfo = (categoryList, sort)=> { |
|
|
module.exports = {
|
|
|
getFavoriteTabs,
|
|
|
favoriteProductList,
|
|
|
favoriteArticleList
|
|
|
favoriteArticleListAsync
|
|
|
}; |
...
|
...
|
|