我的收藏接口替换

This commit is contained in:
zhaofang
2022-06-09 12:08:16 +08:00
parent abf4c9ec6d
commit 7a62d6df51
7 changed files with 54 additions and 34 deletions

View File

@@ -7,11 +7,11 @@
<div class="article-info-title one-line-ellipsis">
{{ item.title }}
</div>
<div class="article-info-summary two-line-ellipsis">{{ item.summary }}</div>
<div class="article-info-summary two-line-ellipsis">{{ item.summary || item.content}}</div>
<div class="article-info-tools">
<authorInfo :avatar="item.avatar" :name="item.name" :info="item.orgInfo" :sex="item.sex"> </authorInfo>
<span>发布时间{{ item.sysCreateTime | timeFilter }}</span>
<span>收藏时间{{ item.time | timeFilter }}</span>
<span>发布时间{{ item.sysCreateTime || item.publishTime | timeFilter }}</span>
<span>收藏时间{{ item.time || item.favoritesTime | timeFilter }}</span>
<el-button @click.stop="delItem(item)" type="text" style="color: #8590A6" icon="el-icon-remove">取消收藏</el-button>
</div>
</div>
@@ -46,9 +46,7 @@ export default {
},
methods: {
jump(item) {
// let routeData = this.$router.resolve({ path: '/article/detail?id=' + item.articleId }); // , query: { id: 1 }
// window.open(routeData.href, '_blank');
this.$router.push({path:'/article/detail',query:{id:item.articleId}})
this.$router.push({path:'/article/detail',query:{id:item.articleId || item.id}})
},
delItem(item) {
this.$confirm('您确定要取消收藏所选文章吗?', '删除提示', {
@@ -61,10 +59,10 @@ export default {
})
.catch(() => {});
},
jump(item){
this.$router.push({path:'/article/detail',query:{id:item.articleId}})
// window.open('/article/detail?id=' + item.articleId)
}
// jump(item){
// this.$router.push({path:'/article/detail',query:{id:item.articleId}})
// // window.open('/article/detail?id=' + item.articleId)
// }
}
};
</script>

View File

@@ -67,7 +67,6 @@ export default {
},
},
created() {
console.log(this.items)
},
}

View File

@@ -8,17 +8,16 @@
</div>
<div class="article-info-date">
<el-button @click="delItem(item)" type="text" icon="el-icon-remove">取消收藏</el-button>
<el-button @click="delItem(item)" type="text" style="color: #8590A6" icon="el-icon-remove">取消收藏</el-button>
</div>
</div>
<div class="article-info-summary three-line-ellipsis">
<router-link :to="'/case/detail?id='+item.cases.id" target="_blank" > {{item.cases.summary}}</router-link>
</div>
<div class="article-info-tools">
<authorInfo :avatar="item.avatar" :name="item.name" :info="item.orgInfo"></authorInfo>
<span>发布时间{{ item.cases.sysCreateTime | timeFilter }}</span>
<span>收藏时间{{ item.time | timeFilter }}</span>
<span style="margin-top:2px">发布时间{{ item.cases.sysCreateTime || item.publishTime | timeFilter }}</span>
<span style="margin-top:2px">收藏时间{{ item.time || item.favoritesTime | timeFilter }}</span>
<!-- <interactBar :type="0" :data="item.cases" :shares="false" :views="false"></interactBar> -->
</div>
</div>

View File

@@ -12,7 +12,7 @@
<span>{{ item.title }}</span>
</div>
<div class="uc-course-text">讲师{{ item.authorName}}</div>
<div class="uc-course-text">收藏日期{{ item.time }}</div>
<div class="uc-course-text">收藏日期{{ item.time || item.favoritesTime}}</div>
</div>
<div class="flex-between">
<el-button v-if="remove" @click.stop="delItem(item)" type="text" icon="el-icon-remove" style="color:#8590A6;font-size:14px;">
@@ -75,7 +75,12 @@ export default {
coudetail(item) {
// let routeData = this.$router.resolve({ path: '/course/detail?id=' + item.objId });
// window.open(routeData.href, '_blank');
this.$router.push({path:'/course/detail',query:{id:item.objId}})
if(item.contentType == '20') {
this.$router.push({path:'/course/detail',query:{id:item.objId || item.id}})
} else {
this.$router.push({path:'/course/micro',query:{id:item.objId || item.id}})
}
},
delItem(item) {
this.$confirm('您确定要删除所选收藏吗?', '删除提示', {

View File

@@ -16,8 +16,8 @@
</div>
<div class="article-info-tools">
<authorInfo :avatar="item.avatar" :name="item.name" :info="item.orgInfo" :sex="item.sex"></authorInfo>
<span>发布时间{{ item.question.sysCreateTime | timeFilter }}</span>
<span>收藏时间{{ item.time | timeFilter }}</span>
<span>发布时间{{ item.question.sysCreateTime || item.publishTime | timeFilter }}</span>
<span>收藏时间{{ item.time || item.favoritesTime | timeFilter }}</span>
<el-button @click.stop="delCollectItem(item)" type="text" icon="el-icon-remove" style="color:#8590A6">取消收藏</el-button>
</div>
</div>

View File

@@ -323,7 +323,7 @@ export default {
if(item.type == 3){
item.cases = {title:'',summary:''};
item.cases.title=item.title;
item.cases.title=item.summary;
item.cases.summary=item.content;
item.cases.id=item.id;
}
});

View File

@@ -35,9 +35,10 @@
</el-tab-pane> -->
<el-tab-pane label="全部" name="all">
<div v-for="(item, index) in dataList.list">
<course-items v-if="item.objType==1" :items="[item]" @confirm="confirm"></course-items>
<article-items v-if="item.objType==2" @confirm="confirm" :items="[item]"></article-items>
<qa-items v-if="item.objType==4" :items="[item]" @confirm="confirm" :collect="true" :share="false" :remove="false" :edit="false"></qa-items>
<course-items v-if="item.type==1" :items="[item]" @confirm="confirm"></course-items>
<case-items v-if="item.type==3" @confirm="confirm" :items="[item]"></case-items>
<article-items v-if="item.type==2" @confirm="confirm" :items="[item]"></article-items>
<qa-items v-if="item.type==4" :items="[item]" @confirm="confirm" :collect="true" :share="false" :remove="false" :edit="false"></qa-items>
</div>
<!-- v-if="courseList.count>courseList.pageSize" -->
<div v-if="dataList.list.length > 0" style="text-align: center;margin-top:57px">
@@ -102,8 +103,7 @@
<div>
<case-items @confirm="confirm" :items="caseList.list"></case-items>
</div>
<div style="text-align: center;margin-top:50px;" v-if="caseList.list.length > 0
">
<div style="text-align: center;margin-top:50px;" v-if="caseList.list.length > 0">
<el-pagination
background
@size-change="handleSizeChange"
@@ -285,6 +285,7 @@ export default {
this.articleList.pageIndex = 1;
this.courseList.pageIndex = 1;
this.dataList.pageIndex = 1;
this.caseList.pageIndex = 1;
this.isSearh = true;
if (this.tabName == 'qa') {
this.findQa();
@@ -307,6 +308,7 @@ export default {
this.articleList.pageIndex = 1;
this.courseList.pageIndex = 1;
this.dataList.pageIndex = 1;
this.caseList.pageIndex = 1;
this.keyword = '';
this.isRead = '';
this.courseList.type = '';
@@ -316,7 +318,6 @@ export default {
},
//tab切换
changeTab(tab) {
if (tab.name == 'qa') {
this.findQa();
}
@@ -385,7 +386,7 @@ export default {
pageSize: this.dataList.pageSize,
keyword: this.keyword.trim()
};
apiFavorite.findAll(query).then(res=>{
apiFavorite.queryAll(query).then(res=>{
if(res.status==200){
this.dataList.count=res.result.count
if(res.result.length!=0){
@@ -395,7 +396,21 @@ export default {
item.name=''
item.orgInfo=''
item.sex= null
courseIds.push(item.objId);
courseIds.push(item.id);
if(item.type == 4) {
item.question = {isResolve:false,title:'',content:'',bestAnswer:''};
item.question.isResolve=item.isResolve;
item.question.title=item.title;
item.question.content=item.content;
item.question.bestAnswer=item.bestAnswer;
item.question.id=item.id;
}
if(item.type == 3){
item.cases = {title:'',summary:''};
item.cases.title=item.title;
item.cases.summary=item.content;
item.cases.id=item.id;
}
})
this.loadCouserTeacher(res.result.list,courseIds);
this.dataList.list = res.result.list;
@@ -415,6 +430,9 @@ export default {
if(item.objType==4){
ids.push(item.question.sysCreateAid)
}
if(item.type){
ids.push(item.authorId)
}
})
let noRepeatIds = [...new Set(ids)];
apiUser.getByIds(noRepeatIds).then(res => {
@@ -431,6 +449,11 @@ export default {
return author.aid == item.question.sysCreateAid;
})
}
if(item.type != 1){
obj=res.result.find(author=>{
return author.aid == item.authorId;
})
}
item=Object.assign(item, obj);
})
// this.dataList.list = list.map(item => {
@@ -494,16 +517,12 @@ export default {
findCase() {
let { pageIndex, pageSize } = this.caseList;
let query = { pageIndex, pageSize };
// if (this.caseList.cases.title) {
query.keyword = this.keyword.trim();
// }
query.resolve = this.isRead;
apiFavorite.casePageList(query).then(res => {
if (res.status == 200) {
this.caseList.count = res.result.count;
this.caseList.list = res.result.list;
console.log(this.caseList)
if (this.caseList.list.length != 0) {
this.getCaseUserData(res.result.list);
}