|
@@ -12,6 +12,7 @@ import AdPositionList from './adPositionList';
|
|
|
import { siteSetData, SiteSetPackageDataProps } from './leadAd';
|
|
|
import BidAdjustment from './bidAdjustment';
|
|
|
import { useModel } from 'umi';
|
|
|
+import { RangePickerProps } from 'antd/lib/date-picker';
|
|
|
const { RangePicker }: { RangePicker: any } = DatePicker;
|
|
|
let DatePickers: any = DatePicker
|
|
|
interface Props {
|
|
@@ -251,7 +252,7 @@ function WeChatAdModal(props: Props) {
|
|
|
} else {
|
|
|
form.setFieldsValue({
|
|
|
adgroupName: '广告_微信朋友圈_' + moment().format('YYYYMMDDhhmmss') + '_' + currentUser.userId,
|
|
|
- date: moment().startOf('day').add(4, 'M'),
|
|
|
+ date: moment().startOf('day').add(2, 'M'),
|
|
|
optimizationGoal: "OPTIMIZATIONGOAL_ECOMMERCE_ORDER",
|
|
|
bidStrategy: "BID_STRATEGY_TARGET_COST",
|
|
|
bidAmount: '1000'
|
|
@@ -346,6 +347,12 @@ function WeChatAdModal(props: Props) {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+ /** 禁止选择以前时间 */
|
|
|
+ const disabledDate: RangePickerProps['disabledDate'] = current => {
|
|
|
+ // Can not select days before today and today
|
|
|
+ return current && current < moment().startOf('day');
|
|
|
+ };
|
|
|
+
|
|
|
return <Modal
|
|
|
visible={visible}
|
|
|
title={type === 'add' ? '新建广告' : type === 'look' ? '广告详情' : '编辑广告'}
|
|
@@ -467,10 +474,10 @@ function WeChatAdModal(props: Props) {
|
|
|
<Form.Item label={<strong>投放日期</strong>} name='dateType'>
|
|
|
<Radio.Group onChange={(e) => {
|
|
|
if (e.target.value === "1") {
|
|
|
- form.setFieldsValue({ date: [moment().startOf('day').add(4, 'M'), moment().startOf('day').add(12, 'M')] })
|
|
|
+ form.setFieldsValue({ date: [moment().startOf('day').add(2, 'M'), moment().startOf('day').add(5, 'M')] })
|
|
|
}
|
|
|
if (e.target.value === "2") {
|
|
|
- form.setFieldsValue({ date: moment().startOf('day').add(4, 'M') })
|
|
|
+ form.setFieldsValue({ date: moment().startOf('day').add(2, 'M') })
|
|
|
}
|
|
|
}}>
|
|
|
<Radio.Button value="1">选择开始与结束日期</Radio.Button>
|
|
@@ -480,9 +487,9 @@ function WeChatAdModal(props: Props) {
|
|
|
{/* 投放日期的不同展示不同的日期选择 */}
|
|
|
{
|
|
|
dateType === '1' ? <Form.Item name='date' rules={[{ required: true, message: '请选择日期' }]}>
|
|
|
- <RangePicker style={{ marginLeft: 177 }}></RangePicker>
|
|
|
+ <RangePicker style={{ marginLeft: 177 }} disabledDate={disabledDate}></RangePicker>
|
|
|
</Form.Item> : <Form.Item name='date' style={{ marginLeft: 177 }} rules={[{ required: true, message: '请选择日期' }]}>
|
|
|
- <DatePickers />
|
|
|
+ <DatePickers disabledDate={disabledDate}/>
|
|
|
</Form.Item>
|
|
|
}
|
|
|
<Form.Item label={<strong>投放时段</strong>}>
|