Commit 9eb3c65a authored by GuanHua's avatar GuanHua

feat: 渠道&店铺&自营模板装修添加分类是否显示选项

parent d0e67dd8
......@@ -270,4 +270,7 @@
'editor.shopfloorline.goods': 'Product Recommendation Settings',
'editor.shopfloorline.category': 'Classification Recommendation Settings',
'editor.mainnav.title': 'Navigation bar editor',
'editor.cateogry.show.title': 'Whether to show recommended categories',
'editor.cateogry.show.yes': 'Yes',
'editor.cateogry.show.no': 'No',
}
......@@ -270,5 +270,8 @@ export default {
'editor.shopfloorline.goods': '상품 추천 설정',
'editor.shopfloorline.category': '분류 권장 설정',
'editor.mainnav.title': '탐색 모음 편집기',
'editor.cateogry.show.title': '추천 카테고리 표시 여부',
'editor.cateogry.show.yes': '예',
'editor.cateogry.show.no': '아니요',
}
......@@ -270,5 +270,8 @@ export default {
'editor.shopfloorline.goods': '商品推荐设置',
'editor.shopfloorline.category': '分类推荐设置',
'editor.mainnav.title': '导航栏编辑',
'editor.cateogry.show.title': '是否展示推荐分类',
'editor.cateogry.show.yes': '是',
'editor.cateogry.show.no': '否',
}
......@@ -312,7 +312,8 @@ const ChannelPreview: React.FC<ChannelPreviewPropsType> = (props) => {
categoryAdvertPicUrl: categoryDetail.categoryAdvertPicUrl,
categoryid: item.categoryId,
linkdisable: true,
categoryList: categoryDetail.categoryBOList
categoryList: categoryDetail.categoryBOList,
isShow: categoryDetail?.isShow
},
},
}
......
......@@ -255,7 +255,8 @@ const OwnMallEdit: React.FC<ShopEditPropsType> = (props) => {
categoryAdvertPicUrl: categoryDetail.categoryAdvertPicUrl,
categoryid: item.categoryId,
linkdisable: true,
categoryList: categoryDetail.categoryBOList
categoryList: categoryDetail.categoryBOList,
isShow: categoryDetail?.isShow
},
},
}
......
......@@ -232,7 +232,7 @@ const OwnMallEdit: React.FC<ShopEditPropsType> = (props) => {
for (const item of firstCategory) {
if (item.categoryId ){
const categoryDetail: any = await fetchCategoryById(item.categoryId)
if (categoryDetail?.isShow !== 1) return
let floorLineConfigItem = {}
floorLineKeys.push(String(initIndex + 1))
......@@ -253,7 +253,8 @@ const OwnMallEdit: React.FC<ShopEditPropsType> = (props) => {
categoryAdvertPicUrl: categoryDetail.categoryAdvertPicUrl,
categoryid: item.categoryId,
linkdisable: true,
categoryList: categoryDetail.categoryBOList
categoryList: categoryDetail.categoryBOList,
isShow: categoryDetail?.isShow
},
},
}
......
import React, { useState, useEffect, useCallback } from 'react'
import { Checkbox, Row, Col, message, Modal } from 'antd'
import { Checkbox, Row, Col, message, Modal, Radio } from 'antd'
import { useIntl } from 'umi'
import UploadImage from '@/components/UploadImage'
import SettingPanel from '../../../../components/SettingPanel'
......@@ -20,16 +20,26 @@ interface CategoryRecommendSettingPropsType {
categoryid?: number;
templateType: 'channel' | 'shop' | 'own',
shopId: number,
isShow: number
}
const CategoryRecommendSetting: React.FC<CategoryRecommendSettingPropsType> = (props) => {
const { categoryList = [], categoryAdvertPicUrl = '', shopId, onChange, templateid, categoryid, templateType } = props
const { categoryList = [], categoryAdvertPicUrl = '', shopId, isShow, templateid, categoryid, templateType } = props
const [imgUrl, setImgUrl] = useState<string>(categoryAdvertPicUrl)
const [selectKeys, setSelectKeys] = useState<number[]>([])
const [categoryResponseList, setCategoryResponseList] = useState<any>([])
const [confirmLoading, setConfirmLoading] = useState<boolean>(false)
const [newProps, setNewProps] = useState(props)
const intl = useIntl()
const [showState, setShowState] = useState<number>(1)
useEffect(() => {
if (isShow) {
setShowState(1)
} else {
setShowState(0)
}
}, [isShow])
const changeNewProps = (key: string, data: any) => {
const result = { ...newProps }
......@@ -119,7 +129,8 @@ const CategoryRecommendSetting: React.FC<CategoryRecommendSettingPropsType> = (p
templateId: templateid,
categoryId: categoryid,
categoryAdvertPicUrl,
twoCategoryIds: selectKeys
twoCategoryIds: selectKeys,
isShow: showState
}
let postFn;
if (templateType === 'channel') {
......@@ -157,6 +168,11 @@ const CategoryRecommendSetting: React.FC<CategoryRecommendSettingPropsType> = (p
}
}, [newProps])
const options = [
{ label: intl.formatMessage({ id: 'editor.cateogry.show.yes' }), value: 1 },
{ label: intl.formatMessage({ id: 'editor.cateogry.show.no' }), value: 0 },
];
return (
<SettingPanel
confirmLoading={confirmLoading}
......@@ -165,6 +181,15 @@ const CategoryRecommendSetting: React.FC<CategoryRecommendSettingPropsType> = (p
>
<div className={styles.category_recommend}>
<div className={styles.category_recommend_title}>
<span>{intl.formatMessage({ id: 'editor.cateogry.show.title' })}</span>
</div>
<div className={styles.category_recommend_body}>
<Radio.Group options={options} value={showState} onChange={(e) => {
changeNewProps('isShow', e.target.value);
setShowState(e.target.value)
}} />
</div>
<div className={styles.category_recommend_title}>
<span>{intl.formatMessage({ id: 'editor.setting.category.first.title' })}</span>
</div>
<div className={styles.category_recommend_body}>
......
......@@ -203,7 +203,8 @@ const ShopEdit: React.FC<ShopEditPropsType> = (props) => {
categoryAdvertPicUrl: categoryDetail.categoryAdvertPicUrl,
categoryid: item.categoryId,
linkdisable: true,
categoryList: categoryDetail.categoryBOList
categoryList: categoryDetail.categoryBOList,
isShow: categoryDetail?.isShow
},
},
}
......
......@@ -291,7 +291,7 @@ const ChannelPreview: React.FC<ChannelPreviewPropsType> = (props) => {
for (const item of firstCategory) {
if(item.categoryId) {
const categoryDetail: any = await fetchCategoryById(item.categoryId)
if (categoryDetail?.isShow !== 1) return
let floorLineConfigItem = {}
floorLineKeys.push(String(initIndex + 1))
......@@ -312,7 +312,8 @@ const ChannelPreview: React.FC<ChannelPreviewPropsType> = (props) => {
categoryAdvertPicUrl: categoryDetail.categoryAdvertPicUrl,
categoryid: item.categoryId,
linkdisable: true,
categoryList: categoryDetail.categoryBOList
categoryList: categoryDetail.categoryBOList,
isShow: categoryDetail?.isShow
},
},
}
......
......@@ -181,7 +181,7 @@ const ShopEdit: React.FC<ShopEditPropsType> = (props) => {
for (const item of firstCategory) {
if (item.categoryId ){
const categoryDetail: any = await fetchCategoryById(item.categoryId)
if (categoryDetail?.isShow !== 1) return
let floorLineConfigItem = {}
floorLineKeys.push(String(initIndex + 1))
......@@ -201,7 +201,8 @@ const ShopEdit: React.FC<ShopEditPropsType> = (props) => {
"props": {
categoryAdvertPicUrl: categoryDetail.categoryAdvertPicUrl,
categoryid: item.categoryId,
categoryList: categoryDetail.categoryBOList
categoryList: categoryDetail.categoryBOList,
isShow: categoryDetail?.isShow
},
},
}
......
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