我分享的全部

This commit is contained in:
lmj
2022-06-09 11:09:41 +08:00
parent ad4f0e89c4
commit 81c3be6de0

View File

@@ -21,10 +21,38 @@
<el-button type="primary" @click="resData" icon="el-icon-refresh-right" style="padding: 10px 15px;">重置</el-button>
</el-col>
</el-row>
<el-tabs v-model="tabName" @tab-click="changeTab" style="margin-top:14px">
<!-- 全部 -->
<el-tab-pane label="全部" name="all">
<div v-for="(item, index) in dataList.list">
<course-items type="toMy" v-if="item.type==1" :items="[item]" @confirm="confirm"></course-items>
<case-items type="toMy" v-if="item.type==3" :items="[item]" @confirm="confirm" ></case-items>
<article-items type="toMy" v-if="item.type==2" @confirm="confirm" :items="[item]"></article-items>
<qa-items type="toMy" 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 style="text-align: center;margin-top:57px">
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="dataList.pageIndex"
:page-sizes="[10, 20, 30, 40]"
:page-size="dataList.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="dataList.count"
></el-pagination>
</div>
</el-tab-pane>
<el-tab-pane label="课程" name="course">
<div style="min-height: 500px;">
<course-items @confirm="confirm" :items="courseList.list"></course-items>
<course-items @confirm="confirm" type="toMy" :items="courseList.list"></course-items>
<!-- v-if="courseList.count>courseList.pageSize" -->
<div v-if="courseList.list.length > 0" style="text-align: center;margin-top:57px">
<el-pagination
@@ -50,7 +78,7 @@
</el-tab-pane>
<el-tab-pane label="案例" name="case">
<div style="min-height: 500px;">
<case-items @confirm="confirm" :items="caseList.list"></case-items>
<case-items @confirm="confirm" type="toMy" :items="caseList.list"></case-items>
<div v-if="caseList.list.length > 0" style="text-align: center;margin-top:57px;">
<el-pagination
background
@@ -73,7 +101,7 @@
</el-tab-pane>
<el-tab-pane label="文章" name="article">
<div style="min-height: 500px;">
<article-items @confirm="confirm" :items="articleList.list"></article-items>
<article-items @confirm="confirm" type="toMy" :items="articleList.list"></article-items>
<!-- v-if="articleList.count>articleList.pageSize" -->
<div v-if="articleList.list.length > 0" style="text-align: center;margin-top:57px;">
<el-pagination
@@ -97,7 +125,7 @@
</el-tab-pane>
<el-tab-pane label="问答" name="qa">
<div>
<qa-items @confirm="confirm" :items="qaList.list"></qa-items>
<qa-items @confirm="confirm" type="toMy" :items="qaList.list"></qa-items>
<!-- v-if="qaList.count>qaList.pageSize" -->
<div v-if="qaList.list.length > 0" style="text-align: center;margin-top:57px;">
<el-pagination
@@ -139,7 +167,7 @@
data(){
return {
isRead: '',
tabName:'course',
tabName:'all',
keyword:'',
courseIndex:null,
qaIndex:null,
@@ -168,10 +196,50 @@
count: 0,
list: []
},
dataList: {
pageIndex: 1,
pageSize: 10,
keyword: '',
count: 0,
list: []
},
isSearh:false,
}
},
methods:{
findAll(){
let { pageIndex, pageSize } = this.dataList;
let query = { pageIndex, pageSize, keyword: this.keyword, isRead: this.isRead };
apiShares.findMeShare(query).then(res=>{
if(res.status == 200){
console.log(res);
this.dataList.count = res.result.count;
res.result.list.forEach(item => {
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.title=item.summary;
item.cases.id=item.id;
}
});
this.dataList.list = res.result.list;
}else {
this.$message.error(res.message);
}
})
},
queryData(){
this.qaList.pageIndex = 1;
this.articleList.pageIndex = 1;
@@ -189,6 +257,9 @@
if (this.tabName == 'course') {
this.findCourse();
}
if (this.tabName == 'all') {
this.findAll();
}
},
resData() {
@@ -200,20 +271,21 @@
this.queryData();
this.isSearh = false;
},
changeIndex(value){
if(this.tabName=='qa'){
this.qaIndex=value
this.findQa();
}
if(this.tabName=='article'){
this.articleIndex=value
this.findArticle();
}
if(this.tabName=='course'){
this.courseIndex=value
this.findCourse();
}
},
// changeIndex(value){
// if(this.tabName=='qa'){
// this.qaIndex=value
// this.findQa();
// }
// if(this.tabName=='article'){
// this.articleIndex=value
// this.findArticle();
// }
// if(this.tabName=='course'){
// this.courseIndex=value
// this.findCourse();
// }
// },
changeTab(tab) {
if (tab.name == 'qa') {
this.findQa();
@@ -228,6 +300,9 @@
if (tab.name == 'case') {
this.findCase();
}
if (tab.name == 'all') {
this.findAll();
}
},
//分页点击事件
handleSizeChange(value) {
@@ -247,6 +322,10 @@
this.caseList.pageSize = value;
this.findCase();
}
if (this.tabName == 'all') {
this.dataList.pageSize = value;
this.findAll()
}
},
//分页点击事件
handleCurrentChange(value) {
@@ -266,6 +345,10 @@
this.caseList.pageIndex = value;
this.findCase();
}
if (this.tabName == 'all') {
this.dataList.pageIndex = value;
this.findAll();
}
},
// 案例数据查询
findCase() {
@@ -397,6 +480,10 @@
if (this.tabName == 'course') {
this.findCourse();
}
if (this.tabName == 'all') {
this.findAll();
}
},
}
</script>