mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-21 00:36:46 +08:00
存放课程分类id集合map
This commit is contained in:
16
src/main.js
16
src/main.js
@@ -85,6 +85,22 @@ const initDictTree = (key) => {
|
||||
(res) => {
|
||||
console.log(res.data.result,'课程分类接口')
|
||||
store.commit("SET_DICT", {key, data: res.data.result});
|
||||
//转化为map放到状态中
|
||||
let map=new Map();
|
||||
res.data.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);
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
store.commit("SET_SYSTYPEMAP", map);
|
||||
},
|
||||
(err) => {
|
||||
message.error(err);
|
||||
|
||||
Reference in New Issue
Block a user