mirror of
https://github.com/MrXujiang/h5-Dooring.git
synced 2026-01-07 12:28:13 +00:00
✏️ 修复列表组件图片裁切不能等比裁切问题
This commit is contained in:
parent
68eedbd245
commit
108d077d7b
@ -33,6 +33,7 @@ const List: IListSchema = {
|
|||||||
key: 'sourceData',
|
key: 'sourceData',
|
||||||
name: '数据源',
|
name: '数据源',
|
||||||
type: 'DataList',
|
type: 'DataList',
|
||||||
|
cropRate: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'round',
|
key: 'round',
|
||||||
|
|||||||
@ -23,10 +23,11 @@ export type EditorModalProps = {
|
|||||||
onCancel: ((e: React.MouseEvent<HTMLElement, MouseEvent>) => void) | undefined;
|
onCancel: ((e: React.MouseEvent<HTMLElement, MouseEvent>) => void) | undefined;
|
||||||
item?: TDataListDefaultTypeItem;
|
item?: TDataListDefaultTypeItem;
|
||||||
onSave: Function;
|
onSave: Function;
|
||||||
|
cropRate: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
const EditorModal: FC<EditorModalProps> = props => {
|
const EditorModal: FC<EditorModalProps> = props => {
|
||||||
const { item, onSave, visible, onCancel } = props;
|
const { item, onSave, visible, onCancel, cropRate } = props;
|
||||||
const onFinish = (values: Store) => {
|
const onFinish = (values: Store) => {
|
||||||
console.log(values);
|
console.log(values);
|
||||||
onSave && onSave(values);
|
onSave && onSave(values);
|
||||||
@ -112,7 +113,7 @@ const EditorModal: FC<EditorModalProps> = props => {
|
|||||||
valuePropName="fileList"
|
valuePropName="fileList"
|
||||||
getValueFromEvent={normFile}
|
getValueFromEvent={normFile}
|
||||||
>
|
>
|
||||||
<Upload />
|
<Upload cropRate={cropRate} isCrop />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Form>
|
</Form>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|||||||
@ -129,6 +129,7 @@ const DndItem = DropTarget(
|
|||||||
export type DataListMemo = {
|
export type DataListMemo = {
|
||||||
onChange?: (v: TDataListDefaultType) => void;
|
onChange?: (v: TDataListDefaultType) => void;
|
||||||
value?: TDataListDefaultType;
|
value?: TDataListDefaultType;
|
||||||
|
cropRate: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type DataListType = DataListMemo & {
|
export type DataListType = DataListMemo & {
|
||||||
@ -136,7 +137,7 @@ export type DataListType = DataListMemo & {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const List = function(props: DataListType) {
|
const List = function(props: DataListType) {
|
||||||
const { onChange, value, connectDropTarget } = props;
|
const { onChange, value, connectDropTarget, cropRate } = props;
|
||||||
const [list, setList] = useState(value);
|
const [list, setList] = useState(value);
|
||||||
const [visible, setVisible] = useState(false);
|
const [visible, setVisible] = useState(false);
|
||||||
const [curItem, setCurItem] = useState<TDataListDefaultTypeItem>();
|
const [curItem, setCurItem] = useState<TDataListDefaultTypeItem>();
|
||||||
@ -230,7 +231,13 @@ const List = function(props: DataListType) {
|
|||||||
添加
|
添加
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<EditorModal visible={visible} onCancel={handleCancel} item={curItem} onSave={handleSave} />
|
<EditorModal
|
||||||
|
visible={visible}
|
||||||
|
onCancel={handleCancel}
|
||||||
|
item={curItem}
|
||||||
|
onSave={handleSave}
|
||||||
|
cropRate={cropRate}
|
||||||
|
/>
|
||||||
</div>,
|
</div>,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -88,7 +88,7 @@ const FormEditor = (props: FormEditorProps) => {
|
|||||||
)}
|
)}
|
||||||
{item.type === 'DataList' && (
|
{item.type === 'DataList' && (
|
||||||
<Form.Item label={item.name} name={item.key}>
|
<Form.Item label={item.name} name={item.key}>
|
||||||
<DataList />
|
<DataList cropRate={item.cropRate} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
)}
|
)}
|
||||||
{item.type === 'Color' && (
|
{item.type === 'Color' && (
|
||||||
|
|||||||
@ -43,6 +43,7 @@ export interface IDataListConfigType {
|
|||||||
key: string;
|
key: string;
|
||||||
name: string;
|
name: string;
|
||||||
type: 'DataList';
|
type: 'DataList';
|
||||||
|
cropRate: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TDataListDefaultTypeItem = {
|
export type TDataListDefaultTypeItem = {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user