Commit f64ab8f2 authored by 皮倩雯's avatar 皮倩雯

fix: '修复宿主管理网关开启bug'

parent 3a122053
Pipeline #61870 passed with stages
......@@ -33,6 +33,7 @@ import {
GetReRoutesFirst,
DelRoutes,
} from '@/services/hostmanager/hostmanager';
import { get, PUBLISH_SERVICE } from '@/services/index';
import configuration from '../../../../assets/images/icons/消息.svg';
import AddModal from './AddModal';
......@@ -53,42 +54,77 @@ const GateConfig = () => {
const { Search } = Input;
const OperateNginx = checked => {
localStorage.setItem('panda-publish', '');
console.log(checked);
UpdateGeteWay({ isUsed: checked }).then(res => {
if (res.code === 0) {
setFlag(flag + 1);
message.success('设置成功');
} else {
message.error('设置失败');
}
});
};
useEffect(() => {
if (currentConfig) {
localStorage.setItem('panda-publish', 'getway');
GetReRoutes({
UpstreamPathTemplate: '',
key: '',
}).then(res => {
setLoading(false);
if (checked) {
UpdateGeteWay({ isUsed: checked }).then(res => {
if (res.code === 0) {
setTableData(res.data);
setFlag(flag + 1);
message.success('设置成功');
} else {
message.error('设置失败');
}
});
setTimeout(() => {
localStorage.setItem('panda-publish', 'getway');
setLoading(true);
GetReRoutes({
UpstreamPathTemplate: '',
key: '',
}).then(res => {
setLoading(false);
if (res.code === 0) {
setTableData(res.data);
}
});
}, 0);
} else {
localStorage.setItem('panda-publish', '');
UpdateGeteWay({ isUsed: checked }).then(res => {
if (res.code === 0) {
setFlag(flag + 1);
message.success('设置成功');
} else {
message.error('设置失败');
}
});
}
}, [currentConfig]);
};
// useEffect(() => {
// if (currentConfig) {
// localStorage.setItem('panda-publish', 'getway');
// GetReRoutes({
// UpstreamPathTemplate: '',
// key: '',
// }).then(res => {
// setLoading(false);
// if (res.code === 0) {
// setTableData(res.data);
// }
// });
// } else {
// console.log(123333);
// localStorage.setItem('panda-publish', '');
// }
// }, [currentConfig]);
useEffect(() => {
GetGateWay().then(res => {
if (res.code === 0) {
setCurrentConfig(res.data);
console.log(currentConfig);
if (res.data) {
GetReRoutes({
UpstreamPathTemplate: '',
key: '',
}).then(resdata => {
setLoading(false);
if (resdata.code === 0) {
setTableData(resdata.data);
}
});
}
}
});
setLoading(true);
// .catch(err => {
// setLoading(false);
// GetReRoutes({
......
......@@ -521,10 +521,10 @@ export default props => {
<Radio value={false}>关闭</Radio>
</Radio.Group>
</Form.Item>
<Form.Item label="菜单状态" name="menuState">
<Form.Item label="菜单样式" name="menuState">
<Radio.Group>
<Radio value="open">开启</Radio>
<Radio value="close">关闭</Radio>
<Radio value="open">展开</Radio>
<Radio value="close">折叠</Radio>
</Radio.Group>
</Form.Item>
</div>
......
......@@ -74,7 +74,7 @@ const ConfigWrapper = props => {
onChange: handleChange,
}),
)}
{<Button onClick={showModal}>编辑</Button>}
{<Button onClick={showModal}>编辑文件</Button>}
<Modal
title="编辑配置"
visible={visible}
......
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