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
3bcbac2d
Commit
3bcbac2d
authored
Dec 08, 2021
by
邓晓峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复登录BUG
parent
b72c6572
Pipeline
#39771
passed with stages
in 14 minutes 22 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
24 additions
and
8 deletions
+24
-8
app.js
src/app.js
+4
-2
MinCategories.js
src/components/SliderPanel/MinCategories.js
+4
-2
BasicLayout1.js
src/layouts/BasicLayout1.js
+9
-1
login.js
src/pages/user/login/login.js
+4
-1
config.js
src/routes/config.js
+1
-1
routes.js
src/utils/routes.js
+2
-1
No files found.
src/app.js
View file @
3bcbac2d
...
@@ -14,6 +14,7 @@ import 'sanitize.css/sanitize.css';
...
@@ -14,6 +14,7 @@ import 'sanitize.css/sanitize.css';
import
React
from
'react'
;
import
React
from
'react'
;
import
ReactDOM
from
'react-dom'
;
import
ReactDOM
from
'react-dom'
;
import
{
event
}
from
'microser-data'
;
import
{
event
}
from
'microser-data'
;
import
_
from
'lodash'
;
import
{
Button
,
ConfigProvider
,
message
,
notification
}
from
'antd'
;
import
{
Button
,
ConfigProvider
,
message
,
notification
}
from
'antd'
;
import
{
ConnectedRouter
}
from
'connected-react-router/immutable'
;
import
{
ConnectedRouter
}
from
'connected-react-router/immutable'
;
import
Immutable
from
'immutable'
;
import
Immutable
from
'immutable'
;
...
@@ -117,9 +118,10 @@ const initGlobalConfig = () => {
...
@@ -117,9 +118,10 @@ const initGlobalConfig = () => {
}
}
});
});
// eslint-disable-next-line react-hooks/rules-of-hooks
// eslint-disable-next-line react-hooks/rules-of-hooks
const
client
=
!
_
.
isNull
(
params
.
getParams
(
'client'
))
?
params
.
getParams
(
'client'
)
:
Cookies
.
get
(
'city'
)
?
Cookies
.
get
(
'city'
):
'city'
;
appService
appService
.
queryConfig
({
.
queryConfig
({
client
:
Cookies
.
get
(
'city'
)
||
params
.
getParams
(
'client'
)
,
client
:
client
,
})
})
.
then
(
res
=>
{
.
then
(
res
=>
{
if
(
res
)
{
if
(
res
)
{
...
@@ -128,7 +130,7 @@ const initGlobalConfig = () => {
...
@@ -128,7 +130,7 @@ const initGlobalConfig = () => {
if
(
!
data
.
client
)
{
if
(
!
data
.
client
)
{
data
.
client
=
params
.
getParams
(
'client'
)
||
'city'
;
data
.
client
=
params
.
getParams
(
'client'
)
||
'city'
;
}
}
Cookies
.
set
(
'city'
,
data
.
client
);
//
Cookies.set('city', data.client);
store
.
dispatch
(
store
.
dispatch
(
actionCreators
.
getConfig
(
actionCreators
.
getConfig
(
Object
.
assign
({},
window
.
globalConfig
,
data
),
Object
.
assign
({},
window
.
globalConfig
,
data
),
...
...
src/components/SliderPanel/MinCategories.js
View file @
3bcbac2d
...
@@ -7,6 +7,7 @@ import styles from './min.less';
...
@@ -7,6 +7,7 @@ import styles from './min.less';
const
Categories
=
props
=>
{
const
Categories
=
props
=>
{
const
[
currentIndex
,
setCurrentIndex
]
=
useState
(
props
.
currentMenuIndex
);
const
[
currentIndex
,
setCurrentIndex
]
=
useState
(
props
.
currentMenuIndex
);
const
selectCategories
=
(
event
,
index
)
=>
{
const
selectCategories
=
(
event
,
index
)
=>
{
debugger
event
.
preventDefault
();
event
.
preventDefault
();
event
.
stopPropagation
();
event
.
stopPropagation
();
event
.
nativeEvent
.
stopImmediatePropagation
();
event
.
nativeEvent
.
stopImmediatePropagation
();
...
@@ -18,7 +19,7 @@ const Categories = props => {
...
@@ -18,7 +19,7 @@ const Categories = props => {
<
div
className
=
{
classNames
(
styles
[
'menu-categories'
],
{
<
div
className
=
{
classNames
(
styles
[
'menu-categories'
],
{
[
styles
[
'min-cateorites'
]]:
props
.
mode
[
styles
[
'min-cateorites'
]]:
props
.
mode
})}
>
})}
>
{(
props
.
data
||
[]).
map
((
item
,
index
)
=>
{
{(
props
.
data
||
[]).
filter
(
item
=>
!
item
.
hideInMenu
).
map
((
item
,
index
)
=>
{
const
categorieCls
=
classNames
(
const
categorieCls
=
classNames
(
styles
[
'categorie-name'
],
styles
[
'categorie-name'
],
styles
.
btn
,
styles
.
btn
,
...
@@ -35,7 +36,8 @@ const Categories = props => {
...
@@ -35,7 +36,8 @@ const Categories = props => {
<
span
>
{
item
.
extData
.
label
}
<
/span
>
<
span
>
{
item
.
extData
.
label
}
<
/span
>
<
/div
>
<
/div
>
);
);
})}
})
}
<
/div
>
<
/div
>
);
);
};
};
...
...
src/layouts/BasicLayout1.js
View file @
3bcbac2d
...
@@ -268,7 +268,10 @@ const BasicLayout = props => {
...
@@ -268,7 +268,10 @@ const BasicLayout = props => {
const
basename
=
getBaseName
();
const
basename
=
getBaseName
();
const
history
=
useHistory
();
const
history
=
useHistory
();
let
currentRoutes
=
props
.
route
.
routes
[
props
.
currentMenuIndex
]
// 处理隐藏菜单
let
currentRoutes
=
props
.
route
.
routes
.
filter
(
item
=>
!
item
.
hideInMenu
)[
props
.
currentMenuIndex
];
//props.currentMenuIndex
useEffect
(()
=>
{
useEffect
(()
=>
{
const
initSelectRoute
=
findPathByLeafId
(
const
initSelectRoute
=
findPathByLeafId
(
`
${
props
.
location
&&
props
.
location
.
pathname
||
''
}
`
,
`
${
props
.
location
&&
props
.
location
.
pathname
||
''
}
`
,
...
@@ -305,6 +308,10 @@ const BasicLayout = props => {
...
@@ -305,6 +308,10 @@ const BasicLayout = props => {
])
])
}
}
},
[]);
},
[]);
useEffect
(()
=>
{
console
.
log
(
props
.
route
.
routes
);
},
[
props
.
currentMenuIndex
]);
window
.
share
&&
window
.
share
.
event
&&
window
.
share
.
event
.
on
(
'event:updateCurrentChildrenRoutes'
,
({
currentPath
,
currentRoute
,
selectedIndex
})
=>
{
window
.
share
&&
window
.
share
.
event
&&
window
.
share
.
event
.
on
(
'event:updateCurrentChildrenRoutes'
,
({
currentPath
,
currentRoute
,
selectedIndex
})
=>
{
currentRoute
&&
currentRoute
.
parent
&&
currentRoute
.
parent
.
routes
?
setChildrenRoutes
(
currentRoute
.
parent
.
routes
):
!
currentRoute
.
parent
?
setChildrenRoutes
(
currentRoute
.
routes
):
setChildrenRoutes
([
currentRoute
]);
currentRoute
&&
currentRoute
.
parent
&&
currentRoute
.
parent
.
routes
?
setChildrenRoutes
(
currentRoute
.
parent
.
routes
):
!
currentRoute
.
parent
?
setChildrenRoutes
(
currentRoute
.
routes
):
setChildrenRoutes
([
currentRoute
]);
setSelectIndex
(
selectedIndex
);
setSelectIndex
(
selectedIndex
);
...
@@ -419,6 +426,7 @@ const BasicLayout = props => {
...
@@ -419,6 +426,7 @@ const BasicLayout = props => {
}
}
const
handleUpdateCurrentIndex
=
index
=>
{
const
handleUpdateCurrentIndex
=
index
=>
{
debugger
setSelectIndex
(
-
1
)
setSelectIndex
(
-
1
)
props
.
updateCurrentIndex
(
index
);
props
.
updateCurrentIndex
(
index
);
window
.
share
&&
window
.
share
.
event
.
emit
(
'trigger:updateMenuIndex'
,
index
);
window
.
share
&&
window
.
share
.
event
.
emit
(
'trigger:updateMenuIndex'
,
index
);
...
...
src/pages/user/login/login.js
View file @
3bcbac2d
...
@@ -754,7 +754,10 @@ class Login {
...
@@ -754,7 +754,10 @@ class Login {
if
(
response
.
access_token
!==
""
)
{
if
(
response
.
access_token
!==
""
)
{
self
.
globalConfig
.
access_token
=
response
.
access_token
;
self
.
globalConfig
.
access_token
=
response
.
access_token
;
localStorage
.
setItem
(
'access_token'
,
response
.
access_token
);
localStorage
.
setItem
(
'access_token'
,
response
.
access_token
);
Cookies
.
set
(
'city'
,
self
.
globalConfig
.
client
)
Cookies
.
set
(
'city'
,
self
.
globalConfig
.
client
,
{
expires
:
exp
/
(
24
*
60
*
60
*
1000
),
path
:
'/'
,
})
}
}
if
(
isRememberPWD
)
{
if
(
isRememberPWD
)
{
Cookies
.
set
(
'city'
,
self
.
globalConfig
.
client
,
{
Cookies
.
set
(
'city'
,
self
.
globalConfig
.
client
,
{
...
...
src/routes/config.js
View file @
3bcbac2d
...
@@ -35,7 +35,7 @@ export const dyRoutes = routes => {
...
@@ -35,7 +35,7 @@ export const dyRoutes = routes => {
{
{
path
:
'/commonmenu'
,
path
:
'/commonmenu'
,
component
:
CommonMenu
,
component
:
CommonMenu
,
name
:
'
commonmenu
'
name
:
'
菜单收藏
'
},
},
{
{
path
:
'/404'
,
path
:
'/404'
,
...
...
src/utils/routes.js
View file @
3bcbac2d
...
@@ -102,7 +102,8 @@ const generRotes = (widgets, parent, level = 0) => {
...
@@ -102,7 +102,8 @@ const generRotes = (widgets, parent, level = 0) => {
href
:
url
,
href
:
url
,
target
:
isURL
(
url
)
?
'_blank'
:
''
,
target
:
isURL
(
url
)
?
'_blank'
:
''
,
key
:
guid
(
'panda'
),
key
:
guid
(
'panda'
),
hideInMenu
:
l
>
3
?
true
:
item
.
hideInMenu
||
false
,
hideInMenu
:
item
.
label
===
'系统菜单组'
?
true
:
item
.
hideInMenu
,
//l > 3 ? true: item.hideInMenu || false,
alias
:
item
.
product
||
DEFAULT_APPLICATION
,
alias
:
item
.
product
||
DEFAULT_APPLICATION
,
extData
:
{
extData
:
{
...
item
,
...
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