Commit 0b55d619 authored by GuanHua's avatar GuanHua

feat: 添加app企业商城装修底部选中icon图片上传

parent ccf76f03
......@@ -18,6 +18,7 @@ interface DataItemType {
id: number,
name: string,
icon: string,
selectIcon: string,
/** 类型:1-首页 2-分类 3-进货单 4-工作台 5-我的 6-找现货 7-找供应 8-求购 9-换积分 10-找店铺 */
type: number,
status: boolean,
......@@ -203,11 +204,11 @@ const BottomNavigation: React.FC<BottomNavigationPropsType> = (props) => {
})
}
const handleIconChange = (url: string, id: number) => {
const handleIconChange = (url: string, id: number, key: string) => {
const newList = [...list]
newList.map(item => {
if (item.id === id) {
item.icon = url
item[key] = url
}
})
setList(newList)
......@@ -272,11 +273,11 @@ const BottomNavigation: React.FC<BottomNavigationPropsType> = (props) => {
</div>
</div>
<div className={styles.setting_line_addItem_line}>
<div className={styles.setting_line_addItem_line_label}>图标:</div>
<div className={styles.setting_line_addItem_line_label}>图标-默认</div>
<div className={styles.setting_line_addItem_line_brief}>
<div className={styles.uploadIconWrap}>
<UploadImage
onChange={(url) => handleIconChange(url, item.id)}
onChange={(url) => handleIconChange(url, item.id, "icon")}
listType="text"
>
<div className={cx(styles.uploadIconBtn, styles.small)}>
......@@ -291,6 +292,26 @@ const BottomNavigation: React.FC<BottomNavigationPropsType> = (props) => {
</div>
</div>
</div>
<div className={styles.setting_line_addItem_line}>
<div className={styles.setting_line_addItem_line_label}>图标-选中:</div>
<div className={styles.setting_line_addItem_line_brief}>
<div className={styles.uploadIconWrap}>
<UploadImage
onChange={(url) => handleIconChange(url, item.id, "selectIcon")}
listType="text"
>
<div className={cx(styles.uploadIconBtn, styles.small)}>
<PlusOutlined className={styles.uploadIconBtnIcon} />
<span>上传图标</span>
</div>
</UploadImage>
<label className={styles.uploadIconTip}>最佳尺寸:160*160</label>
</div>
<div className={styles.previewIconWrap}>
{item.selectIcon && <img src={item.selectIcon} className={styles.previewIcon} alt={item.name} />}
</div>
</div>
</div>
{
(item.type !== 1 && item.type !== 4) && (
<div className={styles.setting_line_addItem_line}>
......
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