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
7f719899
Commit
7f719899
authored
Jan 28, 2021
by
Maofei94
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: 图片组件修改
parent
92d9caf4
Pipeline
#23215
passed with stages
in 19 minutes 47 seconds
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
10 deletions
+77
-10
context.js
src/components/Upload/context.js
+8
-0
index.tsx
src/components/Upload/index.tsx
+22
-6
index.js
src/pages/webConfig/index.js
+31
-2
webMenu.jsx
src/pages/webConfig/menuconfig/webMenu.jsx
+16
-2
No files found.
src/components/Upload/context.js
View file @
7f719899
...
@@ -19,6 +19,14 @@ const PictureWallProvider = props => {
...
@@ -19,6 +19,14 @@ const PictureWallProvider = props => {
if
(
res
.
code
===
0
)
{
if
(
res
.
code
===
0
)
{
const
{
data
}
=
res
;
const
{
data
}
=
res
;
let
arr
=
data
.
filter
(
item
=>
item
.
moduleName
!==
'menu'
)
||
[];
let
arr
=
data
.
filter
(
item
=>
item
.
moduleName
!==
'menu'
)
||
[];
data
.
forEach
(
item
=>
{
if
(
item
.
baseUrl
&&
item
.
moduleName
!==
'CityTemp'
)
{
if
(
!
localStorage
.
getItem
(
'pd2-baseUrl'
))
{
localStorage
.
setItem
(
'pd2-baseUrl'
,
item
.
baseUrl
);
console
.
log
(
1
,
item
.
moduleName
);
}
}
});
setImgBed
(
arr
);
setImgBed
(
arr
);
}
}
})
})
...
...
src/components/Upload/index.tsx
View file @
7f719899
...
@@ -61,6 +61,7 @@ class PicturesWall extends React.Component<PicturesWallType> {
...
@@ -61,6 +61,7 @@ class PicturesWall extends React.Component<PicturesWallType> {
previewTitle
:
''
,
previewTitle
:
''
,
imgBed
:
this
.
props
.
uploadContext
?.
imgBed
||
[],
imgBed
:
this
.
props
.
uploadContext
?.
imgBed
||
[],
curSelectedImg
:
''
,
curSelectedImg
:
''
,
baseUrl
:
''
,
prevProps
:{},
prevProps
:{},
search
:
''
,
search
:
''
,
actives
:
{},
actives
:
{},
...
@@ -158,9 +159,10 @@ class PicturesWall extends React.Component<PicturesWallType> {
...
@@ -158,9 +159,10 @@ class PicturesWall extends React.Component<PicturesWallType> {
});
});
};
};
handleImgSelected
=
(
url
:
string
)
=>
{
handleImgSelected
=
(
url
:
string
,
baseUrl
:
any
)
=>
{
this
.
setState
({
this
.
setState
({
curSelectedImg
:
url
,
curSelectedImg
:
url
,
baseUrl
:
baseUrl
});
});
};
};
...
@@ -172,14 +174,28 @@ class PicturesWall extends React.Component<PicturesWallType> {
...
@@ -172,14 +174,28 @@ class PicturesWall extends React.Component<PicturesWallType> {
handleModalOk
=
()
=>
{
handleModalOk
=
()
=>
{
const
{
maxLen
=
1
}
=
this
.
props
;
const
{
maxLen
=
1
}
=
this
.
props
;
const
{
baseUrl
,
curSelectedImg
}
=
this
.
state
const
fileList
=
[
const
fileList
=
[
{
{
uid
:
uuid
(
8
,
16
),
uid
:
uuid
(
8
,
16
),
name
:
'熊猫运维中台系统'
,
name
:
'熊猫运维中台系统'
,
status
:
'done'
,
status
:
'done'
,
url
:
this
.
state
.
curSelectedImg
,
url
:
curSelectedImg
,
},
},
];
];
if
(
!
curSelectedImg
){
message
.
warn
({
duration
:
2
,
content
:
'请先选择图片'
})
return
}
if
(
curSelectedImg
.
includes
(
'CityTemp'
)){
localStorage
.
setItem
(
'pd-baseUrl'
,
baseUrl
)
}
else
{
localStorage
.
setItem
(
'pd2-baseUrl'
,
baseUrl
)
}
console
.
log
(
fileList
[
0
].
url
)
this
.
props
.
onChange
&&
this
.
props
.
onChange
(
maxLen
===
1
?
fileList
[
0
].
url
.
replace
(
'Web4
\
\'
, '') : fileList.map(f => f.url.replace('
Web4
\\
', '')));
this
.
props
.
onChange
&&
this
.
props
.
onChange
(
maxLen
===
1
?
fileList
[
0
].
url
.
replace
(
'Web4
\
\'
, '') : fileList.map(f => f.url.replace('
Web4
\\
', '')));
this.setState({ fileList, wallModalVisible: false });
this.setState({ fileList, wallModalVisible: false });
};
};
...
@@ -242,7 +258,7 @@ class PicturesWall extends React.Component<PicturesWallType> {
...
@@ -242,7 +258,7 @@ class PicturesWall extends React.Component<PicturesWallType> {
return match&&match[1]||''
return match&&match[1]||''
}
}
renderImgItem(url){
renderImgItem(url
,baseUrl
){
const fileName = this.getFileName(url)
const fileName = this.getFileName(url)
const {curSelectedImg, search} = this.state;
const {curSelectedImg, search} = this.state;
return (
return (
...
@@ -252,7 +268,7 @@ class PicturesWall extends React.Component<PicturesWallType> {
...
@@ -252,7 +268,7 @@ class PicturesWall extends React.Component<PicturesWallType> {
[styles.hide]: !fileName.includes(search)
[styles.hide]: !fileName.includes(search)
})}
})}
key={url}
key={url}
onClick={() => this.handleImgSelected(url)}>
onClick={() => this.handleImgSelected(url
,baseUrl
)}>
<div
<div
className={classnames(
className={classnames(
curSelectedImg === url ? styles.seleted : '',
curSelectedImg === url ? styles.seleted : '',
...
@@ -276,7 +292,7 @@ class PicturesWall extends React.Component<PicturesWallType> {
...
@@ -276,7 +292,7 @@ class PicturesWall extends React.Component<PicturesWallType> {
renderCollapse(module){
renderCollapse(module){
const { Panel } = Collapse;
const { Panel } = Collapse;
const items = module.fileUrls.map(url =>this.renderImgItem(url))
const items = module.fileUrls.map(url =>this.renderImgItem(url
,module.baseUrl
))
return items.length>0&&<Panel
return items.length>0&&<Panel
forceRender
forceRender
header={module.moduleName}
header={module.moduleName}
...
@@ -397,12 +413,12 @@ class PicturesWall extends React.Component<PicturesWallType> {
...
@@ -397,12 +413,12 @@ class PicturesWall extends React.Component<PicturesWallType> {
const child = [...item.child] || [];
const child = [...item.child] || [];
console.log(picType)
if(item.fileUrls.length > 0){
if(item.fileUrls.length > 0){
child.push({
child.push({
moduleName: item.moduleName,
moduleName: item.moduleName,
fileUrls: item.fileUrls,
fileUrls: item.fileUrls,
child: [],
child: [],
baseUrl:item.baseUrl
})
})
}
}
return (
return (
...
...
src/pages/webConfig/index.js
View file @
7f719899
...
@@ -191,13 +191,42 @@ const WebConfigPage = props => {
...
@@ -191,13 +191,42 @@ const WebConfigPage = props => {
const
handleTabChange
=
v
=>
{
const
handleTabChange
=
v
=>
{
setCurWeb
(
webs
.
find
(
w
=>
w
.
id
===
v
));
setCurWeb
(
webs
.
find
(
w
=>
w
.
id
===
v
));
};
};
const
handleGeturl
=
val
=>
{
const
handleSubmit
=
values
=>
{
let
url
;
const
isSite
=
val
.
includes
(
'CityTemp'
);
if
(
isSite
)
{
url
=
val
;
}
else
{
url
=
localStorage
.
getItem
(
'pd2-baseUrl'
)
?
localStorage
.
getItem
(
'pd2-baseUrl'
)
+
val
:
val
;
}
return
url
;
};
const
handleSubmit
=
val
=>
{
let
{
bannerLogo
,
logo
,
shortcutIcon
,
baseBannerUrl
,
baseIconUrl
,
baseLogoUrl
,
}
=
val
;
baseBannerUrl
=
handleGeturl
(
bannerLogo
);
baseIconUrl
=
handleGeturl
(
shortcutIcon
);
baseLogoUrl
=
handleGeturl
(
logo
);
let
values
=
{
...
val
,
baseBannerUrl
,
baseIconUrl
,
baseLogoUrl
,
};
setSubmitting
(
true
);
setSubmitting
(
true
);
const
requestMap
=
{
const
requestMap
=
{
postEditWebConfig
,
postEditWebConfig
,
postAddWebSite
,
postAddWebSite
,
};
};
const
successMsg
=
isEdit
?
'保存成功!'
:
'新增网站成功!'
;
const
successMsg
=
isEdit
?
'保存成功!'
:
'新增网站成功!'
;
const
failMsg
=
isEdit
?
'编辑失败!'
:
'新增网站失败!'
;
const
failMsg
=
isEdit
?
'编辑失败!'
:
'新增网站失败!'
;
requestMap
[
isEdit
?
'postEditWebConfig'
:
'postAddWebSite'
](
values
)
requestMap
[
isEdit
?
'postEditWebConfig'
:
'postAddWebSite'
](
values
)
...
...
src/pages/webConfig/menuconfig/webMenu.jsx
View file @
7f719899
...
@@ -248,10 +248,23 @@ const MiniMenu = props => {
...
@@ -248,10 +248,23 @@ const MiniMenu = props => {
setAddType
(
1
);
setAddType
(
1
);
setAddTwoVisible
(
true
);
setAddTwoVisible
(
true
);
};
};
const
handleGeturl
=
val
=>
{
let
url
;
const
isSite
=
val
.
includes
(
'CityTemp'
);
if
(
isSite
)
{
url
=
val
;
}
else
{
url
=
localStorage
.
getItem
(
'pd2-baseUrl'
)
?
localStorage
.
getItem
(
'pd2-baseUrl'
)
+
val
:
val
;
}
return
url
;
};
// 新增提交的回调
// 新增提交的回调
const
submitCallback
=
(
prop
,
item
)
=>
{
const
submitCallback
=
(
prop
,
item
)
=>
{
setSubmitLoading
(
true
);
setSubmitLoading
(
true
);
let
obj
=
{
...
prop
};
let
baseUrl
=
handleGeturl
(
prop
.
imageUrl
);
let
obj
=
{
...
prop
,
baseUrl
};
const
parentID
=
item
.
menuID
?
item
.
menuID
:
-
1
;
const
parentID
=
item
.
menuID
?
item
.
menuID
:
-
1
;
addWebMenu
({
addWebMenu
({
_dc
:
Date
.
now
(),
_dc
:
Date
.
now
(),
...
@@ -287,7 +300,8 @@ const MiniMenu = props => {
...
@@ -287,7 +300,8 @@ const MiniMenu = props => {
// 编辑的回调
// 编辑的回调
const
editSubmitCallback
=
prop
=>
{
const
editSubmitCallback
=
prop
=>
{
setLoading
(
true
);
setLoading
(
true
);
let
obj
=
{
...
prop
};
let
baseUrl
=
handleGeturl
(
prop
.
imageUrl
);
let
obj
=
{
...
prop
,
baseUrl
};
if
(
nodeType
===
1
)
{
if
(
nodeType
===
1
)
{
obj
.
relatedRoleList
=
String
(
roleList
)
||
''
;
obj
.
relatedRoleList
=
String
(
roleList
)
||
''
;
}
}
...
...
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