优化路由

zqqdev
liushaodong 5 years ago
parent 2b5727f5d3
commit 8d1e11fc87
  1. 106
      src/common/js/utils.js

@ -30,108 +30,14 @@ class Utils {
getRoutes(routes) { getRoutes(routes) {
this._filterRoutes(routes); this._filterRoutes(routes);
for (let parent of [...this.routes]) { for (let parent of [...this.routes]) {
// console.log(...this.routes) if (parent.name in this.curRoutes) {
switch (parent.name) { for (let children of this.curRoutes[parent.name]) {
case USERMANAGE: if (!routeList[children]) continue;
for (let children of this.curRoutes[USERMANAGE]) { parent.children.push(routeList[children]);
// console.log(routeList[children]) this._addDetail(children, parent);
parent.children.push(routeList[children]); }
this._addDetail(children, parent);
}
break;
case ORDERMANAGE:
for (let children of this.curRoutes[ORDERMANAGE]) {
parent.children.push(routeList[children]);
this._addDetail(children, parent);
}
break;
case MANAGE:
for (let children of this.curRoutes[MANAGE]) {
parent.children.push(routeList[children]);
this._addDetail(children, parent);
}
break;
case COST:
for (let children of this.curRoutes[COST]) {
parent.children.push(routeList[children]);
this._addDetail(children, parent);
}
break;
case CAPITAL:
for (let children of this.curRoutes[CAPITAL]) {
parent.children.push(routeList[children]);
this._addDetail(children, parent);
}
break;
case ASSETCOLLECTION:
for (let children of this.curRoutes[ASSETCOLLECTION]) {
parent.children.push(routeList[children]);
this._addDetail(children, parent);
}
break;
case CURRENCY:
for (let children of this.curRoutes[CURRENCY]) {
parent.children.push(routeList[children]);
this._addDetail(children, parent);
}
break;
case SYSTEM:
for (let children of this.curRoutes[SYSTEM]) {
parent.children.push(routeList[children]);
this._addDetail(children, parent);
}
break;
case LOG:
for (let children of this.curRoutes[LOG]) {
parent.children.push(routeList[children]);
this._addDetail(children, parent);
}
break;
case ACCOUNTMANAGE:
for (let children of this.curRoutes[ACCOUNTMANAGE]) {
parent.children.push(routeList[children]);
this._addDetail(children, parent);
}
break;
case OTC:
for (let children of this.curRoutes[OTC]) {
parent.children.push(routeList[children]);
this._addDetail(children, parent);
}
break;
case MATCH:
for (let children of this.curRoutes[MATCH]) {
parent.children.push(routeList[children]);
this._addDetail(children, parent);
}
break;
case BOT:
for (let children of this.curRoutes[BOT]) {
parent.children.push(routeList[children]);
this._addDetail(children, parent);
}
break;
case MATCHBOT:
for (let children of this.curRoutes[MATCHBOT]) {
parent.children.push(routeList[children]);
this._addDetail(children, parent);
}
break;
case MARKETUSER:
for (let children of this.curRoutes[MARKETUSER]) {
parent.children.push(routeList[children]);
this._addDetail(children, parent);
}
break;
case COMMISSION:
for (let children of this.curRoutes[COMMISSION]) {
parent.children.push(routeList[children]);
this._addDetail(children, parent);
}
break;
} }
} }
// console.log([...this.routes])
return [...this.routes]; return [...this.routes];
} }

Loading…
Cancel
Save