mirror of
https://github.com/MrXujiang/h5-Dooring.git
synced 2025-12-14 20:02:49 +00:00
修复轮播图拖拽样式问题
This commit is contained in:
parent
15d8e8e6e6
commit
f1e5a915e9
2
.gitignore
vendored
2
.gitignore
vendored
@ -102,3 +102,5 @@ dist
|
|||||||
|
|
||||||
# TernJS port file
|
# TernJS port file
|
||||||
.tern-port
|
.tern-port
|
||||||
|
|
||||||
|
.umi/
|
||||||
|
|||||||
@ -6,7 +6,10 @@ const XCarousel = memo(props => {
|
|||||||
const {
|
const {
|
||||||
direction,
|
direction,
|
||||||
swipeable,
|
swipeable,
|
||||||
imgList
|
autoPlay,
|
||||||
|
isTpl,
|
||||||
|
imgList,
|
||||||
|
tplImg
|
||||||
} = props
|
} = props
|
||||||
|
|
||||||
const contentRender = () => {
|
const contentRender = () => {
|
||||||
@ -20,17 +23,23 @@ const XCarousel = memo(props => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return <div style={{width: '100%', overflow: 'hidden'}}>
|
return <div style={{width: '100%', overflow: 'hidden'}}>
|
||||||
<Carousel
|
{
|
||||||
onChange={(index) => {
|
isTpl ? <div className={styles.carousel__item__pic}>
|
||||||
// console.log(`onChange: ${index}`);
|
<img src={tplImg} alt="" />
|
||||||
}}
|
</div>
|
||||||
direction={direction}
|
:
|
||||||
swipeable={swipeable}
|
<Carousel
|
||||||
autoPlay
|
onChange={(index) => {
|
||||||
loop
|
// console.log(`onChange: ${index}`);
|
||||||
>
|
}}
|
||||||
{contentRender()}
|
direction={direction}
|
||||||
</Carousel>
|
swipeable={swipeable}
|
||||||
|
autoPlay={autoPlay}
|
||||||
|
loop
|
||||||
|
>
|
||||||
|
{contentRender()}
|
||||||
|
</Carousel>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,11 @@ export default {
|
|||||||
"name": "是否可拖拽",
|
"name": "是否可拖拽",
|
||||||
"type": "Switch",
|
"type": "Switch",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"key": "autoPlay",
|
||||||
|
"name": "是否自动播放",
|
||||||
|
"type": "Switch",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"key": "imgList",
|
"key": "imgList",
|
||||||
"name": "图片列表",
|
"name": "图片列表",
|
||||||
@ -30,6 +35,7 @@ export default {
|
|||||||
"config": {
|
"config": {
|
||||||
"direction": "left",
|
"direction": "left",
|
||||||
"swipeable": false,
|
"swipeable": false,
|
||||||
|
"autoPlay": false,
|
||||||
"imgList": [
|
"imgList": [
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
@ -59,7 +65,8 @@ export default {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"tplImg": "http://io.nainor.com/uploads/carousal_17442e1420f.png"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Text": {
|
"Text": {
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
import React, { useState, useEffect, memo } from 'react'
|
import React, { useState, useEffect, useCallback, memo } from 'react'
|
||||||
import { Input, Slider, Result, Tabs } from 'antd'
|
import { Slider, Result, Tabs, Alert } from 'antd'
|
||||||
import {
|
import {
|
||||||
PieChartOutlined,
|
PieChartOutlined,
|
||||||
ExpandOutlined,
|
ExpandOutlined,
|
||||||
PlayCircleOutlined,
|
PlayCircleOutlined,
|
||||||
HighlightOutlined
|
HighlightOutlined
|
||||||
} from '@ant-design/icons'
|
} from '@ant-design/icons'
|
||||||
|
import TextLoop from 'react-text-loop'
|
||||||
import { connect } from 'dva'
|
import { connect } from 'dva'
|
||||||
import HeaderComponent from './components/Header'
|
import HeaderComponent from './components/Header'
|
||||||
import SourceBox from './SourceBox'
|
import SourceBox from './SourceBox'
|
||||||
@ -17,10 +18,10 @@ import template from 'components/DynamicEngine/template'
|
|||||||
import mediaTpl from 'components/DynamicEngine/mediaTpl'
|
import mediaTpl from 'components/DynamicEngine/mediaTpl'
|
||||||
import graphTpl from 'components/DynamicEngine/graphTpl'
|
import graphTpl from 'components/DynamicEngine/graphTpl'
|
||||||
import schema from 'components/DynamicEngine/schema'
|
import schema from 'components/DynamicEngine/schema'
|
||||||
|
import { uuid } from 'utils/tool'
|
||||||
|
|
||||||
import styles from './index.less'
|
import styles from './index.less'
|
||||||
|
|
||||||
const { Search } = Input;
|
|
||||||
const { TabPane } = Tabs;
|
const { TabPane } = Tabs;
|
||||||
|
|
||||||
const Container = memo((props) => {
|
const Container = memo((props) => {
|
||||||
@ -64,6 +65,10 @@ const Container = memo((props) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const clearData = useCallback(() => {
|
||||||
|
dispatch({ type: 'editorModal/clearAll' })
|
||||||
|
}, [])
|
||||||
|
|
||||||
const handleDel = (id) => {
|
const handleDel = (id) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: 'editorModal/delPointData',
|
type: 'editorModal/delPointData',
|
||||||
@ -75,15 +80,30 @@ const Container = memo((props) => {
|
|||||||
if(window.innerWidth < 1024) {
|
if(window.innerWidth < 1024) {
|
||||||
props.history.push('/mobileTip')
|
props.history.push('/mobileTip')
|
||||||
}
|
}
|
||||||
|
// 存储用户唯一信息
|
||||||
|
if(!localStorage.getItem('uid') || !sessionStorage.getItem('sid')) {
|
||||||
|
localStorage.setItem('uid', uuid(8, 10))
|
||||||
|
sessionStorage.setItem('sid', uuid(5, 10))
|
||||||
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.editorWrap}>
|
<div className={styles.editorWrap}>
|
||||||
<HeaderComponent pointData={pointData} location={props.location} />
|
<HeaderComponent pointData={pointData} clearData={clearData} location={props.location} />
|
||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
<div className={styles.list} >
|
<div className={styles.list} >
|
||||||
<div className={styles.searchBar}>
|
<div className={styles.searchBar}>
|
||||||
<Search placeholder="搜索组件" onSearch={value => console.log(value)} enterButton />
|
<Alert
|
||||||
|
banner
|
||||||
|
message={
|
||||||
|
<TextLoop mask>
|
||||||
|
<div>Dooring升级啦!</div>
|
||||||
|
<div>Dooring添加自动保存功能</div>
|
||||||
|
<div>已有500+人使用</div>
|
||||||
|
<div>持续迭代中...</div>
|
||||||
|
</TextLoop>
|
||||||
|
}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.componentList}>
|
<div className={styles.componentList}>
|
||||||
<Tabs defaultActiveKey="1">
|
<Tabs defaultActiveKey="1">
|
||||||
@ -91,7 +111,7 @@ const Container = memo((props) => {
|
|||||||
{
|
{
|
||||||
template.map((value,i) =>
|
template.map((value,i) =>
|
||||||
<TargetBox item={value} key={i} canvasId={canvasId}>
|
<TargetBox item={value} key={i} canvasId={canvasId}>
|
||||||
<DynamicEngine {...value} config={schema[value.type].config} />
|
<DynamicEngine {...value} config={schema[value.type].config} isTpl={true} />
|
||||||
</TargetBox>
|
</TargetBox>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -100,7 +120,7 @@ const Container = memo((props) => {
|
|||||||
{
|
{
|
||||||
mediaTpl.map((value,i) =>
|
mediaTpl.map((value,i) =>
|
||||||
<TargetBox item={value} key={i} canvasId={canvasId}>
|
<TargetBox item={value} key={i} canvasId={canvasId}>
|
||||||
<DynamicEngine {...value} config={schema[value.type].config} />
|
<DynamicEngine {...value} config={schema[value.type].config} isTpl={true} />
|
||||||
</TargetBox>
|
</TargetBox>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -109,7 +129,7 @@ const Container = memo((props) => {
|
|||||||
{
|
{
|
||||||
graphTpl.map((value,i) =>
|
graphTpl.map((value,i) =>
|
||||||
<TargetBox item={value} key={i} canvasId={canvasId}>
|
<TargetBox item={value} key={i} canvasId={canvasId}>
|
||||||
<DynamicEngine {...value} config={schema[value.type].config} />
|
<DynamicEngine {...value} config={schema[value.type].config} isTpl={true} />
|
||||||
</TargetBox>
|
</TargetBox>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -75,12 +75,12 @@ const SourceBox = memo((props) => {
|
|||||||
<div
|
<div
|
||||||
className="js_box"
|
className="js_box"
|
||||||
style={{
|
style={{
|
||||||
width: '12px',
|
width: '10px',
|
||||||
height: '100%',
|
height: '100%',
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
borderRadius: '0 6px 6px 0',
|
borderRadius: '0 6px 6px 0',
|
||||||
backgroundColor: '#2f54eb',
|
backgroundColor: '#2f54eb',
|
||||||
right: '-12px',
|
right: '-10px',
|
||||||
top: '0',
|
top: '0',
|
||||||
color: '#fff',
|
color: '#fff',
|
||||||
cursor: 'move'
|
cursor: 'move'
|
||||||
@ -103,7 +103,7 @@ const SourceBox = memo((props) => {
|
|||||||
{
|
{
|
||||||
pointData.map(value =>
|
pointData.map(value =>
|
||||||
<div className={styles.dragItem} key={value.id} data-grid={value.point}>
|
<div className={styles.dragItem} key={value.id} data-grid={value.point}>
|
||||||
<DynamicEngine {...value.item} />
|
<DynamicEngine {...value.item} isTpl={false} />
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,13 +35,17 @@ const PreviewPage = memo((props) => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const { tid } = props.location.query
|
const { tid } = props.location.query
|
||||||
|
const timer = null
|
||||||
req.get('/visible/preview/get', { params: { tid } }).then(res => {
|
req.get('/visible/preview/get', { params: { tid } }).then(res => {
|
||||||
setPointData(res.map(item => ({...item, point: {...item.point, isDraggable: false, isResizable: false } })))
|
setPointData(res.map(item => ({...item, point: {...item.point, isDraggable: false, isResizable: false } })))
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
setTimeout(() => {
|
timer = setTimeout(() => {
|
||||||
window.close()
|
window.close()
|
||||||
}, 3000)
|
}, 3000)
|
||||||
})
|
})
|
||||||
|
return () => {
|
||||||
|
clearTimeout(timer)
|
||||||
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user