Commit 83d73031 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏
parents bc821a87 b69ee61c
......@@ -60,10 +60,10 @@
"@ctrl/tinycolor": "^3.4.0",
"@formily/antd": "^1.3.3",
"@formily/antd-components": "^1.3.3",
"@lingxi-disign/core": "^1.0.5",
"@lingxi-disign/react": "^1.0.5",
"@lingxi-disign/core": "^1.0.6",
"@lingxi-disign/react": "^1.0.6",
"@lingxi-disign/react-web": "^1.0.2",
"@lingxi-disign/ui": "^1.0.4",
"@lingxi-disign/ui": "^1.0.5",
"@turf/turf": "^6.4.0",
"@types/crypto-js": "^4.0.1",
"@types/js-cookie": "^2.2.6",
......
......@@ -374,7 +374,7 @@ const ChannelPreview: React.FC<ChannelPreviewPropsType> = (props) => {
</div>
</div>
</div>
<SettingPanel templateId={id} type="channel" />
<SettingPanel templateId={id} type="channel" shopId={shopId} />
</BrickProvider>
) : <Loading />
}
......
......@@ -45,7 +45,7 @@ export const paramsShop = (
childNodes = get(pageConfig, ['2', 'childNodes']) || {}
_params.adornContent.navList = {
style: 0,
status: true,
status: propsData.status,
details: []
}
if (childNodes && Array.isArray(childNodes) && childNodes.length > 0) {
......@@ -683,7 +683,7 @@ export const paramsShop = (
childNodes = get(pageConfig, ['5', 'childNodes']) || {}
_params.adornContent.navList = {
style: 0,
status: true,
status: propsData.status,
details: []
}
if (childNodes && Array.isArray(childNodes) && childNodes.length > 0) {
......
......@@ -18,6 +18,10 @@ export const cardNavSchema: ISchema = {
required: true,
message: '请输入名称',
},
{
len: 6,
message: '名称最多6个字',
},
],
},
icon: {
......
......@@ -272,7 +272,7 @@ const OwnMallEdit: React.FC<ShopEditPropsType> = (props) => {
</div>
</div>
</div>
<SettingPanel templateId={id} type={LAYOUT_TYPE.own} />
<SettingPanel templateId={id} type="own" shopId={shopId} />
</BrickProvider>
) : <Loading />
}
......
......@@ -10,7 +10,8 @@ type SettingPanelType = {
selectedInfo: SelectedInfoType,
pageConfig: PageConfigType,
templateId: number,
type: 'channel' | 'shop'
type: 'channel' | 'shop' | 'own',
shopId: number
}
const SettingPanel = (props) => {
const { selectedInfo, pageConfig } = useSelector<SettingPanelType, STATE_PROPS>(['selectedInfo', 'pageConfig'])
......@@ -18,7 +19,7 @@ const SettingPanel = (props) => {
const { props: selectProps, selectedKey } = selectedInfo || {}
const style = get(pageConfig, [selectedKey, 'props', 'style'])
return <PropsSettings type={props.type} selectedInfo={selectedInfo} templateId={props.templateId} />
return <PropsSettings type={props.type} selectedInfo={selectedInfo} templateId={props.templateId} shopId={props.shopId} />
}
export default SettingPanel;
......@@ -6,6 +6,7 @@ import SettingPanel from '../../../../components/SettingPanel'
import { message, Modal } from 'antd'
import { isEmpty } from '@formily/antd/esm/shared'
import { PublicApi } from '@/services/api'
import { isEqual } from 'lodash'
import { clearSelectedStatus, changeProps, produce } from '@lingxi-disign/core';
import { ArrowUpOutlined, DeleteOutlined, PlusOutlined, ArrowDownOutlined, CaretDownOutlined, CaretUpOutlined } from '@ant-design/icons'
import { addTempalteIdToList } from '../../../../utils'
......@@ -59,11 +60,12 @@ interface AdvertSettingPropsType {
type: 'top' | 'banner' | 'interact' | 'category' | 'service' | number;
templateid: number;
categoryid?: number;
templateType: 'channel' | 'shop' | 'own'
templateType: 'channel' | 'shop' | 'own',
shopId: number
}
const AdvertSetting: React.FC<AdvertSettingPropsType> = forwardRef((props, ref) => {
const { advertList = [], templateid, type, categoryid, templateType } = props
const { advertList = [], templateid, type, categoryid, templateType, shopId } = props
const [list, setList] = useState<AdvertItemType[]>(advertList)
const [confirmLoading, setConfirmLoading] = useState<boolean>(false)
const [newProps, setNewProps] = useState(props)
......@@ -183,7 +185,7 @@ const AdvertSetting: React.FC<AdvertSettingPropsType> = forwardRef((props, ref)
}
const handleCancel = useCallback(() => {
if (JSON.stringify(props) !== JSON.stringify(newProps)) {
if (!isEqual(props, newProps )) {
Modal.confirm({
content: "您还没有保存修改的内容,是否确认关闭?",
okText: "确认",
......@@ -199,11 +201,10 @@ const AdvertSetting: React.FC<AdvertSettingPropsType> = forwardRef((props, ref)
const handleConfirmSave = useCallback((e: any) => {
e.preventDefault();
if (JSON.stringify(props) === JSON.stringify(newProps)) {
if (isEqual(props, newProps )) {
clearSelectedStatus()
return
}
setConfirmLoading(true)
const newParam: any = produce(newProps, (oldNewProps) => {
oldNewProps.advertList.map((item) => {
......@@ -214,6 +215,8 @@ const AdvertSetting: React.FC<AdvertSettingPropsType> = forwardRef((props, ref)
})
return oldNewProps
})
setConfirmLoading(true)
saveAdvert(newParam).then(() => {
changeProps({
props: {...newParam}
......@@ -270,6 +273,7 @@ const AdvertSetting: React.FC<AdvertSettingPropsType> = forwardRef((props, ref)
if (templateType === 'channel') {
postFn = PublicApi.postTemplateAdornWebChannelSaveAdvert
} else if(templateType === 'own') {
param.shopId = shopId
postFn = PublicApi.postTemplateAdornWebSelfSaveAdvert
} else {
postFn = PublicApi.postTemplateAdornWebStoreSaveAdvert
......@@ -279,7 +283,6 @@ const AdvertSetting: React.FC<AdvertSettingPropsType> = forwardRef((props, ref)
if (res.code === 1000) {
resolve(true)
} else {
message.error(res.message)
reject()
}
})
......
......@@ -17,11 +17,12 @@ interface CategoryRecommendSettingPropsType {
onChange: Function;
templateid: number;
categoryid?: number;
templateType: 'channel' | 'shop'
templateType: 'channel' | 'shop' | 'own',
shopId: number,
}
const CategoryRecommendSetting: React.FC<CategoryRecommendSettingPropsType> = (props) => {
const { categoryList = [], categoryAdvertPicUrl = '', onChange, templateid, categoryid, templateType } = props
const { categoryList = [], categoryAdvertPicUrl = '', shopId, onChange, templateid, categoryid, templateType } = props
const [imgUrl, setImgUrl] = useState<string>(categoryAdvertPicUrl)
const [selectKeys, setSelectKeys] = useState<number[]>([])
const [categoryResponseList, setCategoryResponseList] = useState<any>([])
......@@ -50,11 +51,14 @@ const CategoryRecommendSetting: React.FC<CategoryRecommendSettingPropsType> = (p
const fetchCategoryList = () => {
const param = {
categoryId: categoryid,
templateId: templateid
templateId: templateid,
shopId
}
let getFn;
if (templateType === 'channel') {
getFn = PublicApi.getTemplateAdornWebChannelFindCategoryList
} else if (templateType === 'own') {
getFn = PublicApi.getTemplateAdornWebSelfFindCategoryList
} else {
getFn = PublicApi.getTemplateAdornWebStoreFindCategoryList
}
......@@ -118,6 +122,8 @@ const CategoryRecommendSetting: React.FC<CategoryRecommendSettingPropsType> = (p
let postFn;
if (templateType === 'channel') {
postFn = PublicApi.postTemplateAdornWebChannelSaveCategory
} else if (templateType === 'own') {
postFn = PublicApi.postTemplateAdornWebSelfSaveCategory
} else {
postFn = PublicApi.postTemplateAdornWebStoreSaveCategory
}
......
......@@ -20,7 +20,8 @@ interface GoodsSettingPropsType {
templateid: number;
categoryid?: number;
goodsList: GoodsItemType[];
templateType: 'channel' | 'shop'
templateType: 'channel' | 'shop' | 'own',
shopId: number,
}
enum OPERATION_TYPE {
......@@ -33,7 +34,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
const [confirmLoading, setConfirmLoading] = useState<boolean>(false)
const [operationType, setOprationType] = useState<string>(OPERATION_TYPE.list) // 操作类型:list:显示已选列表;select:选择列表
const [isHighSearch, setIsHighSearch] = useState(false)
const { templateid, categoryid, goodsList = [], templateType } = props
const { templateid, categoryid, goodsList = [], templateType, shopId } = props
const [current, setCurrent] = useState<number>(1)
const [pageSize, setPageSize] = useState<number>(10)
const [noSelectGoods, setNoSelectGoods] = useState<any[]>([])
......@@ -57,11 +58,14 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
categoryId: categoryid,
templateId: templateid,
current: 1,
pageSize: 100
pageSize: 100,
shopId,
}
let getFn;
if (templateType === 'channel') {
getFn = PublicApi.getTemplateAdornWebChannelFindCategoryList
} else if (templateType === 'own') {
getFn = PublicApi.getTemplateAdornWebSelfFindCategoryList
} else {
getFn = PublicApi.getTemplateAdornWebStoreFindCategoryList
}
......@@ -79,11 +83,14 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
type: 2,
templateId: templateid,
categoryId: categoryid,
shopId
}
let getFn;
if (templateType === 'channel') {
getFn = PublicApi.getTemplateAdornWebChannelFindBrandList
} else if (templateType === 'own') {
getFn = PublicApi.getTemplateAdornWebSelfFindBrandList
} else {
getFn = PublicApi.getTemplateAdornWebStoreFindBrandList
}
......@@ -106,7 +113,8 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
templateId: templateid,
categoryId: categoryid,
current,
pageSize
pageSize,
shopId,
}
if (filterParam) {
param = Object.assign(param, filterParam)
......@@ -114,6 +122,8 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
let getFn;
if (templateType === 'channel') {
getFn = PublicApi.getTemplateAdornWebChannelFindGoodsList
} else if (templateType === 'own') {
getFn = PublicApi.getTemplateAdornWebSelfFindGoodsList
} else {
getFn = PublicApi.getTemplateAdornWebStoreFindGoodsList
}
......@@ -247,6 +257,8 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
let postFn;
if (templateType === 'channel') {
postFn = PublicApi.postTemplateAdornWebChannelSaveGoods
} else if(templateType === 'own') {
postFn = PublicApi.postTemplateAdornWebSelfSaveGoods
} else {
postFn = PublicApi.postTemplateAdornWebStoreSaveGoods
}
......@@ -335,7 +347,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
{
isHighSearch ?
<Col span={24}>
<Row gutter={[16, 8]} justify="end">
<Row gutter={[16, 8]} justify="end" style={{ marginTop: 16 }}>
<Col span={24} style={{ display: 'flex', justifyContent: 'flex-end' }}>
<Col span={6}>
<Form.Item
......
......@@ -12,15 +12,16 @@ import './index.less'
interface PropsSettingsPropsType {
selectedInfo?: SelectedInfoType,
templateId: number,
type: 'channel' | 'shop' | 'own'
type: 'channel' | 'shop' | 'own',
shopId: number,
}
const PropsSettings: React.FC<PropsSettingsPropsType> = (props) => {
const [drawerVisible, setDrawerVisible] = useState<boolean>(false)
const [drawerTitle, setDrawerTitle] = useState<string>('')
const [drawerWidth, setDrawerWidth] = useState<number>(800)
const { selectedInfo, templateId, type } = props
const { selectedInfo, templateId, type, shopId } = props
console.log(shopId, 'shopId')
const onClose = () => {
setDrawerVisible(false)
clearSelectedStatus()
......@@ -32,12 +33,12 @@ const PropsSettings: React.FC<PropsSettingsPropsType> = (props) => {
if (componentType) {
switch (componentType.type) {
case PROPS_SETTING_TYPES.goods:
return <GoodsSetting templateid={templateId} {...initProps} templateType={type} />
return <GoodsSetting templateid={templateId} {...initProps} shopId={shopId} templateType={type} />
case PROPS_SETTING_TYPES.category:
return <CategoryRecommendSetting templateid={templateId} {...initProps} templateType={type} />
return <CategoryRecommendSetting templateid={templateId} {...initProps} shopId={shopId} templateType={type} />
case PROPS_SETTING_TYPES.categoryBanner:
case PROPS_SETTING_TYPES.advert:
return <AdvertSetting templateid={templateId} {...initProps} templateType={type} />
return <AdvertSetting templateid={templateId} {...initProps} shopId={shopId} templateType={type} />
case PROPS_SETTING_TYPES.mallNav:
return <MallNav templateid={templateId} {...initProps} />;
}
......
......@@ -255,7 +255,7 @@ const ShopEdit: React.FC<ShopEditPropsType> = (props) => {
</div>
</div>
</div>
<SettingPanel templateId={id} type="shop" />
<SettingPanel templateId={id} type="shop" shopId={shopId} />
</BrickProvider>
) : <Loading />
}
......
......@@ -83,11 +83,13 @@ export const channelLayoutConfig : PageConfigType = {
'5': {
title: '分类导航',
canDelete: false,
hideAction: true,
componentName: 'MobileNavCard',
props: {
style: {
margin: '8px',
},
status: true,
stylesthemelist: [
{
key: 0,
......
......@@ -28,11 +28,13 @@ export const shopLayoutConfig : PageConfigType = {
'2': {
title: '分类导航',
canDelete: false,
hideAction: true,
componentName: 'MobileNavCard',
props: {
style: {
margin: '8px',
},
status: true,
stylesthemelist: [
{
key: 0,
......
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