Commit ad7a4e85 authored by Bill's avatar Bill

fix: 修改品类导航页bug

parent 3bc9eca0
......@@ -3,11 +3,15 @@ export interface ShopInfo {
name: string;
type: number;
environment: number;
property?: any;
self: number;
memberOperate: number;
logoUrl: string;
describe?: any;
describe: string;
state: number;
url: string;
isDefault: number;
isDefault?: any;
createTime?: any;
}
export interface OrderMode {
......@@ -28,7 +32,7 @@ export interface SiteInfo {
name: string;
logo: string;
siteUrl: string;
symbol: string;
symbol?: any;
}
export interface Site {
......
......@@ -82,6 +82,7 @@
align-items: center;
width: 100%;
margin-bottom: 8px;
color: #303133;
.activityImg {
width: 24px;
......
......@@ -6,7 +6,7 @@ import { unstable_batchedUpdates } from 'react-dom';
import styles from './product.less';
import { priceFormat } from '@/utils/numberFomat';
import StatusTag from '@/components/StatusTag';
import defaultActivityImage from '@/asserts/activity/ActivityImage.svg';
interface Iprops {
onEdit?: ((data: { id: number, activityId: number}) => void) | null,
......@@ -30,7 +30,7 @@ interface Iprops {
const defaultLabel = [];
const Product: React.FC<Iprops> = (props: Iprops) => {
const { onEdit, onRemove, productName, productImgUrl, id, activityId, price, activityList, isWithLabels, activityImage, label = defaultLabel, onLabelChange = null } = props;
const { onEdit, onRemove, productName, productImgUrl, id, activityId, price, activityList, isWithLabels, activityImage = defaultActivityImage, label = defaultLabel, onLabelChange = null } = props;
const [inputVisible, setInputVisible] = useState<boolean>(false);
const [inputValue, setInputValue] = useState<string>("");
const inputRef = useRef<(Input) | null>(null);
......@@ -168,11 +168,11 @@ const Product: React.FC<Iprops> = (props: Iprops) => {
{
activityList?.map((_item) => {
return (
<div className={styles.activityItem} key={_item.id}>
<a className={styles.activityItem} key={_item.id} href={`/marketingManage/marketing/marketingSearch/preview?id=${_item.id}`} target="_blank">
<img className={styles.activityImg} src={activityImage} />
<span className={styles.activityName}>{_item.name}</span>
<StatusTag type="danger" title={_item.type}></StatusTag>
</div>
</a>
);
})
}
......
import { useEffect, useState } from 'react';
import { updatePageConfig } from '@lingxi-disign/core';
import { updatePageConfig } from '@lingxi-disign/react';
import { cloneDeep } from 'lodash';
import pageConfig from '../schema/pageConfig';
import { PublicApi } from '@/services/api';
......@@ -92,7 +92,8 @@ function useGetLayout() {
childProps: {
otherProps: {
type: `${_child}Item`,
}
},
childNodes: [],
},
canDelete: false,
addBtnText: '添加子节点',
......@@ -118,6 +119,8 @@ function useGetLayout() {
...cloneconfig,
...config
};
console.log("fuck",newConfig)
setDataSourceFromRequest(dataFromRequest);
updatePageConfig(newConfig);
}, [info]);
......
......@@ -28,7 +28,7 @@ type SettingPanelType = {
}
const ComponentSchema = {
tabItem: tabTitleSchema,
// tabItem: tabTitleSchema,
secondaryItem: secondaryTabSchema,
flashSale: blockSchema,
flashSaleItem: flashSaleSchema,
......@@ -74,7 +74,7 @@ const EditPanel = () => {
* 但当一级类型没有被选择的时候,那么必须选择一级导航类型
*/
useEffect(() => {
if (activeKey === null || previousActiveKey !== activeKey || (selectedInfo as any)?.otherProps?.type === 'tabItem') {
if (activeKey === null && previousActiveKey !== activeKey) {
if(activeKey === null) {
message.info("请先选择一级导航类型");
}
......@@ -243,7 +243,7 @@ const EditPanel = () => {
};
const currentProps = type === 0 && componentType.includes('suggestProduct') ? formValueToProps['suggestProduct'] : formValueToProps[componentType];
if(componentType === 'suggestProduct' || type === 0) {
if(componentType.includes('suggestProduct') && type === 0) {
setType(values.type);
}
changeProps({
......
......@@ -15,6 +15,12 @@ export const tabTitleSchema: ISchema = {
type: 'string',
title: "{{ text('类型', help('注意:当一级导航确认选择后,不能修改。')) }}",
enum: [],
"x-rules": [
{
required: true,
message: '请选择一级品类'
}
]
},
title: {
type: 'string',
......@@ -40,6 +46,12 @@ export const secondaryTabSchema: ISchema = {
type: 'string',
title: '类型',
enum: [],
"x-rules": [
{
required: true,
message: '请选择二级类型'
}
]
},
title: {
type: 'string',
......@@ -56,6 +68,12 @@ export const secondaryTabSchema: ISchema = {
children: null,
maxCount: 1,
},
"x-rules": [
{
required: true,
message: '请上传图片'
}
]
}
}
}
......@@ -77,8 +95,13 @@ export const blockSchema: ISchema = {
blockTitle: {
type: 'string',
title: '标题',
"x-rules": [
{
required: true,
message: '请填写标题'
}
]
},
}
}
}
......@@ -124,12 +147,20 @@ export const saleRankSchema: ISchema = {
rankProduct: {
type: 'object',
"x-component": 'FormilyCommodity',
"x-component-props": {
commodityKey: 'saleRanking'
}
},
sale: {
type: 'string',
title: '销量',
"x-rules": [
{
required: true,
message: '请填写销量',
}
]
}
}
}
}
......@@ -209,7 +240,7 @@ export const productListSchema: ISchema = {
}
};
/** 销量排行schema */
/** 精选商品schema */
export const commoditySchema: ISchema = {
type: 'Object',
properties: {
......@@ -225,11 +256,11 @@ export const commoditySchema: ISchema = {
"x-component": 'FormilyCommodity',
'x-component-props': {
isWithLabels: true,
commodityKey: 'suggestProduct'
}
},
}
}
}
};
......@@ -6,7 +6,13 @@ import { useFilterSameOption } from '../../common/hooks/useFilterSameOption';
import { Product } from '@/pages/marketingManage/marketing/marketingActivitiesManagement/activePage/fixtures/components/ProductPanel';
import CommodityDrawer from '@/pages/pageCustomized/components/drawers/commodityDrawer';
type ComponentTypeProps = {
activityType: number,
commodityKey: 'saleRanking' | 'suggestProduct',
isWithLabels?: boolean
} & {
[key: string]: any
}
interface Iprops {
value: {
id: number,
......@@ -19,11 +25,7 @@ interface Iprops {
label: string[],
},
props: {
['x-component-props']: {
activityType: number,
} & {
[key: string]: any
},
['x-component-props']: ComponentTypeProps,
},
mutators: {
change: (params: any) => void
......@@ -37,9 +39,8 @@ const FormilyCommodity: React.FC<Iprops> & { isFieldComponent: boolean } = (prop
const { activeKey } = useSelector<any, "activeKey" >(['activeKey']);
const fixtureContext = useContext(context);
const sameKeyState = useFilterSameOption();
const disabledSaleRankingKeys = useMemo(() => sameKeyState[`tabItem_${activeKey}_saleRanking`], [sameKeyState, activeKey]);
const componentProps = props.props?.['x-component-props'] || {};
const componentProps = props.props?.['x-component-props'] || {} as ComponentTypeProps;
const disabledSaleRankingKeys = useMemo(() => sameKeyState[`tabItem_${activeKey}_${componentProps.commodityKey}`], [sameKeyState, activeKey]);
const { state: productVisible, toggle: setProductVisible } = useToggle();
const productProps = useMemo(() => ({
......
......@@ -177,7 +177,8 @@ const CustomizeTabs: React.FC<Iprops> & { TabItem: typeof TabItem } = (props: Ip
},
otherProps: {
type: `${_item}Item`
}
},
childNodes: [],
};
cloneDeepPageConfig[parentKey].childNodes.push(`${parentKey}-${_rowKey + 1}`);
});
......@@ -189,7 +190,9 @@ const CustomizeTabs: React.FC<Iprops> & { TabItem: typeof TabItem } = (props: Ip
props: _row,
otherProps: {
type: `${_item}Item`
}
},
childNodes: [],
};
cloneDeepPageConfig[parentKey].childNodes.push(`${parentKey}-${_rowKey + 1}`);
});
......
......@@ -19,6 +19,7 @@ import CustomInputSearch from '@/components/NiceForm/components/CustomInputSearc
import CustomCategorySearch from '@/components/NiceForm/components/CustomCategorySearch';
import ActivityImage from '@/asserts/activity/ActivityImage.svg';
import moment from 'moment';
......@@ -55,14 +56,15 @@ const CommodityDrawer: React.FC<CommodityDrawerProps> = (props: CommodityDrawerP
<>
{record?.activityList?.map((item, index) => {
return (
<div key={index} style={{ marginBottom: 8 }}>
<a key={index} style={{ marginBottom: 8 }} href={`/marketingManage/marketing/marketingSearch/preview?id=${item.id}`} target={"_blank"}>
<Space direction='horizontal'>
<img src={ActivityImage} style={{ width: 24, height: 24, borderRadius: 4 }} />
<span>{item?.name}</span>
<div className={styles['defaultTag']}>{item?.type}</div>
<StatusTag title={item?.belongType === 1 ? '平台活动' : '商家活动'} type={item?.belongType === 1 ? 'primary' : 'success'} />
<div style={{color: '#301333'}}>有效期:{item.startTime && moment(item.startTime).format('YYYY-MM-DD HH:mm:ss')}{item.endTime && moment(item.endTime).format('YYYY-MM-DD HH:mm:ss')} </div>
</Space>
</div>
</a>
);
})}
</>
......
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