Commit 564fbec2 authored by 邓超's avatar 邓超

refactor: 替换Web配置模块接口

parent d05c0fc8
Pipeline #33243 skipped with stages
......@@ -43,7 +43,7 @@ const WebConfigForm = props => {
const onGetLoginPages = () => {
if (loginPages.length === 0) {
getLoginPage().then(res => setLoginPages(res));
getLoginPage().then(res => setLoginPages(res.data));
}
};
......
......@@ -44,7 +44,7 @@ const WebConfigPage = props => {
setLoading(true);
updateModuleTree(userMode || 'super', canceled);
getAllConfigName().then(res => {
if (!canceled.cancel) setConfigFiles(res);
if (!canceled.cancel) setConfigFiles(res.data);
});
return () => {
canceled.cancel = true;
......@@ -105,7 +105,7 @@ const WebConfigPage = props => {
.then(res => {
setLoading(false);
if (!canceled.cancel) {
setConfigObj(res);
setConfigObj(res.data);
// setConfigObj(res.data);
if (webTitle === curWeb.text) {
setToEdit(res);
......
......@@ -167,8 +167,8 @@ const MiniMenu = props => {
})
.then(res => {
setLoading(false);
if (res.success) {
setInfo({ ...res });
if (res.code === 0) {
setInfo({ ...res.data });
} else {
notification.error({
message: '提示',
......@@ -197,7 +197,7 @@ const MiniMenu = props => {
})
.then(res => {
setModalLoading(false);
if (res.success) {
if (res.code === 0) {
setDelVisible(false);
setFlag(flag + 1);
setNodeType('');
......@@ -275,7 +275,7 @@ const MiniMenu = props => {
})
.then(res => {
setSubmitLoading(false);
if (res.success) {
if (res.code === 0) {
setAddVisible(false);
setAddTwoVisible(false);
setFlag(flag + 1);
......@@ -314,7 +314,7 @@ const MiniMenu = props => {
.then(res => {
setLoading(false);
if (res.success) {
if (res.code === 0) {
setFlag(flag + 1);
// updateMenuTree('edit');
notification.success({
......@@ -336,16 +336,20 @@ const MiniMenu = props => {
setLoading(false);
});
} else {
pEditWebMenu({
// 新接口改为editWebMenu 原来为pEditWebMenu
editWebMenu({
_dc: Date.now(),
menuID,
// subSystemValue,
...obj,
product: null,
baseUrl: null,
hideInMenu: null,
})
.then(res => {
setLoading(false);
if (res.success) {
if (res.code === 0) {
setFlag(flag + 1);
// updateMenuTree('edit');
notification.success({
......@@ -357,7 +361,7 @@ const MiniMenu = props => {
notification.error({
message: '提示',
duration: 3,
description: res.message || '编辑失败',
description: res.msg || '编辑失败',
});
}
})
......@@ -435,7 +439,7 @@ const MiniMenu = props => {
_version: 9999,
_dc: Date.now(),
}).then(res => {
if (res.success) {
if (res.code === 0) {
// updateMenuTree();
setFlag(flag + 1);
} else {
......
......@@ -3,11 +3,11 @@ import { CITY_SERVICE, get, PUBLISH_SERVICE, post, postForm } from '../index';
// 获取任务列表
export const taskOptionsList = () =>
get(`/PandaCore/OMS/AIConfig/TaskOptionsList`);
get(`${PUBLISH_SERVICE}/AIConfig/TaskOptionsList`);
// 获取设备类型
export const getIotDeviceType = () =>
get(`/PandaCore/OMS/AIConfig/GetIotDeviceType`);
get(`${PUBLISH_SERVICE}/AIConfig/GetIotDeviceType`);
// 获取场景列表
export const algorithmList = () => get(`/PandaCore/OMS/AIConfig/AlgorithmList`);
......@@ -42,7 +42,7 @@ export const deleteTaskOptions = params =>
// 预测列表
export const getPredictInfo = () =>
get(`/PandaCore/OMS/AIConfig/GetPredictInfo`);
get(`${PUBLISH_SERVICE}/AIConfig/GetPredictInfo`);
// 预测新增
export const addPredictOptions = params =>
......
......@@ -22,7 +22,7 @@ export const getWebThemes = () =>
* 获取登录模板下拉选项
*/
export const getLoginPage = () =>
get(`${CITY_SERVICE}/OMS.svc/W4_GetLoginPage`, { query: '' });
get(`${PUBLISH_SERVICE}/WebSite/GetLoginPage`, { query: '' });
/**
* 获取地图配置下拉选项
......@@ -54,46 +54,42 @@ export const postEditWebConfig = (config, isAdd = false) => {
});
return post(
`${PUBLISH_SERVICE}/WebSite/${
isAdd ? 'AddWebsite' : 'W4_EditWebsite'
isAdd ? 'AddWebsite' : 'EditWebsite'
}?_version=9999`,
qs.stringify({ config: JSON.stringify(obj) }),
{
headers: {
'content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
},
},
{ config: obj },
);
};
export const postAddWebSite = config => postEditWebConfig(config, true);
export const deleteWebsite = client =>
get(`${CITY_SERVICE}/OMS.svc/W4_DeleteWebsite?_version=9999`, { client });
get(`${PUBLISH_SERVICE}/WebSite/DeleteWebsite?_version=9999`, { client });
/**
* 获取配置文件下拉选项
*/
export const getAllConfigName = () =>
get(`${CITY_SERVICE}/OMS.svc/W4_GetAllConfigName?_version=9999`);
get(`${PUBLISH_SERVICE}/WebSite/GetAllConfigName?_version=9999`);
export const addWebMenu = param => {
const defaultConfig = { pageUrl: '' };
// eslint-disable-next-line no-return-assign
Object.keys(param).forEach(k => (defaultConfig[k] = param[k]));
return get(`${CITY_SERVICE}/OMS.svc/W4_AddMenu?_version=9999`, defaultConfig);
return get(`${PUBLISH_SERVICE}/WebSite/AddMenu?_version=9999`, defaultConfig);
};
export const editWebMenu = param =>
get(`${CITY_SERVICE}/OMS.svc/W4_EditMenu?_version=9999`, param);
// get(`${CITY_SERVICE}/OMS.svc/W4_EditMenu?_version=9999`, param);
get(`${PUBLISH_SERVICE}/WebSite/EditMenu?_version=9999`, param);
export const pEditWebMenu = param =>
get(`${CITY_SERVICE}/OMS.svc/P_EditMenu?_version=9999`, param);
export const deleteWebMenu = param =>
get(`${CITY_SERVICE}/OMS.svc/W4_DeleteMenu?_version=9999`, param);
get(`${PUBLISH_SERVICE}/WebSite/DeleteMenu?_version=9999`, param);
export const getWebMenuInfo = param =>
get(`${CITY_SERVICE}/OMS.svc/P_GetMenuInfo?_version=9999`, param);
get(`${PUBLISH_SERVICE}/PlatformCenter/GetMenuInfo?_version=9999`, param);
export const saveConfigContent = (fileName, content) =>
post(
......@@ -113,7 +109,7 @@ export const getConfigContent = name =>
// 菜单拖拽
export const dragMenu = params =>
get(`${CITY_SERVICE}/OMS.svc/P_DragMenu`, params);
get(`${PUBLISH_SERVICE}/PlatformCenter/DragMenu`, params);
// 获取产品列表
export const getProductList = params =>
......
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