Commit 130c7cce authored by 田翔's avatar 田翔

fix: 增加卡片图标切换

parent 26f56fa8
Pipeline #80712 passed with stages
...@@ -34,7 +34,8 @@ const Right = () => { ...@@ -34,7 +34,8 @@ const Right = () => {
const [paramForm] = Form.useForm() const [paramForm] = Form.useForm()
const [moblieList, setMoblieList] = useState([]) const [moblieList, setMoblieList] = useState([])
const [iconShow, setIconShow] = useState() const [iconShow, setIconShow] = useState()
const [iconList] = useState([]) const [iconList, setIconList] = useState([])
const [currentIcon, setCurrentIcon] = useState('')
const [paramShow, setParamShow] = useState(false) const [paramShow, setParamShow] = useState(false)
const name = useMemo(() => { const name = useMemo(() => {
...@@ -179,10 +180,15 @@ const Right = () => { ...@@ -179,10 +180,15 @@ const Right = () => {
} }
const getIconList = async () => { const getIconList = async () => {
const { code, data } = await getImageBases('icon,appWorkSpace') const { code, data } = await getImageBases('appWorkSpace')
if (code === 0) { if (code === 0) {
console.log('data', data) let array = []
// setI data.forEach(v => {
if (v.moduleName === 'appWorkSpace') {
array = v.fileUrls
}
})
setIconList(array)
} }
} }
...@@ -268,22 +274,24 @@ const Right = () => { ...@@ -268,22 +274,24 @@ const Right = () => {
<Switch checked={card.nameShow} onChange={check => cardSettingOther(check, 'nameShow')} /> <Switch checked={card.nameShow} onChange={check => cardSettingOther(check, 'nameShow')} />
</Form.Item> </Form.Item>
<Form.Item label="卡片图标" name="icon"> <Form.Item label="卡片图标" name="icon">
<Input value={card.icon} onChange={(e) => cardSetting(e, 'icon')} /> {
{/* {
card.icon ? ( card.icon ? (
<img style={{ width: '60px', height: '60px' }} src={card.icon}></img> <div className={styles['card-img']}>
<img
onClick={() => {
setCurrentIcon(card.icon)
setIconShow(true)
}}
style={{ width: '100%', height: '100%' }}
src={`${origin}/civweb4/${card.icon}`}
/>
</div>
) : ( ) : (
<div className={styles['card-icon']} onClick={() => setIconShow(true)}> <div className={styles['card-icon']} onClick={() => setIconShow(true)}>
<PlusOutlined /> <PlusOutlined />
</div> </div>
) )
} */} }
{/* <PicturesWall
picType="androidMenu"
style={{ width: '100%' }}
value={['CityTemp\\图库\\20230525\\a6dd0b38-661b-4311-9241-4cf829f1d58d.png']}
onChange={value => console.log('value', value)}
/> */}
</Form.Item> </Form.Item>
<Form.Item label="功能跳转" name="url"> <Form.Item label="功能跳转" name="url">
<TreeSelect <TreeSelect
...@@ -313,8 +321,26 @@ const Right = () => { ...@@ -313,8 +321,26 @@ const Right = () => {
title={'卡片图标'} title={'卡片图标'}
visible={iconShow} visible={iconShow}
onCancel={() => setIconShow(false)} onCancel={() => setIconShow(false)}
onOk={() => {
cardSettingOther(currentIcon, 'icon')
setIconShow(false)
}}
> >
<div className={styles.iconBox}>
{
iconList.map(v => {
return (
<div
className={styles.iconItem}
active={`${currentIcon === v}`}
onClick={() => setCurrentIcon(v)}
>
<img style={{ width: '100%', height: '100%' }} src={`${origin}/civweb4/${v}`}></img>
</div>
)
})
}
</div>
</Modal> </Modal>
<Modal <Modal
title={'参数配置'} title={'参数配置'}
......
...@@ -94,6 +94,13 @@ ...@@ -94,6 +94,13 @@
color: #1890ff; color: #1890ff;
} }
} }
.card-img {
width: 60px;
height: 60px;
&:hover {
cursor: pointer;
}
}
} }
} }
} }
...@@ -105,4 +112,31 @@ ...@@ -105,4 +112,31 @@
background-size: 100% 100%; background-size: 100% 100%;
position: relative; position: relative;
top: 7px; top: 7px;
}
.iconBox {
width: 100%;
height: 100%;
display: flex;
flex-wrap: wrap;
.iconItem {
display: flex;
align-items: center;
justify-content: center;
width: 70px;
height: 70px;
font-size: 50px;
margin: 10px;
padding: 10px;
&:hover {
cursor: pointer;
}
&[active='true'] {
transition: all 0.3s ease;
border: 1px solid #4096ff;
border-radius: 5px;
color: white;
transform: scale(1.1);
}
}
} }
\ No newline at end of file
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