我的收藏接口替换

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

View File

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

View File

@@ -8,17 +8,16 @@
</div> </div>
<div class="article-info-date"> <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> </div>
<div class="article-info-summary three-line-ellipsis"> <div class="article-info-summary three-line-ellipsis">
<router-link :to="'/case/detail?id='+item.cases.id" target="_blank" > {{item.cases.summary}}</router-link> <router-link :to="'/case/detail?id='+item.cases.id" target="_blank" > {{item.cases.summary}}</router-link>
</div> </div>
<div class="article-info-tools"> <div class="article-info-tools">
<authorInfo :avatar="item.avatar" :name="item.name" :info="item.orgInfo"></authorInfo> <authorInfo :avatar="item.avatar" :name="item.name" :info="item.orgInfo"></authorInfo>
<span>发布时间{{ item.cases.sysCreateTime | timeFilter }}</span> <span style="margin-top:2px">发布时间{{ item.cases.sysCreateTime || item.publishTime | timeFilter }}</span>
<span>收藏时间{{ item.time | timeFilter }}</span> <span style="margin-top:2px">收藏时间{{ item.time || item.favoritesTime | timeFilter }}</span>
<!-- <interactBar :type="0" :data="item.cases" :shares="false" :views="false"></interactBar> --> <!-- <interactBar :type="0" :data="item.cases" :shares="false" :views="false"></interactBar> -->
</div> </div>
</div> </div>

View File

@@ -12,7 +12,7 @@
<span>{{ item.title }}</span> <span>{{ item.title }}</span>
</div> </div>
<div class="uc-course-text">讲师{{ item.authorName}}</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>
<div class="flex-between"> <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;"> <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) { coudetail(item) {
// let routeData = this.$router.resolve({ path: '/course/detail?id=' + item.objId }); // let routeData = this.$router.resolve({ path: '/course/detail?id=' + item.objId });
// window.open(routeData.href, '_blank'); // 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) { delItem(item) {
this.$confirm('您确定要删除所选收藏吗?', '删除提示', { this.$confirm('您确定要删除所选收藏吗?', '删除提示', {

View File

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

View File

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

View File

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