Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
H
hsWebHttpClient
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
何虹
hsWebHttpClient
Commits
281e67d7
Commit
281e67d7
authored
Dec 17, 2020
by
何虹
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更改构造方式
parent
2a213db5
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
100 additions
and
26 deletions
+100
-26
hsWebHttpClient.js
dist/hsWebHttpClient.js
+4
-4
hsWebHttpClient.min.js
dist/hsWebHttpClient.min.js
+1
-1
index copy 2.js
src/index copy 2.js
+32
-0
index copy.js
src/index copy.js
+34
-0
index.js
src/index.js
+25
-20
root.js
src/root.js
+4
-1
No files found.
dist/hsWebHttpClient.js
View file @
281e67d7
...
@@ -93,10 +93,10 @@ class Root {
...
@@ -93,10 +93,10 @@ class Root {
request
(
method
,
url
,
data
,
params
,
headers
=
null
,
config
=
{})
{
request
(
method
,
url
,
data
,
params
,
headers
=
null
,
config
=
{})
{
this
.
filterEmptyValue
(
data
)
this
.
filterEmptyValue
(
data
)
// 公共头设置
// 公共头设置
const
aixosCtx
=
{
method
,
url
,...
config
}
const
aixosCtx
=
{
method
,
url
}
//
if (config) {
if
(
config
)
{
//
Object.assign(aixosCtx, config)
Object
.
assign
(
aixosCtx
,
config
)
//
}
}
params
&&
(
aixosCtx
.
params
=
params
)
params
&&
(
aixosCtx
.
params
=
params
)
if
(
aixosCtx
.
params
&&
aixosCtx
.
params
.
token
)
delete
aixosCtx
.
params
.
token
if
(
aixosCtx
.
params
&&
aixosCtx
.
params
.
token
)
delete
aixosCtx
.
params
.
token
if
(
aixosCtx
.
params
&&
aixosCtx
.
params
.
_user_info
)
delete
aixosCtx
.
params
.
_user_info
if
(
aixosCtx
.
params
&&
aixosCtx
.
params
.
_user_info
)
delete
aixosCtx
.
params
.
_user_info
...
...
dist/hsWebHttpClient.min.js
View file @
281e67d7
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/index copy 2.js
0 → 100644
View file @
281e67d7
import
Root
from
'./root'
import
Billflow
from
'./packages/modules/billflow'
import
WebChartConfig
from
'./packages/modules/webChartConfig'
import
Restful
from
'./packages/modules/restful'
import
System
from
'./packages/modules/system'
import
WebQueryClient
from
'./packages/modules/webQueryClient'
import
Ref
from
'./packages/modules/ref'
const
root
=
new
Root
()
const
restful
=
new
Restful
(
root
)
const
webQueryClient
=
new
WebQueryClient
(
root
)
const
billflow
=
new
Billflow
(
root
)
const
system
=
new
System
(
root
,
restful
)
const
webChartConfig
=
new
WebChartConfig
(
root
)
const
ref
=
new
Ref
(
root
)
const
list
=
[
webQueryClient
,
billflow
,
system
,
webChartConfig
,
restful
,
ref
]
const
api
=
{
}
list
.
forEach
(
item
=>
{
api
[
item
.
moduleName
]
=
item
})
const
root_prototype
=
root
.
__proto__
const
root_prototype_keys
=
Object
.
getOwnPropertyNames
(
root_prototype
)
root_prototype_keys
.
forEach
(
k
=>
{
if
(
k
!==
'constructor'
)
{
api
[
`
${
k
}
`
]
=
root_prototype
[
k
]
}
})
api
.
init
=
function
(
axios
){
root
.
axios
=
axios
}
export
default
api
src/index copy.js
0 → 100644
View file @
281e67d7
import
Root
from
'./root'
import
Billflow
from
'./packages/modules/billflow'
import
WebChartConfig
from
'./packages/modules/webChartConfig'
import
Restful
from
'./packages/modules/restful'
import
System
from
'./packages/modules/system'
import
WebQueryClient
from
'./packages/modules/webQueryClient'
import
Ref
from
'./packages/modules/ref'
class
HttpClient
{
constructor
(
axios
){
const
root
=
new
Root
(
axios
)
const
restful
=
new
Restful
(
root
)
const
webQueryClient
=
new
WebQueryClient
(
root
)
const
billflow
=
new
Billflow
(
root
)
const
system
=
new
System
(
root
,
restful
)
const
webChartConfig
=
new
WebChartConfig
(
root
)
const
ref
=
new
Ref
(
root
)
const
list
=
[
webQueryClient
,
billflow
,
system
,
webChartConfig
,
restful
,
ref
]
const
api
=
{
}
list
.
forEach
(
item
=>
{
api
[
item
.
moduleName
]
=
item
})
const
root_prototype
=
root
.
__proto__
const
root_prototype_keys
=
Object
.
getOwnPropertyNames
(
root_prototype
)
root_prototype_keys
.
forEach
(
k
=>
{
if
(
k
!==
'constructor'
)
{
api
[
`
${
k
}
`
]
=
root_prototype
[
k
]
}
})
}
}
export
default
HttpClient
src/index.js
View file @
281e67d7
...
@@ -6,24 +6,29 @@ import Restful from './packages/modules/restful'
...
@@ -6,24 +6,29 @@ import Restful from './packages/modules/restful'
import
System
from
'./packages/modules/system'
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'
const
root
=
new
Root
()
class
HttpClient
{
const
restful
=
new
Restful
(
root
)
constructor
(
axios
){
const
webQueryClient
=
new
WebQueryClient
(
root
)
const
root
=
new
Root
(
axios
)
const
billflow
=
new
Billflow
(
root
)
const
restful
=
new
Restful
(
root
)
const
system
=
new
System
(
root
,
restful
)
const
webQueryClient
=
new
WebQueryClient
(
root
)
const
webChartConfig
=
new
WebChartConfig
(
root
)
const
billflow
=
new
Billflow
(
root
)
const
ref
=
new
Ref
(
root
)
const
system
=
new
System
(
root
,
restful
)
const
list
=
[
webQueryClient
,
billflow
,
system
,
webChartConfig
,
restful
,
ref
]
const
webChartConfig
=
new
WebChartConfig
(
root
)
const
api
=
{
const
ref
=
new
Ref
(
root
)
}
const
list
=
[
webQueryClient
,
billflow
,
system
,
webChartConfig
,
restful
,
ref
]
list
.
forEach
(
item
=>
{
const
api
=
{
}
list
.
forEach
(
item
=>
{
api
[
item
.
moduleName
]
=
item
api
[
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'
)
{
api
[
`
${
k
}
`
]
=
root_prototype
[
k
]
api
[
`
${
k
}
`
]
=
root_prototype
[
k
]
}
}
})
})
export
default
api
}
}
export
default
HttpClient
src/root.js
View file @
281e67d7
import
axios
from
'axios'
import
axios
from
'axios'
class
Root
{
class
Root
{
constructor
(
_axios
)
{
this
.
axios
=
_axios
||
axios
}
filterEmptyValue
(
obj
)
{
filterEmptyValue
(
obj
)
{
if
(
!
obj
)
return
if
(
!
obj
)
return
const
emptyValues
=
[
null
,
undefined
,
'null'
,
'undefined'
,
NaN
]
const
emptyValues
=
[
null
,
undefined
,
'null'
,
'undefined'
,
NaN
]
...
@@ -39,7 +42,7 @@ class Root {
...
@@ -39,7 +42,7 @@ class Root {
if
(
aixosCtx
.
params
&&
aixosCtx
.
params
.
_user_info
)
delete
aixosCtx
.
params
.
_user_info
if
(
aixosCtx
.
params
&&
aixosCtx
.
params
.
_user_info
)
delete
aixosCtx
.
params
.
_user_info
data
&&
(
aixosCtx
.
data
=
data
)
data
&&
(
aixosCtx
.
data
=
data
)
headers
&&
(
aixosCtx
.
headers
=
headers
)
headers
&&
(
aixosCtx
.
headers
=
headers
)
const
result
=
axios
(
aixosCtx
)
const
result
=
this
.
axios
(
aixosCtx
)
return
result
return
result
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment