Commit e5952b4f authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix:

parent 30769d21
......@@ -315,15 +315,15 @@ const AddProducts: React.FC<{}> = (props) => {
let numberKeys = Object.keys(_params).map(_ => Number(_)).filter(Boolean)
if (numberKeys.length > 0)
numberKeys.map(item => delete _params[item])
PublicApi.postProductCommoditySaveOrUpdateCommodity(_params).then(res => {
if (res.code === 1000) {
setIsEnableCheck(false)
setReponseId(res.data)
} else {
console.log(_params, 'params')
// PublicApi.postProductCommoditySaveOrUpdateCommodity(_params).then(res => {
// if (res.code === 1000) {
// setIsEnableCheck(false)
// setReponseId(res.data)
// } else {
setIsDisableSaveBtn(false)
}
})
// }
// })
}).then(e => {
if (e) {
setIsDisableSaveBtn(false)
......
......@@ -815,7 +815,9 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
</Form.Item>
}
{
ladderPrice ? <Form.Item
ladderPrice
?
<Form.Item
name="ladderRange"
label=""
shouldUpdate={true}
......@@ -905,7 +907,9 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
);
}}
</Form.List>
</Form.Item> : <Form.Item
</Form.Item>
:
<Form.Item
label={planPrice===3?"所需积分":"单价"}
name="uniquePrice"
rules={[
......@@ -920,7 +924,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
}
]}
>
<InputNumber min={0} style={{width: '100%'}} placeholder={planPrice===3?"请输入积分":"请输入价格"} />
<InputNumber min={0} style={{width: '100%', overflow: 'visible'}} placeholder={planPrice===3?"请输入积分":"请输入价格"} />
</Form.Item>
}
</Form>
......
......@@ -22,7 +22,6 @@ const schemaActions = createFormActions()
const ProductDescFormDefualt: React.FC<{}> = () => {
const [fileImageList, setFileImageList] = useState<any>([])
const [videoList, setVideoList] = useState<any>([])
const [hyperlinkList, setHyperlinkList] = useState<any>([])
const flagRef = useRef<boolean>(false)
const currentRef = useRef<any>({})
const [isLoading, setIsLoading] = useState<boolean>(false) // 上传的加载状态
......@@ -58,6 +57,7 @@ const ProductDescFormDefualt: React.FC<{}> = () => {
}, [selectCategoryId])
useEffect(() => {
console.log(fileImageList, 'fileImageList')
// 设置传输数据
setProductDescription({
video: videoList,
......@@ -66,6 +66,7 @@ const ProductDescFormDefualt: React.FC<{}> = () => {
})
}, [fileImageList, videoList])
/** 拖拽后 改变数据位置 */
const changePosition = useCallback((dragIndex: number, hoverIndex: number) => {
const dragImage = fileImageList[dragIndex]
setFileImageList(
......@@ -78,10 +79,6 @@ const ProductDescFormDefualt: React.FC<{}> = () => {
)
}, [fileImageList])
// useEffect(() => {
// console.log(hyperlinkList)
// }, [hyperlinkList])
const uploadImgProps = {
name: 'file',
action: '/api/file/file/upload',
......@@ -165,9 +162,9 @@ const ProductDescFormDefualt: React.FC<{}> = () => {
}
const handleAddHyperlink = (idx) => {
console.log('添加超链接')
currentRef.current.setVisible(true)
schemaActions.setFieldValue('idx', idx)
schemaActions.setFieldValue('hyperlink', fileImageList[idx]?.link)
}
const handleConfirm = () => {
......@@ -175,10 +172,12 @@ const ProductDescFormDefualt: React.FC<{}> = () => {
}
const handleSubmit = async (value) => {
setHyperlinkList(() => {
let url = [...hyperlinkList]
url[value.idx] = value.hyperlink
return url
console.log(value)
const { idx, hyperlink } = value
setFileImageList(() => {
let list = [...fileImageList]
list[idx]['link'] = hyperlink
return list
})
currentRef.current.setVisible(false)
}
......
......@@ -13,7 +13,7 @@ interface RenderProps {
id: number,
key: number,
index: number,
item: string,
item: ImageItemProps,
handleDelete: (idx: number) => void,
handleAddlink: (idx: number) => void,
changePosition: (dragIdx: number, hoverIdx: number) => void,
......@@ -74,7 +74,7 @@ const ImageItem: React.FC<RenderProps> = (props) => {
drag(drop(ref))
return <div key={index} className={cx(styles.descriptBox, styles.mediaContentBox)} ref={ref}>
<p className={styles.divImage}><img src={item} /></p>
<p className={styles.divImage}><img src={item['url']} /></p>
<div className={styles.rightBtn}>
<Tooltip title="删除图片">
<Button size="small" onClick={()=>handleDelete(index)} icon={<DeleteOutlined />} />
......@@ -89,8 +89,14 @@ const ImageItem: React.FC<RenderProps> = (props) => {
</div>
}
interface ImageItemProps {
url: string,
linkType: number,
link: string,
}
interface DragSortImageListProps {
imageList: string[],
imageList: ImageItemProps[],
handleDelete: (idx: number) => void,
handleAddlink: (idx: number) => void,
changePosition: (dragIdx: number, hoverIdx: number) => void,
......@@ -99,7 +105,7 @@ interface DragSortImageListProps {
const DragSortImageList: React.FC<DragSortImageListProps> = (props) => {
const { imageList, handleDelete, handleAddlink, changePosition } = props
const renderImageList = (item, index) => {
const renderImageList = (item: ImageItemProps, index: number) => {
return <ImageItem
id={index}
key={index}
......
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