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
3f27b99a
Commit
3f27b99a
authored
3 years ago
by
邓晓峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加全局菜单搜索
parent
47a9c1b6
Pipeline
#34808
passed with stages
in 29 minutes 32 seconds
Changes
4
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
12 deletions
+57
-12
ExtendRightContent.js
src/components/GlobalHeader/ExtendRightContent.js
+2
-0
ExtendPanel.js
src/components/HeaderSearch/ExtendPanel.js
+0
-0
index.js
src/components/HeaderSearch/index.js
+28
-3
BasicLayout1.js
src/layouts/BasicLayout1.js
+27
-9
No files found.
src/components/GlobalHeader/ExtendRightContent.js
View file @
3f27b99a
...
...
@@ -201,7 +201,9 @@ const GlobalHeaderRight = props => {
<
HeaderSearch
className
=
{
`
${
styles
.
action
}
${
styles
.
search
}
${
styles
.
extendsearch
}
`
}
placeholder
=
{
intl
.
formatMessage
({
id
:
'component.search.menu.placeholder'
})}
offset
=
"46px"
defaultValue
=
""
mode
=
"tiled"
options
=
{
options
}
{...
props
}
onSelect
=
{
handleSelect
}
...
...
This diff is collapsed.
Click to expand it.
src/components/HeaderSearch/ExtendPanel.js
0 → 100644
View file @
3f27b99a
This diff is collapsed.
Click to expand it.
src/components/HeaderSearch/index.js
View file @
3f27b99a
...
...
@@ -10,7 +10,8 @@ import useMergeValue from 'use-merge-value';
import
{
SearchOutlined
}
from
'@ant-design/icons'
;
import
styles
from
'./index.less'
;
import
SearchPanel
from
'./panel'
;
import
SearchPanel
from
'./Panel'
;
import
ExtendPanel
from
'./ExtendPanel'
;
const
HeaderSearch
=
props
=>
{
const
{
...
...
@@ -162,7 +163,8 @@ const HeaderSearch = props => {
prefix
=
{
<
SearchOutlined
className
=
"site-form-item-icon"
/>
}
/
>
<
/div
>
<
SearchPanel
{
props
.
mode
&&
props
.
mode
===
'tiled'
?
<
ExtendPanel
value
=
{
keyword
}
{...
props
}
target
=
{
wrapperRef
}
...
...
@@ -171,7 +173,28 @@ const HeaderSearch = props => {
className
=
{
focus
?
styles
.
active
:
styles
.
hidden
}
style
=
{{
left
:
`
${
targetOffset
}
px`
,
top
:
isShowWidget
?
'42px'
:
'52px'
,
top
:
isShowWidget
?
'42px'
:
props
.
offset
||
'52px'
,
}}
onEsc
=
{
onEsc
}
onNavUp
=
{
onNavUp
}
onNavDown
=
{
onNavDown
}
onMouseEnter
=
{
onMouseEnter
}
onMouseLeave
=
{
onMouseLeave
}
onWillSearch
=
{
onWillSearch
}
onFocusChange
=
{
onFocusChange
}
willSearch
=
{
willSearch
}
onClose
=
{
onClose
}
console
=
{
willMenu
}
/>: <SearchPane
l
value
=
{
keyword
}
{...
props
}
target
=
{
wrapperRef
}
inputRef
=
{
inputRef
}
test
=
{
focus
}
className
=
{
focus
?
styles
.
active
:
styles
.
hidden
}
style
=
{{
left
:
`
${
targetOffset
}
px`
,
top
:
isShowWidget
?
'42px'
:
props
.
offset
||
'52px'
,
}}
onEsc
=
{
onEsc
}
onNavUp
=
{
onNavUp
}
...
...
@@ -184,6 +207,8 @@ const HeaderSearch = props => {
onClose
=
{
onClose
}
console
=
{
willMenu
}
/
>
}
<
/div
>
);
};
...
...
This diff is collapsed.
Click to expand it.
src/layouts/BasicLayout1.js
View file @
3f27b99a
...
...
@@ -254,13 +254,13 @@ const BasicLayout = props => {
const
[
childrenRoutes
,
setChildrenRoutes
]
=
useState
([]);
const
[
selectedKeys
,
setSelectedKeys
]
=
useState
([]);
const
[
tabActiveKey
,
setTabActiveKey
]
=
useState
(
"1"
);
// const [currentRoutes, setCurrentRoutes] = useState([]);
const
[
siteAction
,
setSiteAction
]
=
useState
(
()
=>
new
Site
(
props
,
setSiteLoading
),
);
const
basename
=
getBaseName
();
const
history
=
useHistory
();
const
currentRoutes
=
props
.
route
.
routes
[
props
.
currentMenuIndex
];
let
currentRoutes
=
props
.
route
.
routes
[
props
.
currentMenuIndex
]
useEffect
(()
=>
{
const
initSelectRoute
=
findPathByLeafId
(
`
${
props
.
location
.
pathname
}
`
,
...
...
@@ -277,9 +277,15 @@ const BasicLayout = props => {
currentChildrenRoute
=
initSelectRoute
}
let
childrenName
=
currentChildrenRoute
?
currentChildrenRoute
.
name
:
parentMenuName
;
if
(
currentChildrenRoute
.
routes
)
{
setTabActiveKey
(
currentChildrenRoute
.
routes
[
0
].
path
)
}
else
{
setTabActiveKey
(
currentChildrenRoute
.
path
);
}
const
initSelectIndex
=
currentRoutes
.
routes
.
findIndex
(
item
=>
item
.
name
===
childrenName
);
setSelectIndex
(
initSelectIndex
);
currentChildrenRoute
&&
currentChildrenRoute
.
routes
?
setChildrenRoutes
(
currentChildrenRoute
.
routes
):
setChildrenRoutes
([
currentChildrenRoute
])
currentChildrenRoute
&&
currentChildrenRoute
.
routes
?
setChildrenRoutes
(
currentChildrenRoute
.
routes
):
setChildrenRoutes
([
currentChildrenRoute
]);
}
else
{
setChildrenRoutes
([
{
...
...
@@ -291,6 +297,14 @@ const BasicLayout = props => {
}
},
[]);
window
.
share
&&
window
.
share
.
event
&&
window
.
share
.
event
.
on
(
'event:updateCurrentChildrenRoutes'
,
({
currentPath
,
currentRoute
,
selectedIndex
})
=>
{
currentRoute
&&
currentRoute
.
parent
&&
currentRoute
.
parent
.
routes
?
setChildrenRoutes
(
currentRoute
.
parent
.
routes
):
setChildrenRoutes
([
currentRoute
]);
setSelectIndex
(
selectedIndex
);
setTabActiveKey
(
currentPath
)
});
useEffect
(()
=>
{
siteAction
.
setGlobalConfig
(
props
.
global
);
if
(
!
Cookies
.
get
(
'token'
))
{
...
...
@@ -326,13 +340,10 @@ const BasicLayout = props => {
window
.
share
.
event
.
on
(
'updateSite'
,
res
=>
setCityData
(
res
));
return
()
=>
{
window
.
share
.
event
.
removeAllListeners
(
'updateSite'
);
// sessionStorage.removeItem('tabNav')
// sessionStorage.removeItem('tabActiveKey')
};
},
[]);
const
handlerSecond
=
(
item
,
index
)
=>
{
let
current
=
void
0
;
if
(
item
&&
item
.
routes
)
{
setChildrenRoutes
(
item
.
routes
);
...
...
@@ -341,9 +352,16 @@ const BasicLayout = props => {
setChildrenRoutes
([
item
]);
current
=
item
;
}
setTabActiveKey
(
"1"
);
window
.
history
.
pushState
(
null
,
''
,
`/civbase
${
current
.
path
}
`
);
setTabActiveKey
(
current
.
path
);
setSelectIndex
(
index
);
if
(
current
.
routes
)
{
setSelectedKeys
([
current
.
routes
[
0
].
href
]);
window
.
history
.
pushState
(
null
,
''
,
`/civbase
${
current
.
routes
[
0
].
path
}
`
);
}
else
{
window
.
history
.
pushState
(
null
,
''
,
`/civbase
${
current
.
path
}
`
);
}
}
const
handleToggleSystem
=
()
=>
{
...
...
@@ -545,7 +563,7 @@ const BasicLayout = props => {
<
/div
>
<
/div
>
<
div
className
=
{
layoutStyles
[
'menu-item-children'
]}
style
=
{{
width
:
collapse
?
'calc(100% - 46px)'
:
'calc(100% - 100px)'
}}
>
<
Tabs
activeKey
=
{
tabActiveKey
}
tabBarGutter
=
{
30
}
tabPosition
=
"top"
onTabClick
=
{(
event
)
=>
handleSelectMenuItem
(
event
)}
>
<
Tabs
activeKey
=
{
tabActiveKey
}
defaultActiveKey
=
{
tabActiveKey
}
tabBarGutter
=
{
30
}
tabPosition
=
"top"
onTabClick
=
{(
event
)
=>
handleSelectMenuItem
(
event
)}
>
{
childrenRoutes
.
map
((
item
,
index
)
=>
(
<>
<
TabPane
...
...
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