forked from github/dataease
feat: 动态设置访问路径前缀
This commit is contained in:
parent
7565161c2d
commit
6b190e83ea
@ -7,6 +7,7 @@ import io.dataease.commons.utils.LogUtil;
|
|||||||
import io.dataease.commons.utils.ServletUtils;
|
import io.dataease.commons.utils.ServletUtils;
|
||||||
import io.dataease.service.panel.PanelLinkService;
|
import io.dataease.service.panel.PanelLinkService;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
@ -29,6 +30,9 @@ public class IndexController {
|
|||||||
@Resource
|
@Resource
|
||||||
private PanelLinkService panelLinkService;
|
private PanelLinkService panelLinkService;
|
||||||
|
|
||||||
|
@Value("${server.servlet.context-path:#{null}}")
|
||||||
|
private String contextPath;
|
||||||
|
|
||||||
@GetMapping(value = "/")
|
@GetMapping(value = "/")
|
||||||
public String index() {
|
public String index() {
|
||||||
return "index.html";
|
return "index.html";
|
||||||
@ -52,6 +56,9 @@ public class IndexController {
|
|||||||
} else {
|
} else {
|
||||||
url = panelLinkService.getUrlByUuid(index);
|
url = panelLinkService.getUrlByUuid(index);
|
||||||
}
|
}
|
||||||
|
if (StringUtils.isNotBlank(contextPath)) {
|
||||||
|
url = contextPath + url;
|
||||||
|
}
|
||||||
HttpServletResponse response = ServletUtils.response();
|
HttpServletResponse response = ServletUtils.response();
|
||||||
try {
|
try {
|
||||||
// TODO 增加仪表板外部参数
|
// TODO 增加仪表板外部参数
|
||||||
|
@ -5,3 +5,5 @@ ENV = 'production'
|
|||||||
# VUE_APP_BASE_API = 'http://localhost:8081/'
|
# VUE_APP_BASE_API = 'http://localhost:8081/'
|
||||||
VUE_APP_BASE_API = '/'
|
VUE_APP_BASE_API = '/'
|
||||||
|
|
||||||
|
VUE_CONTEXT_PATH = '/'
|
||||||
|
|
||||||
|
@ -6,3 +6,5 @@ ENV = 'staging'
|
|||||||
# base api
|
# base api
|
||||||
VUE_APP_BASE_API = '/de-api/'
|
VUE_APP_BASE_API = '/de-api/'
|
||||||
|
|
||||||
|
VUE_CONTEXT_PATH = 'de-api/'
|
||||||
|
|
||||||
|
@ -33,7 +33,8 @@
|
|||||||
const user = getQueryVariable('user')
|
const user = getQueryVariable('user')
|
||||||
const terminal = getQueryVariable('terminal')
|
const terminal = getQueryVariable('terminal')
|
||||||
const attachParams = getQueryVariable('attachParams')
|
const attachParams = getQueryVariable('attachParams')
|
||||||
let url = "/#/delink?link=" + encodeURIComponent(link)
|
const baseUrl = window.location.pathname.replace('link.html', '')
|
||||||
|
let url = baseUrl + "#/delink?link=" + encodeURIComponent(link)
|
||||||
if (terminal) {
|
if (terminal) {
|
||||||
url += '&terminal=' + terminal
|
url += '&terminal=' + terminal
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ const port = process.env.port || process.env.npm_config_port || 9528 // dev port
|
|||||||
const parallel = process.env.NODE_ENV === 'development'
|
const parallel = process.env.NODE_ENV === 'development'
|
||||||
module.exports = {
|
module.exports = {
|
||||||
productionSourceMap: false,
|
productionSourceMap: false,
|
||||||
|
publicPath: process.env.VUE_CONTEXT_PATH,
|
||||||
parallel,
|
parallel,
|
||||||
// 使用mock-server
|
// 使用mock-server
|
||||||
devServer: {
|
devServer: {
|
||||||
@ -52,7 +53,6 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
output: process.env.NODE_ENV === 'development' ? {} : {
|
output: process.env.NODE_ENV === 'development' ? {} : {
|
||||||
filename: `js/[name].[contenthash:8].${pkg.version}.js`,
|
filename: `js/[name].[contenthash:8].${pkg.version}.js`,
|
||||||
publicPath: '/',
|
|
||||||
chunkFilename: `js/[name].[contenthash:8].${pkg.version}.js`
|
chunkFilename: `js/[name].[contenthash:8].${pkg.version}.js`
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
|
Loading…
Reference in New Issue
Block a user