提交 f93cd135 authored 作者: vipcxj's avatar vipcxj

fix:修复导致生产环境的路径相关问题

上级 f386bea9
......@@ -46,7 +46,8 @@ module.exports = {
"production": {
publicPath: "/bm/",
define: {
contextPath: "/bm"
contextPath: "/bm",
apiContextPath: "/bm"
},
"extraBabelPlugins": [
"transform-runtime",
......
......@@ -2,12 +2,12 @@ import request from '../utils/request';
import config from '../utils/config';
export async function countTasks(filters = []) {
return request(`${config.contextPath}/api/bpm/task/all/count`, filters);
return request(`${config.apiContextPath}/api/bpm/task/all/count`, filters);
}
export async function fetchTasks({ pst, psz, filters }) {
const queryParams = [...filters];
queryParams.push(['pst', pst]);
queryParams.push(['psz', psz]);
return request(`${config.contextPath}/api/bpm/task/all/info`, queryParams);
return request(`${config.apiContextPath}/api/bpm/task/all/info`, queryParams);
}
......@@ -66,23 +66,23 @@ const makeParams = (otherParams, { filters = [], sortBys = [], sortTypes = [], p
};
export async function calcGlobalDatasource(name, { pst, psz, filters = [], sortBys = [], sortTypes = [], params = {}, dmPath }) {
return request(`${config.contextPath}/api/datasource/${name}`, makeParams({ pst, psz, dmPath }, { filters, sortBys, sortTypes, params }));
return request(`${config.apiContextPath}/api/datasource/${name}`, makeParams({ pst, psz, dmPath }, { filters, sortBys, sortTypes, params }));
}
export async function countGlobalDatasource(name, { filters = [], params = {}, dmPath }) {
return request(`${config.contextPath}/api/datasource/${name}/count`, makeParams({ dmPath }, { filters, params }));
return request(`${config.apiContextPath}/api/datasource/${name}/count`, makeParams({ dmPath }, { filters, params }));
}
export async function cursorGlobalDatasource(name, key, params = {}, dmPath) {
return request(`${config.contextPath}/api/datasource/${name}/cursor`, makeParams({ key, dmPath }, { params }));
return request(`${config.apiContextPath}/api/datasource/${name}/cursor`, makeParams({ key, dmPath }, { params }));
}
export async function validateUpdateGlobalDatasource(name, key, params = {}, dmPath) {
return request(`${config.contextPath}/api/datasource/${name}/update/validate`, makeParams({ key, dmPath }, { params }));
return request(`${config.apiContextPath}/api/datasource/${name}/update/validate`, makeParams({ key, dmPath }, { params }));
}
export async function updateGlobalDatasource(name, key, params = {}, dmPath) {
return post(`${config.contextPath}/api/datasource/${name}/update`, {
return post(`${config.apiContextPath}/api/datasource/${name}/update`, {
key,
params,
dmPath,
......@@ -90,22 +90,22 @@ export async function updateGlobalDatasource(name, key, params = {}, dmPath) {
}
export async function validateCreateGlobalDatasource(name, params = {}, dmPath) {
return request(`${config.contextPath}/api/datasource/${name}/create/validate`, makeParams({ dmPath }, { params }));
return request(`${config.apiContextPath}/api/datasource/${name}/create/validate`, makeParams({ dmPath }, { params }));
}
export async function createGlobalDatasource(name, params = {}, dmPath) {
return post(`${config.contextPath}/api/datasource/${name}/create`, {
return post(`${config.apiContextPath}/api/datasource/${name}/create`, {
params,
dmPath,
});
}
export async function validateRemoveGlobalDatasource(name, key, params = {}, dmPath) {
return request(`${config.contextPath}/api/datasource/${name}/remove/validate`, makeParams({ key, dmPath }, { params }));
return request(`${config.apiContextPath}/api/datasource/${name}/remove/validate`, makeParams({ key, dmPath }, { params }));
}
export async function removeGlobalDatasource(name, key, params = {}, dmPath) {
return post(`${config.contextPath}/api/datasource/${name}/remove`, {
return post(`${config.apiContextPath}/api/datasource/${name}/remove`, {
key,
params,
dmPath,
......@@ -113,27 +113,27 @@ export async function removeGlobalDatasource(name, key, params = {}, dmPath) {
}
export async function getGlobalDatasourceMeta(name) {
return request(`${config.contextPath}/api/datasource/${name}/meta`);
return request(`${config.apiContextPath}/api/datasource/${name}/meta`);
}
export async function calcModuleDatasource(mdName, dsName, { pst, psz, filters = [], sortBys = [], sortTypes = [], params = {}, dmPath }) {
return request(`${config.contextPath}/api/module/user/${mdName}/datasource/${dsName}`, makeParams({ pst, psz, dmPath }, { filters, sortBys, sortTypes, params }));
return request(`${config.apiContextPath}/api/module/user/${mdName}/datasource/${dsName}`, makeParams({ pst, psz, dmPath }, { filters, sortBys, sortTypes, params }));
}
export async function countModuleDatasource(mdName, dsName, { filters = [], params = {}, dmPath }) {
return request(`${config.contextPath}/api/module/user/${mdName}/datasource/${dsName}/count`, makeParams({ dmPath }, { filters, params }));
return request(`${config.apiContextPath}/api/module/user/${mdName}/datasource/${dsName}/count`, makeParams({ dmPath }, { filters, params }));
}
export async function cursorModuleDatasource(mdName, dsName, key, params = {}, dmPath) {
return request(`${config.contextPath}/api/module/user/${mdName}/datasource/${dsName}/cursor`, makeParams({ key, dmPath }, { params }));
return request(`${config.apiContextPath}/api/module/user/${mdName}/datasource/${dsName}/cursor`, makeParams({ key, dmPath }, { params }));
}
export async function validateUpdateModuleDatasource(mdName, dsName, key, params = {}, dmPath) {
return request(`${config.contextPath}/api/module/user/${mdName}/datasource/${dsName}/update/validate`, makeParams({ key, dmPath }, { params }));
return request(`${config.apiContextPath}/api/module/user/${mdName}/datasource/${dsName}/update/validate`, makeParams({ key, dmPath }, { params }));
}
export async function updateModuleDatasource(mdName, dsName, key, params = {}, dmPath) {
return post(`${config.contextPath}/api/module/user/${mdName}/datasource/${dsName}/update`, {
return post(`${config.apiContextPath}/api/module/user/${mdName}/datasource/${dsName}/update`, {
key,
params,
dmPath,
......@@ -141,22 +141,22 @@ export async function updateModuleDatasource(mdName, dsName, key, params = {}, d
}
export async function validateCreateModuleDatasource(mdName, dsName, params = {}, dmPath) {
return request(`${config.contextPath}/api/module/user/${mdName}/datasource/${dsName}/create/validate`, makeParams({ dmPath }, { params }));
return request(`${config.apiContextPath}/api/module/user/${mdName}/datasource/${dsName}/create/validate`, makeParams({ dmPath }, { params }));
}
export async function createModuleDatasource(mdName, dsName, params = {}, dmPath) {
return post(`${config.contextPath}/api/module/user/${mdName}/datasource/${dsName}/create`, {
return post(`${config.apiContextPath}/api/module/user/${mdName}/datasource/${dsName}/create`, {
params,
dmPath,
});
}
export async function validateRemoveModuleDatasource(mdName, dsName, key, params = {}, dmPath) {
return request(`${config.contextPath}/api/module/user/${mdName}/datasource/${dsName}/remove/validate`, makeParams({ key, dmPath }, { params }));
return request(`${config.apiContextPath}/api/module/user/${mdName}/datasource/${dsName}/remove/validate`, makeParams({ key, dmPath }, { params }));
}
export async function removeModuleDatasource(mdName, dsName, key, params = {}, dmPath) {
return post(`${config.contextPath}/api/module/user/${mdName}/datasource/${dsName}/remove`, {
return post(`${config.apiContextPath}/api/module/user/${mdName}/datasource/${dsName}/remove`, {
key,
params,
dmPath,
......@@ -164,6 +164,6 @@ export async function removeModuleDatasource(mdName, dsName, key, params = {}, d
}
export async function getModuleDatasourceMeta(mdName, dsName) {
return request(`${config.contextPath}/api/module/user/${mdName}/datasource/${dsName}/meta`);
return request(`${config.apiContextPath}/api/module/user/${mdName}/datasource/${dsName}/meta`);
}
......@@ -8,8 +8,8 @@ export async function fetchDomains(basePath, withRoot = false) {
if (!basePath) {
basePath = getCookie(cookie.domainPath);
}
const rootDomainInfo = withRoot ? await request(`${config.contextPath}/api/domain/user/info`, { dmPath: basePath }) : null;
const childrenDomainInfoList = await request(`${config.contextPath}/api/domain/user/children-info`, { dmPath: basePath });
const rootDomainInfo = withRoot ? await request(`${config.apiContextPath}/api/domain/user/info`, { dmPath: basePath }) : null;
const childrenDomainInfoList = await request(`${config.apiContextPath}/api/domain/user/children-info`, { dmPath: basePath });
let infoList;
if (rootDomainInfo && childrenDomainInfoList) {
infoList = [
......@@ -27,9 +27,9 @@ export async function fetchDomains(basePath, withRoot = false) {
}
export async function switchDomain(path) {
return post(`${config.contextPath}/api/domain/user/path`, { dmPath: path });
return post(`${config.apiContextPath}/api/domain/user/path`, { dmPath: path });
}
export async function currentDomain() {
return request(`${config.contextPath}/api/domain/user/info`);
return request(`${config.apiContextPath}/api/domain/user/info`);
}
......@@ -22,9 +22,9 @@ export async function login(payload) {
productId: 'big-machine-web-front',
deviceId: `${new Fingerprint({ ie_activex: true }).get()}`,
};
return post(`${config.contextPath}/api/auth/login`, data, {}, {}, false);
return post(`${config.apiContextPath}/api/auth/login`, data, {}, {}, false);
}
export async function userInfo() {
return request(`${config.contextPath}/api/user/info`);
return request(`${config.apiContextPath}/api/user/info`);
}
......@@ -2,5 +2,5 @@ import post from '../utils/post';
import config from '../utils/config';
export async function logout() {
return post(`${config.contextPath}/api/auth/logout`);
return post(`${config.apiContextPath}/api/auth/logout`);
}
......@@ -2,13 +2,13 @@ import request from '../utils/request';
import config from '../utils/config';
export async function fetchMenus() {
return request(`${config.contextPath}/api/configure/user/menus`);
return request(`${config.apiContextPath}/api/configure/user/menus`);
}
export async function fetchModuleInfos() {
return request(`${config.contextPath}/api/module/user/info`);
return request(`${config.apiContextPath}/api/module/user/info`);
}
export async function fetchModuleLayout(name) {
return request(`${config.contextPath}/api/module/user/${name}/layout`);
return request(`${config.apiContextPath}/api/module/user/${name}/layout`);
}
......@@ -22,37 +22,37 @@ export const templateApi = (dmPath) => {
};
export async function getAllAdminTemplateInfoes(dmPath) {
return request(`${config.contextPath}/api/template/admin/info`, { dmPath });
return request(`${config.apiContextPath}/api/template/admin/info`, { dmPath });
}
export async function getAdminTemplateInfo(name, dmPath) {
return request(`${config.contextPath}/api/template/admin/${encodeURIComponent(name)}/info`, { dmPath });
return request(`${config.apiContextPath}/api/template/admin/${encodeURIComponent(name)}/info`, { dmPath });
}
export async function getAdminTemplateConfigure(name, dmPath) {
return request(`${config.contextPath}/api/template/admin/${encodeURIComponent(name)}/configure`, { dmPath });
return request(`${config.apiContextPath}/api/template/admin/${encodeURIComponent(name)}/configure`, { dmPath });
}
export async function getAdminTemplatePlainConfigure(name, dmPath) {
return request(`${config.contextPath}/api/template/admin/${encodeURIComponent(name)}/plainConfigure`, { dmPath });
return request(`${config.apiContextPath}/api/template/admin/${encodeURIComponent(name)}/plainConfigure`, { dmPath });
}
export async function setAdminTemplateConfigure(name, configure, dmPath) {
return post(`${config.contextPath}/api/template/admin/${encodeURIComponent(name)}/configure`, { configure, dmPath });
return post(`${config.apiContextPath}/api/template/admin/${encodeURIComponent(name)}/configure`, { configure, dmPath });
}
export async function removeAdminTemplateConfigure(name, dmPath) {
return doDelete(`${config.contextPath}/api/template/admin/${encodeURIComponent(name)}/configure`, { dmPath });
return doDelete(`${config.apiContextPath}/api/template/admin/${encodeURIComponent(name)}/configure`, { dmPath });
}
export async function setAdminTemplateTemplate(name, uri, dmPath) {
return post(`${config.contextPath}/api/template/admin/${encodeURIComponent(name)}/template`, { uri, dmPath });
return post(`${config.apiContextPath}/api/template/admin/${encodeURIComponent(name)}/template`, { uri, dmPath });
}
export async function getAdminTemplateTemplate(name, dmPath) {
return request(`${config.contextPath}/api/template/admin/${encodeURIComponent(name)}/template`, { dmPath });
return request(`${config.apiContextPath}/api/template/admin/${encodeURIComponent(name)}/template`, { dmPath });
}
export async function adminRender(name, params, mediaType, dmPath) {
return post(`${config.contextPath}/api/template/admin/${encodeURIComponent(name)}/render`, { dmPath, mediaType, params });
return post(`${config.apiContextPath}/api/template/admin/${encodeURIComponent(name)}/render`, { dmPath, mediaType, params });
}
......@@ -34,6 +34,8 @@ const defaultDateFormat = 'YYYY-MM-DD';
const defaultTimeFormat = 'HH:mm:ss';
const defaultDateTimeFormat = `${defaultDateFormat} ${defaultTimeFormat}`;
// eslint-disable-next-line no-underscore-dangle
const _apiContextPath = process.env.NODE_ENV === 'development' ? '' : apiContextPath;
// eslint-disable-next-line no-underscore-dangle
const _contextPath = process.env.NODE_ENV === 'development' ? '' : contextPath;
......@@ -42,6 +44,7 @@ const config = {
footerText: '上海铂蓝信息科技有限公司',
logo: `${_contextPath}/logo.png`,
contextPath: _contextPath,
apiContextPath: _apiContextPath,
defaultDateFormat,
defaultTimeFormat,
defaultDateTimeFormat,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论