mirror of
https://github.com/dataease/dataease.git
synced 2025-02-25 03:52:59 +08:00
feat: 包装api接口文档
This commit is contained in:
parent
92c2cbd7a8
commit
99aac19d46
@ -51,6 +51,7 @@ public class ShiroConfig {
|
|||||||
filterMap.put("jwt", new JWTFilter());
|
filterMap.put("jwt", new JWTFilter());
|
||||||
filterMap.put("logout", new F2CLogoutFilter());
|
filterMap.put("logout", new F2CLogoutFilter());
|
||||||
filterMap.put("link", new F2CLinkFilter());
|
filterMap.put("link", new F2CLinkFilter());
|
||||||
|
filterMap.put("doc", new F2CDocFilter());
|
||||||
factoryBean.setSecurityManager(securityManager);
|
factoryBean.setSecurityManager(securityManager);
|
||||||
factoryBean.setLoginUrl("/login");
|
factoryBean.setLoginUrl("/login");
|
||||||
factoryBean.setUnauthorizedUrl("/login");
|
factoryBean.setUnauthorizedUrl("/login");
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -20,7 +20,8 @@ public class ShiroServiceImpl implements ShiroService {
|
|||||||
// 配置过滤:不会被拦截的链接 -> 放行 start ----------------------------------------------------------
|
// 配置过滤:不会被拦截的链接 -> 放行 start ----------------------------------------------------------
|
||||||
// 放行Swagger2页面,需要放行这些
|
// 放行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.html",ANON);
|
||||||
filterChainDefinitionMap.put("/swagger-ui/**",ANON);
|
filterChainDefinitionMap.put("/swagger-ui/**",ANON);
|
||||||
filterChainDefinitionMap.put("/swagger/**",ANON);
|
filterChainDefinitionMap.put("/swagger/**",ANON);
|
||||||
|
@ -1,13 +1,21 @@
|
|||||||
package io.dataease.controller;
|
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.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping
|
@RequestMapping
|
||||||
public class IndexController {
|
public class IndexController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DefaultLicenseService defaultLicenseService;
|
||||||
|
|
||||||
@GetMapping(value = "/")
|
@GetMapping(value = "/")
|
||||||
public String index() {
|
public String index() {
|
||||||
return "index.html";
|
return "index.html";
|
||||||
@ -28,5 +36,18 @@ public class IndexController {
|
|||||||
return "test.html";
|
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";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
13
frontend/public/nolic.html
Normal file
13
frontend/public/nolic.html
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||||
|
<link rel="shortcut icon" href="<%= BASE_URL %>favicon.ico">
|
||||||
|
<title>DataEase</title>
|
||||||
|
</head>
|
||||||
|
<body style="height: 100%;">
|
||||||
|
<div id="nolic"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
16
frontend/src/nolic/Nolic.vue
Normal file
16
frontend/src/nolic/Nolic.vue
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<template>
|
||||||
|
<div id="nolic" style="height:100%;">
|
||||||
|
<router-view />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
17
frontend/src/nolic/nolic-router.js
Normal file
17
frontend/src/nolic/nolic-router.js
Normal file
@ -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: '首页'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
26
frontend/src/nolic/nolic.js
Normal file
26
frontend/src/nolic/nolic.js
Normal file
@ -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')
|
9
frontend/src/views/nolic/index.vue
Normal file
9
frontend/src/views/nolic/index.vue
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<template>
|
||||||
|
<div>缺少许可</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
@ -40,6 +40,11 @@ module.exports = {
|
|||||||
entry: 'src/link/link.js',
|
entry: 'src/link/link.js',
|
||||||
template: 'public/link.html',
|
template: 'public/link.html',
|
||||||
filename: 'link.html'
|
filename: 'link.html'
|
||||||
|
},
|
||||||
|
nolic: {
|
||||||
|
entry: 'src/nolic/nolic.js',
|
||||||
|
template: 'public/nolic.html',
|
||||||
|
filename: 'nolic.html'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
configureWebpack: {
|
configureWebpack: {
|
||||||
|
Loading…
Reference in New Issue
Block a user