Commit bb37f6f8 authored by GuanHua's avatar GuanHua

fix:能力中心装修页面问题修改

parent d33b180d
......@@ -3,7 +3,7 @@ import { Button, Input } from 'antd'
import UploadImage from '@/components/UploadImage'
import { filterPropsFunction, getAdvertType } from '../../../../utils'
import SettingPanel from '../../../../components/SettingPanel'
import { message } from 'antd'
import { message, Modal } from 'antd'
import { isEmpty } from '@formily/antd/esm/shared'
import { PublicApi } from '@/services/api'
import { clearSelectedStatus, changeProps } from 'lingxi-editor-core';
......@@ -171,13 +171,26 @@ const AdvertSetting: React.FC<AdvertSettingPropsType> = forwardRef((props, ref)
changeNewProps('advertList', newList)
}
const handleCancel = useCallback(() => {
if (JSON.stringify(props) !== JSON.stringify(newProps)) {
Modal.confirm({
content: "您还没有保存修改的内容,是否确认关闭?",
okText: "确认",
cancelText: "取消",
onOk: () => {
clearSelectedStatus()
}
})
} else {
clearSelectedStatus()
}
}, [newProps])
const handleConfirmSave = useCallback((e: any) => {
e.preventDefault();
if (JSON.stringify(props) === JSON.stringify(newProps)) {
return
}
setConfirmLoading(true)
saveAdvert(newProps).then(() => {
changeProps({
......@@ -253,6 +266,7 @@ const AdvertSetting: React.FC<AdvertSettingPropsType> = forwardRef((props, ref)
return (
<SettingPanel
confirmLoading={confirmLoading}
onCancel={handleCancel}
onOK={handleConfirmSave}
>
<div className={styles.advert_setting}>
......
import React, { useState, useEffect } from 'react'
import { clearSelectedStatus, changeProps } from 'lingxi-editor-core'
import { Row, Col, Button, Input, Pagination, Form, message } from 'antd'
import { Row, Col, Button, Input, Pagination, Form, message, Modal } from 'antd'
import SettingList from '../../../../components/SettingList'
import BrandItem from './BrandItem'
import SettingPanel from '../../../../components/SettingPanel'
......@@ -161,9 +161,25 @@ const BrandSetting: React.FC<ShopSettingPropsType> = (props) => {
setSelectList(selectBrandList)
}
const handleCancel = () => {
if (JSON.stringify(brandList) !== JSON.stringify(selectBrandList)) {
Modal.confirm({
content: "您还没有保存修改的内容,是否确认关闭?",
okText: "确认",
cancelText: "取消",
onOk: () => {
clearSelectedStatus()
}
})
} else {
clearSelectedStatus()
}
}
return (
<SettingPanel
confirmLoading={confirmLoading}
onCancel={handleCancel}
onOK={() => handleConfirm()}
>
<div className={styles.goods_setting}>
......
import React, { useState, useEffect, useCallback } from 'react'
import { Checkbox, Row, Col, message } from 'antd'
import { Checkbox, Row, Col, message, Modal } from 'antd'
import UploadImage from '@/components/UploadImage'
import SettingPanel from '../../../../components/SettingPanel'
import { clearSelectedStatus, changeProps } from 'lingxi-editor-core'
......@@ -127,9 +127,25 @@ const CategoryRecommendSetting: React.FC<CategoryRecommendSettingPropsType> = (p
})
}
const handleCancel = useCallback(() => {
if (JSON.stringify(props) !== JSON.stringify(newProps)) {
Modal.confirm({
content: "您还没有保存修改的内容,是否确认关闭?",
okText: "确认",
cancelText: "取消",
onOk: () => {
clearSelectedStatus()
}
})
} else {
clearSelectedStatus()
}
}, [newProps])
return (
<SettingPanel
confirmLoading={confirmLoading}
onCancel={handleCancel}
onOK={handleConfirmSave}
>
<div className={styles.category_recommend}>
......
......@@ -18,7 +18,7 @@ const GoodsItem: React.FC<GoodsItemPropsType> = (props) => {
<div className={styles.goods_item_info_name}>{dataInfo.goodsName}</div>
<div className={styles.goods_item_info_price}>
<i></i>
<span>{dataInfo.priceRange}</span>
<span>{dataInfo.priceRange || dataInfo.goodsPrice}</span>
</div>
<div className={styles.goods_item_info_brief}>
<span>品类:</span>
......
import React, { useState, useEffect, useCallback } from 'react'
import { clearSelectedStatus, changeProps } from 'lingxi-editor-core'
import { Row, Col, Button, Input, Pagination, Select, Form, message } from 'antd'
import { Row, Col, Button, Input, Pagination, Select, Form, message, Modal } from 'antd'
import SettingList from '../../../../components/SettingList'
import GoodsItem from './GoodsItem'
import SettingPanel from '../../../../components/SettingPanel'
......@@ -129,6 +129,21 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
}
}
const handleCancel = () => {
if (JSON.stringify(goodsList) !== JSON.stringify(selectGoodsList)) {
Modal.confirm({
content: "您还没有保存修改的内容,是否确认关闭?",
okText: "确认",
cancelText: "取消",
onOk: () => {
clearSelectedStatus()
}
})
} else {
clearSelectedStatus()
}
}
const handleConfirmSave = () => {
console.log('handleConfirmSave1')
if (JSON.stringify(goodsList) === JSON.stringify(selectGoodsList)) {
......@@ -141,11 +156,22 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
}
setConfirmLoading(true)
saveGoods().then(() => {
let newList = JSON.parse(JSON.stringify(selectGoodsList))
newList = newList.map(item => {
let minPrice = 0
if (item.priceRange && typeof item.priceRange === 'string') {
minPrice = item.priceRange.split("~")[0]
item.goodsPrice = minPrice
}
return item
})
changeProps({
props: {
templateid,
categoryid,
goodsList: selectGoodsList
goodsList: newList
}
})
clearSelectedStatus()
......@@ -198,6 +224,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
return (
<SettingPanel
confirmLoading={confirmLoading}
onCancel={handleCancel}
onOK={() => handleConfirm()}
>
<div className={styles.goods_setting}>
......
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