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
bbc8a35c
Commit
bbc8a35c
authored
Aug 26, 2020
by
LeeJiancong
Browse files
Options
Browse Files
Download
Plain Diff
'物流-去除物流静态数据'
parents
868c5ebe
1610bddb
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
153 additions
and
23 deletions
+153
-23
app.tsx
src/app.tsx
+18
-6
index.tsx
src/components/ModalTable/index.tsx
+4
-3
index.tsx
src/components/TabTree/index.tsx
+3
-3
index.ts
src/constants/index.ts
+24
-0
global.d.ts~1610bddb1460cd81f648409972bfc813bc51b7ae
...nfig/global.d.ts~1610bddb1460cd81f648409972bfc813bc51b7ae
+58
-0
PositionSetting.tsx
src/pages/repositories/components/PositionSetting.tsx
+10
-1
index.tsx
src/pages/repositories/index.tsx
+0
-6
index.tsx
src/pages/repositories/schema/index.tsx
+35
-3
register.tsx
src/pages/user/register.tsx
+1
-1
No files found.
src/app.tsx
View file @
bbc8a35c
...
...
@@ -15,16 +15,19 @@ import { PublicApi } from './services/api';
setup
()
// 与用户登录相关路由
const
userLoginLists
=
[
'/user/login'
,
'/user/register'
,
]
// let routeAuthUrls: any[] = []
// 路由白名单
const
whiteLists
=
[
...
userLoginLists
,
'/'
,
'/channelmall'
,
'/purchaseOnline'
,
'/pointsMall'
,
'/user/login'
,
'/user/register'
,
'/memberCenter'
,
'/memberCenter/noAuth'
,
'/commodity'
,
...
...
@@ -103,14 +106,19 @@ export function onRouteChange({ routes, matchedRoutes, location, action }) {
console
.
log
(
'onRouteChange'
)
if
(
isDev
)
{
return
;
}
if
(
whiteLists
.
includes
(
location
.
pathname
))
return
;
const
routeAuthUrls
=
getRouters
()
// 是否登录
if
(
getAuth
())
{
const
routeAuthUrls
=
getRouters
()
const
{
query
,
pathname
}
=
location
if
(
userLoginLists
.
includes
(
pathname
))
{
// 当登录过, 并且尝试访问登录相关页面, 需重定向到首页
history
.
replace
(
'/memberCenter/home'
)
return
;
}
// 固定配置, 出现此参数说明需携带参数校验权限路由
if
(
query
.
page_type
&&
routeAuthUrls
.
find
(
authPath
=>
{
const
parseUrl
=
queryString
.
parseUrl
(
authPath
)
...
...
@@ -128,7 +136,11 @@ export function onRouteChange({ routes, matchedRoutes, location, action }) {
// 无权限访问时
history
.
replace
(
'/memberCenter/noAuth'
)
}
else
{
history
.
replace
(
'/user/login'
)
if
(
whiteLists
.
includes
(
location
.
pathname
))
{
// 访问路由在白名单里
}
else
{
history
.
replace
(
'/user/login'
)
}
}
}
...
...
src/components/ModalTable/index.tsx
View file @
bbc8a35c
...
...
@@ -16,12 +16,13 @@ const ModalTable:React.FC<ModalTableProps> = (props) => {
const
{
width
=
704
,
modalTitle
,
confirm
,
cancel
,
visible
,
currentRef
,
resetModal
,
...
resetTable
}
=
props
const
selfRef
=
currentRef
||
useRef
<
any
>
({})
useEffect
(()
=>
{
if
(
!
visible
)
{
if
(
visible
)
{
// 重新开启时需reload接口
selfRef
.
current
.
reload
&&
selfRef
.
current
.
reload
()
}
else
{
selfRef
.
current
.
resetField
&&
selfRef
.
current
.
resetField
({
validate
:
false
})
// 重新开启时需reload接口
selfRef
.
current
.
reload
&&
selfRef
.
current
.
reload
()
}
},
[
visible
,
selfRef
.
current
])
return
(
...
...
src/components/TabTree/index.tsx
View file @
bbc8a35c
...
...
@@ -6,7 +6,6 @@ import deepClone from 'clone'
import
{
TreeProps
}
from
'antd/lib/tree'
import
{
PlusOutlined
,
DeleteOutlined
,
PlusCircleOutlined
}
from
'@ant-design/icons'
import
cx
from
'classnames'
import
{
EventDataNode
}
from
'rc-tree/lib/interface'
import
{
useSelections
}
from
'@umijs/hooks'
export
interface
TabTreeActions
{
...
...
@@ -36,7 +35,7 @@ export interface TabTreeProps extends TreeProps {
// 若传入该字段, 则会作为tree识别的节点, 默认是`key`, 传入后原有的key值将无效
customKey
?:
string
|
number
;
customTitle
?:
string
|
number
;
handleSelect
?:
(
key
:
ReactText
,
node
:
EventDataNode
)
=>
void
|
Promise
<
any
>
;
handleSelect
?:
(
key
:
ReactText
,
node
:
any
)
=>
void
|
Promise
<
any
>
;
handleSubmit
?();
toolsRender
?:
toolsRenderProps
;
getMenuSelectData
?():
Promise
<
any
>
;
...
...
@@ -281,7 +280,8 @@ const TabTree: React.FC<TabTreeProps> = props => {
const
reductData
=
treeReduction
(
treeData
)
const
targetInfo
=
reductData
[
id
]
const
parentInfo
=
reductData
[
targetInfo
.
parentId
]
return
parentInfo
||
null
// fixbug 当选中根节点下的节点时, 由于无parentId, 需自动补充0
return
parentInfo
||
{
id
:
0
}
}
}
const
batchSelect
=
(
items
:
any
)
=>
{
...
...
src/constants/index.ts
View file @
bbc8a35c
...
...
@@ -19,6 +19,30 @@ export const Environment_Status = {
3
:
"APP"
}
// 商城类型
export
const
SHOP_TYPES
=
[
{
value
:
1
,
label
:
"企业商城"
},
{
value
:
2
,
label
:
"积分商城"
},
{
value
:
3
,
label
:
"渠道商城"
},
{
value
:
4
,
label
:
"渠道自有商城"
},
{
value
:
5
,
label
:
"渠道积分商城"
},
]
// 1是阿里云oss服务器, 2是本地文件服务器
export
const
UPLOAD_TYPE
=
isDev
?
2
:
1
...
...
src/global/config/global.d.ts~1610bddb1460cd81f648409972bfc813bc51b7ae
0 → 100644
View file @
bbc8a35c
export interface MemberType {
id: number;
typeName: string;
}
export interface BusinessType {
id: number;
typeName: string;
}
export interface UseType {
memberType: MemberType[];
businessType: BusinessType[];
}
export interface UserRegister {
useType: UseType;
}
export interface ShopInfo {
id: number;
name: string;
type: number;
environment: number;
logoUrl: string;
describe: string;
state: number;
url: string;
}
export interface Web {
shopInfo: ShopInfo[];
}
export interface PayConfig {
paymemberConfig?: any;
}
export interface CountryList {
name: string;
key: string;
icon: string;
}
export interface Global {
siteId: number;
siteUrl: string;
logo: string;
countryList: CountryList[];
}
export interface RootObject {
userRegister: UserRegister;
web: Web;
payConfig: PayConfig;
global: Global;
}
\ No newline at end of file
src/pages/repositories/components/PositionSetting.tsx
View file @
bbc8a35c
...
...
@@ -14,6 +14,7 @@ import {
import
{
Button
}
from
'antd'
import
NiceForm
from
'@/components/NiceForm'
import
ModalTable
from
'@/components/ModalTable'
import
{
GlobalConfig
}
from
'@/global/config'
export
interface
PositionSettingProps
{
addSchemaAction
:
ISchemaFormActions
,
...
...
@@ -229,8 +230,16 @@ const PositionSetting:React.FC<PositionSettingProps> = (props) => {
tableAddButton
,
connectProduct
}
}
effects=
{
()
=>
{
effects=
{
(
$
,
{
setFieldState
}
)
=>
{
createAddRepositoryEffect
(
addSchemaAction
)
$
(
'onFieldValueChange'
,
'shopType'
).
subscribe
(
parentState
=>
{
if
(
parentState
.
value
)
{
console
.
log
(
'review'
)
setFieldState
(
'shopIds'
,
state
=>
{
state
.
props
[
"x-component-props"
].
dataSource
=
GlobalConfig
.
web
.
shopInfo
.
filter
(
v
=>
v
.
id
===
parentState
.
value
)
})
}
})
}
}
onSubmit=
{
handleSubmit
}
actions=
{
addSchemaAction
}
...
...
src/pages/repositories/index.tsx
View file @
bbc8a35c
...
...
@@ -189,12 +189,6 @@ const Repositories: React.FC<{}> = () => {
'search'
,
FORM_FILTER_PATH
,
);
$
(
'onFieldChange'
,
FORM_FILTER_PATH
).
subscribe
(
state
=>
{
console
.
log
(
state
)
})
// 填充下拉框
// useAsyncInitSelect(['category'], async () => (await PublicApi.getProductSelectGetSelectCategory(
{
name
:
''
})).
data
.
map
(
v
=>
({
label
:
v
.
name
,
value
:
v
.
id
})))
// useAsyncInitSelect(['brand'], async () => (await PublicApi.getProductSelectGetSelectBrand(
{
name
:
''
})).
data
.
map
(
v
=>
({
label
:
v
.
name
,
value
:
v
.
id
})))
}
}
schema=
{
repositSchema
}
/>
...
...
src/pages/repositories/schema/index.tsx
View file @
bbc8a35c
...
...
@@ -3,6 +3,20 @@ import { ISchema } from '@formily/antd';
import
{
FORM_FILTER_PATH
}
from
'@/formSchema/const'
;
import
{
GlobalConfig
}
from
'@/global/config'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
{
SHOP_TYPES
}
from
'@/constants'
;
// 将获取的商城转化为可用类型
const
getShopTypeMap
=
(()
=>
{
return
GlobalConfig
.
web
.
shopInfo
.
reduce
((
prev
,
next
)
=>
{
if
(
!
prev
.
find
(
v
=>
v
.
value
===
next
.
id
))
{
prev
.
push
({
label
:
next
.
name
,
value
:
next
.
id
})
}
return
prev
},
[])
})()
export
const
repositSchema
:
ISchema
=
{
type
:
'object'
,
...
...
@@ -155,6 +169,12 @@ export const repositMoreSchema: ISchema = {
placeholder
:
'建议名称:商品名称+商城名称+渠道描述'
}
},
shopType
:
{
type
:
'string'
,
enum
:
SHOP_TYPES
,
title
:
'商城类型'
,
required
:
true
},
productName
:
{
type
:
'string'
,
title
:
'商品名称'
,
...
...
@@ -253,7 +273,7 @@ export const repositMoreSchema: ISchema = {
"type"
:
"array:number"
,
"x-component"
:
'CardCheckBox'
,
"x-component-props"
:
{
dataSource
:
GlobalConfig
.
web
.
shopInfo
dataSource
:
[]
},
"title"
:
"适用商城"
,
"x-rules"
:
[
...
...
@@ -352,6 +372,12 @@ export const repositDetailSchema: ISchema = {
placeholder
:
'建议名称:商品名称+商城名称+渠道描述'
}
},
shopType
:
{
type
:
'string'
,
enum
:
getShopTypeMap
,
title
:
'商城类型'
,
required
:
true
},
productName
:
{
type
:
'string'
,
title
:
'商品名称'
,
...
...
@@ -443,7 +469,7 @@ export const repositDetailSchema: ISchema = {
"type"
:
"array:number"
,
"x-component"
:
'CardCheckBox'
,
"x-component-props"
:
{
dataSource
:
GlobalConfig
.
web
.
shopInfo
dataSource
:
[]
},
"title"
:
"适用商城"
,
required
:
true
,
...
...
@@ -538,6 +564,12 @@ export const repositTabOneSchema: ISchema = {
placeholder
:
'建议名称:商品名称+商城名称+渠道描述'
}
},
shopType
:
{
type
:
'string'
,
enum
:
getShopTypeMap
,
title
:
'商城类型'
,
required
:
true
},
productName
:
{
type
:
'string'
,
title
:
'商品名称'
,
...
...
@@ -630,7 +662,7 @@ export const repositTabOneSchema: ISchema = {
"type"
:
"array:number"
,
"x-component"
:
'CardCheckBox'
,
"x-component-props"
:
{
dataSource
:
GlobalConfig
.
web
.
shopInfo
dataSource
:
[]
},
"title"
:
"适用商城"
,
required
:
true
,
...
...
src/pages/user/register.tsx
View file @
bbc8a35c
...
...
@@ -83,7 +83,7 @@ const UserRegistry = () => {
})
useEffect
(()
=>
{
setAsyncSchema
(
schemas
[
`schema
${
current
}
`
])
if
(
current
===
3
)
runTimerJump
()
if
(
current
===
2
)
runTimerJump
()
},
[
current
,
actions
])
useEffect
(()
=>
{
if
(
time
===
0
){
...
...
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