Commit fb0416bf authored by Bill's avatar Bill

fix: 修改装修提交数据

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