Commit 3cd6a21d authored by 前端-钟卫鹏's avatar 前端-钟卫鹏
parents 96e424f3 462da585
......@@ -129,7 +129,7 @@ const EvaluateAdd = (props) => {
const tempPostData = {
...rest,
appraisalDayStart: appraisalDayStart.format('YYYY-MM-DD'),
appraisalDayEnd: appraisalDayStart.format('YYYY-MM-DD'),
appraisalDayEnd: appraisalDayEnd.format('YYYY-MM-DD'),
items: projectList,
attachments: attachments?.map((_row) => ({
name: _row.name,
......
......@@ -7,6 +7,7 @@ const template = {
componentName: 'SecondaryNavigation',
title: "二级导航",
addBtnText: '添加导航',
canDelete: false,
childComponentName: 'SecondaryNavigation.Item',
childProps: {
otherProps: {
......@@ -21,6 +22,7 @@ const template = {
"6-2": {
componentName: 'SimpleCommodityList',
title: '秒杀',
canDelete: false,
addBtnText: '添加秒杀商品',
childProps: {
otherProps: {
......@@ -39,6 +41,7 @@ const template = {
"6-3": {
componentName: 'SimpleCommodityList',
title: '品类销量排行',
canDelete: false,
addBtnText: '添加销量排行商品',
childComponentName: 'SimpleCommodityList.Item',
childProps: {
......@@ -57,6 +60,7 @@ const template = {
"6-4": {
componentName: 'CategoryList',
title: '品牌',
canDelete: false,
addBtnText: '添加品牌',
childComponentName: 'CategoryList.Item',
childProps: {
......@@ -71,6 +75,7 @@ const template = {
"6-5": {
componentName: 'ProductContainer',
title: '商品',
canDelete: false,
addBtnText: '添加商品',
childComponentName: 'Product',
props: {},
......@@ -175,104 +180,104 @@ const tab: PageConfigType = {
};
const tabContent: PageConfigType = {
"6": {
componentName: 'CustomizeTabs.TabItem',
title: '数码',
props: {
tab: '数码',
id: 1,
},
childNodes: ['6-1', "6-2", "6-3", "6-4", "6-5"],
},
"6-1": {
componentName: 'SecondaryNavigation',
title: "二级导航",
addBtnText: '添加导航',
childComponentName: 'SecondaryNavigation.Item',
childNodes: ['6-1-1'],
// const tabContent: PageConfigType = {
// "6": {
// componentName: 'CustomizeTabs.TabItem',
// title: '数码',
// props: {
// tab: '数码',
// id: 1,
// },
// childNodes: ['6-1', "6-2", "6-3", "6-4", "6-5"],
// },
// "6-1": {
// componentName: 'SecondaryNavigation',
// title: "二级导航",
// addBtnText: '添加导航',
// childComponentName: 'SecondaryNavigation.Item',
// childNodes: ['6-1-1'],
},
"6-1-1": {
componentName: 'SecondaryNavigation.Item',
title: "二级导航-标签",
},
"6-2": {
componentName: 'SimpleCommodityList',
title: '秒杀',
addBtnText: '添加秒杀商品',
childComponentName: 'SimpleCommodityList.Item',
props: {
title: '秒杀'
},
childNodes: ["6-2-1"]
},
"6-2-1": {
componentName: 'SimpleCommodityList.Item',
title: '123',
props: {
// image: "https://img2.baidu.com/it/u=4073850171,2776482768&fm=26&fmt=auto&gp=0.jpg",
// originalPrice: 266,
// discount: 255
}
},
"6-3": {
componentName: 'SimpleCommodityList',
title: '品类销量排行',
addBtnText: '添加销量排行商品',
childComponentName: 'SimpleCommodityList.Item',
props: {
title: '品类销量排行'
},
childNodes: ["6-3-1"]
},
"6-3-1": {
componentName: 'SimpleCommodityList.Item',
title: '123',
props: {
// image: "https://img2.baidu.com/it/u=4073850171,2776482768&fm=26&fmt=auto&gp=0.jpg",
// originalPrice: 266,
// footer: '<div>123</div>'
}
},
"6-4": {
componentName: 'CategoryList',
title: '品牌',
addBtnText: '添加品牌',
childComponentName: 'CategoryList.Item',
props: {},
childNodes: ["6-4-1"]
},
"6-4-1": {
componentName: 'CategoryList.Item',
title: '123',
props: {}
},
/** 商品 */
"6-5": {
componentName: 'Container',
title: '商品',
addBtnText: '添加商品',
childComponentName: 'Product',
props: {
card: false,
listStyle: {
marginRight: '-8px',
flexWrap: 'wrap'
},
itemStyle: {
paddingRight: '8px',
width: '50%'
}
},
childNodes: ["6-5-1"]
},
"6-5-1": {
componentName: 'Product',
title: '商品',
props: {}
}
};
// },
// "6-1-1": {
// componentName: 'SecondaryNavigation.Item',
// title: "二级导航-标签",
// },
// "6-2": {
// componentName: 'SimpleCommodityList',
// title: '秒杀',
// addBtnText: '添加秒杀商品',
// childComponentName: 'SimpleCommodityList.Item',
// props: {
// title: '秒杀'
// },
// childNodes: ["6-2-1"]
// },
// "6-2-1": {
// componentName: 'SimpleCommodityList.Item',
// title: '123',
// props: {
// // image: "https://img2.baidu.com/it/u=4073850171,2776482768&fm=26&fmt=auto&gp=0.jpg",
// // originalPrice: 266,
// // discount: 255
// }
// },
// "6-3": {
// componentName: 'SimpleCommodityList',
// title: '品类销量排行',
// addBtnText: '添加销量排行商品',
// childComponentName: 'SimpleCommodityList.Item',
// props: {
// title: '品类销量排行'
// },
// childNodes: ["6-3-1"]
// },
// "6-3-1": {
// componentName: 'SimpleCommodityList.Item',
// title: '123',
// props: {
// // image: "https://img2.baidu.com/it/u=4073850171,2776482768&fm=26&fmt=auto&gp=0.jpg",
// // originalPrice: 266,
// // footer: '<div>123</div>'
// }
// },
// "6-4": {
// componentName: 'CategoryList',
// title: '品牌',
// addBtnText: '添加品牌',
// childComponentName: 'CategoryList.Item',
// props: {},
// childNodes: ["6-4-1"]
// },
// "6-4-1": {
// componentName: 'CategoryList.Item',
// title: '123',
// props: {}
// },
// /** 商品 */
// "6-5": {
// componentName: 'Container',
// title: '商品',
// addBtnText: '添加商品',
// childComponentName: 'Product',
// props: {
// card: false,
// listStyle: {
// marginRight: '-8px',
// flexWrap: 'wrap'
// },
// itemStyle: {
// paddingRight: '8px',
// width: '50%'
// }
// },
// childNodes: ["6-5-1"]
// },
// "6-5-1": {
// componentName: 'Product',
// title: '商品',
// props: {}
// }
// };
const configs = {
......
......@@ -53,7 +53,6 @@ const EditPanel = () => {
const { selectedInfo, pageConfig, activeKey, domKey } = useSelector<SettingPanelType, STATE_PROPS | "activeKey" | "domKey">(['selectedInfo', 'pageConfig', 'activeKey', "domKey"]);
const {state: visible, toggle: setVisible } = useToggle(true);
const [schema, setSchema] = useState<any>(null);
const previousActiveKey = usePrevious(activeKey);
const [formValue, setFormValue] = useState({});
/** 精选商品type */
const [type, setType] = useState<number>(0);
......@@ -61,12 +60,14 @@ const EditPanel = () => {
* 当每次点击selectInfo 时,都把selectInfo.props 映射到formily 的value 上
* 但当一级类型没有被选择的时候,那么必须选择一级导航类型
*/
console.log()
useEffect(() => {
if (selectedInfo === null) {
setVisible(false);
return;
}
if (activeKey === null && selectedInfo !== null) {
// if(activeKey === null) {
message.info("请先选择一级导航类型");
// }
message.info("请先选择一级导航类型");
const primaryTabProps = pageConfig[domKey!].props;
setFormValue({
primary: primaryTabProps?.id,
......@@ -144,7 +145,7 @@ const EditPanel = () => {
} else {
setVisible(false);
}
}, [selectedInfo, activeKey]);
}, [selectedInfo, activeKey, domKey]);
/** 这里直接筛选出 domKey-${5} 下的type */
useEffect(() => {
......@@ -225,7 +226,6 @@ const EditPanel = () => {
if(componentType.includes('suggestProduct') && type === 0) {
setType(values.type);
}
console.log(values);
changeProps({
treeKey: key,
props: currentProps,
......@@ -299,7 +299,6 @@ const EditPanel = () => {
if (code === 1000) {
// const source = data.map((_item) => ({label: _item.name, value: _item.id}));
const source = data?.map((_item) => ({label: _item.name, value: _item.id, disabled: sameKeyState[`tabItem_${activeKey}_secondary`].includes(_item.id)} )) || [];
console.log("source", source)
formActions.setFieldState('secondary', (state) => {
state.originAsyncData = source;
FormPath.setIn(state, 'props.enum', source);
......
......@@ -167,6 +167,10 @@ export const saleRankSchema: ISchema = {
limitByte: true, // 自定义校验规则
maxByte: 16,
},
{
pattern: /^\d+$/,
message: '只允许填写数字'
}
]
}
......
import React, { useContext, useMemo, useState } from 'react';
import React, { useContext, useMemo, useState, useEffect } from 'react';
import { Tabs } from 'antd';
import cs from 'classnames';
import {createActions, useSelector} from '@lingxi-disign/react';
......@@ -9,6 +9,7 @@ import { context } from '../../../common/context/context';
import { PublicApi } from '@/services/api';
import { getAuth } from '@/utils/auth';
import { usePageStatus } from '@/hooks/usePageStatus';
import { usePrevious } from '@umijs/hooks';
const { TabPane } = Tabs;
......@@ -21,11 +22,11 @@ interface Iprops {
const CustomizeTabs: React.FC<Iprops> & { TabItem: typeof TabItem } = (props: Iprops) => {
const { children } = props;
const auth = getAuth();
const { pageConfig, shopId } = useSelector(['pageConfig', 'shopId']);
const { pageConfig, shopId, selectedInfo, activeKey: currentActiveKey, dom } = useSelector(['pageConfig', 'shopId', 'selectedInfo', 'domKey', 'activeKey']);
const { isSelf } = usePageStatus();
/** 是否是自营商城 */
const isSelfMall = useMemo(() => !!isSelf, [isSelf]);
const [activeKey, setActiveKey] = useState<string>("2");
const [activeKey, setActiveKey] = useState<string>("0");
const [hasRequestTabKey, setHasRequestTabKey] = useState<string[]>([]);
// const { onClick, onDrag, onDragEnd, onDragEnter, onDragStart, onMouseOver, getOperateState, className, ...rest} = props as any;
......@@ -34,6 +35,21 @@ const CustomizeTabs: React.FC<Iprops> & { TabItem: typeof TabItem } = (props: Ip
// onClick, onDrag, onDragEnd, onDragEnter, onDragStart, onMouseOver
// };
useEffect(() => {
// const matches = activeKey.match(/id_(.*)\/\.\$(\d+)/);
if (selectedInfo === null) {
return
}
const { domTreeKeys } = selectedInfo;
if (domTreeKeys.length < 3) {
return;
}
const activeTabKeyID = domTreeKeys[2];
const props = pageConfig[activeTabKeyID].props;
const formatTabKey = `id_${props.id}/.$${activeTabKeyID}`;
onChange(formatTabKey);
}, [selectedInfo])
/** 获取活动商品 */
const getActivityProduct = async (ids: number[]) => {
if (ids.length === 0) {
......
......@@ -78,7 +78,6 @@ const CategoryNavigation = () => {
const onSave = async (pageConfig, rest) => {
const hasRequestTabKey = rest.hasRequestTabKey?.map((_item: string) => _item.match(/id_(.*)\/\.\$(\d+)/)?.[1]) || [];
/** domKey 从7开始都是tab 的值 */
const tabChildren = pageConfig[4].childNodes.slice(1);
setLoading(true);
......@@ -90,7 +89,8 @@ const CategoryNavigation = () => {
if (!id) {
return;
}
if (!hasRequestTabKey.includes(id.toString())) {
/** 如果没有请求过数据,那就用原始数据 */
if (!hasRequestTabKey.includes(id.toString()) && dataSourceFromRequest[id]) {
return dataSourceFromRequest[id];
}
const tabProps = {
......@@ -103,14 +103,14 @@ const CategoryNavigation = () => {
const tabItemChild = pageConfig[_nodeKey].childNodes;
tabItemChild.forEach(element => {
const { otherProps: { type }, props, childNodes } = pageConfig[element];
const rest = type === 'suggestProduct' ? { type: props.type, num: props.num } : {};
const rest = type === 'suggestProduct' ? { type: props.type || 1, num: props.num || 50 } : {};
tabItemData[type] = {
title: props?.title || TITLE_MAP[type],
...rest,
children: childNodes.map((_son) => {
const sonData = pageConfig[_son];
if (sonData && sonData.props) {
if (sonData && sonData.props && sonData.props.id) {
return keyFunc[type]?.(sonData.props);
}
}).filter(Boolean)
......@@ -120,7 +120,6 @@ const CategoryNavigation = () => {
return tabProps;
});
const postData = { style: 0, category: result.filter(Boolean) };
console.log(result, postData);
const service = isSelfMall ? PublicApi.postTemplateAdornAppSelfSave : PublicApi.postTemplateAdornAppChannelSave;
const { data, code } = await service({
templateId: Number(id),
......
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