Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-admin
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-admin
Commits
d4faf550
Commit
d4faf550
authored
Feb 17, 2022
by
Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改装修内容未null时报错,以及组合促销已选择时,过滤其余活动
parent
e578bcdf
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
62 additions
and
128 deletions
+62
-128
global.d.ts
src/global/config/global.d.ts
+1
-1
schema.ts
...esManagement/activePage/fixtures/common/configs/schema.ts
+0
-8
useGetLayout.ts
...nagement/activePage/fixtures/common/hooks/useGetLayout.ts
+8
-105
useSaveData.ts
...anagement/activePage/fixtures/common/hooks/useSaveData.ts
+1
-1
editPanelForm.tsx
...ctivePage/fixtures/components/EditPanel/editPanelForm.tsx
+16
-4
index.tsx
...ures/components/EditPanelFormily/FormilyProduct/index.tsx
+3
-1
index.tsx
...ivePage/fixtures/components/Layouts/Combination/index.tsx
+30
-5
swapCoupon.tsx
.../fixtures/components/Layouts/CommodityList/swapCoupon.tsx
+3
-3
No files found.
src/global/config/global.d.ts
View file @
d4faf550
...
...
@@ -32,7 +32,7 @@ export interface SiteInfo {
name
:
string
;
logo
:
string
;
siteUrl
:
string
;
symbol
:
string
;
symbol
?:
any
;
}
export
interface
Global
{
...
...
src/pages/marketingManage/marketing/marketingActivitiesManagement/activePage/fixtures/common/configs/schema.ts
View file @
d4faf550
import
{
ComponentSchemaType
,
PROPS_SETTING_TYPES
,
PROPS_TYPES
}
from
'@linkseeks/design-core'
;
// const View: ComponentSchemaType = {
// propsConfig: {
// children: {
// label: '内容',
// type: PROPS_TYPES.string,
// }
// },
// };
const
Advertisement
:
ComponentSchemaType
=
{
propsConfig
:
{
...
...
src/pages/marketingManage/marketing/marketingActivitiesManagement/activePage/fixtures/common/hooks/useGetLayout.ts
View file @
d4faf550
...
...
@@ -26,38 +26,6 @@ type DetailType = Omit<GetTemplateWebActivityPageGetResponse, "adornContent"> &
adornContent
:
DataSourceType
}
// /** 请求钱处理 */
// const formatData = {
// coupon: (data: { id: number, type: 1 | 2 | number & {} }[]) => {
// return {
// couponList: data.map((_item) => ({
// belongType: _item.type,
// couponId: _item.id
// })).filter((_item) => _item.couponId)
// };
// },
// hot: (data: number[]) => ({ids: data}),
// specialOffer: (data: number[]) => ({ids: data}),
// plummet: (data: number[]) => ({ids: data}),
// discount: (data: number[]) => ({ids: data}),
// fullQuantitySub: (data: number[]) => ({ids: data}),
// fullQuantityDiscount: (data: number[]) => ({ids: data}),
// fullMoneySub: (data: number[]) => ({ids: data}),
// fullMoneyDiscount: (data: number[]) => ({ids: data}),
// giveProduct: (data: number[]) => ({ids: data}),
// giveCoupon: (data: number[]) => ({ids: data}),
// morePiece: (data: number[]) => ({ids: data}),
// combination: (data: number[]) => ({ids: data}),
// groupPurchase: (data: number[]) => ({ids: data}),
// bargain: (data: number[]) => ({ids: data}),
// secKill: (data: number[]) => ({ids: data}),
// fullSwap: (data: number[]) => ({ids: data}),
// buySwap: (data: number[]) => ({ids: data}),
// preSale: (data: number[]) => ({ids: data}),
// setMeal: (data: number[]) => ({ids: data}),
// attempt: (data: number[]) => ({ids: data}),
// // suggestProductItem: (data: number[]) => ({ids: data.map((_item))}),
// };
/** key 对应组件名 */
const
COMPONENT_NAME
=
{
...
...
@@ -112,68 +80,6 @@ const CHILD_COMPONENT_NAME = {
suggestProduct
:
"CommodityList"
,
};
// /**
// * key 对应接口
// */
// const service = {
// coupon: postMarketingCouponPlatformActivityPageSelectDetail,
// hot: getMarketingAdornActivityGoodsAdorn,
// specialOffer: getMarketingAdornActivityGoodsAdorn,
// plummet: getMarketingAdornActivityGoodsAdorn,
// discount: getMarketingAdornActivityGoodsAdorn,
// fullQuantitySub: getMarketingAdornActivityGoodsAdorn,
// fullQuantityDiscount: getMarketingAdornActivityGoodsAdorn,
// fullMoneySub: getMarketingAdornActivityGoodsAdorn,
// fullMoneyDiscount: getMarketingAdornActivityGoodsAdorn,
// giveProduct: getMarketingAdornActivityGoodsAdorn,
// giveCoupon: getMarketingAdornActivityGoodsAdorn,
// morePiece: getMarketingAdornActivityGoodsAdorn,
// combination: getMarketingAdornActivityGoodsAdorn,
// groupPurchase: getMarketingAdornActivityGoodsAdorn,
// bargain: getMarketingAdornActivityGoodsAdorn,
// secKill: getMarketingAdornActivityGoodsAdorn,
// fullSwap: getMarketingAdornActivityGoodsAdorn,
// buySwap: getMarketingAdornActivityGoodsAdorn,
// preSale: getMarketingAdornActivityGoodsAdorn,
// setMeal: getMarketingAdornActivityGoodsAdorn,
// attempt: getMarketingAdornActivityGoodsAdorn,
// suggestProductItem: getMarketingAdornActivityGoodsAdorn,
// };
// const DEFAULT_RES = [];
// const COMMON_FORMAT = ({code, data}) => {
// if (code === 1000) {
// return data;
// }
// return DEFAULT_RES;
// };
// /**
// * 请求后处理
// */
// const afterRequestFormat = {
// coupon: COMMON_FORMAT,
// hot: COMMON_FORMAT,
// specialOffer: COMMON_FORMAT,
// plummet: COMMON_FORMAT,
// discount: COMMON_FORMAT,
// fullQuantitySub: COMMON_FORMAT,
// fullQuantityDiscount: COMMON_FORMAT,
// fullMoneySub: COMMON_FORMAT,
// fullMoneyDiscount: COMMON_FORMAT,
// giveProduct: COMMON_FORMAT,
// giveCoupon: COMMON_FORMAT,
// morePiece: COMMON_FORMAT,
// combination: COMMON_FORMAT,
// groupPurchase: COMMON_FORMAT,
// bargain: COMMON_FORMAT,
// secKill: COMMON_FORMAT,
// fullSwap: COMMON_FORMAT,
// buySwap: COMMON_FORMAT,
// preSale: COMMON_FORMAT,
// setMeal: COMMON_FORMAT,
// suggestProductItem: COMMON_FORMAT,
// };
const
title
=
{
top
:
'广告图'
,
coupon
:
'优惠券'
,
...
...
@@ -371,7 +277,7 @@ function useGetLayout() {
/** 获取自定义区域请求体 */
const
customizeAreaRequestData
=
adornContent
!
.
suggestProduct
!
.
props
?.
childrenData
?.
reduce
((
prev
,
next
,
_index
)
=>
{
const
labelsWithId
=
{};
const
result
=
next
.
childrenData
.
map
((
_item
,
_key
)
=>
{
const
result
=
next
.
childrenData
?
.
map
((
_item
,
_key
)
=>
{
labelsWithId
[
`
${
_index
+
1
}
-
${
_key
+
1
}
-
${
_item
.
id
}
`
]
=
_item
.
label
;
return
_item
.
id
});
...
...
@@ -380,9 +286,8 @@ function useGetLayout() {
labelsWithId
:
labelsWithId
,
}
return
prev
},
{
ids
:
[],
label
:
{}
})
},
{
ids
:
[],
label
:
{}
})
||
[]
/** 获取组合促销请求体 */
console
.
log
(
adornContent
)
const
combinationRequestData
=
adornContent
.
combination
?.
props
?.
childrenData
?.
reduce
((
prev
,
next
,
_index
)
=>
{
prev
=
[...
prev
,
...(
next
.
childrenData
||
[])]
return
prev
...
...
@@ -390,10 +295,10 @@ function useGetLayout() {
/** 获取其他活动的请求体 */
const
activityRequestData
=
Object
.
keys
(
adornContent
).
reduce
((
all
:
any
,
_item
)
=>
{
if
(
ACTIVITY_LIST
.
includes
(
_item
as
any
)
&&
_item
!==
'combination'
)
{
all
=
[...
all
,
...((
adornContent
[
_item
]
as
any
)
.
props
.
childrenData
)]
all
=
[...
all
,
...((
adornContent
[
_item
]
as
any
)
?.
props
?.
childrenData
.
filter
(
Boolean
)
||
[]
)]
}
return
all
;
},
[]);
},
[])
||
[]
;
const
getCouponData
=
async
(
couponData
)
=>
{
if
(
couponData
.
length
===
0
)
{
...
...
@@ -490,8 +395,6 @@ function useGetLayout() {
...
thirdFloorData
,
},
}
// console.log(sideControllerData, "sideControllerData")
}
/** 设置左边菜单栏属性 */
sideControllerData
=
{
...
...
@@ -520,7 +423,7 @@ function useGetLayout() {
if
(
_row
.
key
===
'coupon'
)
{
const
{
config
,
keys
}
=
createComponent
({
componentName
:
[
`
${
CHILD_COMPONENT_NAME
[
_row
.
key
]}
`
],
childrenData
:
childrenData
,
childrenData
:
childrenData
.
filter
(
Boolean
)
,
startKey
:
startKey
,
dataSource
:
couponResponseData
,
primaryKey
:
"id"
,
...
...
@@ -539,7 +442,7 @@ function useGetLayout() {
// 组合促销时
const
{
config
,
keys
}
=
createComponent
({
componentName
:
[
`Combination`
,
`Combination.Item`
],
childrenData
:
childrenData
,
childrenData
:
childrenData
.
filter
(
Boolean
)
,
startKey
:
startKey
,
dataSource
:
activityDataResponse
,
primaryKey
:
null
,
...
...
@@ -559,7 +462,7 @@ function useGetLayout() {
}
else
if
(
_row
.
key
!==
'suggestProduct'
)
{
const
{
config
,
keys
}
=
createComponent
({
componentName
:
[
`
${
CHILD_COMPONENT_NAME
[
_row
.
key
]}
`
],
childrenData
:
childrenData
,
childrenData
:
childrenData
.
filter
(
Boolean
)
,
startKey
:
startKey
,
dataSource
:
activityDataResponse
,
primaryKey
:
null
,
...
...
@@ -577,7 +480,7 @@ function useGetLayout() {
}
else
{
const
{
config
,
keys
}
=
createComponent
({
componentName
:
[
`CommodityList`
,
'CommodityList.Item'
],
childrenData
:
childrenData
,
childrenData
:
childrenData
.
filter
(
Boolean
)
,
startKey
:
startKey
,
dataSource
:
activityDataResponse
,
primaryKey
:
"id"
,
...
...
src/pages/marketingManage/marketing/marketingActivitiesManagement/activePage/fixtures/common/hooks/useSaveData.ts
View file @
d4faf550
...
...
@@ -107,7 +107,7 @@ function useSaveData(options: Options) {
const
childrenData
=
childNodes
.
map
((
_record
)
=>
{
const
childTargetProps
=
pageConfig
[
_record
].
props
;
return
childTargetProps
.
id
;
});
})
.
filter
(
Boolean
)
;
// const childrenData = products?.map((_item) => _item.id) || [];
result
=
generaterData
(
result
,
dataIndex
,
{
sort
:
sort
,
...
...
src/pages/marketingManage/marketing/marketingActivitiesManagement/activePage/fixtures/components/EditPanel/editPanelForm.tsx
View file @
d4faf550
...
...
@@ -120,6 +120,8 @@ const EditPanelForm = () => {
setFormValue
({
product
:
{
...
selectedInfo
.
props
,
/** 当selectedInfo.props 未空对象的时候就不会更新当前value, 所有添加uuid */
uuid
:
Math
.
random
()
}
});
setSchema
(
activityProducts
);
...
...
@@ -138,7 +140,7 @@ const EditPanelForm = () => {
:
propsMapToValue
?.[
componentType
];
setSchema
(
tempSchema
);
setFormValue
({
...
tempFormValue
});
setFormValue
({
...
tempFormValue
,
uuid
:
Math
.
random
()
});
}
/** 16 种活动,请求是需要带上活动类型 */
const
activityType
=
ACTIVITY_MAP
[
componentType
]
?
{
activityType
:
ACTIVITY_MAP
[
componentType
]
}
:
{};
...
...
@@ -147,16 +149,26 @@ const EditPanelForm = () => {
// console.log(hotItem".substring(0, 1));
formActions
.
setFieldState
(
'product'
,
(
fieldState
)
=>
{
const
[,
parentKey
]
=
selectedInfo
.
parentKey
.
split
(
'-'
);
const
isCombination
=
componentType
===
'combinationItem'
;
/** 如果是组合促销, 要是已经选择了一个组合促销数据,那么搜索活动商品列表时需要添加当前活动id */
let
withActivityId
=
{};
if
(
isCombination
)
{
const
[,
currentCombinationActivityId
]
=
sameKeys
[
`combination_
${
+
(
parentKey
)
-
1
}
`
][
0
].
split
(
'_'
);
withActivityId
=
currentCombinationActivityId
===
'undefined'
?
{}
:
{
id
:
currentCombinationActivityId
}
}
const
disabledKeys
=
componentType
===
'suggestProductItem'
?
sameKeys
[
`suggestProduct_
${
parseInt
(
parentKey
)
-
1
}
`
]
:
componentType
===
'combinationItem'
?
sameKeys
[
`combination_
${
parseInt
(
parentKey
)
-
1
}
`
]
:
sameKeys
[
`
${
componentType
?.
substring
(
0
,
componentType
.
length
-
4
)}
`] || [];
FormPath.setIn(fieldState, 'props.x-component-props', {
activityImage: activityImage,
...activityType,
disabledKeys: disabledKeys,
...isWithLabels,
...withActivityId,
activityImage: activityImage,
disabledKeys: disabledKeys,
minType: isWithMinType,
});
});
...
...
@@ -199,7 +211,7 @@ const EditPanelForm = () => {
title: values?.title || values?.name
});
handleOnClose();
formActions.reset();
//
formActions.reset();
};
const renderUploadChild = (value) => {
...
...
src/pages/marketingManage/marketing/marketingActivitiesManagement/activePage/fixtures/components/EditPanelFormily/FormilyProduct/index.tsx
View file @
d4faf550
...
...
@@ -81,12 +81,14 @@ const FormilyActivityProduct: React.FC<Iprops> & { isFieldComponent: boolean } =
const
fetchData
=
async
(
params
:
GetMarketingAdornPlatformActivityListAdornRequest
)
=>
{
const
withActivityType
=
componentProps
?.
activityType
?
{
activityType
:
componentProps
?.
activityType
}
:
{};
const
minType
=
componentProps
?.
minType
?
{
minType
:
componentProps
.
minType
}
:
{};
const
withActivityId
=
componentProps
?.
id
?
{
id
:
componentProps
.
id
}
:
{}
const
common
=
{
...
params
,
shopId
:
shopId
?.
toString
(),
...
withActivityType
,
...
minType
...
minType
,
...
withActivityId
,
};
const
isWithActivityType
=
common
;
return
await
getMarketingAdornPlatformActivityListAdorn
(
isWithActivityType
as
any
);
...
...
src/pages/marketingManage/marketing/marketingActivitiesManagement/activePage/fixtures/components/Layouts/Combination/index.tsx
View file @
d4faf550
...
...
@@ -14,6 +14,22 @@ interface Iprops {
theme
:
number
}
function
parseChildrenList
(
children
:
React
.
ReactNode
)
{
const
elements
=
React
.
Children
.
map
(
children
,
(
node
)
=>
{
if
(
React
.
isValidElement
(
node
))
{
const
key
=
node
.
key
!==
undefined
?
String
(
node
.
key
)
:
undefined
;
return
{
key
,
...
node
.
props
,
node
,
};
}
return
null
});
return
elements
||
[];
}
const
Combination
:
React
.
FC
<
Iprops
>
&
{
Item
:
typeof
CombinationItem
}
=
(
props
:
Iprops
)
=>
{
const
{
children
,
className
,
title
,
theme
,
status
=
true
,
...
other
}
=
props
;
const
visible
=
status
...
...
@@ -22,6 +38,11 @@ const Combination: React.FC<Iprops> & { Item: typeof CombinationItem } = (props:
const
divProps
=
{
onClick
,
onMouseOver
};
const
childrenList
=
parseChildrenList
(
children
);
const
containerTitle
=
childrenList
.
length
===
0
?
`以下商品认选n件,只需m元`
:
childrenList
[
0
]?.
activityList
?.
find
((
_item
)
=>
_item
.
id
===
childrenList
[
0
]?.
activityId
)?.
label
;
// const { onClick, onDrag, onDragEnd, onDragEnter, onDragStart, onMouseOver, getOperateState } = other as any;
const
count
=
React
.
Children
.
count
(
children
);
const
renderChildren
=
()
=>
{
...
...
@@ -43,7 +64,7 @@ const Combination: React.FC<Iprops> & { Item: typeof CombinationItem } = (props:
<
div
className=
{
classNameStr
}
{
...
divProps
}
>
{
/* <p className={styles.title}>{title}</p> */
}
<
div
className=
{
styles
.
container
}
>
<
div
className=
{
styles
[
'container-title'
]
}
>
以下商品认选2件,只需800元
</
div
>
<
div
className=
{
styles
[
'container-title'
]
}
>
{
containerTitle
}
</
div
>
{
renderChildren
()
}
{
count
>
0
&&
(
...
...
@@ -61,10 +82,10 @@ const Combination: React.FC<Iprops> & { Item: typeof CombinationItem } = (props:
}
const
CombinationItem
:
React
.
FC
<
any
>
=
(
props
:
any
)
=>
{
const
{
productImgUrl
,
discount
,
price
,
footer
,
sale
,
productName
,
id
,
activityPrice
}
=
props
as
any
;
const
{
onClick
,
on
Drag
,
onDragEnd
,
onDragEnter
,
onDragStart
,
on
MouseOver
,
getOperateState
,
className
}
=
props
as
any
;
const
{
productImgUrl
,
discount
,
price
,
footer
,
sale
,
productName
,
id
,
activityPrice
,
activityList
}
=
props
as
any
;
const
{
onClick
,
onMouseOver
,
getOperateState
,
className
}
=
props
as
any
;
const
divProps
=
{
onClick
,
on
Drag
,
onDragEnd
,
onDragEnter
,
onDragStart
,
on
MouseOver
onClick
,
onMouseOver
};
// const wrapClass = cx(styles.simple);
const
wrapClass
=
cx
(
styles
.
section
,
className
)
...
...
@@ -86,7 +107,11 @@ const CombinationItem: React.FC<any> = (props: any) => {
<
img
src=
{
productImgUrl
}
className=
{
styles
[
'simple-product-image'
]
}
/>
<
div
className=
{
styles
[
'simple-product-name'
]
}
>
{
productName
}
</
div
>
<
div
className=
{
styles
[
'simple-product-label'
]
}
>
<
CustomizeTag
>
800元2件
</
CustomizeTag
>
{
activityList
.
map
((
_item
)
=>
{
return
(
<
CustomizeTag
>
{
_item
.
label
}
</
CustomizeTag
>
)
})
}
</
div
>
</
div
>
</
div
>
...
...
src/pages/marketingManage/marketing/marketingActivitiesManagement/activePage/fixtures/components/Layouts/CommodityList/swapCoupon.tsx
View file @
d4faf550
...
...
@@ -16,10 +16,10 @@ const SwapCoupon = (props) => {
const
restProps
=
_omit
(
other
,
[
"getOperateState"
,
"onClick"
,
"onDrag"
,
"onDragEnd"
,
"onDragEnter"
,
"onDragStart"
,
"onMouseOver"
,
"draggable"
]);
const
isEmpty
=
typeof
restProps
[
'productName'
]
===
'undefined'
;
const
{
onClick
,
on
Drag
,
onDragEnd
,
onDragEnter
,
onDragStart
,
on
MouseOver
,
getOperateState
}
=
other
as
any
;
const
{
onClick
,
onMouseOver
,
getOperateState
}
=
other
as
any
;
const
divProps
=
{
onClick
,
on
Drag
,
onDragEnd
,
onDragEnter
,
onDragStart
,
on
MouseOver
,
onClick
,
onMouseOver
,
};
const
handleTabChange
=
(
key
:
string
)
=>
{
setActiveKey
(
key
);
...
...
@@ -65,7 +65,7 @@ const SwapCoupon = (props) => {
<
span
className=
{
styles
.
num
}
>
{
_row
.
denomination
}
</
span
>
</
div
>
<
div
className=
{
styles
.
condition
}
>
{
`满${_row.useConditionMoney}可使用`
}
</
div
>
<
div
className=
{
styles
.
couponType
}
>
{
_row
.
coupon
Name
}
</
div
>
<
div
className=
{
styles
.
couponType
}
>
{
_row
.
type
Name
}
</
div
>
</
div
>
);
})
...
...
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