diff --git a/backend/pom.xml b/backend/pom.xml
index eb3d1cdf4a..b7de8b16dd 100644
--- a/backend/pom.xml
+++ b/backend/pom.xml
@@ -407,48 +407,74 @@
-
- org.apache.maven.plugins
- maven-antrun-plugin
-
-
-
- main-class-placement
- generate-resources
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- run
-
-
-
-
+
+
+
+ whole
+
+ whole
+
+
+ true
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-antrun-plugin
+
+
+
+ main-class-placement
+ generate-resources
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ run
+
+
+
+
+
+
+
+
+
+ stage
+
+ stage
+
+
+
+
+
pentaho-public
diff --git a/backend/src/main/java/io/dataease/controller/IndexController.java b/backend/src/main/java/io/dataease/controller/IndexController.java
index e2c5128d71..bf8ad7eca0 100644
--- a/backend/src/main/java/io/dataease/controller/IndexController.java
+++ b/backend/src/main/java/io/dataease/controller/IndexController.java
@@ -53,7 +53,7 @@ public class IndexController {
String url;
if (CodingUtil.isNumeric(index)) {
url = panelLinkService.getUrlByIndex(Long.parseLong(index));
- }else {
+ } else {
url = panelLinkService.getUrlByUuid(index);
}
HttpServletResponse response = ServletUtils.response();
@@ -65,8 +65,6 @@ public class IndexController {
}
}
-
-
@GetMapping("/tempMobileLink/{id}/{token}")
public void tempMobileLink(@PathVariable("id") String id, @PathVariable("token") String token) {
String url = "/#preview/" + id;
diff --git a/backend/src/main/java/io/dataease/service/panel/PanelLinkService.java b/backend/src/main/java/io/dataease/service/panel/PanelLinkService.java
index 8325c7591c..65ee577faa 100644
--- a/backend/src/main/java/io/dataease/service/panel/PanelLinkService.java
+++ b/backend/src/main/java/io/dataease/service/panel/PanelLinkService.java
@@ -8,7 +8,6 @@ import io.dataease.base.mapper.PanelGroupMapper;
import io.dataease.base.mapper.PanelLinkMapper;
import io.dataease.base.mapper.PanelLinkMappingMapper;
import io.dataease.base.mapper.ext.ExtPanelLinkMapper;
-import io.dataease.commons.exception.DEException;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.CodingUtil;
import io.dataease.commons.utils.ServletUtils;
@@ -20,6 +19,7 @@ import io.dataease.dto.panel.link.GenerateDto;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -27,7 +27,6 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
-import java.util.Optional;
@Service
public class PanelLinkService {
@@ -36,6 +35,9 @@ public class PanelLinkService {
private static final String USERPARAM = "&user=";
private static final String SHORT_URL_PREFIX = "/link/";
+ @Value("${server.servlet.context-path}")
+ private String contextPath;
+
@Resource
private PanelLinkMapper mapper;
@Resource
@@ -60,7 +62,7 @@ public class PanelLinkService {
panelLinkMappingMapper.updateByExampleSelective(mapping, example);
}
- private PanelLinkExample example(String panelLinkId, Long userId){
+ private PanelLinkExample example(String panelLinkId, Long userId) {
PanelLinkExample example = new PanelLinkExample();
example.createCriteria().andResourceIdEqualTo(panelLinkId).andUserIdEqualTo(userId);
return example;
@@ -88,18 +90,18 @@ public class PanelLinkService {
private PanelLink findOne(String resourceId) {
PanelLinkExample example = new PanelLinkExample();
example.createCriteria().andResourceIdEqualTo(resourceId).andUserIdIsNull();
- List list = mapper.selectByExample(example);
+ List list = mapper.selectByExample(example);
return CollectionUtils.isNotEmpty(list) ? list.get(0) : null;
}
public PanelLink findOne(String resourceId, Long userId) {
- if(userId == null){
+ if (userId == null) {
return findOne(resourceId);
}
List panelLinks = mapper.selectByExample(example(resourceId, userId));
- if(CollectionUtils.isNotEmpty(panelLinks)){
+ if (CollectionUtils.isNotEmpty(panelLinks)) {
return panelLinks.get(0);
- }else {
+ } else {
return null;
}
}
@@ -152,8 +154,8 @@ public class PanelLinkService {
private String buildLinkParam(PanelLink link) {
String linkParam = encrypt(link.getResourceId());
- if(link.getUserId() != null){
- linkParam = linkParam+ USERPARAM + link.getUserId().toString();
+ if (link.getUserId() != null) {
+ linkParam = linkParam + USERPARAM + link.getUserId().toString();
}
return linkParam;
}
@@ -172,7 +174,8 @@ public class PanelLinkService {
public Boolean validateHeads(PanelLink panelLink) throws Exception {
HttpServletRequest request = ServletUtils.request();
String token = request.getHeader("LINK-PWD-TOKEN");
- if (!panelLink.getEnablePwd() || StringUtils.isEmpty(token) || StringUtils.equals("undefined", token) || StringUtils.equals("null", token)) {
+ if (!panelLink.getEnablePwd() || StringUtils.isEmpty(token) || StringUtils.equals("undefined", token)
+ || StringUtils.equals("null", token)) {
String resourceId = panelLink.getResourceId();
String pwd = "dataease";
String tk = JWTUtils.signLink(resourceId, panelLink.getUserId(), pwd);
@@ -181,7 +184,8 @@ public class PanelLinkService {
httpServletResponse.setHeader("LINK-PWD-TOKEN", tk);
return false;
}
- if (StringUtils.isEmpty(panelLink.getPwd())) return false;
+ if (StringUtils.isEmpty(panelLink.getPwd()))
+ return false;
return JWTUtils.verifyLink(token, panelLink.getResourceId(), panelLink.getUserId(), panelLink.getPwd());
}
@@ -218,7 +222,7 @@ public class PanelLinkService {
List mappings = panelLinkMappingMapper.selectByExample(example);
PanelLinkMapping mapping = mappings.get(0);
String uuid = mapping.getUuid();
- return SHORT_URL_PREFIX + (StringUtils.isBlank(uuid) ? mapping.getId() : uuid);
+ return contextPath + SHORT_URL_PREFIX + (StringUtils.isBlank(uuid) ? mapping.getId() : uuid);
}
public String getUrlByIndex(Long index) {
diff --git a/backend/src/main/resources/application-stage.properties b/backend/src/main/resources/application-stage.properties
new file mode 100644
index 0000000000..4e1c3c1d54
--- /dev/null
+++ b/backend/src/main/resources/application-stage.properties
@@ -0,0 +1 @@
+server.servlet.context-path=/de-api
\ No newline at end of file
diff --git a/backend/src/main/resources/application-whole.properties b/backend/src/main/resources/application-whole.properties
new file mode 100644
index 0000000000..99b93b71c8
--- /dev/null
+++ b/backend/src/main/resources/application-whole.properties
@@ -0,0 +1 @@
+server.servlet.context-path=
\ No newline at end of file
diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties
index 4b4a49e919..fdb33ea352 100644
--- a/backend/src/main/resources/application.properties
+++ b/backend/src/main/resources/application.properties
@@ -1,3 +1,4 @@
+spring.profiles.active=@profiles.active@
spring.application.name=dataease
server.port=8081
diff --git a/frontend/.env.staging b/frontend/.env.staging
index a8793a0989..44c8f6dec2 100644
--- a/frontend/.env.staging
+++ b/frontend/.env.staging
@@ -4,5 +4,5 @@ NODE_ENV = production
ENV = 'staging'
# base api
-VUE_APP_BASE_API = '/stage-api'
+VUE_APP_BASE_API = '/de-api/'
diff --git a/frontend/src/utils/request.js b/frontend/src/utils/request.js
index fa250e5cad..dc79cca838 100644
--- a/frontend/src/utils/request.js
+++ b/frontend/src/utils/request.js
@@ -14,7 +14,7 @@ import Cookies from 'js-cookie'
const getTimeOut = () => {
let time = 10
- const url = '/system/requestTimeOut'
+ const url = process.env.VUE_APP_BASE_API + 'system/requestTimeOut'
const xhr = new XMLHttpRequest()
xhr.onreadystatechange = () => {
if (xhr.readyState === 4 && xhr.status === 200) {
diff --git a/mobile/.env.staging b/mobile/.env.staging
new file mode 100644
index 0000000000..44c8f6dec2
--- /dev/null
+++ b/mobile/.env.staging
@@ -0,0 +1,8 @@
+NODE_ENV = production
+
+# just a flag
+ENV = 'staging'
+
+# base api
+VUE_APP_BASE_API = '/de-api/'
+
diff --git a/mobile/package.json b/mobile/package.json
index 73618117cb..d22d55817a 100644
--- a/mobile/package.json
+++ b/mobile/package.json
@@ -5,6 +5,8 @@
"scripts": {
"serve": "npm run dev:h5",
"build": "npm run build:h5",
+ "build:stage": "npm run build:h5:stage",
+ "build:h5:stage": "cross-env NODE_ENV=production UNI_PLATFORM=h5 UNI_OUTPUT_DIR=dist vue-cli-service uni-build --mode staging",
"build:app-plus": "cross-env NODE_ENV=production UNI_PLATFORM=app-plus vue-cli-service uni-build",
"build:custom": "cross-env NODE_ENV=production uniapp-cli custom",
"build:h5": "cross-env NODE_ENV=production UNI_PLATFORM=h5 UNI_OUTPUT_DIR=dist vue-cli-service uni-build",