Commit 56aed0db authored by Maofei94's avatar Maofei94

perf: 小程序配置优化

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