Commit 56aed0db authored by Maofei94's avatar Maofei94

perf: 小程序配置优化

parent 624cb4c1
...@@ -10,7 +10,7 @@ import PicturesWall from '@/components/Upload/index'; ...@@ -10,7 +10,7 @@ import PicturesWall from '@/components/Upload/index';
const { Item } = Form; const { Item } = Form;
const { Option } = Select; const { Option } = Select;
const SiteConfig = props => { const SiteConfig = props => {
const { miniTitle, submitCallback, subType } = props; const { miniTitle, submitCallback, subType, addCallback } = props;
console.log(subType, 'ubType'); console.log(subType, 'ubType');
const [config, setConfig] = useState(''); // 网站配置信息 const [config, setConfig] = useState(''); // 网站配置信息
const [loginList, setLoginList] = useState([ const [loginList, setLoginList] = useState([
...@@ -73,7 +73,7 @@ const SiteConfig = props => { ...@@ -73,7 +73,7 @@ const SiteConfig = props => {
.then(res => { .then(res => {
setLoading(false); setLoading(false);
if (res.success) { if (res.success) {
submitCallback(); addCallback(params.title);
notification.success({ notification.success({
message: '提示', message: '提示',
duration: 3, duration: 3,
...@@ -151,7 +151,16 @@ const SiteConfig = props => { ...@@ -151,7 +151,16 @@ const SiteConfig = props => {
> >
<Input placeholder="请输入系统图标名称" allowClear /> <Input placeholder="请输入系统图标名称" allowClear />
</Item> */} </Item> */}
<Item label="系统图标预览:" name="shortcutIcon"> <Item
label="系统图标:"
name="shortcutIcon"
rules={[
{
required: true,
message: '请选择系统图标',
},
]}
>
<PicturesWall /> <PicturesWall />
</Item> </Item>
...@@ -212,7 +221,7 @@ const SiteConfig = props => { ...@@ -212,7 +221,7 @@ const SiteConfig = props => {
))} ))}
</Select> </Select>
</Item> </Item>
<Item label="开启云登陆:" name="cloudLogin"> <Item label="开启云登陆:" name="cloudLogin" initialValue={false}>
<Radio.Group onChange={radioChange}> <Radio.Group onChange={radioChange}>
<Radio value></Radio> <Radio value></Radio>
<Radio value={false}></Radio> <Radio value={false}></Radio>
......
...@@ -65,28 +65,40 @@ const MobileConfigPage = props => { ...@@ -65,28 +65,40 @@ const MobileConfigPage = props => {
setFlag(flag + 1); setFlag(flag + 1);
setSubType(''); setSubType('');
}; };
const addCallback = val => {
console.log(val);
setSubType('');
setMiniTitle(val);
setPosition(['right']);
};
// 删除小程序 // 删除小程序
const delMini = () => { const delMini = () => {
setLoading(true);
deleteWebsite({ deleteWebsite({
client: 'miniapp', client: 'miniapp',
_version: 9999, _version: 9999,
_dc: Date.now(), _dc: Date.now(),
}).then(res => { })
if (res.success) { .then(res => {
setFlag(flag + 1); setLoading(false);
notification.success({ if (res.success) {
message: '提示', setFlag(flag + 1);
duration: 3, notification.success({
description: '删除成功', message: '提示',
}); duration: 3,
} else { description: '删除成功',
notification.success({ });
message: '提示', } else {
duration: 3, notification.success({
description: res.message || '删除失败', message: '提示',
}); duration: 3,
} description: res.message || '删除失败',
}); });
}
})
.catch(() => {
setLoading(false);
});
}; };
const addMini = () => { const addMini = () => {
setShowConfig(true); setShowConfig(true);
...@@ -130,6 +142,7 @@ const MobileConfigPage = props => { ...@@ -130,6 +142,7 @@ const MobileConfigPage = props => {
miniTitle={miniTitle} miniTitle={miniTitle}
submitCallback={submitCallback} submitCallback={submitCallback}
subType={subType} subType={subType}
addCallback={addCallback}
/> />
), ),
}, },
...@@ -149,13 +162,23 @@ const MobileConfigPage = props => { ...@@ -149,13 +162,23 @@ const MobileConfigPage = props => {
onChange={handleChange} onChange={handleChange}
tabBarExtraContent={slot} tabBarExtraContent={slot}
> >
{showConfig && {/* {showConfig &&
tabArr?.length > 0 && tabArr?.length > 0 &&
tabArr.map(item => ( tabArr.map(item => (
<TabPane tab={item.title} key={item.key}> <TabPane tab={item.title} key={item.key}>
{activeKey === item.key && item.component} {activeKey === item.key && item.component}
</TabPane> </TabPane>
))} ))} */}
{showConfig && (
<TabPane tab={tabArr[0].title} key={tabArr[0].key}>
{activeKey === tabArr[0].key && tabArr[0].component}
</TabPane>
)}
{showConfig && subType !== 'add' && (
<TabPane tab={tabArr[1].title} key={tabArr[1].key}>
{activeKey === tabArr[1].key && tabArr[1].component}
</TabPane>
)}
</Tabs> </Tabs>
</Spin> </Spin>
</ProCard> </ProCard>
......
...@@ -139,10 +139,10 @@ const MiniMenu = props => { ...@@ -139,10 +139,10 @@ const MiniMenu = props => {
icon: icon:
obj.menuType !== 'MiniAppMenuThree' && obj.menuType !== 'MiniAppMenuThree' &&
obj.menuType !== 'MiniAppMenu' ? ( obj.menuType !== 'MiniAppMenu' ? (
<FolderFilled /> <FolderFilled />
) : ( ) : (
<FileOutlined /> <FileOutlined />
), ),
menuType: obj.menuType, menuType: obj.menuType,
children: hasChild ? obj.children.map(i => mapTree(i)) : [], children: hasChild ? obj.children.map(i => mapTree(i)) : [],
}; };
......
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