Commit 4ed15565 authored by 何虹's avatar 何虹 💬

统一模块化

parent 9623badd
...@@ -7,7 +7,8 @@ import System from './packages/modules/system' ...@@ -7,7 +7,8 @@ import System from './packages/modules/system'
import WebQueryClient from './packages/modules/webQueryClient' import WebQueryClient from './packages/modules/webQueryClient'
import Ref from './packages/modules/ref' import Ref from './packages/modules/ref'
class HttpClient { class HttpClient {
constructor(axios){ constructor(axios) {
this.axios = axios
const root = new Root(axios) const root = new Root(axios)
const restful = new Restful(root) const restful = new Restful(root)
const webQueryClient = new WebQueryClient(root) const webQueryClient = new WebQueryClient(root)
...@@ -15,19 +16,19 @@ class HttpClient { ...@@ -15,19 +16,19 @@ class HttpClient {
const system = new System(root, restful) const system = new System(root, restful)
const webChartConfig = new WebChartConfig(root) const webChartConfig = new WebChartConfig(root)
const ref = new Ref(root) const ref = new Ref(root)
const list = [webQueryClient, billflow, system, webChartConfig, restful, ref] const list = [root, webQueryClient, billflow, system, webChartConfig, restful, ref]
// const api = { // const api = {
// } // }
list.forEach(item => { list.forEach(item => {
this[item.moduleName] = item this[item.moduleName] = item
}) })
const root_prototype = root.__proto__ // const root_prototype = root.__proto__
const root_prototype_keys = Object.getOwnPropertyNames(root_prototype) // const root_prototype_keys = Object.getOwnPropertyNames(root_prototype)
root_prototype_keys.forEach(k => { // root_prototype_keys.forEach(k => {
if (k !== 'constructor') { // if (k !== 'constructor') {
this[`${k}`] = root_prototype[k] // this[`${k}`] = root_prototype[k]
} // }
}) // })
} }
} }
......
import axios from 'axios' import axios from 'axios'
class Root { class Root {
constructor(_axios) { constructor(_axios) {
this.moduleName = 'rootModule'
this.axios = _axios || axios this.axios = _axios || axios
} }
filterEmptyValue (obj) { filterEmptyValue (obj) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment