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
linweijiong
jinfa-platform
Commits
f22d391a
Commit
f22d391a
authored
Aug 26, 2020
by
前端-许佳敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
适用商城添加
parent
6226b7ff
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
81 additions
and
11 deletions
+81
-11
index.ts
src/constants/index.ts
+24
-0
global.d.ts
src/global/config/global.d.ts
+12
-1
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
No files found.
src/constants/index.ts
View file @
f22d391a
...
...
@@ -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
View file @
f22d391a
...
...
@@ -17,8 +17,19 @@ 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
:
any
[];
shopInfo
:
ShopInfo
[];
}
export
interface
PayConfig
{
...
...
src/pages/repositories/components/PositionSetting.tsx
View file @
f22d391a
...
...
@@ -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 @
f22d391a
...
...
@@ -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 @
f22d391a
...
...
@@ -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
,
...
...
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