Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivWeb
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
CivWeb
Commits
32cd9c1c
Commit
32cd9c1c
authored
Mar 20, 2023
by
张瑶
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
云平台网关取子站配置
parent
25c2adde
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
89 additions
and
90 deletions
+89
-90
index.js
src/api/index.js
+4
-31
BasicLayout.js
src/layouts/BasicLayout.js
+3
-2
Site.js
src/layouts/Site.js
+43
-11
Card.js
src/pages/cloud/introduction/newproducts/Card.js
+30
-38
Panel.js
src/pages/cloud/introduction/newproducts/Panel.js
+9
-8
index.js
src/pages/cloud/introduction/newproducts/index.js
+0
-0
No files found.
src/api/index.js
View file @
32cd9c1c
import
{
Modal
,
notification
}
from
'antd'
;
import
{
notification
}
from
'antd'
;
import
{
instanceRequest
,
service
,
event
}
from
'@wisdom-utils/utils'
;
import
AppService
from
'./service/base'
;
import
notificationService
from
'./service/notification'
;
import
CloudService
from
'./service/cloud'
;
const
{
warning
}
=
Modal
;
// eslint-disable-next-line no-return-await
instanceRequest
.
reportCodeError
=
true
;
instanceRequest
.
transformRequestURL
=
function
(
url
)
{
// url = url.replace(/\/GateWay/, '')
const
excludeURL
=
[
'/PandaCore/GCK/Basis/GateWayConfig'
,
'/CityInterface/rest/services.svc/GetConfig'
,
...
...
@@ -20,28 +17,9 @@ instanceRequest.transformRequestURL = function(url) {
if
(
excludeURL
.
includes
(
url
))
{
return
url
.
replace
(
/PandaCore
\/
GateWay
\/
/
,
''
);
}
// if (
// window.globalConfig &&
// window.globalConfig.hasGateWay &&
// /^\/(cityinterface|CityInterface|Cityinterface|CityServer|PandaInformatization)/.test(
// url,
// )
// ) {
// return /\/CityInterface\/rest\/services.svc\/GetConfig/.test(url)
// ? url
// ? /^\/GateWay/.test(url)
// ? url
// : `/GateWay${url}`
// : `/GateWay${url}`
// : `/GateWay${url}`;
// }
// if(window.globalConfig && window.globalConfig.hasGateWay) {
// return url && /^\/GateWay/.test(url) ? url : `/GateWay${url}`
// }
return
url
;
};
const
codeMessage
=
{
200
:
'服务器成功返回请求的数据。'
,
201
:
'新建或修改数据成功。'
,
...
...
@@ -60,7 +38,6 @@ const codeMessage = {
504
:
'网关超时。'
,
};
const
instance
=
null
;
instanceRequest
.
setErrorHandler
(
error
=>
{
const
{
response
}
=
error
;
if
(
response
&&
response
.
status
)
{
...
...
@@ -69,11 +46,7 @@ instanceRequest.setErrorHandler(error => {
if
(
status
===
401
)
{
event
.
emit
(
'event:logout'
);
}
else
{
// notification.error({
// message: `请求错误 ${status}: ${config.url}`,
// description: errorText,
// });
console
.
log
(
errorText
);
console
.
error
(
errorText
);
}
}
else
if
(
!
response
)
{
notification
.
error
({
...
...
src/layouts/BasicLayout.js
View file @
32cd9c1c
...
...
@@ -25,7 +25,6 @@ import SecurityLayout from './SecurityLayout';
import
Site
from
'./Site'
;
const
{
params
}
=
helpers
;
const
{
getParamsV1
}
=
params
;
// const ArcgisMap = React.lazy(() => import('../pages/map/arcgis'));
// const AMap = React.lazy(() => import('../pages/map/amap'));
...
...
@@ -244,7 +243,9 @@ const transformFloatMenu = (routes, homepage) => {
};
const
Layout
=
props
=>
{
const
currentProduct
=
`__global__recent_productIndex__micro_
${
window
.
location
.
hostname
}
_
${
params
.
getParams
(
'client'
)
||
const
currentProduct
=
`__global__recent_productIndex__micro_
${
window
.
location
.
hostname
}
_
${
params
.
getParams
(
'client'
,
)
||
sessionStorage
.
getItem
(
'client'
)
||
'city'
}
`
;
const
menuState
=
sessionStorage
.
getItem
(
'menuState'
)
||
'open'
;
...
...
src/layouts/Site.js
View file @
32cd9c1c
...
...
@@ -297,7 +297,7 @@ class Site {
return
arr
;
}
writeCookie
(
token
,
site
,
onChangeVisible
,
actionRef
)
{
writeCookie
(
token
,
site
,
onChangeVisible
,
actionRef
,
accessToken
)
{
const
date
=
new
Date
();
date
.
setTime
(
date
.
getTime
()
+
24
*
60
*
60
*
1000
);
// date = date.toGMTString();
...
...
@@ -306,6 +306,8 @@ class Site {
path
:
'/'
,
});
localStorage
.
setItem
(
'access_token'
,
accessToken
);
const
encodeSite
=
encode
(
encodeURIComponent
(
site
));
Cookies
.
set
(
'site'
,
encodeSite
,
{
expires
:
date
,
...
...
@@ -375,25 +377,55 @@ class Site {
}
beforeChangeCheck
(
token
,
site
,
onChangeVisible
,
actionRef
)
{
// eslint-disable-next-line no-undef
appService
.
getUserInfo
({
const
userParam
=
{
token
,
subOID
:
'subOID'
,
site
,
ignoreSite
:
true
,
};
const
gateWayParam
=
{
_site
:
site
,
};
Promise
.
all
([
appService
.
getUserInfo
(
userParam
),
appService
.
getWateWayConfig
(
gateWayParam
)])
.
then
(
results
=>
{
const
res
=
results
[
0
];
const
gatewayRes
=
results
[
1
];
if
(
res
.
code
!==
0
)
{
this
.
setLoading
(
false
);
message
.
error
(
'获取用户信息失败'
);
}
const
config
=
window
?.
globalConfig
;
config
.
uiwidgets
=
[];
config
.
widgets
=
[];
config
.
allWidgets
=
[];
config
.
userInfo
=
window
?.
globalConfig
?.
transformUserInfo
?.(
res
.
data
)
??
res
.
data
;
window
.
globalConfig
=
config
;
// 重置网关配置
// eslint-disable-next-line prettier/prettier, no-undef
const
hasGateWay
=
!
gatewayRes
||
!
gatewayRes
.
data
?
false
:
_
.
isString
(
gatewayRes
.
data
)
?
JSON
.
parse
(
gatewayRes
.
data
)
:
(
typeof
gatewayRes
.
data
===
'boolean'
?
gatewayRes
.
data
:
false
);
if
(
hasGateWay
)
{
appService
.
authorizationToken
({
loginName
:
config
.
userInfo
?.
loginName
||
''
,
type
:
'WorkNo'
,
})
.
then
(
res
=>
{
if
(
res
&&
res
.
code
===
0
)
{
this
.
writeCookie
(
token
,
site
,
onChangeVisible
,
actionRef
);
}
else
{
message
.
warning
(
'企业切换失败,请联系管理员排查问题!'
);
.
then
(
tokenRes
=>
{
const
accessToken
=
tokenRes
.
data
?.
access_token
??
null
;
localStorage
.
setItem
(
'access_token'
,
accessToken
);
this
.
writeCookie
(
token
,
site
,
onChangeVisible
,
actionRef
,
accessToken
);
})
.
catch
(
err
=>
{
this
.
setLoading
(
false
);
this
.
writeCookie
(
token
,
site
,
onChangeVisible
,
actionRef
,
null
);
});
}
else
{
localStorage
.
setItem
(
'access_token'
,
null
);
this
.
writeCookie
(
token
,
site
,
onChangeVisible
,
actionRef
,
null
);
}
})
.
catch
(
e
=>
{
message
.
warning
(
'企业切换失败,请联系管理员排查问题!'
);
.
catch
(
err
=>
{
this
.
setLoading
(
false
);
message
.
warning
(
'企业切换失败,请联系管理员排查问题!'
);
});
}
...
...
src/pages/cloud/introduction/newproducts/Card.js
View file @
32cd9c1c
import
React
from
'react'
;
import
classnames
from
'classnames'
;
import
styles
from
'./index.less'
;
import
cover
from
'./images/default.png'
;
import
{
chunk
}
from
'lodash-es'
;
import
cover
from
'./images/default.png'
;
import
styles
from
'./index.less'
;
const
assetPath
=
`
${
window
.
location
.
origin
}
/PandaWorkFlow/WorkFlow/AccountManage/DownloadFiles`
;
const
Card
=
({
onCardClick
,
...
props
})
=>
{
const
Card
=
({
onCardClick
,
...
props
})
=>
{
const
{
config
}
=
props
;
if
(
config
[
'副标题'
].
indexOf
(
'
\\
n'
)
===
-
1
)
{
config
[
'副标题'
]
=
config
[
'副标题'
]
+
'
\\
n'
;
if
(
config
[
'副标题'
].
indexOf
(
'
\\
n'
)
===
-
1
)
{
config
[
'副标题'
]
+=
'
\\
n'
;
}
if
(
config
[
'系统特点'
].
indexOf
(
','
)
===
-
1
)
{
config
[
'系统特点'
]
=
config
[
'系统特点'
]
+
','
;
if
(
config
[
'系统特点'
].
indexOf
(
','
)
===
-
1
)
{
config
[
'系统特点'
]
+=
','
;
}
return
(
<
div
className
=
{
styles
.
card
}
onClick
=
{
e
=>
onCardClick
(
e
,
props
)}
>
<
div
className
=
{
classnames
(
styles
[
'card-title'
],
styles
[
'nowrap-text'
])}
>
{
config
&&
config
[
'标题'
]}
<
/div
>
<
div
key
=
{
config
&&
config
[
'标题'
]
?
config
[
'标题'
]
:
Math
.
random
()}
className
=
{
styles
.
card
}
onClick
=
{
e
=>
onCardClick
(
config
,
props
)}
>
<
div
className
=
{
classnames
(
styles
[
'card-title'
],
styles
[
'nowrap-text'
])}
>
{
config
&&
config
[
'标题'
]}
<
/div
>
<
div
className
=
{
classnames
(
styles
[
'card-content'
])}
>
<
div
className
=
{
classnames
(
styles
[
'card-img'
])}
>
<
img
src
=
{
config
&&
config
[
'封面图'
]
?
`
${
assetPath
}
?filePath=
${
config
[
'封面图'
]}
`
:
cover
}
/
>
<
img
src
=
{
config
&&
config
[
'封面图'
]
?
`
${
assetPath
}
?filePath=
${
config
[
'封面图'
]}
`
:
cover
}
alt
=
""
/>
{
config
&&
config
[
'系统描述'
]
?
(
<
div
className
=
{
styles
.
back
}
>
{
config
&&
config
[
'系统描述'
]}
<
/div
>
)
:
null
}
{
config
&&
config
[
'系统描述'
]
?
<
div
className
=
{
styles
.
back
}
>
{
config
&&
config
[
'系统描述'
]}
<
/div> : null
}
<
/div
>
<
div
className
=
{
classnames
(
styles
[
'card-info'
])}
>
<
div
className
=
{
classnames
(
styles
[
'card-desc'
])}
>
{
config
&&
config
[
'副标题'
]
&&
config
&&
config
[
'副标题'
].
split
(
"
\\
n"
).
map
((
item
,
index
)
=>
{
return
<
div
key
=
{
index
}
>
{
item
}
<
/div
>
})
}
{
config
&&
config
[
'副标题'
]
&&
config
[
'副标题'
].
split
(
'
\\
n'
).
map
((
item
,
index
)
=>
<
div
key
=
{
index
}
>
{
item
}
<
/div>
)
}
<
/div
>
<
div
className
=
{
classnames
(
styles
[
'card-tags'
])}
>
<
div
className
=
{
classnames
(
styles
[
'card-list'
])}
>
{
c
onfig
&&
config
[
'系统特点'
]
&&
chunk
(
config
[
'系统特点'
].
split
(
','
)
,
2
).
map
((
item
,
index
)
=>
{
return
<
div
key
=
{
index
}
className
=
{
classnames
(
styles
[
'card-list-content'
])}
>
{
item
.
map
((
child
,
key
)
=>
{
return
<
div
className
=
{
classnames
(
styles
[
'card-tag'
])}
{
config
[
'系统特点'
]
&&
c
hunk
(
config
[
'系统特点'
].
split
(
','
),
2
).
map
((
item
,
index
)
=>
(
<
div
key
=
{
index
}
className
=
{
classnames
(
styles
[
'card-list-content'
])}
>
{
item
.
map
(
child
=>
(
<
div
className
=
{
classnames
(
styles
[
'card-tag'
])}
style
=
{{
height
:
config
[
'系统特点'
].
split
(
','
).
length
<=
6
?
44
:
40
,
lineHeight
:
config
[
'系统特点'
].
split
(
','
).
length
<=
6
?
'44px'
:
'40px'
,
marginTop
:
config
[
'系统特点'
].
split
(
','
).
length
<=
8
?
10
:
0
}}
key
=
{
key
+
index
}
>
marginTop
:
config
[
'系统特点'
].
split
(
','
).
length
<=
8
?
10
:
0
,
}}
key
=
{
child
}
>
<
i
className
=
{
classnames
(
styles
[
'card-tag-icon'
])}
/
>
{
child
}
<
/div
>
})
}
))}
<
/div
>
})
}
))}
<
/div
>
<
/div
>
<
/div
>
<
/div
>
...
...
src/pages/cloud/introduction/newproducts/Panel.js
View file @
32cd9c1c
import
React
from
'react'
;
import
styles
from
'./index.less'
;
import
Card
from
'./Card'
;
import
classnames
from
'classnames'
;
const
Panel
=
({
products
=
[],
onCardClick
,
pageIndex
,
pageSize
})
=>
{
return
(
<
div
className
=
{
classnames
(
styles
.
panel
)}
num
=
{
pageIndex
==
0
?
products
.
length
:
pageSize
}
>
{
products
.
map
((
item
,
index
)
=>
<
Card
key
=
{
index
}
{...
item
}
onCardClick
=
{
onCardClick
}
/>
)
}
import
Card
from
'./Card'
;
import
styles
from
'./index.less'
;
const
Panel
=
({
products
=
[],
onCardClick
,
pageIndex
,
pageSize
})
=>
(
<
div
className
=
{
classnames
(
styles
.
panel
)}
num
=
{
pageIndex
===
0
?
products
.
length
:
pageSize
}
>
{
products
.
map
((
item
,
index
)
=>
(
<
Card
key
=
{
index
}
{...
item
}
onCardClick
=
{
onCardClick
}
/
>
))}
<
/div
>
);
};
);
export
default
Panel
;
src/pages/cloud/introduction/newproducts/index.js
View file @
32cd9c1c
This diff is collapsed.
Click to expand it.
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