Commit fb0416bf authored by Bill's avatar Bill

fix: 修改装修提交数据

parent 98ddb318
import React, { CSSProperties, useCallback, useEffect, useState } from 'react';
import { DatePicker } from 'antd';
import cx from 'classnames';
import styles from './index.less';
import moment, { Moment } from 'moment';
import styles from './index.less';
interface Iprops {
containerStyle?: CSSProperties,
......@@ -24,8 +24,9 @@ interface Iprops {
}
const RangeTime: React.FC<Iprops> = (props: Iprops) => {
const { containerStyle, rangeTime, onChange, placeholader, shouldGtCurrent, disabled } = props;
const { containerStyle, rangeTime, onChange, placeholader, shouldGtCurrent, disabled, showTime } = props;
const currentDay = moment();
const endOfUnit = showTime ? 'second' : 'day';
const [innerRangeTime, setInnerRangeTime] = useState({
startTime: null,
......@@ -37,17 +38,17 @@ const RangeTime: React.FC<Iprops> = (props: Iprops) => {
setInnerRangeTime({
startTime: startTime,
endTime: endTime,
})
}, [props.rangeTime])
});
}, [props.rangeTime]);
const handleChange = (date: Moment | null, dateString: string, mode: "startTime" | "endTime") => {
const newObject = {
...innerRangeTime,
[mode]: date,
}
onChange?.([newObject.startTime as unknown as Moment, newObject.endTime as unknown as Moment])
setInnerRangeTime(newObject)
}
};
onChange?.([newObject.startTime as unknown as Moment, newObject.endTime as unknown as Moment]);
setInnerRangeTime(newObject);
};
const getDisableDate = useCallback((current: Moment, mode: "startTime" | "endTime") => {
const reverseMode = mode === 'startTime' ? 'endTime' : 'startTime';
......@@ -56,17 +57,17 @@ const RangeTime: React.FC<Iprops> = (props: Iprops) => {
// current 为当前日历上的日期, 如果返回值为true,那么表示当前日期为禁用状态
if(!modeTime) {
if(shouldGtCurrent) {
return current < currentDay.endOf('day');
return current < currentDay.endOf(endOfUnit);
}
return false
return false;
}
if (mode === 'startTime') {
return shouldGtCurrent ? (current < currentDay.endOf('day') || current > (modeTime as Moment).endOf('day')) : current > (modeTime as Moment).endOf('day')
return shouldGtCurrent ? (current < currentDay.endOf(endOfUnit) || current > (modeTime as Moment).endOf(endOfUnit)) : current > (modeTime as Moment).endOf(endOfUnit);
} else {
//现在的时间要大于开始的时间, true 为禁用
return shouldGtCurrent ? (current < currentDay.endOf('day') || current < (modeTime as Moment).endOf('day')) : current < (modeTime as Moment).endOf('day')
return shouldGtCurrent ? (current < currentDay.endOf(endOfUnit) || current < (modeTime as Moment).endOf(endOfUnit)) : current < (modeTime as Moment).endOf(endOfUnit);
}
}, [innerRangeTime])
}, [innerRangeTime]);
return (
<div className={cx(styles.container, containerStyle)}>
......@@ -93,8 +94,8 @@ const RangeTime: React.FC<Iprops> = (props: Iprops) => {
/>
</div>
</div>
)
}
);
};
RangeTime.defaultProps = {
containerStyle: {},
......@@ -104,6 +105,6 @@ RangeTime.defaultProps = {
shouldGtCurrent: true,
disabled: false,
showTime: false,
}
};
export default RangeTime
export default RangeTime;
import React from 'react';
import StatusTag from '@/components/StatusTag';
import { DeleteOutlined, EditOutlined, PlayCircleOutlined } from '@ant-design/icons';
import { Button, Space, Popconfirm } from 'antd';
import moment from 'moment';
import { Link } from 'umi';
import { enumName } from '@/constants/const/environment';
import styles from './index.less';
import { enumName } from '@/constants/const/environment';
import StatusTag from '@/components/StatusTag';
interface Iprops {
templatePicUrl?: string,
title: string,
templateName: string,
shopName: string,
startTime: string,
endTime: string,
startTime: number,
endTime: number,
statusName: string,
id: number,
/** 1.WEB 2.H5 3.小程序 4.APP */
......
import * as LingXiUI from 'lingxi-design-ui';
import * as LxUI from '@lingxi-disign/ui';
import { ConfigType } from '@lingxi-disign/react';
import schema from './schema';
import CustomLayouts from '../../components/Layouts';
import MallLayout from '@/pages/pageCustomized/configs/componentConfigs/LingXiUI/MallLayout';
// import MobileQuickNav from '@/pages/pageCustomized/configs/componentConfigs/LingXiUI/MobileQuickNav';
import * as HTML from '@/pages/pageCustomized/configs/componentConfigs/HTML';
import schema from './schema';
import CustomLayouts from '../../components/Layouts';
const componentSchemasMap = { MallLayout, ...schema, ...HTML };
const originalComponents = { ...LxUI, ...LingXiUI, ...CustomLayouts };
......
......@@ -276,6 +276,7 @@ function useGetData(pageConfig: PageConfigType) {
newPageConfig[0]["childNodes"] = newSortChild.concat(restNode as string[]);
setLoading(false);
console.log(newPageConfig);
updatePageConfig(newPageConfig);
}
setPageConfigData();
......
......@@ -32,7 +32,6 @@
"theme": 1,
"visible": true,
"title":"特价促销",
"explain":"爆款限时特价",
"childrenData": []
}
},
......@@ -42,7 +41,6 @@
"theme":1,
"visible": false,
"title":"直降促销",
"explain":"大牌商品最高直降100元",
"childrenData": []
}
},
......@@ -52,7 +50,6 @@
"theme":0,
"visible": false,
"title":"折扣促销",
"explain":"大牌商品低至5折起",
"childrenData": []
}
},
......@@ -62,7 +59,6 @@
"theme":0,
"visible": false,
"title":"满量促销--满量减",
"explain":"大牌商品多买最高减100元",
"childrenData": []
}
},
......@@ -72,7 +68,6 @@
"theme":0,
"visible": false,
"title":"满量促销--满量折",
"explain":"大牌商品多买最高5折起",
"childrenData": []
}
},
......@@ -82,7 +77,6 @@
"theme":0,
"visible": false,
"title":"满额促销--满额减",
"explain":"大牌商品买满299元最高减100元",
"childrenData": []
}
},
......@@ -92,7 +86,6 @@
"theme":0,
"visible": false,
"title":"满额促销--满额折",
"explain":"大牌商品买满199元最高5折起",
"childrenData": []
}
},
......@@ -102,7 +95,6 @@
"theme":0,
"visible": false,
"title":"赠送促销--赠送商品(满额赠+买商品赠)",
"explain":"买满199元即有机会获赠以下商品",
"childrenData":[]
}
},
......@@ -112,7 +104,6 @@
"theme":0,
"visible": false,
"title":"赠送促销--赠送优惠劵(满额赠+买商品赠)",
"explain":"买满199元即有机会获赠以下商品",
"childrenData":[]
}
},
......@@ -122,7 +113,6 @@
"theme":0,
"visible": false,
"title":"多件促销",
"explain":"以下商品第二件5折起",
"childrenData": []
}
},
......@@ -132,7 +122,6 @@
"theme": 2,
"visible": false,
"title":"组合促销",
"explain":"任选3件,只需99元",
"childrenData": []
}
},
......@@ -142,7 +131,6 @@
"theme":0,
"visible": false,
"title":"拼团",
"explain":"时令水果拼团专场",
"childrenData":[]
}
},
......@@ -152,7 +140,6 @@
"theme":0,
"visible": false,
"title":"砍价",
"explain":"砍一砍,免费拿",
"childrenData":[]
}
},
......@@ -162,7 +149,6 @@
"theme":0,
"visible": false,
"title":"秒杀",
"explain":"今日大牌秒杀",
"childrenData": []
}
},
......@@ -172,7 +158,6 @@
"theme":0,
"visible": false,
"title":"换购-满额换购",
"explain":"买满199元即可换购下面商品",
"childrenData":[]
}
},
......@@ -182,7 +167,6 @@
"theme":0,
"visible": false,
"title":"换购-买商品换购",
"explain":"买了这台苹果18元即可换购下面商品",
"childrenData":[]
}
},
......@@ -192,7 +176,6 @@
"theme":0,
"visible": false,
"title":"预售",
"explain":"大牌新品火爆预售",
"childrenData":[]
}
},
......@@ -202,7 +185,6 @@
"theme": 2,
"visible": true,
"title":"套餐",
"explain":"超级搭配套餐",
"childrenData": []
}
},
......@@ -212,7 +194,6 @@
"theme":0,
"visible": false,
"title":"试用",
"explain":"大牌新品免费试用",
"childrenData":[]
}
},
......
......@@ -3,9 +3,8 @@ import { Spin, message , Tabs } from 'antd';
import { BrickProvider, ModuleTree } from '@lingxi-disign/react';
import _get from 'lodash/get';
import _omit from 'lodash/omit';
import _pick from 'lodash/pick';
import { history } from 'umi';
import { PublicApi } from '@/services/api';
import { usePageStatus } from '@/hooks/usePageStatus';
import MobileDesignPanel from './components/MobileDesignPanel';
import componentConfigs from './common/configs';
import Toolbar from './components/Toolbar';
......@@ -16,6 +15,8 @@ import useGetData from './common/hooks/useGetData';
import Module from './components/ComponentTree';
import ToolbarSubmit from './components/Toolbar/toolbarSubmit';
import { RenovationProvider } from './common/context/shopContext';
import { usePageStatus } from '@/hooks/usePageStatus';
import { PublicApi } from '@/services/api';
const { TabPane } = Tabs;
......@@ -49,7 +50,7 @@ const Fixtures = () => {
result = generaterData(result, dataIndex, {
sort: sort,
props: {
...props,
..._pick(props, ['theme', 'visible']),
childrenData: childrenData
}
});
......@@ -59,22 +60,24 @@ const Fixtures = () => {
result = generaterData(result, dataIndex, {
sort: sort,
props: {
...otherProps,
..._pick(otherProps, ['theme', 'visible', 'title']),
childrenData: childrenData
}
});
} else if (dataIndex === 'suggestProduct') {
const { products, childrenData, ...otherProps } = props || {};
console.log(otherProps, "suggestProduct");
const { childNodes } = target;
const temp = {
sort: sort,
props: {
...otherProps,
visible: true,
childrenData: childNodes?.filter((_record) => /\d+-\d+/.test(_record)).map((_row) => {
const childrenNodeTarget = pageConfig[_row];
const { products: productList, ...childRestProps } = childrenNodeTarget?.props;
return {
...childRestProps,
title: childRestProps.title,
theme: childRestProps.theme || 0,
childrenData: productList?.map((_listItem) => {
return {
id: _listItem.id,
......@@ -88,10 +91,12 @@ const Fixtures = () => {
result = generaterData(result, dataIndex, temp);
}
});
console.log(result);
// return;
const { data, code } = await PublicApi.postTemplateWebActivityPageAdorn({
id: id,
adornContent: result
});
} as any);
setSubmitLoading(false);
if (code === 1000) {
history.goBack();
......
......@@ -4,12 +4,12 @@ import { PlusOutlined } from '@ant-design/icons';
import { unstable_batchedUpdates as batchedUpdates } from 'react-dom';
import { useDebounce } from '@umijs/hooks';
import { Link } from 'umi';
import { PublicApi } from '@/services/api';
import { GetTemplateWebActivityPagePageResponseDetail, GetTemplateWebActivityPagePageRequest } from '@/services/Template2Api';
import moment from 'moment';
import ActivityItem from './components/ActivityItem';
import styles from './index.less';
import SearchPannel from './components/SearchPannel';
import { GetTemplateWebActivityPagePageResponseDetail, GetTemplateWebActivityPagePageRequest } from '@/services/Template2Api';
import { PublicApi } from '@/services/api';
const { Search } = Input;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment