From 8d1e11fc8777eb7cae5c48fb4970efa59d595245 Mon Sep 17 00:00:00 2001 From: liushaodong Date: Fri, 8 Nov 2019 17:55:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/js/utils.js | 106 +++-------------------------------------- 1 file changed, 6 insertions(+), 100 deletions(-) diff --git a/src/common/js/utils.js b/src/common/js/utils.js index 845a83d..98d36a7 100644 --- a/src/common/js/utils.js +++ b/src/common/js/utils.js @@ -30,108 +30,14 @@ class Utils { getRoutes(routes) { this._filterRoutes(routes); for (let parent of [...this.routes]) { - // console.log(...this.routes) - switch (parent.name) { - case USERMANAGE: - for (let children of this.curRoutes[USERMANAGE]) { - // console.log(routeList[children]) - 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; + if (parent.name in this.curRoutes) { + for (let children of this.curRoutes[parent.name]) { + if (!routeList[children]) continue; + parent.children.push(routeList[children]); + this._addDetail(children, parent); + } } } - // console.log([...this.routes]) return [...this.routes]; }