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
d61cd07d
Commit
d61cd07d
authored
Jan 15, 2021
by
何虹
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
升级httpClient
parent
90a42892
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
159 additions
and
45 deletions
+159
-45
hsWebHttpClient.js
dist/hsWebHttpClient.js
+79
-22
hsWebHttpClient.min.js
dist/hsWebHttpClient.min.js
+1
-1
index.js
src/index.js
+8
-1
restful.js
src/packages/modules/restful.js
+19
-6
system.js
src/packages/modules/system.js
+10
-2
webChartConfig.js
src/packages/modules/webChartConfig.js
+13
-13
root.js
src/root.js
+29
-0
No files found.
dist/hsWebHttpClient.js
View file @
d61cd07d
...
...
@@ -31,9 +31,12 @@ __webpack_require__.r(__webpack_exports__);
class
HttpClient
{
constructor(axios) {
constructor
(
axios
,
appCode
,
pageName
)
{
this
.
axios
=
axios
const
root
=
new
_root__WEBPACK_IMPORTED_MODULE_0__
.
default
(
axios
)
appCode
&&
(
root
.
appCode
=
appCode
)
pageName
&&
(
root
.
pageName
=
pageName
)
this
.
root
=
root
const
restful
=
new
_packages_modules_restful__WEBPACK_IMPORTED_MODULE_3__
.
default
(
root
)
const
webQueryClient
=
new
_packages_modules_webQueryClient__WEBPACK_IMPORTED_MODULE_5__
.
default
(
root
)
const
billflow
=
new
_packages_modules_billflow__WEBPACK_IMPORTED_MODULE_1__
.
default
(
root
)
...
...
@@ -54,6 +57,10 @@ class HttpClient {
// }
// })
}
init
(
config
)
{
config
.
appCode
&&
(
this
.
root
.
appCode
=
config
.
appCode
)
config
.
pageName
&&
(
this
.
root
.
pageName
=
config
.
pageName
)
}
}
/* harmony default export */
__webpack_exports__
[
"default"
]
=
(
HttpClient
);
...
...
@@ -100,6 +107,34 @@ class Root {
requestConfig
(
config
)
{
return
axios__WEBPACK_IMPORTED_MODULE_0___default
()(
config
)
}
handleParams
(
params
){
if
(
params
)
{
delete
params
.
token
delete
params
.
_user_info
delete
params
.
user_info
const
replaceStr
=
{
'%'
:
"%25"
,
'#'
:
"%23"
,
'&'
:
"%26"
,
'>'
:
"%3E"
,
'<'
:
"%3C"
,
'+'
:
"%2B"
,
'/'
:
"%2F"
,
'='
:
"3D"
,
':'
:
"3A"
}
const
replaceStrKeys
=
Object
.
keys
(
replaceStr
)
for
(
let
k
in
params
)
{
let
value
=
params
[
k
]
replaceStrKeys
.
forEach
(
rkey
=>
{
const
reg
=
new
RegExp
(
`\${rkey}`
,
'g'
)
value
=
value
.
replace
(
reg
,
replaceStr
[
rkey
])
})
params
[
k
]
=
value
}
}
}
request
(
method
,
url
,
data
,
params
,
headers
=
null
,
config
=
{})
{
this
.
filterEmptyValue
(
data
)
// 公共头设置
...
...
@@ -107,6 +142,7 @@ class Root {
if
(
config
)
{
Object
.
assign
(
aixosCtx
,
config
)
}
//this.handleParams(params)
params
&&
(
aixosCtx
.
params
=
params
)
if
(
aixosCtx
.
params
&&
aixosCtx
.
params
.
token
)
delete
aixosCtx
.
params
.
token
if
(
aixosCtx
.
params
&&
aixosCtx
.
params
.
_user_info
)
delete
aixosCtx
.
params
.
_user_info
...
...
@@ -1954,13 +1990,13 @@ class Control {
this
.
moduleName
=
'WebChartConfigModule'
}
// 处理传入的data 如果有appCode,pageName dbName
packParamHandle(parms) {
packParamHandle
(
parms
)
{
const
{
appCode
,
pageName
,
dbName
,
dbCode
,
userId
}
=
parms
if
(
!
appCode
)
{
parms.appCode = urlParam.appCode
parms
.
appCode
=
this
.
requestClient
.
appCode
//||
urlParam.appCode
}
if
(
!
pageName
)
{
parms.pageName = urlParam.pageName
parms
.
pageName
=
this
.
requestClient
.
appCode
//||
urlParam.pageName
}
if
(
!
dbName
)
{
parms
.
dbName
=
urlParam
.
dbName
||
''
...
...
@@ -1987,7 +2023,7 @@ class Control {
* sData: 数据
* @param {*} data
*/
webChartConfigSave(param) { // routerParms: page路由 position位置 other参数, sConfig 配置json sData 数据json
webChartConfigSave
(
param
)
{
// routerParms: page路由 position位置 other参数, sConfig 配置json sData 数据json
this
.
packParamHandle
(
param
)
const
{
appCode
,
pageName
,
controlName
,
controlType
,
querySql
,
mockData
,
userId
,
dbName
,
dbCode
,
config
,
data
}
=
param
const
postData
=
{
...
...
@@ -2016,7 +2052,7 @@ class Control {
* sData: 数据
* @param {*} data
*/
webChartConfigQuery(data) {
webChartConfigQuery
(
data
)
{
this
.
packParamHandle
(
data
)
const
{
appCode
,
pageName
,
controlName
,
userId
,
dbName
,
dbCode
}
=
data
const
postData
=
{
...
...
@@ -2027,7 +2063,7 @@ class Control {
return
this
.
requestClient
.
post
(
_common_commonModule__WEBPACK_IMPORTED_MODULE_0__
.
WEB_QUERY_QUERY
,
postData
)
}
// 获取将要另存到本地的配置
webChartConfigSaveAs(data) {
webChartConfigSaveAs
(
data
)
{
this
.
packParamHandle
(
data
)
const
{
appCode
,
pageName
,
dbName
,
dbCode
}
=
data
const
postData
=
{
...
...
@@ -2038,14 +2074,14 @@ class Control {
return
this
.
requestClient
.
post
(
_common_commonModule__WEBPACK_IMPORTED_MODULE_0__
.
WEB_QUERY_QUERY_VALUE
,
postData
)
}
// 另存配置
async saveAsDataToLocal(data) {
async
saveAsDataToLocal
(
data
)
{
this
.
packParamHandle
(
data
)
const
{
appCode
,
pageName
}
=
data
const
res
=
await
this
.
webChartConfigSaveAs
(
data
)
if
(
!
res
)
return
this
.
download
(
`spappWebChartConfig_Upgrade_
${
appCode
}
_
${
pageName
}
.sql`
,
res
.
data
)
}
download(name, data) {
download
(
name
,
data
)
{
var
urlObject
=
window
.
URL
||
window
.
webkitURL
||
window
var
downloadData
=
new
Blob
([
data
])
var
save_link
=
document
.
createElementNS
(
'http://www.w3.org/1999/xhtml'
,
'a'
)
...
...
@@ -2053,7 +2089,7 @@ class Control {
save_link
.
download
=
name
this
.
fake_click
(
save_link
)
}
fake_click(obj) {
fake_click
(
obj
)
{
var
ev
=
document
.
createEvent
(
'MouseEvents'
)
ev
.
initMouseEvent
(
'click'
,
true
,
false
,
window
,
0
,
0
,
0
,
0
,
0
...
...
@@ -2062,7 +2098,7 @@ class Control {
obj
.
dispatchEvent
(
ev
)
}
// 直接执行sql语句
execSql(data) {
execSql
(
data
)
{
this
.
packParamHandle
(
data
)
const
{
execSql
,
dbName
,
dbCode
}
=
data
const
postData
=
{
...
...
@@ -2072,7 +2108,7 @@ class Control {
}
return
this
.
requestClient
.
post
(
_common_commonModule__WEBPACK_IMPORTED_MODULE_0__
.
WEB_QUERY_QUERY
,
postData
)
}
webChartConfigQueryLog(data) {
webChartConfigQueryLog
(
data
)
{
this
.
packParamHandle
(
data
)
const
{
appCode
,
pageName
,
controlName
,
dbName
,
dbCode
}
=
data
const
postData
=
{
...
...
@@ -2082,7 +2118,7 @@ class Control {
}
return
this
.
requestClient
.
post
(
_common_commonModule__WEBPACK_IMPORTED_MODULE_0__
.
WEB_QUERY_QUERY
,
postData
)
}
webChartConfigRevert(data) {
webChartConfigRevert
(
data
)
{
this
.
packParamHandle
(
data
)
const
{
appCode
,
pageName
,
dbName
,
dbCode
,
controlName
,
version
}
=
data
const
postData
=
{
...
...
@@ -2093,7 +2129,7 @@ class Control {
return
this
.
requestClient
.
post
(
_common_commonModule__WEBPACK_IMPORTED_MODULE_0__
.
WEB_QUERY
,
postData
)
}
// 控件配置查询
webControlQuery(data) {
webControlQuery
(
data
)
{
this
.
packParamHandle
(
data
)
const
{
dbName
,
pageName
,
param
,
appCode
,
controlName
,
returnType
,
dbCode
,
userId
}
=
data
const
postData
=
{
...
...
@@ -21968,7 +22004,15 @@ class RestFul {
this
.
requestClient
=
requestClient
this
.
moduleName
=
'RestFulModule'
}
query(data) {
// 处理传入的data 如果有appCode dbName
packParamHandle
(
parms
)
{
const
{
appCode
}
=
parms
if
(
!
appCode
)
{
parms
.
appCode
=
this
.
requestClient
.
appCode
//|| urlParam.appCode
}
}
query
(
data
)
{
this
.
packParamHandle
(
data
)
const
{
tableName
,
appCode
,
group
,
parms
,
bodyData
}
=
data
let
url
=
`
${
_common_commonModule__WEBPACK_IMPORTED_MODULE_0__
.
TOOL_API
}${
appCode
}
/
${
tableName
}
/`
if
(
group
)
{
// 非标准保存
...
...
@@ -21980,7 +22024,8 @@ class RestFul {
return
this
.
requestClient
.
get
(
url
,
parms
)
}
}
save(data) {
save
(
data
)
{
this
.
packParamHandle
(
data
)
const
{
tableName
,
appCode
,
bodyData
,
group
,
parms
}
=
data
let
url
=
`
${
_common_commonModule__WEBPACK_IMPORTED_MODULE_0__
.
TOOL_API
}${
appCode
}
/
${
tableName
}
/`
if
(
group
)
{
// 非标准保存
...
...
@@ -21988,7 +22033,8 @@ class RestFul {
}
return
this
.
requestClient
.
post
(
url
,
bodyData
,
parms
)
}
queryOne(data) {
queryOne
(
data
)
{
this
.
packParamHandle
(
data
)
const
{
tableName
,
id
,
appCode
,
parms
,
group
,
bodyData
}
=
data
let
url_
=
`
${
_common_commonModule__WEBPACK_IMPORTED_MODULE_0__
.
TOOL_API
}${
appCode
}
/
${
tableName
}
/
${
id
}
/`
if
(
group
)
{
...
...
@@ -22000,7 +22046,8 @@ class RestFul {
return
this
.
requestClient
.
get
(
url_
,
parms
)
}
}
put(data) {
put
(
data
)
{
this
.
packParamHandle
(
data
)
const
{
tableName
,
appCode
,
bodyData
,
group
,
parms
}
=
data
let
url
=
`
${
_common_commonModule__WEBPACK_IMPORTED_MODULE_0__
.
TOOL_API
}${
appCode
}
/
${
tableName
}
/`
if
(
group
)
{
// 非标准保存
...
...
@@ -22008,7 +22055,8 @@ class RestFul {
}
return
this
.
requestClient
.
put
(
url
,
bodyData
,
parms
)
}
queryList(data) {
queryList
(
data
)
{
this
.
packParamHandle
(
data
)
const
{
tableName
,
appCode
,
parms
,
group
,
bodyData
}
=
data
let
url_
=
`
${
_common_commonModule__WEBPACK_IMPORTED_MODULE_0__
.
TOOL_API
}${
appCode
}
/
${
tableName
}
/`
if
(
group
)
{
...
...
@@ -22021,7 +22069,8 @@ class RestFul {
return
this
.
requestClient
.
get
(
url_
,
parms
)
}
}
deleteList(data) {
deleteList
(
data
)
{
this
.
packParamHandle
(
data
)
const
{
tableName
,
appCode
,
bodyData
,
parms
}
=
data
const
url_
=
`
${
_common_commonModule__WEBPACK_IMPORTED_MODULE_0__
.
TOOL_API
}${
appCode
}
/
${
tableName
}
/`
return
this
.
requestClient
.
delete
(
url_
,
bodyData
,
parms
)
...
...
@@ -22054,8 +22103,8 @@ class System {
const
{
appCode
,
pageName
}
=
data
const
params
=
{
parms
:
{
app_code: appCode,
page_name: pageName,
app_code
:
appCode
||
this
.
requestClient
.
appCode
,
page_name
:
pageName
||
this
.
requestClient
.
pageName
,
usable
:
1
},
appCode
:
'queryBi'
,
...
...
@@ -22065,6 +22114,14 @@ class System {
}
// 获取 动态中的action列表
saveBillpbWebDyncCode
(
data
)
{
const
{
appCode
,
pageName
,
app_code
,
page_name
}
=
data
if
(
!
appCode
&&
!
app_code
)
{
data
.
app_code
=
this
.
requestClient
.
appCode
}
if
(
!
pageName
&&
!
page_name
)
{
data
.
page_name
=
this
.
requestClient
.
pageName
data
.
page_url
=
this
.
requestClient
.
pageName
}
const
params
=
{
bodyData
:
data
,
appCode
:
'queryBi'
,
...
...
dist/hsWebHttpClient.min.js
View file @
d61cd07d
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/index.js
View file @
d61cd07d
...
...
@@ -7,9 +7,12 @@ import System from './packages/modules/system'
import
WebQueryClient
from
'./packages/modules/webQueryClient'
import
Ref
from
'./packages/modules/ref'
class
HttpClient
{
constructor
(
axios
)
{
constructor
(
axios
,
appCode
,
pageName
)
{
this
.
axios
=
axios
const
root
=
new
Root
(
axios
)
appCode
&&
(
root
.
appCode
=
appCode
)
pageName
&&
(
root
.
pageName
=
pageName
)
this
.
root
=
root
const
restful
=
new
Restful
(
root
)
const
webQueryClient
=
new
WebQueryClient
(
root
)
const
billflow
=
new
Billflow
(
root
)
...
...
@@ -30,6 +33,10 @@ class HttpClient {
// }
// })
}
init
(
config
)
{
config
.
appCode
&&
(
this
.
root
.
appCode
=
config
.
appCode
)
config
.
pageName
&&
(
this
.
root
.
pageName
=
config
.
pageName
)
}
}
export
default
HttpClient
src/packages/modules/restful.js
View file @
d61cd07d
...
...
@@ -4,7 +4,15 @@ class RestFul {
this
.
requestClient
=
requestClient
this
.
moduleName
=
'RestFulModule'
}
query
(
data
)
{
// 处理传入的data 如果有appCode dbName
packParamHandle
(
parms
)
{
const
{
appCode
}
=
parms
if
(
!
appCode
)
{
parms
.
appCode
=
this
.
requestClient
.
appCode
//|| urlParam.appCode
}
}
query
(
data
)
{
this
.
packParamHandle
(
data
)
const
{
tableName
,
appCode
,
group
,
parms
,
bodyData
}
=
data
let
url
=
`
${
TOOL_API
}${
appCode
}
/
${
tableName
}
/`
if
(
group
)
{
// 非标准保存
...
...
@@ -16,7 +24,8 @@ class RestFul {
return
this
.
requestClient
.
get
(
url
,
parms
)
}
}
save
(
data
)
{
save
(
data
)
{
this
.
packParamHandle
(
data
)
const
{
tableName
,
appCode
,
bodyData
,
group
,
parms
}
=
data
let
url
=
`
${
TOOL_API
}${
appCode
}
/
${
tableName
}
/`
if
(
group
)
{
// 非标准保存
...
...
@@ -24,7 +33,8 @@ class RestFul {
}
return
this
.
requestClient
.
post
(
url
,
bodyData
,
parms
)
}
queryOne
(
data
)
{
queryOne
(
data
)
{
this
.
packParamHandle
(
data
)
const
{
tableName
,
id
,
appCode
,
parms
,
group
,
bodyData
}
=
data
let
url_
=
`
${
TOOL_API
}${
appCode
}
/
${
tableName
}
/
${
id
}
/`
if
(
group
)
{
...
...
@@ -36,7 +46,8 @@ class RestFul {
return
this
.
requestClient
.
get
(
url_
,
parms
)
}
}
put
(
data
)
{
put
(
data
)
{
this
.
packParamHandle
(
data
)
const
{
tableName
,
appCode
,
bodyData
,
group
,
parms
}
=
data
let
url
=
`
${
TOOL_API
}${
appCode
}
/
${
tableName
}
/`
if
(
group
)
{
// 非标准保存
...
...
@@ -44,7 +55,8 @@ class RestFul {
}
return
this
.
requestClient
.
put
(
url
,
bodyData
,
parms
)
}
queryList
(
data
)
{
queryList
(
data
)
{
this
.
packParamHandle
(
data
)
const
{
tableName
,
appCode
,
parms
,
group
,
bodyData
}
=
data
let
url_
=
`
${
TOOL_API
}${
appCode
}
/
${
tableName
}
/`
if
(
group
)
{
...
...
@@ -57,7 +69,8 @@ class RestFul {
return
this
.
requestClient
.
get
(
url_
,
parms
)
}
}
deleteList
(
data
)
{
deleteList
(
data
)
{
this
.
packParamHandle
(
data
)
const
{
tableName
,
appCode
,
bodyData
,
parms
}
=
data
const
url_
=
`
${
TOOL_API
}${
appCode
}
/
${
tableName
}
/`
return
this
.
requestClient
.
delete
(
url_
,
bodyData
,
parms
)
...
...
src/packages/modules/system.js
View file @
d61cd07d
...
...
@@ -15,8 +15,8 @@ class System {
const
{
appCode
,
pageName
}
=
data
const
params
=
{
parms
:
{
app_code
:
appCode
,
page_name
:
pageName
,
app_code
:
appCode
||
this
.
requestClient
.
appCode
,
page_name
:
pageName
||
this
.
requestClient
.
pageName
,
usable
:
1
},
appCode
:
'queryBi'
,
...
...
@@ -26,6 +26,14 @@ class System {
}
// 获取 动态中的action列表
saveBillpbWebDyncCode
(
data
)
{
const
{
appCode
,
pageName
,
app_code
,
page_name
}
=
data
if
(
!
appCode
&&
!
app_code
)
{
data
.
app_code
=
this
.
requestClient
.
appCode
}
if
(
!
pageName
&&
!
page_name
)
{
data
.
page_name
=
this
.
requestClient
.
pageName
data
.
page_url
=
this
.
requestClient
.
pageName
}
const
params
=
{
bodyData
:
data
,
appCode
:
'queryBi'
,
...
...
src/packages/modules/webChartConfig.js
View file @
d61cd07d
...
...
@@ -9,13 +9,13 @@ class Control {
this
.
moduleName
=
'WebChartConfigModule'
}
// 处理传入的data 如果有appCode,pageName dbName
packParamHandle
(
parms
)
{
packParamHandle
(
parms
)
{
const
{
appCode
,
pageName
,
dbName
,
dbCode
,
userId
}
=
parms
if
(
!
appCode
)
{
parms
.
appCode
=
urlParam
.
appCode
parms
.
appCode
=
this
.
requestClient
.
appCode
//||
urlParam.appCode
}
if
(
!
pageName
)
{
parms
.
pageName
=
urlParam
.
pageName
parms
.
pageName
=
this
.
requestClient
.
appCode
//||
urlParam.pageName
}
if
(
!
dbName
)
{
parms
.
dbName
=
urlParam
.
dbName
||
''
...
...
@@ -42,7 +42,7 @@ class Control {
* sData: 数据
* @param {*} data
*/
webChartConfigSave
(
param
)
{
// routerParms: page路由 position位置 other参数, sConfig 配置json sData 数据json
webChartConfigSave
(
param
)
{
// routerParms: page路由 position位置 other参数, sConfig 配置json sData 数据json
this
.
packParamHandle
(
param
)
const
{
appCode
,
pageName
,
controlName
,
controlType
,
querySql
,
mockData
,
userId
,
dbName
,
dbCode
,
config
,
data
}
=
param
const
postData
=
{
...
...
@@ -71,7 +71,7 @@ class Control {
* sData: 数据
* @param {*} data
*/
webChartConfigQuery
(
data
)
{
webChartConfigQuery
(
data
)
{
this
.
packParamHandle
(
data
)
const
{
appCode
,
pageName
,
controlName
,
userId
,
dbName
,
dbCode
}
=
data
const
postData
=
{
...
...
@@ -82,7 +82,7 @@ class Control {
return
this
.
requestClient
.
post
(
WEB_QUERY_QUERY
,
postData
)
}
// 获取将要另存到本地的配置
webChartConfigSaveAs
(
data
)
{
webChartConfigSaveAs
(
data
)
{
this
.
packParamHandle
(
data
)
const
{
appCode
,
pageName
,
dbName
,
dbCode
}
=
data
const
postData
=
{
...
...
@@ -93,14 +93,14 @@ class Control {
return
this
.
requestClient
.
post
(
WEB_QUERY_QUERY_VALUE
,
postData
)
}
// 另存配置
async
saveAsDataToLocal
(
data
)
{
async
saveAsDataToLocal
(
data
)
{
this
.
packParamHandle
(
data
)
const
{
appCode
,
pageName
}
=
data
const
res
=
await
this
.
webChartConfigSaveAs
(
data
)
if
(
!
res
)
return
this
.
download
(
`spappWebChartConfig_Upgrade_
${
appCode
}
_
${
pageName
}
.sql`
,
res
.
data
)
}
download
(
name
,
data
)
{
download
(
name
,
data
)
{
var
urlObject
=
window
.
URL
||
window
.
webkitURL
||
window
var
downloadData
=
new
Blob
([
data
])
var
save_link
=
document
.
createElementNS
(
'http://www.w3.org/1999/xhtml'
,
'a'
)
...
...
@@ -108,7 +108,7 @@ class Control {
save_link
.
download
=
name
this
.
fake_click
(
save_link
)
}
fake_click
(
obj
)
{
fake_click
(
obj
)
{
var
ev
=
document
.
createEvent
(
'MouseEvents'
)
ev
.
initMouseEvent
(
'click'
,
true
,
false
,
window
,
0
,
0
,
0
,
0
,
0
...
...
@@ -117,7 +117,7 @@ class Control {
obj
.
dispatchEvent
(
ev
)
}
// 直接执行sql语句
execSql
(
data
)
{
execSql
(
data
)
{
this
.
packParamHandle
(
data
)
const
{
execSql
,
dbName
,
dbCode
}
=
data
const
postData
=
{
...
...
@@ -127,7 +127,7 @@ class Control {
}
return
this
.
requestClient
.
post
(
WEB_QUERY_QUERY
,
postData
)
}
webChartConfigQueryLog
(
data
)
{
webChartConfigQueryLog
(
data
)
{
this
.
packParamHandle
(
data
)
const
{
appCode
,
pageName
,
controlName
,
dbName
,
dbCode
}
=
data
const
postData
=
{
...
...
@@ -137,7 +137,7 @@ class Control {
}
return
this
.
requestClient
.
post
(
WEB_QUERY_QUERY
,
postData
)
}
webChartConfigRevert
(
data
)
{
webChartConfigRevert
(
data
)
{
this
.
packParamHandle
(
data
)
const
{
appCode
,
pageName
,
dbName
,
dbCode
,
controlName
,
version
}
=
data
const
postData
=
{
...
...
@@ -148,7 +148,7 @@ class Control {
return
this
.
requestClient
.
post
(
WEB_QUERY
,
postData
)
}
// 控件配置查询
webControlQuery
(
data
)
{
webControlQuery
(
data
)
{
this
.
packParamHandle
(
data
)
const
{
dbName
,
pageName
,
param
,
appCode
,
controlName
,
returnType
,
dbCode
,
userId
}
=
data
const
postData
=
{
...
...
src/root.js
View file @
d61cd07d
...
...
@@ -31,6 +31,34 @@ class Root {
requestConfig
(
config
)
{
return
axios
(
config
)
}
handleParams
(
params
){
if
(
params
)
{
delete
params
.
token
delete
params
.
_user_info
delete
params
.
user_info
const
replaceStr
=
{
'%'
:
"%25"
,
'#'
:
"%23"
,
'&'
:
"%26"
,
'>'
:
"%3E"
,
'<'
:
"%3C"
,
'+'
:
"%2B"
,
'/'
:
"%2F"
,
'='
:
"3D"
,
':'
:
"3A"
}
const
replaceStrKeys
=
Object
.
keys
(
replaceStr
)
for
(
let
k
in
params
)
{
let
value
=
params
[
k
]
replaceStrKeys
.
forEach
(
rkey
=>
{
const
reg
=
new
RegExp
(
`\${rkey}`
,
'g'
)
value
=
value
.
replace
(
reg
,
replaceStr
[
rkey
])
})
params
[
k
]
=
value
}
}
}
request
(
method
,
url
,
data
,
params
,
headers
=
null
,
config
=
{})
{
this
.
filterEmptyValue
(
data
)
// 公共头设置
...
...
@@ -38,6 +66,7 @@ class Root {
if
(
config
)
{
Object
.
assign
(
aixosCtx
,
config
)
}
//this.handleParams(params)
params
&&
(
aixosCtx
.
params
=
params
)
if
(
aixosCtx
.
params
&&
aixosCtx
.
params
.
token
)
delete
aixosCtx
.
params
.
token
if
(
aixosCtx
.
params
&&
aixosCtx
.
params
.
_user_info
)
delete
aixosCtx
.
params
.
_user_info
...
...
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