Commit 8c5a67a3 authored by 田翔's avatar 田翔

fix: 工作台优化

parent ecaa9e7e
Pipeline #83587 passed with stages
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
...@@ -3,6 +3,7 @@ import styles from './index.less' ...@@ -3,6 +3,7 @@ import styles from './index.less'
import { useDrag, useDrop, DndProvider } from 'react-dnd' import { useDrag, useDrop, DndProvider } from 'react-dnd'
import { GlobalStore } from '../../index' import { GlobalStore } from '../../index'
import { message } from 'antd' import { message } from 'antd'
import TipBox from '../TipBox'
const Group = (props) => { const Group = (props) => {
...@@ -132,21 +133,23 @@ const Group = (props) => { ...@@ -132,21 +133,23 @@ const Group = (props) => {
) )
} }
{ {
props.children.map(v => { props.children?.length > 0 ? (
return ( props.children?.map(v => {
<div return (
key={v.id} <div
className={styles.card} key={v.id}
widget={v.widget} className={styles.card}
onClick={(e) => cardClick(e, v)} widget={v.widget}
active={`${v.active}`} onClick={(e) => cardClick(e, v)}
> active={`${v.active}`}
{ >
v.active && <span className={styles.deleted} onClick={(e) => deleteCrad(e, v)}>删除</span> {
} v.active && <span className={styles.deleted} onClick={(e) => deleteCrad(e, v)}>删除</span>
</div> }
) </div>
}) )
})
) : <TipBox text='左侧拖拽组件到这里' />
} }
</div> </div>
) )
......
import React from 'react'
import styles from './index.less'
const TipBox = (props) => {
return (
<div className={styles.TipBox} style={props.style}>
<div className={styles.TipBoxText}>{props.text}</div>
</div>
)
}
export default TipBox
\ No newline at end of file
.TipBox {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
.TipBoxText {
width: 180px;
height: 50px;
line-height: 50px;
text-align: center;
border: 1px dashed #DDDDDD;
background: #F4F4F4;
}
}
\ No newline at end of file
...@@ -11,6 +11,7 @@ import { ...@@ -11,6 +11,7 @@ import {
import { useDrag, useDrop, DndProvider } from 'react-dnd' import { useDrag, useDrop, DndProvider } from 'react-dnd'
import { GlobalStore } from '../index' import { GlobalStore } from '../index'
import Group from './Group' import Group from './Group'
import TipBox from './TipBox'
import moment from 'moment' import moment from 'moment'
import { getSiteTree } from '@/services/siteManage/api' import { getSiteTree } from '@/services/siteManage/api'
import { Carousel } from 'antd' import { Carousel } from 'antd'
...@@ -32,7 +33,7 @@ const Container = (props, ref) => { ...@@ -32,7 +33,7 @@ const Container = (props, ref) => {
const moblieRef = useRef(null) const moblieRef = useRef(null)
const [currentSite, setCurrentSite] = useState('永吉水务有限公司') const [currentSite, setCurrentSite] = useState('永吉水务有限公司')
const { shema, setShema } = useContext(GlobalStore) const { shema, setShema } = useContext(GlobalStore)
const { carousel } = shema const { work, carousel } = shema
const [, drop] = useDrop(() => { const [, drop] = useDrop(() => {
return { return {
...@@ -50,7 +51,7 @@ const Container = (props, ref) => { ...@@ -50,7 +51,7 @@ const Container = (props, ref) => {
shema?.work.forEach(v => { shema?.work.forEach(v => {
array.push({ ...v, active: false, children: v.children.map(s => ({ ...s, active: false })) }) array.push({ ...v, active: false, children: v.children.map(s => ({ ...s, active: false })) })
}) })
setShema({ ...shema, work: array, active: true }) setShema({ ...shema, work: array, active: true, carousel: { ...shema.carousel, active: false } })
} }
const getSite = async () => { const getSite = async () => {
...@@ -120,7 +121,9 @@ const Container = (props, ref) => { ...@@ -120,7 +121,9 @@ const Container = (props, ref) => {
</div> </div>
<div style={{ padding: '10px' }}> <div style={{ padding: '10px' }}>
{ {
shema?.work?.map((v, i) => <Group key={v.id} index={i} {...v} />) work?.length > 0 ? (
work?.map((v, i) => <Group key={v.id} index={i} {...v} />)
) : <TipBox style={{ marginTop: '10px' }} text='左侧拖拽布局到这里' />
} }
</div> </div>
</div> </div>
...@@ -135,6 +138,7 @@ const Container = (props, ref) => { ...@@ -135,6 +138,7 @@ const Container = (props, ref) => {
className={styles.slideShow} className={styles.slideShow}
onClick={(e) => carouselClick(e)} onClick={(e) => carouselClick(e)}
active={`${carousel?.active}`} active={`${carousel?.active}`}
style={!carousel?.active && !carousel?.imgUrls?.length > 0 ? { borderBottom: '1px dashed #DDDDDD' } : {}}
> >
<div className={styles.top}> <div className={styles.top}>
<div className={styles['top-left']}> <div className={styles['top-left']}>
...@@ -147,21 +151,27 @@ const Container = (props, ref) => { ...@@ -147,21 +151,27 @@ const Container = (props, ref) => {
<span className={styles['r-text']}>{currentDate}</span> <span className={styles['r-text']}>{currentDate}</span>
</div> </div>
</div> </div>
<Carousel autoplay> {
{ carousel?.imgUrls?.length > 0 ? (
shema?.carousel?.imgUrls?.map(v => { <Carousel autoplay>
return ( {
<div className={styles['carousel-item']}> carousel?.imgUrls?.map(v => {
<img style={{ width: '100%', height: '100%' }} src={`${window.origin}/PandaOMS/OMS/FileCenter/DownLoadFiles?module=图库&filePath=${v}`} /> return (
</div> <div className={styles['carousel-item']}>
) <img style={{ width: '100%', height: '100%' }} src={`${window.origin}/PandaOMS/OMS/FileCenter/DownLoadFiles?module=图库&filePath=${v}`} />
}) </div>
} )
</Carousel> })
}
</Carousel>
) : <TipBox text='点击此处设置轮播图' />
}
</div> </div>
<div style={{ padding: '10px' }}> <div className={styles.groups}>
{ {
shema?.work?.map((v, i) => <Group key={v.id} index={i} {...v} />) work?.length > 0 ? (
work?.map((v, i) => <Group key={v.id} index={i} {...v} />)
) : <TipBox text='左侧拖拽布局到这里' />
} }
</div> </div>
</div> </div>
...@@ -171,14 +181,17 @@ const Container = (props, ref) => { ...@@ -171,14 +181,17 @@ const Container = (props, ref) => {
return ( return (
<div className={styles.container}> <div className={styles.container}>
<div className={styles.content}> <div className={styles.content}>
<div <div className={styles.moblieBox}>
ref={moblieRef} <div className={styles.moblieBoxTop}></div>
className={styles.moblie} <div
onClick={() => pageClick()} ref={moblieRef}
active={`${shema.active}`} className={styles.moblie}
style={{ background: shema?.background }} onClick={() => pageClick()}
> active={`${shema.active}`}
{getMoblieCenter()} style={{ background: shema?.background }}
>
{getMoblieCenter()}
</div>
</div> </div>
<div className={styles['c-btns']}> <div className={styles['c-btns']}>
{ {
......
...@@ -38,8 +38,26 @@ ...@@ -38,8 +38,26 @@
} }
} }
} }
.moblieBox {
position: relative;
padding: 15px 10px;
background: url('@{imgSrc}/手机壳.png');
background-size: 100% 100%;
.moblieBoxTop {
position: absolute;
z-index: 99;
left: 50%;
transform: translateX(-50%);
top: 20px;
width: 85%;
height: 10px;
background: url('@{imgSrc}/手机状态.png');
background-size: 100% 100%;
}
}
.moblie { .moblie {
width: 330px; width: 330px;
border-radius: 15px;
overflow: auto; overflow: auto;
background: #f7f7f7; background: #f7f7f7;
border: 1px solid #e4e1e1; border: 1px solid #e4e1e1;
...@@ -98,13 +116,16 @@ ...@@ -98,13 +116,16 @@
height: 650px; height: 650px;
position: relative; position: relative;
.slideShow { .slideShow {
border-radius: 15px 15px 0 0;
position: relative; position: relative;
width: 100%; width: 100%;
height: 150px; height: 160px;
overflow: hidden;
.top { .top {
position: absolute; position: absolute;
width: 100%; width: 100%;
padding: 10px; padding: 10px;
padding-top: 22px;
z-index: 99; z-index: 99;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
...@@ -150,10 +171,12 @@ ...@@ -150,10 +171,12 @@
border: 2px solid #001bff; border: 2px solid #001bff;
} }
.carousel-item { .carousel-item {
height: 150px; height: 160px;
background: #52A2E5;
} }
} }
.groups {
padding: 10px;
}
} }
&[active='true'] { &[active='true'] {
border: 2px solid #001bff; border: 2px solid #001bff;
......
...@@ -92,7 +92,7 @@ const Right = () => { ...@@ -92,7 +92,7 @@ const Right = () => {
} }
const changeThemeStyles = (v) => { const changeThemeStyles = (v) => {
setShema({ ...shema, themeStyle: v.name }) setShema({ ...shema, themeStyle: v.name, background: shema.background || '#daebfe' })
} }
const groupChange = ({ attr, value }) => { const groupChange = ({ attr, value }) => {
...@@ -276,6 +276,7 @@ const Right = () => { ...@@ -276,6 +276,7 @@ const Right = () => {
<div className={styles['g-title']}>轮播图</div> <div className={styles['g-title']}>轮播图</div>
<div className={styles['g-content']}> <div className={styles['g-content']}>
<Upload <Upload
multiple
name="singleFile" name="singleFile"
listType="picture-card" listType="picture-card"
className="avatar-uploader" className="avatar-uploader"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment