#
Junjie
2024-03-28 0817793961918c1123328bca9a78ca29d95738b8
zy-asrs-flow/src/pages/map/drawer/shelf/view.jsx
@@ -1,25 +1,62 @@
import React, { useState, useRef, useEffect } from 'react';
import { Card, Form, Button } from 'antd';
import { Spin, Form, Button } from 'antd';
import { FormattedMessage, useIntl, useModel } from '@umijs/max';
import { LoadingOutlined } from '@ant-design/icons';
import { createStyles } from 'antd-style';
import * as Utils from '../../utils'
import Http from '@/utils/http';
import ShelfThree from './shelfThree'
const useStyles = createStyles(({ token, css }) => {
    return {
        threeContainer: {
            zIndex: 99,
            width: '500px',
            height: '600px',
        },
    }
})
let shelfThree;
const ShelfView = (props) => {
    const intl = useIntl();
    const { styles } = useStyles();
    const refContainer = useRef();
    const [loading, setLoading] = React.useState(false);
    const startThree = () => {
        shelfThree = new ShelfThree(refContainer.current);
        shelfThree.startup();
    }
    const endThree = () => {
        if (shelfThree) {
            shelfThree.destroy();
            shelfThree = null;
        }
    }
    useEffect(() => {
        setLoading(true);
        endThree();
        setTimeout(() => {
            setLoading(false);
            startThree();
        }, 300)
    }, []);
        return endThree;
    }, [props.data.uuid]);
    return (
        <>
            <h1>{props.data.uuid}</h1>
            <Spin
                spinning={loading}
                indicator={<LoadingOutlined spin />}
                size={'large'}
            >
                <div ref={refContainer} className={styles.threeContainer}></div>
            </Spin>
        </>
    )
}