+
@@ -334,7 +313,7 @@ import {formatDate, formatUserNumber, toScore} from "@/utils/tools.js";
import apiSearchterm from "@/api/modules/searchterm.js";
import apiPlace from "@/api/phase2/place.js"
import {qualityCourseTimeMark, qualityPageList} from "@/api/phase2"
-
+import apiCourseTag from '@/api/modules/courseTag.js'
export default {
name: "index",
components: {
@@ -354,6 +333,41 @@ export default {
let list = [];
},
+ // 取消搜索条件标签展示
+ /*stagList() { //计算出选择的内容
+ let list = [];
+ if (this.keyword) {
+ list.push({
+ type: 0,
+ id: 'keyword',
+ name: this.keyword,
+ checked: true
+ })
+ }
+ this.oneList.forEach(one => {
+ var twoChildChecked = false;//是否有下级
+ one.children.forEach(two => {
+ if (two.checked) {
+ twoChildChecked = true;
+ }
+ var threeChildChecked = false;
+ two.children.forEach(three => {
+ if (three.checked) {
+ list.push(three);
+ threeChildChecked = true;
+ }
+ });
+ if (two.checked && !threeChildChecked) {
+ list.push(two);
+ }
+ });
+ if (one.checked && !twoChildChecked) {
+ list.push(one);
+ }
+ })
+ return list;
+ },*/
+
stagList() {
let list = [];
@@ -430,24 +444,6 @@ export default {
});
return !flag;
},
- // oneTagAll() {
- // let flag = this.oneList.some(item => {
- // return item.checked;
- // });
- // return !flag;
- // },
- // twoTagAll() {
- // let flag = this.twoList.some(item => {
- // return item.checked;
- // });
- // return !flag;
- // },
- // threeTagAll() {
- // let flag = this.threeList.some(item => {
- // return item.checked;
- // });
- // return !flag;
- // }
},
data() {
return {
@@ -515,7 +511,8 @@ export default {
searchRecords: [],
hotList: [],
totalPages: 1,
- localSessionKey: this.$xpage.constants.localCourseFiltersKey
+ localSessionKey: this.$xpage.constants.localCourseFiltersKey,
+ hotTagsList: [],
};
},
// 受众需要每次刷新
@@ -535,17 +532,6 @@ export default {
qualityCourseTimeMark().then(response=>{
this.years = response.data.result
})
- // let screenWidth = window.screen.availWidth;
- // if (screenWidth < 1280) {
- // this.course.pageSize = 9;
- // this.columns = 3;
- // } else if (screenWidth < 1600) {
- // this.course.pageSize = 12;
- // this.columns = 3;
- // } else if (screenWidth >= 1600) {
- // this.course.pageSize = 15;
- // this.columns = 3;
- // }
let el_top = document.querySelector("#searchbar");
let el_search = document.querySelector("#searchbar");
@@ -571,8 +557,6 @@ export default {
this.loadSysTypes();
this.getScoreList();
this.getHotList();
- // this.toCourseDetail(item);
- // this.orderChange(id);
//查询排行榜,页面打开只查询一次
let localKey = "user_" + this.userInfo.sysId + "_gids";
if (this.audiences.length == 0) {
@@ -591,30 +575,15 @@ export default {
}
this.search();
})
- // Promise.all([apiOldCourse.audience(this.userInfo.sysId),apiUserGroup.userGroupIds()]).then(rs=>{
- // //console.log(rs,'rs');
- // let aids=[];
- // if(rs[0].status==200){
- // aids.push(rs[0].result);
- // }
- // if(rs[1].status==200){
- // aids.push(rs[1].result);
- // }
- // this.audiences=aids;
- // sessionStorage.setItem(localKey,this.audiences);
- // this.search();
- // })
}
}
-
- //this.searchterm();//搜索词已经没有了
this.couresreso();//广告位
-
},
beforeDestroy() {
// window.removeEventListener("scroll", this.handleScroll);
},
methods: {
+
isAllHotTagsSelected() {
return !this.hotTagsList.some(tag => tag.checked);
},
@@ -630,6 +599,7 @@ export default {
this.searchData();
},
handleTagClick(item, list,type) {
+ console.info('切换标签 item = ' + item)
item.checked = !item.checked;
// 更新course.tags
@@ -727,15 +697,55 @@ export default {
}
},
//搜索条件
+ // 搜索条件
stagClose(tag, tagIndex) {
this.courseChosen = void 0;
tag.checked = false;
+
if (tag.type == 0) {
+ // 关键词类型
this.keyword = '';
+ } else if (tag.type == 1) {
+ // 课程类型
+ this.ctypeList.forEach(item => {
+ if (item.id == tag.id) {
+ item.checked = false;
+ }
+ });
+ } else if (tag.type == 14) {
+ // 热点标签类型
+ this.hotTagsList.forEach(item => {
+ if (item.id == tag.id) {
+ item.checked = false;
+ }
+ });
+ // 更新course.tags
+ const checkedHotTags = this.hotTagsList.filter(tag => tag.checked);
+ let tagIds = checkedHotTags.map(tag => tag.id).join(',');
+ this.course.tags = tagIds;
+ } else if (tag.type == 11 || tag.type == 12 || tag.type == 13) {
+ // 三级分类标签
+ this.oneList.forEach(one => {
+ if (one.id == tag.id) {
+ one.checked = false;
+ }
+ one.children.forEach(two => {
+ if (two.id == tag.id) {
+ two.checked = false;
+ }
+ two.children.forEach(three => {
+ if (three.id == tag.id) {
+ three.checked = false;
+ }
+ });
+ });
+ });
}
+
this.navTitle = []
this.searchData();
},
+
isTagMatched(tag) {
// 检查stagList中是否有匹配的标签
return this.stagList.some(searchTag =>
@@ -779,10 +789,23 @@ export default {
handleClearTags() {
//清空所有的条件
this.keyword = '';
- // 取消搜索条件标签展示
- // this.ctypeList.forEach(item => {
- // item.checked = false;
- // });
+
+ // 清除课程类型
+ this.ctypeList.forEach(item => {
+ item.checked = false;
+ });
+
+ // 清除热点标签
+ this.hotTagsList.forEach(item => {
+ item.checked = false;
+ });
+ // 清空course.tags
+ this.course.tags = '';
+
+ // 清除年份选择
+ this.yearChosen = [];
+
+ // 清除三级分类
this.oneList.forEach(one => {
one.checked = false;
one.children.forEach(two => {
@@ -792,7 +815,8 @@ export default {
})
})
});
- // 清除左侧被选中的内容
+
+ // 清除左侧被选中的内容
this.courseChosen = void 0;
this.twoList = [];
this.threeList = [];
@@ -801,6 +825,7 @@ export default {
sessionStorage.removeItem(this.localSessionKey)
this.searchData();
},
+
// 导航切换(录播课,线下课,学习项目)
handleTypeClick(item, list) {
// item.checked = !item.checked;
@@ -839,57 +864,6 @@ export default {
})
})
})
-
- // item.checked = !item.checked;
- //使用上面一行是可以多选,使用下面是单选
- // list.forEach(row => {
- // row.checked = false;
- // })
- // item.checked = true;
- // //以下是新的规则的修改,
- // if (!item.checked) {
- // //清空它下面的所有的中的
- // item.children.forEach(subItem => {
- // subItem.checked = false;
- // if (subItem.children) {
- // subItem.children.forEach(sub => {
- // sub.checked = false;
- // })
- // }
- // });
- // if (level == 1) {
- // this.twoList = [];
- // this.threeList = [];
- // }
- // if (level == 2) {
- // this.threeList = [];
- // }
- // this.searchData();
- // return;
- // }
-
- // let $this = this;
- // if (level == 1) { //一级的情况
- // this.twoList = [];
- // this.threeList = [];
- // let lastCheked = null;
- // item.children.forEach(two => {
- // $this.twoList.push(two);
- // if (two.checked) {
- // lastCheked = two;
- // }
- // });
- // if (lastCheked != null) {
- // $this.threeList = lastCheked.children;
- // item.children.forEach(three => {
- // });
- // }
- // } else if (level == 2) { //二级的情况
- // this.threeList = item.children;
- // } else if (level == 3) { //三级的情况
-
- // }
- //this.handleChangeTypes(item);
this.searchData();
},
// 无用
@@ -899,18 +873,6 @@ export default {
this.twoList = [];
this.threeList = [];
let $this = this;
- // this.oneList.forEach(one=>{
- // if(one.checked){
- // one.children.forEach(two=>{
- // $this.twoList.push(two);
- // if(two.checked){
- // two.children.forEach(three=>{
- // $this.threeList.push(three);
- // })
- // }
- // });
- // }
- // })
this.oneList.forEach(one => {
if (one.checked) {
one.children.forEach(two => {
@@ -941,15 +903,6 @@ export default {
checked: false
}
if (item.children) {
- //增加死数据
- // item.children.push({
- // type: 12,
- // id: item.id * (index + 200),
- // name: '线上品牌系列课程',
- // children: [],
- // checked: false,
- // newData: true
- // })
item.children.forEach(subItem => {
let newSubItem = {
type: 12,
@@ -1016,47 +969,16 @@ export default {
this.keyword = val;
this.searchData();
},
-
- // 滚动
- // handleScroll() {
- // if (this.courseList.length > 6) {
-
- // let innerHeight = document.querySelector("#couser-list-content").clientHeight;
- // let outerHeight = document.documentElement.clientHeight;
- // let scrollTop = document.documentElement.scrollTop;
- // let outerWidth = document.querySelector(".xcontent2-minor").clientWidth;
- // if (outerHeight + scrollTop + 350 >= innerHeight) {
- // if (this.moreState == 1 && this.course.pageIndex < 4) {
- // this.loadMore();
- // }
- // }
- // //console.log(this.course.pageIndex,'this.course.pageIndex');
- // //加此判断,是为了没有数据时的闪动问题
- // //if(this.course.pageIndex >1){
- // if (scrollTop > 1176) {
- // document.querySelector("#fixd-box").style.cssText =
- // "position: fixed;top: -882px;width:" + outerWidth + "px";
- // } else {
- // document.querySelector("#fixd-box").style.cssText = "position: static";
- // }
- // //}
- // }
- // },
-
- toNeedCourse() {// 上传
- // 需要先切换标签
- //this.$store.dispatch('SetCurIdentity',2);
- //this.$router.push('/need/course?open=new');
+ toNeedCourse() {
this.$refs.floatTools.toNeedCourse();
-
},
- searchData() {
+ searchData(type) {
this.course.pageIndex = 1;
this.noPageList = true; //判断接口是否还有数据
this.noDataList = true; //判断接口是否还有数据
this.courseList = [];
this.totalPages = 4;
- this.search();
+ this.search(type);
},
inputOn() {
this.$forceUpdate();
@@ -1216,17 +1138,12 @@ export default {
return list;
},
// 查询
- async search () {
- //
+ async search (type) {
if (this.searching) {
this.$message.warning("正在搜索中,请待搜索完成后再重新搜索");
return;
}
this.searching = true;
- //测试时间格式化
- // let s=1650973801;
- // var d = new Date(1650973801*1000);
- // console.log(formatDateByFmt(d,'yyyy-MM-dd hh:mm'),'data');
this.saveLocalFilters();
let that = this;
if (this.keyword) {
@@ -1237,7 +1154,6 @@ export default {
this.course.audiences = this.audiences.join(",");
}
//console.log(this.userInfo)
- //this.course.companyId=this.userInfo.companyId;
this.course.type = "";//不使用单查询了
this.course.types = "";
this.course.sysType1 = "";
@@ -1260,6 +1176,20 @@ export default {
that.course.sysType3 += item.id;
}
});
+ if (!type && type !== 1){
+ apiCourseTag.getHotTagList(that.course).then(rs => {
+ if (rs.status == 200) {
+ // 保留已选中标签的状态
+ const currentCheckedTags = this.hotTagsList.filter(tag => tag.checked);
+ this.hotTagsList = rs.result.map(tag => ({
+ ...tag,
+ checked: currentCheckedTags.some(checkedTag => checkedTag.id === tag.id)
+ }));
+ } else {
+ console.log(rs.message);
+ }
+ })
+ }
this.isFind = true;
this.course.device = 1;
@@ -1279,6 +1209,9 @@ export default {
params.pageNum = pageIndex
params.orderByType = orderField
params.courseSource = this.ctypeList.findIndex(e => e.checked)
+ if (params.courseSource === -1) {
+ params.courseSource = 0
+ }
this.yearChosen.length && (params.years = this.yearChosen)
params.courseName = this.keyword
delete params.userId
@@ -1291,44 +1224,8 @@ export default {
console.log(res.status)
if (res.status === 200) {
this.totalPages = res.data.result.pages;
- // res.result.list.forEach(item => {
- // if (item.startTime != '') {
- // item.startTime = formatDateByFmt(new Date(item.startTime * 1000), 'yyyy-MM-dd hh:mm')
- // //let time = item.startTime.split('-');
- // //item.startTime = `${time[0]}年${time[1]}月${time[2]}日`
- // }
- // //教师转化
- // if (item.teacher) {
- // item.teacher = item.teacher.split(',').filter(itemValue => itemValue !== 'BOE教师').join(',');
- // // if (dotIdx > 0) {
- // // item.teacher = item.teacher.substring(0, dotIdx);
- // // }
- // }
- // if (item.teacher && item.teacher == 'BOE教师') {
- // item.teacher = '';
- // }
- //
- // //转化标红显示
- // item.title = item.name;
- // if (that.course.keyword) {
- // item.name = that.brightenKeyword(item.name, that.course.keyword);
- // item.keywordsActive = that.brightenKeywords(item.keywordsList, that.course.keyword)
- // console.log(item.keywordsActive);
- // } else {
- // item.name = item.name;
- // }
- // });
const list = res.data.result.records ?? []
- // list.forEach(course=>{
- // const id = course.courseId
- //
- // apiCourse.getTeacherByCourseIDs([id]).then(res=>{
- // console.log(res, "ids res")
- // course.teacher = res.result[0].names[0]
- // console.log(`course.teacher`, course.teacher)
- // })
- // })
this.courseList = list
if (this.newData) {
@@ -1389,18 +1286,7 @@ export default {
this.moreState = 2;
});
},
- // showInApply() {
- // this.inapply.show = true;
- // },
- // pushEnter(type) {
- // this.type1.push(type);
- // },
- // deleteOut(type) {
- // this.type1 = this.type.filter(item => item != type);
- // },
- // chooseShow(type) {
- // return this.type1.some(item => item == type);
- // },
+
getAnkingData() {
apiCourse.ranking().then(res => {
if (res.status == 200) {
@@ -2205,7 +2091,7 @@ export default {
border-radius: 8px;
::v-deep .el-input {
- width: 420px;
+ //width: 420px;
height: 38px;
//margin-bottom: 13px;
@@ -2327,4 +2213,6 @@ export default {
.option-active {
color: #387DF7;
-}
+}
+
+