mirror of
https://github.com/MrXujiang/h5-Dooring.git
synced 2026-02-06 18:15:36 +00:00
Merge pull request #59 from MrXujiang/yehuozhiliwork
feat; customer draggable
This commit is contained in:
commit
9e88c86710
@ -3,7 +3,7 @@ import { library, generateRespones, RenderList, useRegister } from 'chatbot-antd
|
|||||||
import { IRouteComponentProps } from 'umi';
|
import { IRouteComponentProps } from 'umi';
|
||||||
import { Button } from 'antd';
|
import { Button } from 'antd';
|
||||||
import { CustomerServiceOutlined } from '@ant-design/icons';
|
import { CustomerServiceOutlined } from '@ant-design/icons';
|
||||||
import { stat } from 'fs/promises';
|
import Draggable, { DraggableData, DraggableEvent } from 'react-draggable';
|
||||||
|
|
||||||
library.push(
|
library.push(
|
||||||
//语料库,push进去,也可以不用
|
//语料库,push进去,也可以不用
|
||||||
@ -65,13 +65,17 @@ export default function Layout({ children }: IRouteComponentProps) {
|
|||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
1.{' '}
|
1.{' '}
|
||||||
<a href="https://github.com/MrXujiang/h5-Dooring" target="_blank">
|
<a href="https://github.com/MrXujiang/h5-Dooring" target="_blank" rel="noreferrer">
|
||||||
H5-Dooring源码地址
|
H5-Dooring源码地址
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
2.{' '}
|
2.{' '}
|
||||||
<a href="https://github.com/MrXujiang/h5-Dooring/graphs/contributors" target="_blank">
|
<a
|
||||||
|
href="https://github.com/MrXujiang/h5-Dooring/graphs/contributors"
|
||||||
|
target="_blank"
|
||||||
|
rel="noreferrer"
|
||||||
|
>
|
||||||
贡献者列表
|
贡献者列表
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@ -84,6 +88,7 @@ export default function Layout({ children }: IRouteComponentProps) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const [state, setState] = useState<dooringContextType>('h5');
|
const [state, setState] = useState<dooringContextType>('h5');
|
||||||
|
const [pos, setPos] = useState({ x: 0, y: 0 });
|
||||||
return (
|
return (
|
||||||
<dooringContext.Provider
|
<dooringContext.Provider
|
||||||
value={{
|
value={{
|
||||||
@ -92,6 +97,12 @@ export default function Layout({ children }: IRouteComponentProps) {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div style={{ height: '100%', width: '100%', overflow: 'hidden' }}>
|
<div style={{ height: '100%', width: '100%', overflow: 'hidden' }}>
|
||||||
|
<Draggable
|
||||||
|
position={pos}
|
||||||
|
onStop={(e: DraggableEvent, data: DraggableData) => {
|
||||||
|
setPos({ x: data.x, y: data.y });
|
||||||
|
}}
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
position: 'fixed',
|
position: 'fixed',
|
||||||
@ -105,6 +116,7 @@ export default function Layout({ children }: IRouteComponentProps) {
|
|||||||
<CustomerServiceOutlined></CustomerServiceOutlined>
|
<CustomerServiceOutlined></CustomerServiceOutlined>
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
</Draggable>
|
||||||
{render}
|
{render}
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user