我的收藏接口替换

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

@@ -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,10 +103,9 @@
<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
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="caseList.pageIndex"
@@ -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.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);
}