|
@@ -20,9 +20,7 @@ const getFavoriteTabs = (type) => { |
|
@@ -20,9 +20,7 @@ const getFavoriteTabs = (type) => { |
20
|
type = type || 'product';
|
20
|
type = type || 'product';
|
21
|
|
21
|
|
22
|
return TABS.map((item) => {
|
22
|
return TABS.map((item) => {
|
23
|
- if (item.type === type) {
|
|
|
24
|
- item.active = true;
|
|
|
25
|
- }
|
23
|
+ item.active = item.type === type;
|
26
|
item.url = helpers.urlFormat('/home/favorite', {type: item.type});
|
24
|
item.url = helpers.urlFormat('/home/favorite', {type: item.type});
|
27
|
return item;
|
25
|
return item;
|
28
|
});
|
26
|
});
|
|
@@ -149,13 +147,13 @@ const favoriteBrandList = (uid, page, limit, type)=> { |
|
@@ -149,13 +147,13 @@ const favoriteBrandList = (uid, page, limit, type)=> { |
149
|
})();
|
147
|
})();
|
150
|
};
|
148
|
};
|
151
|
|
149
|
|
152
|
-const favoriteArticleList = (uid, udid, page, limit, type)=> {
|
150
|
+const favoriteArticleListAsync = (uid, udid, page, limit)=> {
|
153
|
return co(function*() {
|
151
|
return co(function*() {
|
154
|
let result = {articles: [], pager: {}};
|
152
|
let result = {articles: [], pager: {}};
|
155
|
- let article = yield favoriteApi.favoriteArticleData(uid, udid, page, limit);
|
153
|
+ let articles = yield favoriteApi.favoriteArticleData(uid, udid, page, limit);
|
156
|
|
154
|
|
157
|
- if (!article.data && !article.data.data) {
|
|
|
158
|
- article.data.data.forEach((item, i)=> {
|
155
|
+ if (!articles.data && !articles.data.data) {
|
|
|
156
|
+ articles.data.data.forEach((item)=> {
|
159
|
result.articles.push({
|
157
|
result.articles.push({
|
160
|
id: item.id,
|
158
|
id: item.id,
|
161
|
name: item.title,
|
159
|
name: item.title,
|
|
@@ -165,11 +163,11 @@ const favoriteArticleList = (uid, udid, page, limit, type)=> { |
|
@@ -165,11 +163,11 @@ const favoriteArticleList = (uid, udid, page, limit, type)=> { |
165
|
});
|
163
|
});
|
166
|
});
|
164
|
});
|
167
|
|
165
|
|
168
|
- let total = article.data.total || 0;
|
|
|
169
|
- let pageTotal = article.data.totalPage || 0;
|
|
|
170
|
- let page = article.data.page || 0;
|
166
|
+ let total = articles.data.total || 0;
|
|
|
167
|
+ let pageTotal = articles.data.totalPage || 0;
|
|
|
168
|
+ let pageNum = articles.data.page || 0;
|
171
|
|
169
|
|
172
|
- result.pager = getPager(page, total, pageTotal);
|
170
|
+ result.pager = getPager(pageNum, total, pageTotal);
|
173
|
} else {
|
171
|
} else {
|
174
|
result.articles = {empty: '你尚未收藏任何文章!'};
|
172
|
result.articles = {empty: '你尚未收藏任何文章!'};
|
175
|
}
|
173
|
}
|
|
@@ -261,5 +259,5 @@ const getSortInfo = (categoryList, sort)=> { |
|
@@ -261,5 +259,5 @@ const getSortInfo = (categoryList, sort)=> { |
261
|
module.exports = {
|
259
|
module.exports = {
|
262
|
getFavoriteTabs,
|
260
|
getFavoriteTabs,
|
263
|
favoriteProductList,
|
261
|
favoriteProductList,
|
264
|
- favoriteArticleList
|
262
|
+ favoriteArticleListAsync
|
265
|
}; |
263
|
}; |