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
shenshaokai
jinfa-platform
Commits
9068080a
Commit
9068080a
authored
Jan 13, 2021
by
GuanHua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复从渠道商城进入会员中心后,返回商城时,返回到企业商城的问题
parent
afda6263
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
56 additions
and
17 deletions
+56
-17
HeaderDropdown.tsx
src/layouts/components/HeaderDropdown.tsx
+3
-4
RightContent.tsx
src/layouts/components/RightContent.tsx
+13
-8
LXChannelLayout.tsx
src/pages/lxMall/layouts/LXChannelLayout.tsx
+6
-1
LXIChannelLayout.tsx
src/pages/lxMall/layouts/LXIChannelLayout.tsx
+6
-2
LXMallLayout.tsx
src/pages/lxMall/layouts/LXMallLayout.tsx
+5
-1
LXShopLayout.tsx
src/pages/lxMall/layouts/LXShopLayout.tsx
+5
-1
index.ts
src/store/site/index.ts
+18
-0
No files found.
src/layouts/components/HeaderDropdown.tsx
View file @
9068080a
...
...
@@ -8,7 +8,7 @@ import us from '../../../mockStatic/us.png'
import
{
CaretDownOutlined
}
from
'@ant-design/icons'
import
{
GlobalConfig
}
from
'@/global/config'
interface
c
ountryItem
{
interface
C
ountryItem
{
name
:
string
,
key
:
string
,
icon
:
string
...
...
@@ -16,7 +16,7 @@ interface countryItem {
const
HeaderDropdown
:
React
.
FC
=
()
=>
{
// 此处暂时无接口, 对接接口后需用枚举类型做补充
const
[
select
,
setSelect
]
=
useState
<
c
ountryItem
>
({
const
[
select
,
setSelect
]
=
useState
<
C
ountryItem
>
({
key
:
'cn'
,
name
:
'简体中文-ZH'
,
icon
:
ChinaImg
...
...
@@ -46,4 +46,4 @@ const HeaderDropdown: React.FC = () => {
)
}
export
default
HeaderDropdown
\ No newline at end of file
export
default
HeaderDropdown
src/layouts/components/RightContent.tsx
View file @
9068080a
...
...
@@ -4,11 +4,12 @@ import React, { useCallback, useRef, useLayoutEffect, useState } from 'react';
import
Avatar
from
'./AvatarDropdown'
;
import
SelectLang
from
'./SelectLang'
;
import
Location
from
'./Location'
;
import
{
history
}
from
'umi'
import
Roles
from
'./Roles'
;
import
{
inject
,
observer
}
from
'mobx-react'
import
styles
from
'../styles/RightContent.less'
;
import
{
Link
}
from
'umi'
;
import
{
getAuth
}
from
'@/utils/auth'
;
import
{
SOCKET_URL
}
from
'@/constants'
;
import
{
SOCKET_URL
,
LAYOUT_TYPE
}
from
'@/constants'
;
// export type SiderTheme = 'light' | 'dark';
// export interface GlobalHeaderRightProps extends Partial<ConnectProps> {
...
...
@@ -17,10 +18,10 @@ import { SOCKET_URL } from '@/constants';
// }
const
NOT_READ_MESSAGE
=
1
;
const
GlobalHeaderRight
:
React
.
FC
<
{}
>
=
(
props
)
=>
{
// const { theme, layout
} = props;
const
GlobalHeaderRight
:
React
.
FC
<
{
SiteStore
?:
any
}
>
=
(
props
)
=>
{
const
{
SiteStore
:
{
currentLayoutInfo
}
}
=
props
;
const
[
message
,
setMessage
]
=
useState
<
number
>
(
0
);
le
t
className
=
styles
.
right
;
cons
t
className
=
styles
.
right
;
// if (theme === 'dark' && layout === 'topmenu') {
// className = `${styles.right} ${styles.dark}`;
...
...
@@ -33,7 +34,7 @@ const GlobalHeaderRight: React.FC<{}> = (props) => {
if
(
SOCKET_URL
&&
(
!
ws
.
current
||
ws
.
current
.
readyState
===
3
)
&&
userInfo
)
{
const
url
=
`
${
SOCKET_URL
}
/report/websocket?memberId=
${
userInfo
.
memberId
}
&roleId=
${
userInfo
.
memberRoleId
}
&token=
${
userInfo
.
token
}
&source=
${
1
}
`
;
ws
.
current
=
new
WebSocket
(
url
);
ws
.
current
.
onopen
=
(
e
)
=>
{}
//
ws.current.onopen = (e) => {}
ws
.
current
.
onmessage
=
(
e
)
=>
{
const
data
=
JSON
.
parse
(
e
.
data
);
if
(
data
.
type
===
NOT_READ_MESSAGE
)
{
...
...
@@ -56,9 +57,13 @@ const GlobalHeaderRight: React.FC<{}> = (props) => {
};
},
[
ws
,
webSocketInit
]);
const
handleBackMall
=
()
=>
{
history
.
push
(
currentLayoutInfo
.
mallLink
)
}
return
(
<
div
className=
{
className
}
>
<
Link
to=
'/'
style=
{
{
color
:
'rgba(0, 0, 0, 0.85)'
}
}
>
返回商城
</
Link
>
<
span
style=
{
{
color
:
'rgba(0, 0, 0, 0.85)'
,
cursor
:
"pointer"
}
}
onClick=
{
handleBackMall
}
>
返回商城
</
span
>
<
Roles
/>
<
Location
/>
<
SelectLang
/>
...
...
@@ -87,7 +92,7 @@ const GlobalHeaderRight: React.FC<{}> = (props) => {
);
};
export
default
GlobalHeaderRight
export
default
inject
(
"SiteStore"
)(
observer
(
GlobalHeaderRight
))
// export default connect(({ settings }: ConnectState) => ({
// theme: settings.navTheme,
...
...
src/pages/lxMall/layouts/LXChannelLayout.tsx
View file @
9068080a
...
...
@@ -9,6 +9,7 @@ import { LAYOUT_TYPE } from "@/constants"
import
{
inject
,
observer
}
from
'mobx-react'
import
TopBar
from
'../components/TopBar'
import
{
PublicApi
}
from
'@/services/api'
import
{
GlobalConfig
}
from
'@/global/config'
import
{
GetTemplateWebMemberChannelWebMemberChannelMainResponse
}
from
'@/services/TemplateApi'
import
SearchShopResult
from
'../components/SearchShopResult'
import
ChannelHeader
from
'../components/ChannelHeader'
...
...
@@ -27,7 +28,7 @@ interface LXChannelLayoutPropsType {
}
const
LXChannelLayout
:
React
.
FC
<
LXChannelLayoutPropsType
>
=
(
props
)
=>
{
const
{
children
,
location
}
=
props
const
{
children
,
location
,
SiteStore
}
=
props
const
[
templateName
]
=
useState
<
string
>
(
'theme-channel-science'
)
const
{
channelId
}
=
location
.
query
const
[
shopInfo
,
setShopInfo
]
=
useState
<
GetTemplateWebMemberChannelWebMemberChannelMainResponse
>
()
...
...
@@ -52,6 +53,10 @@ const LXChannelLayout: React.FC<LXChannelLayoutPropsType> = (props) => {
}
catch
(
error
)
{
setLoading
(
false
)
}
SiteStore
.
saveCurrentLayout
({
layoutType
:
LAYOUT_TYPE
.
channel
,
mallLink
:
`
${
GlobalConfig
.
channelRootRoute
}
?channelId=
${
channelId
}
`
})
},
[])
useEffect
(()
=>
{
...
...
src/pages/lxMall/layouts/LXIChannelLayout.tsx
View file @
9068080a
...
...
@@ -9,6 +9,7 @@ import { LAYOUT_TYPE } from "@/constants"
import
{
inject
,
observer
}
from
'mobx-react'
import
TopBar
from
'../components/TopBar'
import
{
PublicApi
}
from
'@/services/api'
import
{
GlobalConfig
}
from
'@/global/config'
import
{
GetTemplateWebMemberChannelWebMemberChannelMainResponse
}
from
'@/services/TemplateApi'
import
SearchShopResult
from
'../components/SearchShopResult'
import
ChannelHeader
from
'../components/ChannelHeader'
...
...
@@ -27,7 +28,7 @@ interface LXIChannelLayoutPropsType {
}
const
LXIChannelLayout
:
React
.
FC
<
LXIChannelLayoutPropsType
>
=
(
props
)
=>
{
const
{
children
,
location
}
=
props
const
{
children
,
location
,
SiteStore
}
=
props
const
[
templateName
]
=
useState
<
string
>
(
'theme-channel-science'
)
const
{
channelId
}
=
location
.
query
const
[
shopInfo
,
setShopInfo
]
=
useState
<
GetTemplateWebMemberChannelWebMemberChannelMainResponse
>
()
...
...
@@ -51,7 +52,10 @@ const LXIChannelLayout: React.FC<LXIChannelLayoutPropsType> = (props) => {
}
catch
(
error
)
{
setLoading
(
false
)
}
SiteStore
.
saveCurrentLayout
({
layoutType
:
LAYOUT_TYPE
.
ichannel
,
mallLink
:
`
${
GlobalConfig
.
ichannelRootRoute
}
?channelId=
${
channelId
}
`
})
},
[])
useEffect
(()
=>
{
...
...
src/pages/lxMall/layouts/LXMallLayout.tsx
View file @
9068080a
...
...
@@ -28,7 +28,7 @@ interface LXMallLayoutPropsType {
const
LXMallLayout
:
React
.
FC
<
LXMallLayoutPropsType
>
=
(
props
)
=>
{
const
{
children
,
location
}
=
props
const
[
templateName
]
=
useState
<
string
>
(
'theme-mall-science'
)
const
{
s
iteId
,
mallTemplateInfo
,
findUseMallTemplate
}
=
props
.
SiteStore
const
{
s
aveCurrentLayout
,
mallTemplateInfo
,
findUseMallTemplate
}
=
props
.
SiteStore
const
[
mallInfo
,
setMallInfo
]
=
useState
<
any
>
({})
const
getMenuRouter
=
(
routes
:
any
,
pathname
:
any
)
=>
{
...
...
@@ -46,6 +46,10 @@ const LXMallLayout: React.FC<LXMallLayoutPropsType> = (props) => {
findUseMallTemplate
()
}
getWebMallInfo
()
saveCurrentLayout
({
layoutType
:
LAYOUT_TYPE
.
mall
,
mallLink
:
"/"
,
})
},
[])
const
getWebMallInfo
=
()
=>
{
...
...
src/pages/lxMall/layouts/LXShopLayout.tsx
View file @
9068080a
...
...
@@ -28,7 +28,7 @@ interface LXMallLayoutPropsType {
const
LXShopLayout
:
React
.
FC
<
LXMallLayoutPropsType
>
=
(
props
)
=>
{
const
{
children
,
location
}
=
props
const
{
children
,
location
,
SiteStore
}
=
props
const
[
templateName
]
=
useState
<
string
>
(
'theme-shop-science'
)
const
{
shopId
}
=
location
.
query
const
[
shopInfo
,
setShopInfo
]
=
useState
<
any
>
()
...
...
@@ -45,6 +45,10 @@ const LXShopLayout: React.FC<LXMallLayoutPropsType> = (props) => {
console
.
log
(
error
)
setLoading
(
false
)
}
SiteStore
.
saveCurrentLayout
({
layoutType
:
LAYOUT_TYPE
.
mall
,
mallLink
:
"/"
,
})
getWebMallInfo
()
},
[])
...
...
src/store/site/index.ts
View file @
9068080a
import
{
action
,
computed
,
observable
,
runInAction
}
from
'mobx'
import
{
ISiteModule
}
from
'@/module/siteModule'
import
{
GlobalConfig
}
from
'@/global/config'
import
{
LAYOUT_TYPE
}
from
'@/constants'
import
{
PublicApi
}
from
'@/services/api'
type
CurrentLayoutType
=
{
layoutType
:
string
,
mallLink
:
string
,
}
const
sessionCurrentLayout
:
string
=
sessionStorage
.
getItem
(
"currentLayout"
)
class
SiteStore
implements
ISiteModule
{
// 可在根目录下的demo.js修改数据
@
observable
public
siteId
:
number
=
GlobalConfig
.
global
.
siteInfo
.
id
;
// 站点id
...
...
@@ -12,6 +21,7 @@ class SiteStore implements ISiteModule {
@
observable
public
shopTemplateId
:
number
=
null
;
// 店铺模板id
@
observable
public
channelTemplateId
:
number
=
null
;
// 渠道模板id
@
observable
public
commodityTemplateInfo
:
any
=
{}
@
observable
public
currentLayoutInfo
:
CurrentLayoutType
=
sessionCurrentLayout
?
JSON
.
parse
(
sessionCurrentLayout
)
:
{
layoutType
:
LAYOUT_TYPE
.
mall
,
mallLink
:
"/"
}
/**
* 根据站点查询正在使用的商城模板
...
...
@@ -37,6 +47,14 @@ class SiteStore implements ISiteModule {
}
/**
* 保存当前商城类型
*/
public
saveCurrentLayout
=
(
layoutInfo
:
CurrentLayoutType
)
=>
{
this
.
currentLayoutInfo
=
layoutInfo
sessionStorage
.
setItem
(
"currentLayout"
,
JSON
.
stringify
(
this
.
currentLayoutInfo
))
}
/**
* 根据站点查询正在使用的商品描述模板
*/
@
action
.
bound
...
...
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