| | |
| | | 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>HJdsa</h1> |
| | | <Spin |
| | | spinning={loading} |
| | | indicator={<LoadingOutlined spin />} |
| | | size={'large'} |
| | | > |
| | | <div ref={refContainer} className={styles.threeContainer}></div> |
| | | </Spin> |
| | | </> |
| | | ) |
| | | } |