修改课程分类缓存的问题

This commit is contained in:
nisen
2023-10-27 18:02:19 +08:00
parent 5ef919875d
commit e1204317b7

View File

@@ -405,15 +405,51 @@ export default {
this.getResOwnerTree().then(rs=>{
this.resOwnerListMap=rs;
});
this.getSysTypeTree().then(rs=>{
this.sysTypeListMap=rs;
})
// 取消全局课程分类
// this.getSysTypeTree().then(rs=>{
// this.sysTypeListMap=rs;
// })
// 新增的获取内容分类
this.getCourseList();
//已经加载tree的情况下不需要再单独的加载一次
this.loadResOwners();
this.loadSysTypes();
},
methods: {
getCourseList(){
// this.getSysTypeTree().then(rs => {
// this.sysTypeListMap = rs;
// console.log(rs,'您好啊好好');
// });
apiType.tree(1).then(res=>{
if(res.status === 200) {
sessionStorage.setItem('sysTypeTree',JSON.stringify(res.result));
this.$store.commit('sysType/setSysTypeTree', res.result);
this.sysTypeListMap = res.result;
//转化为map放到状态中
let map=new Map();
res.result.forEach(item=>{
map.set(item.id, item.name);
if(item.children && item.children!=''){
item.children.forEach(child=>{
map.set(child.id, child.name);
if(child.children && child.children!=''){
child.children.forEach(last=>{
map.set(last.id, last.name);
})
}
})
}
});
this.$store.commit('sysType/setSysTypeMap', map);
} else {
// reject('资源归属获取失败!');
}
})
},
showStudent(row){
//出现学员管理
window.parent.openSelectStu(row);