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

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

上级 5c89fa3c
......@@ -24,8 +24,9 @@ module.exports = {
'menu-dark-bg': '#404040',
"layout-header-padding": "0",
},
publicPath: "/bm",
define: {
contextPath: "bg"
contextPath: "/bm"
},
"env": {
"development": {
......
......@@ -113,7 +113,7 @@ function RouterConfig({ history, app }) {
require.ensure([], (require) => {
registerModel(app, require('./models/login'));
cb(null, require('./routes/login'));
}, 'login');
}, '/login');
},
},
{
......@@ -123,7 +123,7 @@ function RouterConfig({ history, app }) {
require.ensure([], (require) => {
registerModel(app, require('./models/domain'));
cb(null, require('./routes/domain'));
}, 'domain');
}, '/domain');
},
},
{
......@@ -133,7 +133,7 @@ function RouterConfig({ history, app }) {
require.ensure([], (require) => {
registerModel(app, require('./models/main'));
cb(null, require('./routes/main'));
}, 'main');
}, '/main');
},
getChildRoutes: (nextState, cb) => {
getMenus()
......
import request from '../utils/request';
import config from '../utils/config';
export async function countTasks(filters = []) {
return request('/api/bpm/task/all/count', filters);
return request(`${config.contextPath}/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('/api/bpm/task/all/info', queryParams);
return request(`${config.contextPath}/api/bpm/task/all/info`, queryParams);
}
......@@ -3,6 +3,7 @@ import request from '../utils/request';
import post from '../utils/post';
import { normParams } from '../utils/http-helper';
import { split } from '../utils/filter';
import config from '../utils/config';
const parseFilters = filtersIn => (filtersIn || []).filter(({ filter }) => !!filter).map(({ key, filter }) => [
split(key, false).map(value => `f-${value}`).join('|'),
......@@ -65,23 +66,23 @@ const makeParams = (otherParams, { filters = [], sortBys = [], sortTypes = [], p
};
export async function calcGlobalDatasource(name, { pst, psz, filters = [], sortBys = [], sortTypes = [], params = {}, dmPath }) {
return request(`/api/datasource/${name}`, makeParams({ pst, psz, dmPath }, { filters, sortBys, sortTypes, params }));
return request(`${config.contextPath}/api/datasource/${name}`, makeParams({ pst, psz, dmPath }, { filters, sortBys, sortTypes, params }));
}
export async function countGlobalDatasource(name, { filters = [], params = {}, dmPath }) {
return request(`/api/datasource/${name}/count`, makeParams({ dmPath }, { filters, params }));
return request(`${config.contextPath}/api/datasource/${name}/count`, makeParams({ dmPath }, { filters, params }));
}
export async function cursorGlobalDatasource(name, key, params = {}, dmPath) {
return request(`/api/datasource/${name}/cursor`, makeParams({ key, dmPath }, { params }));
return request(`${config.contextPath}/api/datasource/${name}/cursor`, makeParams({ key, dmPath }, { params }));
}
export async function validateUpdateGlobalDatasource(name, key, params = {}, dmPath) {
return request(`/api/datasource/${name}/update/validate`, makeParams({ key, dmPath }, { params }));
return request(`${config.contextPath}/api/datasource/${name}/update/validate`, makeParams({ key, dmPath }, { params }));
}
export async function updateGlobalDatasource(name, key, params = {}, dmPath) {
return post(`/api/datasource/${name}/update`, {
return post(`${config.contextPath}/api/datasource/${name}/update`, {
key,
params,
dmPath,
......@@ -89,22 +90,22 @@ export async function updateGlobalDatasource(name, key, params = {}, dmPath) {
}
export async function validateCreateGlobalDatasource(name, params = {}, dmPath) {
return request(`/api/datasource/${name}/create/validate`, makeParams({ dmPath }, { params }));
return request(`${config.contextPath}/api/datasource/${name}/create/validate`, makeParams({ dmPath }, { params }));
}
export async function createGlobalDatasource(name, params = {}, dmPath) {
return post(`/api/datasource/${name}/create`, {
return post(`${config.contextPath}/api/datasource/${name}/create`, {
params,
dmPath,
});
}
export async function validateRemoveGlobalDatasource(name, key, params = {}, dmPath) {
return request(`/api/datasource/${name}/remove/validate`, makeParams({ key, dmPath }, { params }));
return request(`${config.contextPath}/api/datasource/${name}/remove/validate`, makeParams({ key, dmPath }, { params }));
}
export async function removeGlobalDatasource(name, key, params = {}, dmPath) {
return post(`/api/datasource/${name}/remove`, {
return post(`${config.contextPath}/api/datasource/${name}/remove`, {
key,
params,
dmPath,
......@@ -112,27 +113,27 @@ export async function removeGlobalDatasource(name, key, params = {}, dmPath) {
}
export async function getGlobalDatasourceMeta(name) {
return request(`/api/datasource/${name}/meta`);
return request(`${config.contextPath}/api/datasource/${name}/meta`);
}
export async function calcModuleDatasource(mdName, dsName, { pst, psz, filters = [], sortBys = [], sortTypes = [], params = {}, dmPath }) {
return request(`/api/module/user/${mdName}/datasource/${dsName}`, makeParams({ pst, psz, dmPath }, { filters, sortBys, sortTypes, params }));
return request(`${config.contextPath}/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(`/api/module/user/${mdName}/datasource/${dsName}/count`, makeParams({ dmPath }, { filters, params }));
return request(`${config.contextPath}/api/module/user/${mdName}/datasource/${dsName}/count`, makeParams({ dmPath }, { filters, params }));
}
export async function cursorModuleDatasource(mdName, dsName, key, params = {}, dmPath) {
return request(`/api/module/user/${mdName}/datasource/${dsName}/cursor`, makeParams({ key, dmPath }, { params }));
return request(`${config.contextPath}/api/module/user/${mdName}/datasource/${dsName}/cursor`, makeParams({ key, dmPath }, { params }));
}
export async function validateUpdateModuleDatasource(mdName, dsName, key, params = {}, dmPath) {
return request(`/api/module/user/${mdName}/datasource/${dsName}/update/validate`, makeParams({ key, dmPath }, { params }));
return request(`${config.contextPath}/api/module/user/${mdName}/datasource/${dsName}/update/validate`, makeParams({ key, dmPath }, { params }));
}
export async function updateModuleDatasource(mdName, dsName, key, params = {}, dmPath) {
return post(`/api/module/user/${mdName}/datasource/${dsName}/update`, {
return post(`${config.contextPath}/api/module/user/${mdName}/datasource/${dsName}/update`, {
key,
params,
dmPath,
......@@ -140,22 +141,22 @@ export async function updateModuleDatasource(mdName, dsName, key, params = {}, d
}
export async function validateCreateModuleDatasource(mdName, dsName, params = {}, dmPath) {
return request(`/api/module/user/${mdName}/datasource/${dsName}/create/validate`, makeParams({ dmPath }, { params }));
return request(`${config.contextPath}/api/module/user/${mdName}/datasource/${dsName}/create/validate`, makeParams({ dmPath }, { params }));
}
export async function createModuleDatasource(mdName, dsName, params = {}, dmPath) {
return post(`/api/module/user/${mdName}/datasource/${dsName}/create`, {
return post(`${config.contextPath}/api/module/user/${mdName}/datasource/${dsName}/create`, {
params,
dmPath,
});
}
export async function validateRemoveModuleDatasource(mdName, dsName, key, params = {}, dmPath) {
return request(`/api/module/user/${mdName}/datasource/${dsName}/remove/validate`, makeParams({ key, dmPath }, { params }));
return request(`${config.contextPath}/api/module/user/${mdName}/datasource/${dsName}/remove/validate`, makeParams({ key, dmPath }, { params }));
}
export async function removeModuleDatasource(mdName, dsName, key, params = {}, dmPath) {
return post(`/api/module/user/${mdName}/datasource/${dsName}/remove`, {
return post(`${config.contextPath}/api/module/user/${mdName}/datasource/${dsName}/remove`, {
key,
params,
dmPath,
......@@ -163,6 +164,6 @@ export async function removeModuleDatasource(mdName, dsName, key, params = {}, d
}
export async function getModuleDatasourceMeta(mdName, dsName) {
return request(`/api/module/user/${mdName}/datasource/${dsName}/meta`);
return request(`${config.contextPath}/api/module/user/${mdName}/datasource/${dsName}/meta`);
}
/* eslint-disable no-param-reassign */
import request from '../utils/request';
import post from '../utils/post';
import { cookie } from '../utils/config';
import config, { cookie } from '../utils/config';
import { getCookie } from '../utils/helper';
export async function fetchDomains(basePath, withRoot = false) {
......@@ -27,9 +27,9 @@ export async function fetchDomains(basePath, withRoot = false) {
}
export async function switchDomain(path) {
return post('/api/domain/user/path', { dmPath: path });
return post(`${config.contextPath}/api/domain/user/path`, { dmPath: path });
}
export async function currentDomain() {
return request('/api/domain/user/info');
return request(`${config.contextPath}/api/domain/user/info`);
}
import Fingerprint from 'fingerprintjs';
import post from '../utils/post';
import request from '../utils/request';
import config from '../utils/config';
export async function login(payload) {
const data = {};
......@@ -20,9 +22,9 @@ export async function login(payload) {
productId: 'big-machine-web-front',
deviceId: `${new Fingerprint({ ie_activex: true }).get()}`,
};
return post('/api/auth/login', data, {}, {}, false);
return post(`${config.contextPath}/api/auth/login`, data, {}, {}, false);
}
export async function userInfo() {
return request('/api/user/info');
return request(`${config.contextPath}/api/user/info`);
}
import post from '../utils/post';
import config from '../utils/config';
export async function logout() {
return post('/api/auth/logout');
return post(`${config.contextPath}/api/auth/logout`);
}
import request from '../utils/request';
import config from '../utils/config';
export async function fetchMenus() {
return request('/api/configure/user/menus');
return request(`${config.contextPath}/api/configure/user/menus`);
}
export async function fetchModuleInfos() {
return request('/api/module/user/info');
return request(`${config.contextPath}/api/module/user/info`);
}
export async function fetchModuleLayout(name) {
return request(`/api/module/user/${name}/layout`);
return request(`${config.contextPath}/api/module/user/${name}/layout`);
}
......@@ -2,6 +2,7 @@ import _, { partial } from 'lodash';
import request from '../utils/request';
import post from '../utils/post';
import doDelete from '../utils/delete';
import config from '../utils/config';
// noinspection JSUnusedGlobalSymbols
export const templateApi = (dmPath) => {
......@@ -21,37 +22,37 @@ export const templateApi = (dmPath) => {
};
export async function getAllAdminTemplateInfoes(dmPath) {
return request('/api/template/admin/info', { dmPath });
return request(`${config.contextPath}/api/template/admin/info`, { dmPath });
}
export async function getAdminTemplateInfo(name, dmPath) {
return request(`/api/template/admin/${encodeURIComponent(name)}/info`, { dmPath });
return request(`${config.contextPath}/api/template/admin/${encodeURIComponent(name)}/info`, { dmPath });
}
export async function getAdminTemplateConfigure(name, dmPath) {
return request(`/api/template/admin/${encodeURIComponent(name)}/configure`, { dmPath });
return request(`${config.contextPath}/api/template/admin/${encodeURIComponent(name)}/configure`, { dmPath });
}
export async function getAdminTemplatePlainConfigure(name, dmPath) {
return request(`/api/template/admin/${encodeURIComponent(name)}/plainConfigure`, { dmPath });
return request(`${config.contextPath}/api/template/admin/${encodeURIComponent(name)}/plainConfigure`, { dmPath });
}
export async function setAdminTemplateConfigure(name, configure, dmPath) {
return post(`/api/template/admin/${encodeURIComponent(name)}/configure`, { configure, dmPath });
return post(`${config.contextPath}/api/template/admin/${encodeURIComponent(name)}/configure`, { configure, dmPath });
}
export async function removeAdminTemplateConfigure(name, dmPath) {
return doDelete(`/api/template/admin/${encodeURIComponent(name)}/configure`, { dmPath });
return doDelete(`${config.contextPath}/api/template/admin/${encodeURIComponent(name)}/configure`, { dmPath });
}
export async function setAdminTemplateTemplate(name, uri, dmPath) {
return post(`/api/template/admin/${encodeURIComponent(name)}/template`, { uri, dmPath });
return post(`${config.contextPath}/api/template/admin/${encodeURIComponent(name)}/template`, { uri, dmPath });
}
export async function getAdminTemplateTemplate(name, dmPath) {
return request(`/api/template/admin/${encodeURIComponent(name)}/template`, { dmPath });
return request(`${config.contextPath}/api/template/admin/${encodeURIComponent(name)}/template`, { dmPath });
}
export async function adminRender(name, params, mediaType, dmPath) {
return post(`/api/template/admin/${encodeURIComponent(name)}/render`, { dmPath, mediaType, params });
return post(`${config.contextPath}/api/template/admin/${encodeURIComponent(name)}/render`, { dmPath, mediaType, params });
}
......@@ -34,11 +34,14 @@ const defaultDateFormat = 'YYYY-MM-DD';
const defaultTimeFormat = 'HH:mm:ss';
const defaultDateTimeFormat = `${defaultDateFormat} ${defaultTimeFormat}`;
// eslint-disable-next-line no-underscore-dangle
const _contextPath = process.env.NODE_ENV === 'development' ? '' : contextPath;
const config = {
name: 'Jbpm Demo',
footerText: '上海铂蓝信息科技有限公司',
logo: '/logo.png',
contextPath: process.env.NODE_ENV === 'development' ? '' : contextPath,
logo: `${_contextPath}/logo.png`,
contextPath: _contextPath,
defaultDateFormat,
defaultTimeFormat,
defaultDateTimeFormat,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论