|
@@ -17,6 +17,7 @@ interface Props {
|
|
|
visible?: boolean;
|
|
|
onChange?: () => void
|
|
|
onClose?: () => void
|
|
|
+ initialValues?: any
|
|
|
}
|
|
|
|
|
|
export const DispatchBookLink = React.createContext<BOOKLINK.DispatchBookLink | null>(null);
|
|
@@ -26,7 +27,7 @@ export const DispatchBookLink = React.createContext<BOOKLINK.DispatchBookLink |
|
|
|
* @param param0
|
|
|
* @returns
|
|
|
*/
|
|
|
-const ModalBookLink: React.FC<Props> = ({ mpList, bookPlatForm, visible, onChange, onClose }) => {
|
|
|
+const ModalBookLink: React.FC<Props> = ({ mpList, bookPlatForm, visible, onChange, onClose, initialValues = { yueWenCreateLinkDTOList: [{}] } }) => {
|
|
|
|
|
|
/********************************************/
|
|
|
const { message } = App.useApp()
|
|
@@ -51,8 +52,8 @@ const ModalBookLink: React.FC<Props> = ({ mpList, bookPlatForm, visible, onChang
|
|
|
} else if (linkType === '2') {
|
|
|
return { ...rest, bookPromoLinkCreateDTO, linkType }
|
|
|
} else if (linkType === '3') {
|
|
|
- const { activityTime, display, ...ralDto } = rechargeActivityLinkDTO
|
|
|
- return { ...rest, rechargeActivityLinkDTO: { ...ralDto, startTime: dayJs(activityTime[0]).format('YYYY-MM-DD'), endTime: dayJs(activityTime[1]).format('YYYY-MM-DD'), display: display?.join(',') }, linkType }
|
|
|
+ const { activityTime, display, isDayRepeat, rechargeCount, ...ralDto } = rechargeActivityLinkDTO
|
|
|
+ return { ...rest, rechargeActivityLinkDTO: { ...ralDto, rechargeCount, isDayRepeat: rechargeCount == 1 ? isDayRepeat : false, startTime: dayJs(activityTime[0]).format('YYYY-MM-DD'), endTime: dayJs(activityTime[1]).format('YYYY-MM-DD'), display: display?.join(',') }, linkType }
|
|
|
} else if (linkType === '4') {
|
|
|
const { activityTime, display, ...calDto } = giftActivityLinkDTO
|
|
|
return { ...rest, giftActivityLinkDTO: { ...calDto, startTime: dayJs(activityTime[0]).format('YYYY-MM-DD'), endTime: dayJs(activityTime[1]).format('YYYY-MM-DD'), display: display?.join(',') }, linkType }
|
|
@@ -95,9 +96,7 @@ const ModalBookLink: React.FC<Props> = ({ mpList, bookPlatForm, visible, onChang
|
|
|
message.error(errorFields?.[0]?.errors?.[0])
|
|
|
}}
|
|
|
onFinish={handleOk}
|
|
|
- initialValues={{
|
|
|
- yueWenCreateLinkDTOList: [{}]
|
|
|
- }}
|
|
|
+ initialValues={initialValues}
|
|
|
>
|
|
|
<Card title={<strong>基础信息配置</strong>} style={{ background: '#fff', marginBottom: 10 }}>
|
|
|
<Form.Item label={<strong>书城</strong>} name="platform" rules={[{ required: true, message: '请选择书城!' }]}>
|
|
@@ -223,7 +222,7 @@ const ModalBookLink: React.FC<Props> = ({ mpList, bookPlatForm, visible, onChang
|
|
|
{...restField}
|
|
|
name={[name, 'channelName']}
|
|
|
label={<strong>渠道名称</strong>}
|
|
|
- rules={[{ required: ['1', '2'].includes(yueWenCreateLinkDTO?.linkType), message: '请输入渠道名称!' }]}
|
|
|
+ rules={[{ required: true, message: '请输入渠道名称!' }]}
|
|
|
>
|
|
|
<Input placeholder="请输入渠道名称" allowClear />
|
|
|
</Form.Item>
|
|
@@ -231,7 +230,7 @@ const ModalBookLink: React.FC<Props> = ({ mpList, bookPlatForm, visible, onChang
|
|
|
{...restField}
|
|
|
name={[name, 'channelType']}
|
|
|
label={<strong>推广类型</strong>}
|
|
|
- rules={[{ required: ['1', '2'].includes(yueWenCreateLinkDTO?.linkType), message: '请选择推广类型!' }]}
|
|
|
+ rules={[{ required: true, message: '请选择推广类型!' }]}
|
|
|
>
|
|
|
<Select
|
|
|
showSearch
|
|
@@ -245,7 +244,7 @@ const ModalBookLink: React.FC<Props> = ({ mpList, bookPlatForm, visible, onChang
|
|
|
</Form.Item>
|
|
|
{yueWenCreateLinkDTO?.linkType === '1' ? <PagePromoLinkCreateDTO restField={restField} name={name} /> :
|
|
|
yueWenCreateLinkDTO?.linkType === '2' ? <BookPromoLinkCreateDTO restField={restField} name={name} platform={platform} mpAccountIds={mpAccountIds} yueWenCreateLinkDTO={yueWenCreateLinkDTO} /> :
|
|
|
- yueWenCreateLinkDTO?.linkType === '3' ? <RechargeActivityLinkDTO restField={restField} name={name} /> :
|
|
|
+ yueWenCreateLinkDTO?.linkType === '3' ? <RechargeActivityLinkDTO restField={restField} name={name} itemData={yueWenCreateLinkDTO} /> :
|
|
|
yueWenCreateLinkDTO?.linkType === '4' ? <GiftActivityLinkDTO restField={restField} name={name} /> :
|
|
|
yueWenCreateLinkDTO?.linkType === '5' ? <ConsumeActivityLinkDTO restField={restField} name={name} /> :
|
|
|
undefined}
|