diff --git a/backend/src/main/java/io/dataease/auth/config/ShiroConfig.java b/backend/src/main/java/io/dataease/auth/config/ShiroConfig.java index a3d6e190de..764aefb3f3 100644 --- a/backend/src/main/java/io/dataease/auth/config/ShiroConfig.java +++ b/backend/src/main/java/io/dataease/auth/config/ShiroConfig.java @@ -51,6 +51,7 @@ public class ShiroConfig { filterMap.put("jwt", new JWTFilter()); filterMap.put("logout", new F2CLogoutFilter()); filterMap.put("link", new F2CLinkFilter()); + filterMap.put("doc", new F2CDocFilter()); factoryBean.setSecurityManager(securityManager); factoryBean.setLoginUrl("/login"); factoryBean.setUnauthorizedUrl("/login"); diff --git a/backend/src/main/java/io/dataease/auth/filter/F2CDocFilter.java b/backend/src/main/java/io/dataease/auth/filter/F2CDocFilter.java new file mode 100644 index 0000000000..022180c4b3 --- /dev/null +++ b/backend/src/main/java/io/dataease/auth/filter/F2CDocFilter.java @@ -0,0 +1,26 @@ +package io.dataease.auth.filter; + +import org.apache.shiro.web.filter.authc.AnonymousFilter; + +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import java.io.IOException; + +public class F2CDocFilter extends AnonymousFilter { + + @Override + protected boolean onPreHandle(ServletRequest request, ServletResponse response, Object mappedValue) { + HttpServletRequest req = (HttpServletRequest) request; + String path = "/deApi"; + try { + req.getRequestDispatcher(path).forward(req, response); + } catch (ServletException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return true; + } +} diff --git a/backend/src/main/java/io/dataease/auth/service/impl/ShiroServiceImpl.java b/backend/src/main/java/io/dataease/auth/service/impl/ShiroServiceImpl.java index a6cdf4ec83..c12a511e21 100644 --- a/backend/src/main/java/io/dataease/auth/service/impl/ShiroServiceImpl.java +++ b/backend/src/main/java/io/dataease/auth/service/impl/ShiroServiceImpl.java @@ -20,7 +20,8 @@ public class ShiroServiceImpl implements ShiroService { // 配置过滤:不会被拦截的链接 -> 放行 start ---------------------------------------------------------- // 放行Swagger2页面,需要放行这些 - filterChainDefinitionMap.put("/doc.html",ANON); + filterChainDefinitionMap.put("/doc.html**","doc"); + filterChainDefinitionMap.put("/deApi**",ANON); filterChainDefinitionMap.put("/swagger-ui.html",ANON); filterChainDefinitionMap.put("/swagger-ui/**",ANON); filterChainDefinitionMap.put("/swagger/**",ANON); diff --git a/backend/src/main/java/io/dataease/controller/IndexController.java b/backend/src/main/java/io/dataease/controller/IndexController.java index 7a48d8f564..19c83d007f 100644 --- a/backend/src/main/java/io/dataease/controller/IndexController.java +++ b/backend/src/main/java/io/dataease/controller/IndexController.java @@ -1,13 +1,21 @@ package io.dataease.controller; +import io.dataease.commons.license.DefaultLicenseService; +import io.dataease.commons.license.F2CLicenseResponse; +import io.dataease.exception.DataEaseException; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; +import javax.annotation.Resource; + @Controller @RequestMapping public class IndexController { + @Resource + private DefaultLicenseService defaultLicenseService; + @GetMapping(value = "/") public String index() { return "index.html"; @@ -28,5 +36,18 @@ public class IndexController { return "test.html"; } + @GetMapping("/deApi") + public String deApi() { + F2CLicenseResponse f2CLicenseResponse = defaultLicenseService.validateLicense(); + switch (f2CLicenseResponse.getStatus()) { + case valid: + return "doc.html"; + default: + // DataEaseException.throwException("Invalid License."); + return "nolic.html"; + } + // return "index.html"; + } + } diff --git a/frontend/public/nolic.html b/frontend/public/nolic.html new file mode 100644 index 0000000000..89f3ecbc52 --- /dev/null +++ b/frontend/public/nolic.html @@ -0,0 +1,13 @@ + + + + + + + + DataEase + + +
+ + diff --git a/frontend/src/nolic/Nolic.vue b/frontend/src/nolic/Nolic.vue new file mode 100644 index 0000000000..3824ab98da --- /dev/null +++ b/frontend/src/nolic/Nolic.vue @@ -0,0 +1,16 @@ + + + diff --git a/frontend/src/nolic/nolic-router.js b/frontend/src/nolic/nolic-router.js new file mode 100644 index 0000000000..4730048019 --- /dev/null +++ b/frontend/src/nolic/nolic-router.js @@ -0,0 +1,17 @@ +import Vue from 'vue' +import Router from 'vue-router' + +Vue.use(Router) + +export default new Router({ + routes: [ + { + path: '/', + name: 'home', + component: () => import('../views/nolic/index.vue'), + meta: { + title: '首页' + } + } + ] +}) diff --git a/frontend/src/nolic/nolic.js b/frontend/src/nolic/nolic.js new file mode 100644 index 0000000000..f3110de5ae --- /dev/null +++ b/frontend/src/nolic/nolic.js @@ -0,0 +1,26 @@ +import Vue from 'vue' +import Nolic from './Nolic.vue' +import router from './nolic-router' +import store from '../store' +import '@/styles/index.scss' // global css +import i18n from '../lang' // internationalization +import ElementUI from 'element-ui' +import '@/components/canvas/custom-component' // 注册自定义组件 +import widgets from '@/components/widget' +import * as echarts from 'echarts' +import UmyUi from 'umy-ui' + +Vue.use(UmyUi) +Vue.prototype.$echarts = echarts +Vue.config.productionTip = false +Vue.use(widgets) +Vue.use(ElementUI, { + + i18n: (key, value) => i18n.t(key, value) +}) +new Vue({ + router, + store, + i18n, + render: h => h(Nolic) +}).$mount('#nolic') diff --git a/frontend/src/views/nolic/index.vue b/frontend/src/views/nolic/index.vue new file mode 100644 index 0000000000..0ce8caa15f --- /dev/null +++ b/frontend/src/views/nolic/index.vue @@ -0,0 +1,9 @@ + + + diff --git a/frontend/vue.config.js b/frontend/vue.config.js index 1fbffca388..8005c12a4a 100644 --- a/frontend/vue.config.js +++ b/frontend/vue.config.js @@ -40,6 +40,11 @@ module.exports = { entry: 'src/link/link.js', template: 'public/link.html', filename: 'link.html' + }, + nolic: { + entry: 'src/nolic/nolic.js', + template: 'public/nolic.html', + filename: 'nolic.html' } }, configureWebpack: {