提交修改

This commit is contained in:
daihh
2022-07-22 17:36:03 +08:00
parent 41947348ce
commit 114df2ee90

View File

@@ -85,7 +85,7 @@
<span v-if="cinfo.type=='face-course'" class="course-type-title course-type">线下课</span>
<span v-if="cinfo.type=='project'" class="course-type-title course-type">学习项目</span>
</div>
<div :title="cinfo.name" class="course-title title-line-ellipsis" v-html="cinfo.name">
<div :title="cinfo.title" class="course-title title-line-ellipsis" v-html="cinfo.name">
</div>
<div class="course-author">
<div class="course-author-left" v-if="cinfo.teacher">
@@ -435,7 +435,7 @@ export default {
this.category = "";
this.categorySub = "";
}
this.searchTags.splice(index, 1);
if(i === 'type') {
@@ -512,6 +512,15 @@ export default {
this.course.pageIndex += 1;
this.search();
},
// 高亮搜索词
brightenKeyword(val, keyword) {
const Reg = new RegExp(keyword, 'i');
let res = '';
if (val) {
res = val.replace(Reg, `<span style="color: #3e7fff;">${keyword}</span>`);
return res;
}
},
async search() {
let that = this;
if (this.course.keyword) {
@@ -539,7 +548,7 @@ export default {
// if(this.course.pageIndex == 1) {
// this.courseList = [];
// }
let data = [];
let isTopList = [];
// 隐藏loadMore
this.moreState = 2;
@@ -548,12 +557,17 @@ export default {
.then(res => {
if (res.status == 200 && res.result.list.length > 0) {
this.totalPages = res.result.totalPages;
let courseIds = [];
// res.result.list.forEach(item => {
// courseIds.push(item.id);
// data.push(item);
// });
// data = res.result.list;
res.result.list.forEach(item => {
//转化标红显示
item.title=item.name;
if(that.course.keyword){
item.name=that.brightenKeyword(item.name,that.course.keyword);
}else{
item.name=item.name;
}
});
this.courseList.push(...res.result.list);
this.moreState = 1;
} else {
@@ -563,7 +577,7 @@ export default {
.catch(err => {
this.moreState = 3;
});
},
getTags() {
this.searchTags = [];
@@ -641,7 +655,7 @@ export default {
});
},
jumpRouter(item) {
console.log(item.type, "item.type");
//console.log(item.type, "item.type");
// return console.log(id,type,"fihkj1")
if (item.type == 20) {
//录播课