This commit is contained in:
daihh
2022-06-08 17:27:07 +08:00
2 changed files with 68 additions and 14 deletions

View File

@@ -29,7 +29,7 @@
<el-input v-show="!hideSearch" placeholder="请输入关键词搜索" style="width: 260px;" @keyup.enter.native="searchJump()" clearable maxlength="20" v-model="keyword" class="input-with-select"> <el-input v-show="!hideSearch" placeholder="请输入关键词搜索" style="width: 260px;" @keyup.enter.native="searchJump()" clearable maxlength="20" v-model="keyword" class="input-with-select">
<el-select v-if="current == 'index'" v-model="findType" style="width: 75px;" slot="prepend" placeholder="请选择"> <el-select v-if="current == 'index'" v-model="findType" style="width: 75px;" slot="prepend" placeholder="请选择">
<el-option label="课程" value="1"></el-option> <el-option label="课程" value="1"></el-option>
<!-- <el-option label="案例" value="2"></el-option> --> <el-option label="案例" value="2"></el-option>
<el-option label="文章" value="3"></el-option> <el-option label="文章" value="3"></el-option>
<el-option label="问答" value="4"></el-option> <el-option label="问答" value="4"></el-option>
<!-- <el-option label="专区" value="5"></el-option> --> <!-- <el-option label="专区" value="5"></el-option> -->

View File

@@ -18,13 +18,14 @@
</el-row> </el-row>
<el-tabs v-model="tabName" @tab-click="changeTab" style="margin-top:14px"> <el-tabs v-model="tabName" @tab-click="changeTab" style="margin-top:14px">
<!-- 全部 --> <!-- 全部 -->
<!-- <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 type="toMy" 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 type="toMy" v-if="item.type==3" :items="[item]" @confirm="confirm" ></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 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> </div>
v-if="courseList.count>courseList.pageSize" <!-- v-if="courseList.count>courseList.pageSize" -->
<div style="text-align: center;margin-top:57px"> <div style="text-align: center;margin-top:57px">
<el-pagination <el-pagination
background background
@@ -37,9 +38,7 @@
:total="dataList.count" :total="dataList.count"
></el-pagination> ></el-pagination>
</div> </div>
</el-tab-pane> --> </el-tab-pane>
<el-tab-pane label="课程" name="course"> <el-tab-pane label="课程" name="course">
<div style="min-height: 500px;"> <div style="min-height: 500px;">
<course-items :keyword="keyword" type="toMy" @confirm="confirm" :items="courseList.list"></course-items> <course-items :keyword="keyword" type="toMy" @confirm="confirm" :items="courseList.list"></course-items>
@@ -155,7 +154,7 @@ export default {
return { return {
isSearh:false, isSearh:false,
isRead: '', isRead: '',
tabName: 'course', tabName: 'all',
keyword: '', keyword: '',
courseIndex: null, courseIndex: null,
qaIndex: null, qaIndex: null,
@@ -198,6 +197,7 @@ export default {
this.qaList.pageIndex = 1; this.qaList.pageIndex = 1;
this.articleList.pageIndex = 1; this.articleList.pageIndex = 1;
this.courseList.pageIndex = 1; this.courseList.pageIndex = 1;
this.dataList.pageIndex = 1;
this.isSearh= true; this.isSearh= true;
if (this.tabName == 'qa') { if (this.tabName == 'qa') {
this.findQa(); this.findQa();
@@ -211,6 +211,9 @@ export default {
if (this.tabName == 'case') { if (this.tabName == 'case') {
this.findCase(); this.findCase();
} }
if (this.tabName == 'all') {
this.findAll();
}
}, },
resData() { resData() {
@@ -219,6 +222,7 @@ export default {
this.qaList.pageIndex = 1; this.qaList.pageIndex = 1;
this.articleList.pageIndex = 1; this.articleList.pageIndex = 1;
this.courseList.pageIndex = 1; this.courseList.pageIndex = 1;
this.dataList.pageIndex = 1;
this.queryData(); this.queryData();
this.isSearh= false; this.isSearh= false;
}, },
@@ -249,6 +253,9 @@ export default {
if (tab.name == 'case') { if (tab.name == 'case') {
this.findCase(); this.findCase();
} }
if (tab.name == 'all') {
this.findAll();
}
}, },
//分页点击事件 //分页点击事件
handleSizeChange(value) { handleSizeChange(value) {
@@ -268,6 +275,10 @@ export default {
this.caseList.pageSize = value; this.caseList.pageSize = value;
this.findCase() this.findCase()
} }
if (this.tabName == 'all') {
this.dataList.pageSize = value;
this.findAll()
}
}, },
//分页点击事件 //分页点击事件
handleCurrentChange(value) { handleCurrentChange(value) {
@@ -287,8 +298,39 @@ export default {
this.caseList.pageIndex = value; this.caseList.pageIndex = value;
this.findCase(); this.findCase();
} }
if (this.tabName == 'all') {
this.dataList.pageIndex = value;
this.findAll();
}
}, },
findAll(){
let { pageIndex, pageSize } = this.dataList;
let query = { pageIndex, pageSize, keyword: this.keyword, isRead: this.isRead };
apiShares.findShareMe(query).then(res=>{
if(res.status == 200) {
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;
}
if(item.type == 3){
item.cases = {title:'',summary:''};
item.cases.title=item.title;
item.cases.title=item.summary;
}
});
this.dataList.list = res.result.list;
} else {
this.$message.error(res.message);
}
})
},
// 案例 // 案例
findCase(){ findCase(){
let { pageIndex, pageSize } = this.caseList; let { pageIndex, pageSize } = this.caseList;
@@ -396,6 +438,12 @@ export default {
if (this.tabName == 'course') { if (this.tabName == 'course') {
this.findCourse(); this.findCourse();
} }
if (this.tabName == 'case') {
this.findCase();
}
if (this.tabName == 'all') {
this.findAll();
}
} }
}, },
mounted() { mounted() {
@@ -408,6 +456,12 @@ export default {
if (this.tabName == 'course') { if (this.tabName == 'course') {
this.findCourse(); this.findCourse();
} }
if (this.tabName == 'case') {
this.findCase();
}
if (this.tabName == 'all') {
this.findAll();
}
} }
}; };