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

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

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