mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-11 11:56:44 +08:00
修改课程分类缓存问题
This commit is contained in:
@@ -17,15 +17,15 @@ const mutations={
|
|||||||
const actions={
|
const actions={
|
||||||
getSysTypeTree({commit}) {
|
getSysTypeTree({commit}) {
|
||||||
return new Promise((resolve,reject)=>{
|
return new Promise((resolve,reject)=>{
|
||||||
if(state.sysTypeTree.length>0){
|
// if(state.sysTypeTree.length>0){
|
||||||
resolve(state.sysTypeTree);
|
// resolve(state.sysTypeTree);
|
||||||
}else{
|
// }else{
|
||||||
let hasData = sessionStorage.getItem('sysTypeTree');
|
// let hasData = sessionStorage.getItem('sysTypeTree');
|
||||||
if(hasData){
|
// if(hasData){
|
||||||
let treeData = JSON.parse(hasData);
|
// let treeData = JSON.parse(hasData);
|
||||||
commit('setSysTypeTree', treeData);
|
// commit('setSysTypeTree', treeData);
|
||||||
resolve(treeData);
|
// resolve(treeData);
|
||||||
}else{
|
// }else{
|
||||||
apiType.tree(1).then(res=>{
|
apiType.tree(1).then(res=>{
|
||||||
if(res.status === 200) {
|
if(res.status === 200) {
|
||||||
sessionStorage.setItem('sysTypeTree',JSON.stringify(res.result));
|
sessionStorage.setItem('sysTypeTree',JSON.stringify(res.result));
|
||||||
@@ -51,8 +51,8 @@ const mutations={
|
|||||||
reject('资源归属获取失败!');
|
reject('资源归属获取失败!');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
loadSysTypes(context){
|
loadSysTypes(context){
|
||||||
|
|||||||
@@ -406,50 +406,15 @@ export default {
|
|||||||
this.resOwnerListMap=rs;
|
this.resOwnerListMap=rs;
|
||||||
});
|
});
|
||||||
// 取消全局课程分类
|
// 取消全局课程分类
|
||||||
// this.getSysTypeTree().then(rs=>{
|
this.getSysTypeTree().then(rs=>{
|
||||||
// this.sysTypeListMap=rs;
|
this.sysTypeListMap=rs;
|
||||||
// })
|
})
|
||||||
// 新增的获取内容分类
|
|
||||||
this.getCourseList();
|
|
||||||
//已经加载tree的情况下,不需要再单独的加载一次
|
//已经加载tree的情况下,不需要再单独的加载一次
|
||||||
this.loadResOwners();
|
this.loadResOwners();
|
||||||
this.loadSysTypes();
|
this.loadSysTypes();
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
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){
|
showStudent(row){
|
||||||
//出现学员管理
|
//出现学员管理
|
||||||
window.parent.openSelectStu(row);
|
window.parent.openSelectStu(row);
|
||||||
|
|||||||
Reference in New Issue
Block a user