Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
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
黄庭坚
jinfa-platform
Commits
e64da9e7
Commit
e64da9e7
authored
Apr 21, 2022
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 完善首页侧边栏交互;添加默认跳转srm采购商首页逻辑
parent
5d627558
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
58 additions
and
15 deletions
+58
-15
app.tsx
src/app.tsx
+3
-1
home.ts
src/constants/home.ts
+11
-0
BasicLayout.tsx
src/layouts/BasicLayout.tsx
+7
-4
MenuSlider.tsx
src/layouts/components/MenuSlider.tsx
+2
-1
OuterSide.tsx
src/layouts/components/OuterSide.tsx
+2
-1
RightContent.tsx
src/layouts/components/RightContent.tsx
+2
-1
Roles.tsx
src/layouts/components/Roles.tsx
+2
-1
index.tsx
...pages/member/memberImport/components/MemberForm/index.tsx
+2
-1
index.less
src/pages/srmHome/components/TodoCard/index.less
+0
-1
index.tsx
...ges/supplier/memberImport/components/MemberForm/index.tsx
+2
-1
LoginWrap.tsx
src/pages/user/components/LoginWrap.tsx
+3
-1
ScanLoginWrap.tsx
src/pages/user/components/ScanLoginWrap.tsx
+3
-1
auth.ts
src/utils/auth.ts
+2
-1
defaultHomePath.ts
src/utils/defaultHomePath.ts
+17
-0
No files found.
src/app.tsx
View file @
e64da9e7
...
...
@@ -16,6 +16,7 @@ import LRU from '@/utils/lru';
import
{
getMemberLoginReget
}
from
'./services/MemberV2Api'
;
import
{
getManagePaasSiteEnableMultiTenancy
}
from
'./services/ManageV2Api'
;
import
{
GlobalConfig
}
from
'./global/config'
;
import
defaultHomePath
from
'./utils/defaultHomePath'
;
const
recent
=
new
LRU
(
6
);
recent
.
init
();
...
...
@@ -49,6 +50,7 @@ const whiteLists = [
// 登录后的路由白名单
const
loginWhiteList
=
[
'/memberCenter/home'
,
'/memberCenter/home/index'
,
'/memberCenter/editMySelf'
]
...
...
@@ -168,7 +170,7 @@ export function onRouteChange({ routes, matchedRoutes, location, action }) {
console
.
log
(
pathname
,
'pathname'
)
if
(
userLoginLists
.
includes
(
pathname
))
{
// 当登录过, 并且尝试访问登录相关页面, 需重定向到首页
history
.
replace
(
'/memberCenter/home'
)
history
.
replace
(
defaultHomePath
()
)
return
;
}
...
...
src/constants/home.ts
View file @
e64da9e7
...
...
@@ -33,3 +33,13 @@ export const SRM_HOME_TODO = {
'/memberCenter/afterService'
:
'售后中心'
,
'/memberCenter/logisticsAbility'
:
'物流中心'
,
};
/**
* src采购商首页路径
*/
export
const
SRM_PURCHASER_HOME_PATH
=
'/memberCenter/home/srmPurchaser'
;
/**
* 首页路径
*/
export
const
HOME_PATH
=
'/memberCenter/home/index'
;
\ No newline at end of file
src/layouts/BasicLayout.tsx
View file @
e64da9e7
...
...
@@ -17,6 +17,7 @@ import MenuSlider from './components/MenuSlider'
import
{
getMatchMenu
}
from
'@umijs/route-utils'
;
import
{
useGlobal
}
from
'@/models/useGlobal'
;
import
{
MenuUnfoldOutlined
,
MenuFoldOutlined
}
from
'@ant-design/icons'
;
import
{
HOME_PATH
,
SRM_PURCHASER_HOME_PATH
}
from
'@/constants/home'
;
export
interface
BasicLayoutProps
extends
ProLayoutProps
{
breadcrumbNameMap
:
{
...
...
@@ -60,7 +61,9 @@ const defaultFooterDom = (
/>
);
const
DEFAULT_COLLAPSED_LIST
=
[
"/memberCenter/noAuth"
];
const
HOME_PAGE_LIST
=
[
HOME_PATH
,
SRM_PURCHASER_HOME_PATH
];
const
OTHER_PAGE_LIST
=
[
"/memberCenter/noAuth"
];
const
DEFAULT_COLLAPSED_LIST
=
[...
HOME_PAGE_LIST
,
...
OTHER_PAGE_LIST
];
const
BasicLayout
:
React
.
FC
<
BasicLayoutProps
>
=
(
props
)
=>
{
const
{
...
...
@@ -76,11 +79,11 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
const
[
selectedKeys
,
setSelectedKeys
]
=
useState
<
string
[]
|
undefined
>
([]);
// 获取全局状态
const
[
globalState
,
globalDispatch
]
=
useGlobal
();
// const isHome = location.pathname ===
'/memberCenter/home'
// const isHome = location.pathname ===
HOME_PATH
const
isHome
=
false
const
handleMenuCollapse
=
(
payload
:
boolean
):
void
=>
{
if
(
DEFAULT_COLLAPSED
_LIST
.
includes
(
location
.
pathname
))
{
if
(
OTHER_PAGE
_LIST
.
includes
(
location
.
pathname
))
{
return
;
}
setCollapsed
(
payload
)
...
...
@@ -168,7 +171,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
</
Link
>
)
}
collapsed=
{
collapsed
}
collapsedButtonRender=
{
(
flag
)
=>
(
DEFAULT_COLLAPSED
_LIST
.
includes
(
location
.
pathname
)
?
null
:
flag
?
<
MenuUnfoldOutlined
/>
:
<
MenuFoldOutlined
/>)
}
collapsedButtonRender=
{
(
flag
)
=>
(
OTHER_PAGE
_LIST
.
includes
(
location
.
pathname
)
?
null
:
flag
?
<
MenuUnfoldOutlined
/>
:
<
MenuFoldOutlined
/>)
}
onCollapse=
{
handleMenuCollapse
}
disableContentMargin=
{
currentRouter
?.
noMargin
!==
undefined
}
breadcrumbRender=
{
(
routers
=
[])
=>
[
...
...
src/layouts/components/MenuSlider.tsx
View file @
e64da9e7
...
...
@@ -11,6 +11,7 @@ import { GlobalConfig } from '@/global/config'
import
styles
from
'../styles/MenuSlider.less'
import
{
getRouters
}
from
'@/utils/auth'
;
import
{
isDev
}
from
'@/constants'
;
import
defaultHomePath
from
'@/utils/defaultHomePath'
;
const
{
Sider
}
=
Layout
const
{
SubMenu
}
=
Menu
;
...
...
@@ -102,7 +103,7 @@ const MenuSlider: React.FC<MenuSliderProps> = (props) => {
return
<>
<
OuterSider
{
...
props
}
/>
<
Sider
theme=
"light"
className=
{
styles
.
menu_sider
}
width=
{
props
.
collapseState
?
0
:
200
}
collapsedWidth=
{
props
.
collapseState
?
0
:
80
}
collapsed=
{
props
.
collapseState
}
>
<
Link
to=
{
`/`
}
className=
{
styles
.
logo
}
>
<
Link
to=
{
defaultHomePath
()
}
className=
{
styles
.
logo
}
>
<
img
src=
{
GlobalConfig
.
global
.
siteInfo
.
logo
}
/>
</
Link
>
<
div
className=
{
styles
.
menuTitle
}
>
...
...
src/layouts/components/OuterSide.tsx
View file @
e64da9e7
...
...
@@ -8,6 +8,7 @@ import { observer, inject } from 'mobx-react';
import
CustomIcon
from
'./CustomIcon'
;
import
Icon
from
'@ant-design/icons'
;
import
{
ReactComponent
as
DefaultAvatar
}
from
'@/assets/imgs/default_avatar.svg'
;
import
defaultHomePath
from
'@/utils/defaultHomePath'
;
const
{
Sider
}
=
Layout
export
interface
OuterSiderProps
{
...
...
@@ -56,7 +57,7 @@ const OuterSider: React.FC<OuterSiderProps> = observer((props) => {
return
<>
<
Sider
collapsed=
{
true
}
collapsedWidth=
{
64
}
className=
{
styles
.
wrapperSilder
}
>
<
div
className=
{
styles
.
userPic
}
>
<
Link
to=
"/memberCenter/home"
>
<
Link
to=
{
defaultHomePath
()
}
>
{
props
.
UserStore
.
avatar
?
<
img
src=
{
props
.
UserStore
.
avatar
}
className=
{
styles
.
avatar
}
/>
...
...
src/layouts/components/RightContent.tsx
View file @
e64da9e7
...
...
@@ -15,6 +15,7 @@ import { SOCKET_URL, PLATFORM_DOMAIN } from '@/constants';
import
{
GlobalConfig
}
from
'@/global/config'
;
import
{
usePurchaseBidStore
}
from
'@/store/purchaseBid'
;
import
defaultHomePath
from
'@/utils/defaultHomePath'
;
// export type SiderTheme = 'light' | 'dark';
// export interface GlobalHeaderRightProps extends Partial<ConnectProps> {
...
...
@@ -110,7 +111,7 @@ const GlobalHeaderRight: React.FC<{ SiteStore?: any, isHome: boolean }> = (props
return
(
<
div
className=
{
className
}
>
<
div
>
<
Link
to=
{
"/memberCenter/home"
}
className=
{
styles
.
container
}
style=
{
isHome
?
cacheStyle
.
isHome
:
{}
}
>
<
Link
to=
{
defaultHomePath
()
}
className=
{
styles
.
container
}
style=
{
isHome
?
cacheStyle
.
isHome
:
{}
}
>
{
isHome
&&
(
<
img
src=
{
GlobalConfig
.
global
.
siteInfo
.
logo
}
style=
{
cacheStyle
.
iamge
}
/>
...
...
src/layouts/components/Roles.tsx
View file @
e64da9e7
...
...
@@ -4,6 +4,7 @@ import { CaretDownOutlined } from '@ant-design/icons';
import
{
getAuth
,
getCookieAuth
,
setAuth
,
setRouters
}
from
'@/utils/auth'
;
import
{
postMemberLoginSwitchrole
}
from
'@/services/MemberV2Api'
;
import
{
useIntl
}
from
'umi'
import
defaultHomePath
from
'@/utils/defaultHomePath'
;
interface
MemberRole
{
memberRoleId
:
number
;
...
...
@@ -49,7 +50,7 @@ const Roles: React.FC = () => {
setAuth
(
res
.
data
);
setRouters
(
res
.
data
.
auth
);
setTimeout
(()
=>
{
window
.
location
.
replace
(
'/memberCenter/home'
);
window
.
location
.
replace
(
defaultHomePath
()
);
},
800
);
}).
finally
(()
=>
{
msg
();
...
...
src/pages/member/memberImport/components/MemberForm/index.tsx
View file @
e64da9e7
...
...
@@ -10,6 +10,7 @@ import NiceForm from '@/components/NiceForm';
import
{
useAsyncInitSelect
}
from
'@/formSchema/effects/useAsyncInitSelect'
;
import
{
useLinkageUtils
}
from
'@/utils/formEffectUtils'
;
import
{
getAuth
,
setAuth
}
from
'@/utils/auth'
;
import
defaultHomePath
from
'@/utils/defaultHomePath'
;
import
{
initDetailSchema
}
from
'./schema'
;
import
AreaSelect
from
'../../../components/AreaSelect'
;
import
{
...
...
@@ -262,7 +263,7 @@ const MemberForm: React.FC<MemberFormProps> = ({
}
as
any
);
setUnsaved
(
false
);
setTimeout
(()
=>
{
history
.
push
(
'/memberCenter/home'
);
history
.
push
(
defaultHomePath
()
);
},
800
);
}).
finally
(()
=>
{
msg
();
...
...
src/pages/srmHome/components/TodoCard/index.less
View file @
e64da9e7
...
...
@@ -45,7 +45,6 @@
&-content {
margin-left: -@margin-md;
padding-bottom: @padding-md / 2;
}
&-group {
...
...
src/pages/supplier/memberImport/components/MemberForm/index.tsx
View file @
e64da9e7
...
...
@@ -10,6 +10,7 @@ import NiceForm from '@/components/NiceForm';
import
{
useAsyncInitSelect
}
from
'@/formSchema/effects/useAsyncInitSelect'
;
import
{
useLinkageUtils
}
from
'@/utils/formEffectUtils'
;
import
{
getAuth
,
setAuth
}
from
'@/utils/auth'
;
import
defaultHomePath
from
'@/utils/defaultHomePath'
;
import
{
initDetailSchema
}
from
'./schema'
;
import
AreaSelect
from
'../../../components/AreaSelect'
;
import
{
...
...
@@ -262,7 +263,7 @@ const MemberForm: React.FC<MemberFormProps> = ({
}
as
any
);
setUnsaved
(
false
);
setTimeout
(()
=>
{
history
.
push
(
'/memberCenter/home'
);
history
.
push
(
defaultHomePath
()
);
},
800
);
}).
finally
(()
=>
{
msg
();
...
...
src/pages/user/components/LoginWrap.tsx
View file @
e64da9e7
...
...
@@ -11,6 +11,8 @@ import { setAuth, setRouters } from '@/utils/auth';
import
{
encryptedByAES
,
Base64
}
from
'@/utils/cryptoAes'
;
import
{
setUserCookie
}
from
'@/utils/siteCookie'
;
import
{
omit
}
from
'@/utils'
;
import
defaultHomePath
from
'@/utils/defaultHomePath'
;
const
intl
=
getIntl
();
const
LoginWrap
:
React
.
FC
=
()
=>
{
const
{
redirect
}
=
history
.
location
.
query
...
...
@@ -33,7 +35,7 @@ const LoginWrap: React.FC = () => {
if
(
redirect
)
{
window
.
location
.
replace
(
decodeURIComponent
(
Base64
.
decode
(
redirect
)))
}
else
{
window
.
location
.
replace
(
'/memberCenter/home'
)
window
.
location
.
replace
(
defaultHomePath
()
)
}
}
else
{
setLoginLoading
(
false
)
...
...
src/pages/user/components/ScanLoginWrap.tsx
View file @
e64da9e7
...
...
@@ -4,6 +4,8 @@ import { getIntl, history } from 'umi';
import
{
setAuth
,
setRouters
}
from
'@/utils/auth'
;
import
QRCode
from
'qrcode'
;
import
{
postMemberLoginAuthUrl
,
postMemberLoginInfo
}
from
'@/services/MemberV2Api'
;
import
defaultHomePath
from
'@/utils/defaultHomePath'
;
const
intl
=
getIntl
();
const
ScanLoginWrap
:
React
.
FC
=
()
=>
{
const
{
redirect
}
=
history
.
location
.
query
...
...
@@ -70,7 +72,7 @@ const ScanLoginWrap: React.FC = () => {
if
(
redirect
)
{
window
.
location
.
replace
(
decodeURIComponent
(
atob
(
redirect
)))
}
else
{
window
.
location
.
replace
(
'/memberCenter/home'
)
window
.
location
.
replace
(
defaultHomePath
()
)
}
console
.
log
(
redirect
,
'redirect'
)
clearTimeout
(
timer
.
current
)
...
...
src/utils/auth.ts
View file @
e64da9e7
...
...
@@ -143,7 +143,8 @@ export const removeAuth = () => {
const
HOME_URL
=
[
'/'
,
'/memberCenter/home'
'/memberCenter/home'
,
'/memberCenter/home/index'
,
]
export
const
asyncRouter
=
async
(
routeLists
:
{
b
:
string
[],
u
:
string
}[],
routes
:
any
[])
=>
{
...
...
src/utils/defaultHomePath.ts
0 → 100644
View file @
e64da9e7
import
{
SRM_PURCHASER_HOME_PATH
,
HOME_PATH
}
from
'@/constants/home'
;
import
{
getAuth
}
from
"./auth"
;
/**
* @description 返回默认首页路径,如果用户菜单中存在 srm采购商首页 则返回,否则返回之前的首页
* @returns 默认首页路径
*/
const
defaultHomePath
=
():
string
=>
{
const
userAuth
=
getAuth
();
if
(
userAuth
.
urls
.
includes
(
SRM_PURCHASER_HOME_PATH
))
{
return
SRM_PURCHASER_HOME_PATH
;
}
return
HOME_PATH
;
};
export
default
defaultHomePath
;
\ No newline at end of file
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