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
b9b5b7ef
Commit
b9b5b7ef
authored
Feb 08, 2023
by
皮倩雯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: '网关配置优化'
parent
ee832ee1
Pipeline
#67119
passed with stages
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
139 additions
and
33 deletions
+139
-33
RightContent.jsx
src/components/GlobalHeader/RightContent.jsx
+2
-2
AddModal.jsx
src/pages/platformCenter/hostmanager/gateWay/AddModal.jsx
+25
-8
gateWay.jsx
src/pages/platformCenter/hostmanager/gateWay/gateWay.jsx
+112
-23
No files found.
src/components/GlobalHeader/RightContent.jsx
View file @
b9b5b7ef
...
...
@@ -95,8 +95,8 @@ const GlobalHeaderRight = props => {
return
{
breadcrumbName
:
matchRoute
?.
name
,
path
:
matchRoute
.
path
,
component
:
matchRoute
.
component
,
path
:
matchRoute
?
.
path
,
component
:
matchRoute
?
.
component
,
};
};
const
itemRender
=
(
route
,
params
,
routes
,
paths
)
=>
{
...
...
src/pages/platformCenter/hostmanager/gateWay/AddModal.jsx
View file @
b9b5b7ef
...
...
@@ -22,12 +22,16 @@ const AddModal = props => {
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
current
,
setCurrent
]
=
useState
(
false
);
const
[
advanced
,
setAdvanced
]
=
useState
(
0
);
const
[
hidden
,
setHidden
]
=
useState
(
false
);
const
[
form
]
=
Form
.
useForm
();
useEffect
(()
=>
{
if
(
visible
)
{
console
.
log
(
keepData
);
if
(
type
===
'edit'
)
{
let
data
=
[
'CityServer'
,
'IOT'
,
'CivData'
,
'GIS'
];
if
(
data
.
indexOf
(
pickItem
.
key
)
!=
-
1
)
{
setHidden
(
true
);
}
let
aa
=
pickItem
.
methods
.
replace
(
/
\s
/g
,
''
);
form
.
setFieldsValue
({
UpstreamPathTemplate
:
pickItem
.
upstreamPathTemplate
,
...
...
@@ -79,6 +83,7 @@ const AddModal = props => {
form
.
setFieldsValue
({
IsAuthentication
:
true
});
}
}
else
{
setHidden
(
false
);
form
.
resetFields
();
setAdvanced
(
0
);
setCurrent
(
false
);
...
...
@@ -237,7 +242,12 @@ const AddModal = props => {
},
]
}
>
<
Input
allowClear
style=
{
{
width
:
'100%'
}
}
placeholder=
"示例:/PandaOMS/PandaOMS/{url}"
/>
<
Input
allowClear
style=
{
{
width
:
'100%'
}
}
placeholder=
"示例:/PandaOMS/PandaOMS/{url}"
disabled=
{
hidden
}
/>
</
Item
>
<
Item
label=
"下游路由模板"
...
...
@@ -259,7 +269,7 @@ const AddModal = props => {
},
]
}
>
<
Input
allowClear
placeholder=
"示例:/{url}"
/>
<
Input
allowClear
placeholder=
"示例:/{url}"
disabled=
{
hidden
}
/>
</
Item
>
<
Item
label=
"上游请求方式"
...
...
@@ -271,7 +281,7 @@ const AddModal = props => {
},
]
}
>
<
Checkbox
.
Group
options=
{
plainOptions
}
style=
{
{
display
:
'flex'
}
}
/>
<
Checkbox
.
Group
options=
{
plainOptions
}
style=
{
{
display
:
'flex'
}
}
disabled=
{
hidden
}
/>
</
Item
>
<
Item
label=
"下游服务地址"
...
...
@@ -287,8 +297,12 @@ const AddModal = props => {
</
Item
>
<
Item
label=
"身份认证"
name=
"IsAuthentication"
>
<
Radio
.
Group
>
<
Radio
value=
{
true
}
>
开启
</
Radio
>
<
Radio
value=
{
false
}
>
关闭
</
Radio
>
<
Radio
value=
{
true
}
disabled=
{
hidden
}
>
开启
</
Radio
>
<
Radio
value=
{
false
}
disabled=
{
hidden
}
>
关闭
</
Radio
>
</
Radio
.
Group
>
</
Item
>
<
Item
...
...
@@ -302,6 +316,9 @@ const AddModal = props => {
{
validator
:
(
rule
,
value
)
=>
{
let
aa
=
form
.
getFieldValue
().
Key
;
if
(
!
/^
[^\u
4e00-
\u
9fa5
]
{1,10}$/g
.
test
(
aa
))
{
return
Promise
.
reject
(
'不允许输入中文'
);
}
if
(
type
===
'edit'
)
{
if
(
keepData
.
indexOf
(
aa
)
!==
-
1
&&
pickItem
.
key
!==
aa
)
{
return
Promise
.
reject
(
'关键字已存在'
);
...
...
@@ -315,7 +332,7 @@ const AddModal = props => {
},
]
}
>
<
Input
allowClear
/>
<
Input
allowClear
disabled=
{
hidden
}
/>
</
Item
>
<
Row
>
<
Col
span=
{
8
}
>
...
...
@@ -338,7 +355,7 @@ const AddModal = props => {
name=
"Priority"
labelCol=
{
{
span
:
12
}
}
>
<
InputNumber
min=
{
0
}
max=
{
10
}
defaultValue=
{
0
}
/>
<
InputNumber
min=
{
0
}
max=
{
10
}
defaultValue=
{
0
}
disabled=
{
hidden
}
/>
</
Item
>
</
Col
>
<
Col
span=
{
16
}
>
...
...
src/pages/platformCenter/hostmanager/gateWay/gateWay.jsx
View file @
b9b5b7ef
...
...
@@ -26,6 +26,7 @@ import {
SyncOutlined
,
SearchOutlined
,
}
from
'@ant-design/icons'
;
import
{
useHistory
}
from
'react-router-dom'
;
import
styles
from
'./gateWay.less'
;
import
{
GetGateWay
,
...
...
@@ -54,7 +55,8 @@ const GateConfig = () => {
const
[
checkVisible
,
setCheckVisible
]
=
useState
(
false
);
const
[
pickItem
,
setPickItem
]
=
useState
(
''
);
const
[
type
,
setType
]
=
useState
(
''
);
const
[
keepData
,
setKeepData
]
=
useState
([]);
// 保存关键字
const
history
=
useHistory
();
const
[
keepData
,
setKeepData
]
=
useState
([]);
// 保存内置关键字
const
{
Search
}
=
Input
;
const
OperateNginx
=
checked
=>
{
...
...
@@ -64,6 +66,7 @@ const GateConfig = () => {
UpdateGeteWay
({
isUsed
:
checked
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
console
.
log
(
localStorage
.
getItem
(
'token'
));
// localStorage.removeItem('token');
window
.
globalConfig
=
{
...
window
.
globalConfig
,
access_token
:
localStorage
.
getItem
(
'token'
),
...
...
@@ -72,6 +75,41 @@ const GateConfig = () => {
};
setFlag
(
flag
+
1
);
message
.
success
(
'设置成功'
);
// const key = 'authrizeFail';
// notification.warning({
// key,
// title: '提示',
// message: '授权失败,即将跳转到登录页',
// duration: 2,
// });
// setTimeout(() => {
// history.push(`/user/login`);
// }, 2000);
const
key
=
'authrizeFail'
;
const
btn
=
(
<
Button
type=
"primary"
size=
"small"
onClick=
{
()
=>
{
notification
.
close
(
key
);
window
.
location
.
href
=
`/${process.env.PUBLIC_PATH || 'civmanage'}/user/login`
;
}
}
>
确定
</
Button
>
);
if
(
!
/
\/
user
\/
login$/
.
test
(
window
.
location
.
pathname
))
{
notification
.
warning
({
key
,
title
:
'提示'
,
message
:
'授权失败,即将跳转到登录页'
,
duration
:
2
,
btn
,
});
setTimeout
(()
=>
{
window
.
location
.
href
=
`/
${
process
.
env
.
PUBLIC_PATH
||
'civmanage'
}
/user/login`
;
},
2000
);
}
}
else
{
message
.
error
(
'设置失败'
);
}
...
...
@@ -179,7 +217,43 @@ const GateConfig = () => {
return
(
<
Tooltip
placement=
"top"
title=
{
text
}
>
<
span
>
{
searchStyle1
(
text
)
}
<
Tag
color=
"cyan"
>
万能模板
</
Tag
>
{
searchStyle1
(
text
)
}{
' '
}
<
Tag
color=
"cyan"
style=
{
{
marginRight
:
'0px'
}
}
>
万能模板
</
Tag
>
</
span
>
</
Tooltip
>
);
}
else
if
(
record
.
key
===
'IOT'
)
{
return
(
<
Tooltip
placement=
"top"
title=
{
text
}
>
<
span
>
{
searchStyle1
(
text
)
}{
' '
}
<
Tag
color=
"purple"
style=
{
{
marginRight
:
'0px'
}
}
>
物联
</
Tag
>
</
span
>
</
Tooltip
>
);
}
else
if
(
record
.
key
===
'CivData'
)
{
return
(
<
Tooltip
placement=
"top"
title=
{
text
}
>
<
span
>
{
searchStyle1
(
text
)
}{
' '
}
<
Tag
color=
"green"
style=
{
{
marginRight
:
'0px'
}
}
>
中台
</
Tag
>
</
span
>
</
Tooltip
>
);
}
else
if
(
record
.
key
===
'GIS'
)
{
return
(
<
Tooltip
placement=
"top"
title=
{
text
}
>
<
span
>
{
searchStyle1
(
text
)
}{
' '
}
<
Tag
color=
"volcano"
style=
{
{
marginRight
:
'0px'
}
}
>
GIS
</
Tag
>
</
span
>
</
Tooltip
>
);
...
...
@@ -195,19 +269,32 @@ const GateConfig = () => {
},
},
{
title
:
'上游
路由模板
'
,
title
:
'上游
服务地址
'
,
dataIndex
:
'upstreamPathTemplate'
,
key
:
'upstreamPathTemplate'
,
align
:
'center'
,
ellipsis
:
true
,
render
:
(
text
,
record
)
=>
(
<
span
>
<
Tooltip
placement=
"top"
title=
{
text
}
>
{
searchStyle
(
text
)
}
<
Tooltip
placement=
"top"
title=
{
`上游路由模板:${text}`
}
>
{
window
.
location
.
origin
+
`/PandaCore/GateWay${text}`
}
</
Tooltip
>
</
span
>
),
},
// {
// title: '上游路由模板',
// dataIndex: 'upstreamPathTemplate',
// key: 'upstreamPathTemplate',
// align: 'center',
// ellipsis: true,
// render: (text, record) => (
// <span>
// <Tooltip placement="top" title={text}>
// {searchStyle(text)}
// </Tooltip>
// </span>
// ),
// },
{
title
:
'上游请求方式'
,
dataIndex
:
'methods'
,
...
...
@@ -229,29 +316,29 @@ const GateConfig = () => {
key
:
'url'
,
align
:
'center'
,
ellipsis
:
true
,
width
:
200
,
render
:
(
text
,
record
)
=>
(
<
span
>
<
Tooltip
placement=
"top"
title=
{
text
}
>
{
text
}
</
Tooltip
>
</
span
>
),
},
{
title
:
'下游路由模板'
,
dataIndex
:
'downstreamPathTemplate'
,
key
:
'downstreamPathTemplate'
,
ellipsis
:
true
,
align
:
'center'
,
render
:
(
text
,
record
)
=>
(
<
span
>
<
Tooltip
placement=
"top"
title=
{
text
}
>
{
text
}
<
Tooltip
placement=
"top"
title=
{
`下游路由模板:${record.downstreamPathTemplate}`
}
>
{
`${text}${record.downstreamPathTemplate}`
}
</
Tooltip
>
</
span
>
),
},
// {
// title: '下游路由模板',
// dataIndex: 'downstreamPathTemplate',
// key: 'downstreamPathTemplate',
// ellipsis: true,
// width: 150,
// align: 'center',
// render: (text, record) => (
// <span>
// <Tooltip placement="top" title={text}>
// {text}
// </Tooltip>
// </span>
// ),
// },
{
title
:
'开启身份认证'
,
dataIndex
:
'isAuthentication'
,
...
...
@@ -271,6 +358,7 @@ const GateConfig = () => {
dataIndex
:
'priority'
,
key
:
'priority'
,
align
:
'center'
,
width
:
100
,
render
:
(
text
,
record
)
=>
{
console
.
log
(
text
);
return
(
...
...
@@ -287,6 +375,7 @@ const GateConfig = () => {
key
:
'action'
,
width
:
100
,
align
:
'center'
,
fixed
:
'right'
,
render
:
record
=>
{
if
(
record
.
key
!=
'CityServer'
)
{
return
(
...
...
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