#
luxiaotao1123
2024-03-07 b300ffcfbbdce2a02fe410f4190032c98b07128f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
import React, { useState, useRef, useEffect } from 'react';
import {
    ProForm,
    ProFormDigit,
    ProFormText,
    ProFormSelect,
    ProFormDateTimePicker,
    ProFormTextArea,
    ProFormSlider,
} from '@ant-design/pro-components';
import moment from 'moment';
import { Col, Form, Modal, Row, Checkbox, Image, Tree, Drawer, Space, Button, Card, Divider } from 'antd';
import { FormattedMessage, useIntl, useModel } from '@umijs/max';
import * as PIXI from 'pixi.js';
import { createStyles } from 'antd-style';
import './index.css';
import Http from '@/utils/http';
 
const useStyles = createStyles(({ token, css }) => {
 
})
 
const SpriteSettings = (props) => {
    const intl = useIntl();
    const { styles } = useStyles();
    const { curSprite } = props;
    const [form] = Form.useForm();
 
    useEffect(() => {
 
    }, []);
 
    useEffect(() => {
        form.resetFields();
        form.setFieldsValue({
            ...props.values
        })
    }, [form, props])
 
    const handleCancel = () => {
        props.onCancel();
    };
 
    const handleOk = () => {
        form.submit();
    }
 
    const handleFinish = async (values) => {
        props.onSubmit({ ...values });
    }
 
    const formValuesChange = (changeValues) => {
        console.log(changeValues);
    }
 
    return (
        <>
            <Drawer
                open={props.open}
                onClose={handleCancel}
                getContainer={props.refCurr}
                rootStyle={{ position: "absolute" }}
                mask={false}
                width={570}
                extra={
                    <Space>
                        <Button onClick={handleCancel}>
                            <FormattedMessage id='common.cancel' defaultMessage='取消' />
                        </Button>
                        <Button onClick={handleOk} type="primary">
                            <FormattedMessage id='common.submit' defaultMessage='保存' />
                        </Button>
                    </Space>
                }
            >
                <Card>
 
                    <ProForm
                        form={form}
                        submitter={false}
                        onFinish={handleFinish}
                        layout="horizontal"
                        grid={true}
                        onValuesChange={formValuesChange}
                    >
                        {/* 
                            // position
                            // scale
                            // rotation
                            // copy
                        */}
                        <ProForm.Group>
                            <ProFormText
                                name="name"
                                label="名称"
                                colProps={{ md: 12, xl: 12 }}
                            />
                            <ProFormDigit
                                label="InputNumber"
                                name="input-number"
                                min={1}
                                max={10}
                                colProps={{ md: 12, xl: 12 }}
                            />
                        </ProForm.Group>
                        <ProForm.Group>
                            <ProFormSlider
                                name="slider"
                                label="Slider"
                                width="lg"
                                marks={{
                                    0: 'A',
                                    20: 'B',
                                    40: 'C',
                                    60: 'D',
                                    80: 'E',
                                    100: 'F',
                                }}
                            />
                        </ProForm.Group>
                        <ProForm.Group>
                            <ProFormTextArea
                                name="memo"
                                label="备注"
                                colProps={{ md: 24, xl: 24 }}
                            />
                        </ProForm.Group>
                    </ProForm>
                </Card>
            </Drawer>
        </>
    )
}
 
export default SpriteSettings;