Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivManage
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
ReactWeb5
CivManage
Commits
1cfebb1d
Commit
1cfebb1d
authored
Oct 22, 2020
by
张烨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style: fix lint
parent
0d870f22
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
58 deletions
+54
-58
.prettierrc
.prettierrc
+2
-1
request.jsx
src/pages/testPages/request.jsx
+52
-57
No files found.
.prettierrc
View file @
1cfebb1d
...
...
@@ -4,5 +4,6 @@
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "all"
"trailingComma": "all",
"endOfLine": "auto"
}
src/pages/testPages/request.jsx
View file @
1cfebb1d
...
...
@@ -19,21 +19,25 @@ const RequestTest = () => {
const
params
=
values
.
params
&&
values
.
params
.
reduce
((
param
,
{
key
,
value
})
=>
{
// eslint-disable-next-line no-param-reassign
param
[
key
.
trim
()]
=
value
.
trim
();
return
param
;
},
{});
if
(
window
.
location
.
host
===
values
.
url
)
{
methodMap
[
method
](
url
,
params
).
catch
(
err
=>
{
console
.
error
(
err
);
});
// eslint-disable-next-line no-console
console
.
error
(
err
);
});
}
else
{
const
proxyUrl
=
url
.
replace
(
/^https
?
:
\/\/([^\/]
+
)
/
,
$1
=>
{
return
`
${
window
.
location
.
origin
}
`
;
const
proxyUrl
=
url
.
replace
(
// eslint-disable-next-line no-useless-escape
/^https
?
:
\/\/([^\/]
+
)
/
,
()
=>
`
${
window
.
location
.
origin
}
`
,
);
methodMap
[
method
](
proxyUrl
,
params
).
catch
(
err
=>
{
// eslint-disable-next-line no-console
console
.
error
(
err
);
});
methodMap
[
method
](
proxyUrl
,
params
)
.
catch
(
err
=>
{
console
.
error
(
err
);
});
}
};
...
...
@@ -41,21 +45,14 @@ const RequestTest = () => {
setprotocal
(
v
);
};
const
handleKeyChange
=
(
v
,
field
)
=>
{
console
.
log
(
form
);
};
const
handleValueChange
=
(
v
,
field
)
=>
{
console
.
log
(
form
);
};
const
protocalBefore
=
(
<
Select
defaultValue=
"http://"
className=
"select-before"
onChange=
{
handleProtoSelectChange
}
>
<
Option
value=
"http://"
>
http://
</
Option
>
<
Option
value=
"https://"
>
https://
</
Option
>
<
Select
.
Option
value=
"http://"
>
http://
</
Select
.
Option
>
<
Select
.
Option
value=
"https://"
>
https://
</
Select
.
Option
>
</
Select
>
);
...
...
@@ -83,47 +80,45 @@ const RequestTest = () => {
<
Select
options=
{
methods
}
/>
</
Form
.
Item
>
<
Form
.
List
name=
"params"
>
{
(
fields
,
{
add
,
remove
})
=>
{
return
(
<>
{
fields
.
map
(
field
=>
(
<
Space
key=
{
field
.
key
}
align=
"start"
>
<
Form
.
Item
{
...
field
}
label=
{
`key`
}
name=
{
[
field
.
name
,
'key'
]
}
fieldKey=
{
[
field
.
fieldKey
,
'key'
]
}
rules=
{
[{
required
:
true
,
message
:
'Missing key'
}]
}
>
<
Input
onChange=
{
v
=>
handleKeyChange
(
v
,
field
)
}
/>
</
Form
.
Item
>
<
Form
.
Item
{
...
field
}
label=
{
`value`
}
fieldKey=
{
[
field
.
fieldKey
,
'value'
]
}
name=
{
[
field
.
name
,
'value'
]
}
>
<
Input
onChange=
{
v
=>
handleValueChange
(
v
,
field
)
}
/>
</
Form
.
Item
>
<
MinusCircleOutlined
onClick=
{
()
=>
console
.
log
(
field
)
||
remove
(
field
.
name
)
}
/>
</
Space
>
))
}
<
Form
.
Item
>
<
Button
type=
"dashed"
onClick=
{
()
=>
{
add
();
}
}
block
{
(
fields
,
{
add
,
remove
})
=>
(
<>
{
fields
.
map
(
field
=>
(
<
Space
key=
{
field
.
key
}
align=
"start"
>
<
Form
.
Item
{
...
field
}
label=
"key"
name=
{
[
field
.
name
,
'key'
]
}
fieldKey=
{
[
field
.
fieldKey
,
'key'
]
}
rules=
{
[{
required
:
true
,
message
:
'Missing key'
}]
}
>
<
Input
/>
</
Form
.
Item
>
<
Form
.
Item
{
...
field
}
label=
"value"
fieldKey=
{
[
field
.
fieldKey
,
'value'
]
}
name=
{
[
field
.
name
,
'value'
]
}
>
<
PlusOutlined
/>
Add params
</
Button
>
</
Form
.
Item
>
</>
);
}
}
<
Input
/>
</
Form
.
Item
>
<
MinusCircleOutlined
onClick=
{
()
=>
console
.
log
(
field
)
||
remove
(
field
.
name
)
}
/>
</
Space
>
))
}
<
Form
.
Item
>
<
Button
type=
"dashed"
onClick=
{
()
=>
{
add
();
}
}
block
>
<
PlusOutlined
/>
Add params
</
Button
>
</
Form
.
Item
>
</>
)
}
</
Form
.
List
>
<
Form
.
Item
>
...
...
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