mirror of
https://github.com/MrXujiang/h5-Dooring.git
synced 2026-02-05 17:19:19 +00:00
Merge pull request #40 from MrXujiang/yehuozhiliwork
style: optimize left pannel
This commit is contained in:
commit
4b1c6b100d
@ -2,7 +2,6 @@ import React, { memo } from 'react';
|
|||||||
import { IFooterConfig } from './schema';
|
import { IFooterConfig } from './schema';
|
||||||
const Footer = memo((props: IFooterConfig) => {
|
const Footer = memo((props: IFooterConfig) => {
|
||||||
const { bgColor, text, color, align, fontSize, height } = props;
|
const { bgColor, text, color, align, fontSize, height } = props;
|
||||||
console.log(props);
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{props.isTpl && (
|
{props.isTpl && (
|
||||||
|
|||||||
@ -9,7 +9,6 @@ interface IProps extends IWhiteTplConfig {
|
|||||||
|
|
||||||
const WhiteTpl = memo((props: IProps) => {
|
const WhiteTpl = memo((props: IProps) => {
|
||||||
const { bgColor, text, fontSize, color, height, isTpl } = props;
|
const { bgColor, text, fontSize, color, height, isTpl } = props;
|
||||||
console.log('data', bgColor, text, fontSize, color, height);
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={styles.whiteTpl}
|
className={styles.whiteTpl}
|
||||||
|
|||||||
@ -41,4 +41,27 @@ body {
|
|||||||
|
|
||||||
.react-grid-item{
|
.react-grid-item{
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-tabs-nav
|
||||||
|
,.ant-tabs-nav-list{
|
||||||
|
width: 40px!important;
|
||||||
|
min-width: 40px!important;
|
||||||
|
}
|
||||||
|
.ant-tabs-left{
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-tabs-left > .ant-tabs-nav .ant-tabs-tab{
|
||||||
|
padding:20px 0px !important;
|
||||||
|
|
||||||
|
}
|
||||||
|
.ant-tabs-tab{
|
||||||
|
margin:auto!important;
|
||||||
|
}
|
||||||
|
.ant-tabs-tab div{
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
.ant-tabs-content-holder{
|
||||||
|
overflow: auto;
|
||||||
}
|
}
|
||||||
@ -84,7 +84,6 @@ export default function Layout({ children }: IRouteComponentProps) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const [state, setState] = useState<dooringContextType>('h5');
|
const [state, setState] = useState<dooringContextType>('h5');
|
||||||
debugger;
|
|
||||||
return (
|
return (
|
||||||
<dooringContext.Provider
|
<dooringContext.Provider
|
||||||
value={{
|
value={{
|
||||||
|
|||||||
@ -6,6 +6,8 @@ import {
|
|||||||
PlayCircleOutlined,
|
PlayCircleOutlined,
|
||||||
HighlightOutlined,
|
HighlightOutlined,
|
||||||
ReloadOutlined,
|
ReloadOutlined,
|
||||||
|
DoubleRightOutlined,
|
||||||
|
DoubleLeftOutlined,
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import TextLoop from 'react-text-loop';
|
import TextLoop from 'react-text-loop';
|
||||||
import { connect } from 'dva';
|
import { connect } from 'dva';
|
||||||
@ -49,6 +51,12 @@ const Container = (props: {
|
|||||||
const pointData = pstate ? pstate.pointData : [];
|
const pointData = pstate ? pstate.pointData : [];
|
||||||
const cpointData = cstate ? cstate.pointData : [];
|
const cpointData = cstate ? cstate.pointData : [];
|
||||||
|
|
||||||
|
const changeCollapse = useMemo(() => {
|
||||||
|
return (c: boolean) => {
|
||||||
|
setCollapsed(c);
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
const context = useContext(dooringContext);
|
const context = useContext(dooringContext);
|
||||||
const curPoint = useMemo(() => {
|
const curPoint = useMemo(() => {
|
||||||
if (context.theme === 'h5') {
|
if (context.theme === 'h5') {
|
||||||
@ -62,7 +70,6 @@ const Container = (props: {
|
|||||||
if (context.theme === 'h5') {
|
if (context.theme === 'h5') {
|
||||||
return schema1;
|
return schema1;
|
||||||
} else {
|
} else {
|
||||||
console.log(schema2);
|
|
||||||
return schema2;
|
return schema2;
|
||||||
}
|
}
|
||||||
}, [context.theme]);
|
}, [context.theme]);
|
||||||
@ -98,24 +105,21 @@ const Container = (props: {
|
|||||||
setScale(1);
|
setScale(1);
|
||||||
};
|
};
|
||||||
|
|
||||||
const toggleCollapsed = (checked: boolean) => {
|
|
||||||
console.log(checked);
|
|
||||||
setCollapsed(checked);
|
|
||||||
};
|
|
||||||
|
|
||||||
const CpIcon = {
|
const CpIcon = {
|
||||||
base: <HighlightOutlined />,
|
base: <HighlightOutlined />,
|
||||||
media: <PlayCircleOutlined />,
|
media: <PlayCircleOutlined />,
|
||||||
visible: <PieChartOutlined />,
|
visible: <PieChartOutlined />,
|
||||||
};
|
};
|
||||||
|
|
||||||
const generateHeader = (type: componentsType, text: string) => {
|
const generateHeader = useMemo(() => {
|
||||||
return (
|
return (type: componentsType, text: string) => {
|
||||||
<div>
|
return (
|
||||||
{CpIcon[type]} {text}
|
<div>
|
||||||
</div>
|
{CpIcon[type]} {text}
|
||||||
);
|
</div>
|
||||||
};
|
);
|
||||||
|
};
|
||||||
|
}, [CpIcon]);
|
||||||
|
|
||||||
const handleSliderChange = (v: number) => {
|
const handleSliderChange = (v: number) => {
|
||||||
setScale(prev => (v >= 150 ? 1.5 : v / 100));
|
setScale(prev => (v >= 150 ? 1.5 : v / 100));
|
||||||
@ -198,7 +202,7 @@ const Container = (props: {
|
|||||||
arr.push(v.type);
|
arr.push(v.type);
|
||||||
});
|
});
|
||||||
return arr;
|
return arr;
|
||||||
}, []);
|
}, [graphTpl, mediaTpl, template]);
|
||||||
|
|
||||||
const [dragstate, setDragState] = useState({ x: 0, y: 0 });
|
const [dragstate, setDragState] = useState({ x: 0, y: 0 });
|
||||||
const [render] = useGetBall(setDragState, {
|
const [render] = useGetBall(setDragState, {
|
||||||
@ -207,8 +211,6 @@ const Container = (props: {
|
|||||||
intervalDelay: 5,
|
intervalDelay: 5,
|
||||||
});
|
});
|
||||||
|
|
||||||
const [display] = useAnimation(collapsed, 500);
|
|
||||||
|
|
||||||
const renderRight = useMemo(() => {
|
const renderRight = useMemo(() => {
|
||||||
if (context.theme === 'h5') {
|
if (context.theme === 'h5') {
|
||||||
return (
|
return (
|
||||||
@ -263,6 +265,64 @@ const Container = (props: {
|
|||||||
}
|
}
|
||||||
}, [context.theme, cpointData.length, curPoint, handleDel, handleFormSave, pointData.length]);
|
}, [context.theme, cpointData.length, curPoint, handleDel, handleFormSave, pointData.length]);
|
||||||
|
|
||||||
|
const tabRender = useMemo(() => {
|
||||||
|
if (collapsed) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<TabPane tab={generateHeader('base', '')} key="1"></TabPane>
|
||||||
|
<TabPane tab={generateHeader('media', '')} key="2"></TabPane>
|
||||||
|
<TabPane tab={generateHeader('visible', '')} key="3"></TabPane>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<TabPane tab={generateHeader('base', '')} key="1">
|
||||||
|
<div className={styles.ctitle}>基础组件</div>
|
||||||
|
{template.map((value, i) => {
|
||||||
|
return (
|
||||||
|
<TargetBox item={value} key={i} canvasId={canvasId}>
|
||||||
|
<DynamicEngine
|
||||||
|
{...value}
|
||||||
|
config={schema[value.type as keyof typeof schema].config}
|
||||||
|
componentsType="base"
|
||||||
|
isTpl={true}
|
||||||
|
/>
|
||||||
|
</TargetBox>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</TabPane>
|
||||||
|
<TabPane tab={generateHeader('media', '')} key="2">
|
||||||
|
<div className={styles.ctitle}>媒体组件</div>
|
||||||
|
{mediaTpl.map((value, i) => (
|
||||||
|
<TargetBox item={value} key={i} canvasId={canvasId}>
|
||||||
|
<DynamicEngine
|
||||||
|
{...value}
|
||||||
|
config={schema[value.type as keyof typeof schema].config}
|
||||||
|
componentsType="media"
|
||||||
|
isTpl={true}
|
||||||
|
/>
|
||||||
|
</TargetBox>
|
||||||
|
))}
|
||||||
|
</TabPane>
|
||||||
|
<TabPane tab={generateHeader('visible', '')} key="3">
|
||||||
|
<div className={styles.ctitle}>可视化组件</div>
|
||||||
|
{graphTpl.map((value, i) => (
|
||||||
|
<TargetBox item={value} key={i} canvasId={canvasId}>
|
||||||
|
<DynamicEngine
|
||||||
|
{...value}
|
||||||
|
config={schema[value.type as keyof typeof schema].config}
|
||||||
|
componentsType={'visible' as componentsType}
|
||||||
|
isTpl={true}
|
||||||
|
/>
|
||||||
|
</TargetBox>
|
||||||
|
))}
|
||||||
|
</TabPane>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}, [canvasId, collapsed, generateHeader, graphTpl, mediaTpl, schema, template]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.editorWrap}>
|
<div className={styles.editorWrap}>
|
||||||
<HeaderComponent
|
<HeaderComponent
|
||||||
@ -271,72 +331,42 @@ const Container = (props: {
|
|||||||
pointData={context.theme === 'h5' ? pointData : cpointData}
|
pointData={context.theme === 'h5' ? pointData : cpointData}
|
||||||
clearData={clearData}
|
clearData={clearData}
|
||||||
location={props.location}
|
location={props.location}
|
||||||
toggleCollapsed={toggleCollapsed}
|
|
||||||
/>
|
/>
|
||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
<div
|
<div
|
||||||
className={styles.list}
|
className={styles.list}
|
||||||
style={{
|
style={{
|
||||||
transform: collapsed ? 'translate(0,0)' : 'translate(-100%,0)',
|
|
||||||
transition: 'all ease-in-out 0.5s',
|
transition: 'all ease-in-out 0.5s',
|
||||||
display: display ? 'none' : 'block',
|
position: 'fixed',
|
||||||
|
width: collapsed ? '50px' : '350px',
|
||||||
|
zIndex: 200,
|
||||||
|
boxShadow: 'none',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className={styles.searchBar}>
|
|
||||||
<Alert
|
|
||||||
banner
|
|
||||||
message={
|
|
||||||
<TextLoop mask>
|
|
||||||
<div>Dooring升级啦!</div>
|
|
||||||
<div>已有1000+人使用</div>
|
|
||||||
<div>持续迭代中...</div>
|
|
||||||
</TextLoop>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className={styles.componentList}>
|
<div className={styles.componentList}>
|
||||||
<Tabs defaultActiveKey="1">
|
<Tabs
|
||||||
<TabPane tab={generateHeader('base', '基础组件')} key="1">
|
onTabClick={() => changeCollapse(false)}
|
||||||
{template.map((value, i) => {
|
defaultActiveKey="1"
|
||||||
return (
|
tabPosition={'left'}
|
||||||
<TargetBox item={value} key={i} canvasId={canvasId}>
|
>
|
||||||
<DynamicEngine
|
{tabRender}
|
||||||
{...value}
|
|
||||||
config={schema[value.type as keyof typeof schema].config}
|
|
||||||
componentsType="base"
|
|
||||||
isTpl={true}
|
|
||||||
/>
|
|
||||||
</TargetBox>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</TabPane>
|
|
||||||
<TabPane tab={generateHeader('media', '媒体组件')} key="2">
|
|
||||||
{mediaTpl.map((value, i) => (
|
|
||||||
<TargetBox item={value} key={i} canvasId={canvasId}>
|
|
||||||
<DynamicEngine
|
|
||||||
{...value}
|
|
||||||
config={schema[value.type as keyof typeof schema].config}
|
|
||||||
componentsType="media"
|
|
||||||
isTpl={true}
|
|
||||||
/>
|
|
||||||
</TargetBox>
|
|
||||||
))}
|
|
||||||
</TabPane>
|
|
||||||
<TabPane tab={generateHeader('visible', '可视化组件')} key="3">
|
|
||||||
{graphTpl.map((value, i) => (
|
|
||||||
<TargetBox item={value} key={i} canvasId={canvasId}>
|
|
||||||
<DynamicEngine
|
|
||||||
{...value}
|
|
||||||
config={schema[value.type as keyof typeof schema].config}
|
|
||||||
componentsType={'visible' as componentsType}
|
|
||||||
isTpl={true}
|
|
||||||
/>
|
|
||||||
</TargetBox>
|
|
||||||
))}
|
|
||||||
</TabPane>
|
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
className={styles.collapsed}
|
||||||
|
style={{ position: 'absolute', bottom: '80px', left: '25px' }}
|
||||||
|
onClick={() => changeCollapse(!collapsed)}
|
||||||
|
>
|
||||||
|
{collapsed ? <DoubleRightOutlined /> : <DoubleLeftOutlined />}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
width: collapsed ? '50px' : '350px',
|
||||||
|
transition: 'all ease-in-out 0.5s',
|
||||||
|
}}
|
||||||
|
></div>
|
||||||
|
|
||||||
<div className={styles.tickMark} id="calibration">
|
<div className={styles.tickMark} id="calibration">
|
||||||
<div className={styles.tickMarkTop}>
|
<div className={styles.tickMarkTop}>
|
||||||
<Calibration direction="up" id="calibrationUp" multiple={scaleNum} />
|
<Calibration direction="up" id="calibrationUp" multiple={scaleNum} />
|
||||||
|
|||||||
@ -58,7 +58,6 @@ const SourceBox = memo((props: SourceBoxProps) => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log(item.x);
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'editorPcModal/addPointData',
|
type: 'editorPcModal/addPointData',
|
||||||
payload: {
|
payload: {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
.header {
|
.header {
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 10;
|
z-index: 201;
|
||||||
padding-left: 30px;
|
padding-left: 30px;
|
||||||
padding-right: 30px;
|
padding-right: 30px;
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -32,6 +32,6 @@
|
|||||||
}
|
}
|
||||||
.btnArea {
|
.btnArea {
|
||||||
width: 320px;
|
width: 320px;
|
||||||
text-align: right;
|
text-align: left;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,11 +29,10 @@ interface HeaderComponentProps {
|
|||||||
clearData: any;
|
clearData: any;
|
||||||
undohandler: any;
|
undohandler: any;
|
||||||
redohandler: any;
|
redohandler: any;
|
||||||
toggleCollapsed: any;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const HeaderComponent = memo((props: HeaderComponentProps) => {
|
const HeaderComponent = memo((props: HeaderComponentProps) => {
|
||||||
const { pointData, location, clearData, undohandler, redohandler, toggleCollapsed } = props;
|
const { pointData, location, clearData, undohandler, redohandler } = props;
|
||||||
const iptRef = useRef<Input>(null);
|
const iptRef = useRef<Input>(null);
|
||||||
|
|
||||||
const toPreview = () => {
|
const toPreview = () => {
|
||||||
@ -137,7 +136,6 @@ const HeaderComponent = memo((props: HeaderComponentProps) => {
|
|||||||
<ArrowLeftOutlined />
|
<ArrowLeftOutlined />
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.logo}>Dooring</div>
|
<div className={styles.logo}>Dooring</div>
|
||||||
<Switch defaultChecked onChange={toggleCollapsed} style={{ marginLeft: '100px' }} />
|
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.controlArea}>
|
<div className={styles.controlArea}>
|
||||||
<Button type="primary" style={{ marginRight: '9px' }} onClick={useTemplate}>
|
<Button type="primary" style={{ marginRight: '9px' }} onClick={useTemplate}>
|
||||||
|
|||||||
@ -25,11 +25,24 @@
|
|||||||
.list {
|
.list {
|
||||||
width: 350px;
|
width: 350px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
padding: 10px 16px 16px;
|
padding: 10px;
|
||||||
box-shadow: 2px 0px 10px rgba(0, 0, 0, 0.2);
|
box-shadow: 2px 0px 10px rgba(0, 0, 0, 0.2);
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
overflow: auto;
|
& > div:nth-child(1) {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.ctitle {
|
||||||
|
font-weight: bold;
|
||||||
|
line-height: 50px;
|
||||||
|
font-family: PingFangSC-Medium, PingFang SC;
|
||||||
|
}
|
||||||
|
.collapsed {
|
||||||
|
cursor: pointer;
|
||||||
|
&:hover {
|
||||||
|
color: #06c;
|
||||||
|
}
|
||||||
|
}
|
||||||
.searchBar {
|
.searchBar {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -85,6 +85,7 @@ export function useAnimation(state: boolean, delay: number) {
|
|||||||
export function unParams(params = '?a=1&b=2&c=3') {
|
export function unParams(params = '?a=1&b=2&c=3') {
|
||||||
let obj: any = {};
|
let obj: any = {};
|
||||||
params &&
|
params &&
|
||||||
|
// eslint-disable-next-line no-useless-escape
|
||||||
params.replace(/((\w*)=([\.a-z0-9A-Z]*)?)?/g, (m, a, b, c): any => {
|
params.replace(/((\w*)=([\.a-z0-9A-Z]*)?)?/g, (m, a, b, c): any => {
|
||||||
if (b || c) obj[b] = c;
|
if (b || c) obj[b] = c;
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user