Commit 90736543 authored by XieZhiXiong's avatar XieZhiXiong
parents be8f5f8e 0ca7ff75
......@@ -4,6 +4,7 @@
.size_require {
color: #97A0AF;
margin-left: 24px;
}
.upload_btn {
......@@ -11,7 +12,6 @@
width: 104px;
height: 104px;
display: flex;
margin-right: 24px;
align-items: center;
justify-content: center;
color: #6B778C;
......@@ -42,4 +42,37 @@
margin-top: 12px;
}
}
// 删除效果
.delete_wrap {
display: none;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.4);
position: absolute;
left: 0;
top: 0;
border-radius: 2px;
.delete_btn {
color: #fff;
position: absolute;
top:50%;
left:50%;
transform: translate(-50%, -50%);
}
}
.upload_wrap{
position: relative;
width: 104px;
height: 104px;
&:hover {
.delete_wrap {
display: block;
}
}
}
}
\ No newline at end of file
import React, { useState, Fragment, forwardRef } from 'react'
import { Upload, message } from 'antd'
import { LoadingOutlined, PlusOutlined } from '@ant-design/icons'
import { Upload, message, Button } from 'antd'
import { LoadingOutlined, PlusOutlined, DeleteOutlined } from '@ant-design/icons'
import { UploadFile, UploadChangeParam } from 'antd/lib/upload/interface'
import cx from 'classnames'
import styles from './index.less'
......@@ -58,6 +58,10 @@ const UploadImage: React.FC<UploadImagePorpsType> = forwardRef((props, ref) => {
beforeUpload
};
const clearImage = () => {
onChange('')
}
const uploadButton = (
<Fragment>
{loading ? <LoadingOutlined /> : <PlusOutlined />}
......@@ -67,13 +71,18 @@ const UploadImage: React.FC<UploadImagePorpsType> = forwardRef((props, ref) => {
return (
<div className={styles.upload_image_wrap}>
<Upload {...uploadProps}>
{<div className={cx(styles.upload_btn, !imgUrl ? styles.isAdd : "", large ? styles.large : '')}>
{
imgUrl ? <img src={imgUrl} /> : uploadButton
}
</div>}
</Upload>
<div className={styles.upload_wrap}>
<Upload {...uploadProps}>
{<div className={cx(styles.upload_btn, !imgUrl ? styles.isAdd : "", large ? styles.large : '')}>
{
imgUrl ? <img src={imgUrl} /> : uploadButton
}
</div>}
</Upload>
{
imgUrl && <div className={styles.delete_wrap}><Button onClick={clearImage} className={styles.delete_btn} type="text" icon={<DeleteOutlined />} /></div>
}
</div>
{
showDesc &&
<div className={styles.size_require}>
......
......@@ -96,6 +96,7 @@ const ClassProperty: React.FC<{}> = () => {
setNodeRecord(undefined)
// 保存后要将是否填写过表单设为false
setIsEditForm(false)
flag = false
})
}
......@@ -175,12 +176,11 @@ const ClassProperty: React.FC<{}> = () => {
setIsEditForm(true)
})
$('onFieldValueChange', 'name, type, imageUrl, category').subscribe(state => {
console.log(flag,'flag')
if(flag){
setIsEditForm(true)
flag = false
}
else
flag = true
})
}}
schema={classSchema}
......
......@@ -72,8 +72,16 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
useEffect(() => {
// 获取品类树
PublicApi.getProductCustomerGetCustomerCategoryTree().then(res => {
if (res.code === 1000)
setCustomerCategoryTree(res.data)
if (res.code === 1000){
// 过滤children空数组
let { data } = res
data.map(item => {
if(!item.children.length)
delete item.children
})
console.log(data)
setCustomerCategoryTree(data)
}
})
//获取省市区
PublicApi.getManageAreaAll().then(res => {
......
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