diff --git a/src/views/Index.vue b/src/views/Index.vue index 10370e6f..942ad5ed 100644 --- a/src/views/Index.vue +++ b/src/views/Index.vue @@ -109,7 +109,7 @@
- + 推荐案例 最热 @@ -122,9 +122,9 @@ -
-
- - +
@@ -472,20 +468,44 @@ export default { let userIds = []; res.result.forEach(item => { item.authorInfo = { aid: '', name: '', orgInfo: '', avatar: '', code: '',sex:null }; - + if (item.authorId && item.authorId != '') { userIds.push(item.authorId); } }); this.caseList.list = res.result; - this.loadAuthorInfo(res.result, userIds); + this.loadCaseAuthorInfo(res.result, userIds); } - this.caseList.list = res.result; + // this.caseList.list = res.result; } else { console.log('加载案例错误:' + res.error); } }); }, + loadCaseAuthorInfo(list, ids) { + //加载作者信息,头像,机构信息 + if (ids.length == 0) { + return; + } + const noReapetIds = [...new Set(ids)]; + apiUser.getByIds(ids).then(res => { + if (res.status == 200) { + list.forEach((item, index) => { + res.result.some(author => { + if (author.aid == item.authorId) { + item.authorInfo = author; + return true; + } else { + return false; + } + }); + }); + } else { + console.log('加载用户信息失败:' + res.error); + //this.$message.error(res.message); + } + }); + }, getArticleData() { let $this = this; this.articleList.list = []; @@ -678,7 +698,7 @@ export default { width: 100%; border-bottom: 1px solid #f3f3f3; } - + } } // .qa-dai{ diff --git a/src/views/portal/case/Index.vue b/src/views/portal/case/Index.vue index bbb0a9c4..52e1d856 100644 --- a/src/views/portal/case/Index.vue +++ b/src/views/portal/case/Index.vue @@ -93,29 +93,19 @@
-
- -
- - + +
+ +
- {{displayAll(item)}} {{item.isAll?'收起':'展开'}}
- - -
-
@@ -238,24 +228,31 @@