提交修改

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=='face-course'" class="course-type-title course-type">线下课</span>
<span v-if="cinfo.type=='project'" class="course-type-title course-type">学习项目</span> <span v-if="cinfo.type=='project'" class="course-type-title course-type">学习项目</span>
</div> </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>
<div class="course-author"> <div class="course-author">
<div class="course-author-left" v-if="cinfo.teacher"> <div class="course-author-left" v-if="cinfo.teacher">
@@ -512,6 +512,15 @@ export default {
this.course.pageIndex += 1; this.course.pageIndex += 1;
this.search(); 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() { async search() {
let that = this; let that = this;
if (this.course.keyword) { if (this.course.keyword) {
@@ -539,7 +548,7 @@ export default {
// if(this.course.pageIndex == 1) { // if(this.course.pageIndex == 1) {
// this.courseList = []; // this.courseList = [];
// } // }
let data = [];
let isTopList = []; let isTopList = [];
// 隐藏loadMore // 隐藏loadMore
this.moreState = 2; this.moreState = 2;
@@ -548,12 +557,17 @@ export default {
.then(res => { .then(res => {
if (res.status == 200 && res.result.list.length > 0) { if (res.status == 200 && res.result.list.length > 0) {
this.totalPages = res.result.totalPages; this.totalPages = res.result.totalPages;
let courseIds = []; res.result.list.forEach(item => {
// res.result.list.forEach(item => { //转化标红显示
// courseIds.push(item.id); item.title=item.name;
// data.push(item); if(that.course.keyword){
// }); item.name=that.brightenKeyword(item.name,that.course.keyword);
// data = res.result.list; }else{
item.name=item.name;
}
});
this.courseList.push(...res.result.list); this.courseList.push(...res.result.list);
this.moreState = 1; this.moreState = 1;
} else { } else {
@@ -641,7 +655,7 @@ export default {
}); });
}, },
jumpRouter(item) { jumpRouter(item) {
console.log(item.type, "item.type"); //console.log(item.type, "item.type");
// return console.log(id,type,"fihkj1") // return console.log(id,type,"fihkj1")
if (item.type == 20) { if (item.type == 20) {
//录播课 //录播课