master
wangbing 5 years ago
parent cd06fce8a0
commit 9aaa908292

@ -211,16 +211,24 @@ public class SpringBootCallable implements Callable {
File control = new File(root.getAbsolutePath(), "control");
control.mkdirs();
File ajax = new File(root.getAbsolutePath(), "ajax");
ajax.mkdirs();
File auth = new File(root.getAbsolutePath(), "auth");
auth.mkdirs();
File screen = new File(root.getAbsolutePath(), "screen");
screen.mkdirs();
freeMarkerManager.outputTemp(new File(control.getAbsolutePath(), "Footer.java"), option + "/java/action/control/Footer.java", ctx);
freeMarkerManager.outputTemp(new File(control.getAbsolutePath(), "Header.java"), option + "/java/action/control/Header.java", ctx);
File screen = new File(root.getAbsolutePath(), "screen");
screen.mkdirs();
freeMarkerManager.outputTemp(new File(ajax.getAbsolutePath(), "AuthAjax.java"), option + "/java/action/ajax/system/AuthAjax.java", ctx);
freeMarkerManager.outputTemp(new File(screen.getAbsolutePath(), "Index.java"), option + "/java/action/screen/Index.java", ctx);
freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "GlobalController.java"), option + "/java/action/GlobalController.ftl", ctx);
freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "GlobalController.java"), option + "/java/action/GlobalController.java", ctx);
freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "AjaxController.java"), option + "/java/action/AjaxController.ftl", ctx);
// freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "AjaxController.java"), option + "/java/action/AjaxController.java", ctx);
}
public void generateConfig(File root, Project project, DataBase dataBase, String option) {
@ -236,6 +244,7 @@ public class SpringBootCallable implements Callable {
//config
freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "ActionConfig.java"), option + "/java/config/ActionConfig.java", ctx);
freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "FreeMarkerConfig.java"), option + "/java/config/FreeMarkerConfig.java", ctx);
freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "SecurityConfig.java"), option + "/java/config/SecurityConfig.java", ctx);
freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "TaskConfig.java"), option + "/java/config/TaskConfig.java", ctx);
freeMarkerManager.outputTemp(new File(root.getAbsolutePath(), "ThreadPoolConfig.java"), option + "/java/config/ThreadPoolConfig.java", ctx);
@ -495,9 +504,9 @@ public class SpringBootCallable implements Callable {
freeMarkerManager.outputTemp(new File(base.getAbsolutePath(), "Token.java"), option + "/java/frame/base/Token.java", ctx);
//freemarker
freeMarkerManager.outputTemp(new File(freemarker.getAbsolutePath(), "ViewNameTranslator.java"), option + "/java/frame/freemarker/ViewNameTranslator.java", ctx);
freeMarkerManager.outputTemp(new File(freemarker.getAbsolutePath(), "Layout.java"), option + "/java/frame/freemarker/Layout.java", ctx);
freeMarkerManager.outputTemp(new File(freemarker.getAbsolutePath(), "Uri.java"), option + "/java/frame/freemarker/Uri.java", ctx);
// freeMarkerManager.outputTemp(new File(freemarker.getAbsolutePath(), "ViewNameTranslator.java"), option + "/java/frame/freemarker/ViewNameTranslator.java", ctx);
// freeMarkerManager.outputTemp(new File(freemarker.getAbsolutePath(), "Layout.java"), option + "/java/frame/freemarker/Layout.java", ctx);
// freeMarkerManager.outputTemp(new File(freemarker.getAbsolutePath(), "Uri.java"), option + "/java/frame/freemarker/Uri.java", ctx);
//uitls
freeMarkerManager.outputTemp(new File(utils.getAbsolutePath(), "Base64Util.java"), option + "/java/frame/utils/Base64Util.java", ctx);

@ -480,8 +480,8 @@ public class SpringMVCCallable implements Callable {
ctx.put("author", project.getProjectAuthor());
ctx.put("date", new Date());
freeMarkerManager.outputTemp(new File(root.getAbsolutePath() + File.separator + "AjaxController.java"), option + "/java/controller/AjaxController.ftl", ctx);
freeMarkerManager.outputTemp(new File(root.getAbsolutePath() + File.separator + "GlobalController.java"), option + "/java/controller/GlobalController.ftl", ctx);
freeMarkerManager.outputTemp(new File(root.getAbsolutePath() + File.separator + "AjaxController.java"), option + "/java/controller/AjaxController.java", ctx);
freeMarkerManager.outputTemp(new File(root.getAbsolutePath() + File.separator + "GlobalController.java"), option + "/java/controller/GlobalController.java", ctx);
} catch (Exception e) {
e.printStackTrace();

@ -1,186 +0,0 @@
package ${basePackage}.action;
import ${basePackage}.frame.base.FileUploadResponse;
import ${basePackage}.frame.base.BaseResponse;
import ${basePackage}.frame.base.ErrorType;
import ${basePackage}.frame.base.Screen;
import ${basePackage}.frame.auth.LocalData;
import ${basePackage}.config.ActionConfig;
import org.springframework.beans.BeansException;
import org.apache.commons.io.FileUtils;
import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import org.springframework.beans.factory.annotation.Value;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 全局请求Controller如果无特殊请求则不需再增加其他Controller
* 全局htm后缀入口{@link GlobalController#hold}
* 全局异常捕捉{@link GlobalController#excepitonHandler}
* 全局上传接口{@link GlobalController#upload}
* 全局下载接口{@link GlobalController#download}
* <p>
* 说明Request命名规则驼峰式命名
* Api#Example#Request ==> 目标#动作#Request
*
* @author author
* @version 0.0.1
* @since 2019-06-16
*/
@Controller
@ControllerAdvice
public class GlobalController implements ErrorController {
@Value("${r'${web.welcome.page}'}")
private String homePage;
/**
* 全局异常捕捉
*
* @param request
* @param response
* @param exception 要捕获的异常
* @return
*/
@ExceptionHandler(Exception.class)
public String excepitonHandler(HttpServletRequest request, HttpServletResponse response, Model model, Exception exception) {
StringBuffer msg = new StringBuffer("");
if (exception != null) {
msg = new StringBuffer("");
String message = exception.toString();
int length = exception.getStackTrace().length;
if (length > 0) {
msg.append("<a>").append(message).append("</a><br>");
for (int i = 0; i < length; i++) {
msg.append("<a>").append(exception.getStackTrace()[i]).append("</a><br>");
}
} else {
msg.append(message);
}
}
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
model.addAttribute("msg", msg.toString());
return "500";
}
private final static String ERROR_PATH = "/error";
@Override
public String getErrorPath() {
return ERROR_PATH;
}
@RequestMapping(value = ERROR_PATH)
public String error(HttpServletRequest request) {
Integer statusCode = (Integer) request.getAttribute("javax.servlet.error.status_code");
switch (statusCode) {
case 404:
return "404";
case 403:
try {
LocalData.getResponse().sendRedirect("/login.htm");
} catch (IOException e) {
e.printStackTrace();
}
return "403";
case 500:
return "500";
default:
return "403";
}
}
@RequestMapping("/")
public String home() {
return "forward:" + homePage;
}
/**
* 当未明确指定控制器时走该请求默认返回对应的layout布局和screen视图
* 当需要使用layout时不需要返回值ViewNameTranslator会处理对应关系
* @param model
* @param request
*/
@RequestMapping({"/**/*.htm"})
public void hold(HttpServletRequest request, Model model) {
HttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
// 尝试执行Target Screen执行器(服务器渲染),不存在则直接返回视图模板(Ajax渲染)
Screen screenExec = null;
try {
String target = LocalData.getTarget();
target = target.replaceAll("/", ".").toLowerCase();
screenExec = LocalData.getApplicationContext().getBean(ActionConfig.SCREEN_PREFIX + target, Screen.class);
screenExec.exec(model, request, response);
} catch (BeansException e) {
}
//todo 可在此获取共性数据(也可以在全局拦截器GlobalHandlerInterceptor、拦截器作用域比此更高)
//todo 例如用户信息等。其他业务数据在页面渲染后通过Ajax请求
}
@RequestMapping("/upload")
@ResponseBody
public BaseResponse upload(HttpServletRequest request) {
FileUploadResponse fileUploadResponse = new FileUploadResponse();
MultipartHttpServletRequest multipartHttpServletRequest = (MultipartHttpServletRequest) request;
MultipartFile target = multipartHttpServletRequest.getFile("file");
String fileName = target.getOriginalFilename();
//========
//处理文件
//========
fileUploadResponse.setId(1L);
fileUploadResponse.setUrl("example.com\\img\\1.jpg");
fileUploadResponse.setDownloadUrl("example.com\\img\\1.jpg");
if (target != null) {
fileUploadResponse.addError(ErrorType.BUSINESS_ERROR, "文件上传成功,但未处理文件[" + fileName + "]!");
} else {
fileUploadResponse.addError(ErrorType.BUSINESS_ERROR, "文件上传失败!");
}
return fileUploadResponse;
}
@RequestMapping("/download")
@ResponseBody
public ResponseEntity<byte[]> download(@RequestParam(value = "file", required = false) String file) throws IOException {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
//========
//下载DEMO
//========
if (file == null) {
file = "test.txt";
headers.setContentDispositionFormData("attachment", new String(file.getBytes("UTF-8"), "iso-8859-1"));
return new ResponseEntity<byte[]>("test".getBytes(),
headers, HttpStatus.CREATED);
}
return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(new File(file)),
headers, HttpStatus.CREATED);
}
}

@ -0,0 +1,339 @@
package ${basePackage}.action;
import ${basePackage}.frame.base.*;
import ${basePackage}.frame.auth.LocalData;
import ${basePackage}.config.ActionConfig;
import ${basePackage}.frame.utils.MapperUtil;
import org.springframework.beans.BeansException;
import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.servlet.DispatcherServlet;
import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.View;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Locale;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* ControllerController
* htm{@link GlobalController#action(HttpServletRequest, Model)}
* {@link GlobalController#exceptionHandler(HttpServletRequest, HttpServletResponse, Model, Exception)}
* {@link GlobalController#upload(HttpServletRequest)}
* {@link GlobalController#download(String)}
* {@link GlobalController#sse(String)}
* <p>
* Request
* Api#Example#Request ==> ##Request
*
* @author author
* @version 0.0.1
* @since 2019-06-16
*/
@Controller
@ControllerAdvice
public class GlobalController implements ErrorController {
@Value("${r'${web.welcome.page}'}")
private String homePage;
@Value("${r'${web.login.page}'}")
private String loginPage;
@Autowired
private FreeMarkerViewResolver viewResolver;
/**
*
*
* @param request
* @param response
* @param exception
* @return
*/
@ExceptionHandler(Exception.class)
public String exceptionHandler(HttpServletRequest request, HttpServletResponse response, Model model, Exception exception) {
StringBuffer msg = new StringBuffer("");
if (exception != null) {
msg = new StringBuffer("");
String message = exception.toString();
int length = exception.getStackTrace().length;
if (length > 0) {
msg.append("<a>").append(message).append("</a><br>");
for (int i = 0; i < length; i++) {
msg.append("<a>").append(exception.getStackTrace()[i]).append("</a><br>");
}
} else {
msg.append(message);
}
}
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
model.addAttribute("msg", msg.toString());
return "500";
}
private final static String ERROR_PATH = "/error";
@Override
public String getErrorPath() {
return ERROR_PATH;
}
@RequestMapping(value = ERROR_PATH)
public String error(HttpServletRequest request) {
Integer statusCode = (Integer) request.getAttribute("javax.servlet.error.status_code");
switch (statusCode) {
case 404:
return "404";
case 403:
try {
LocalData.getResponse().sendRedirect("/login.htm");
} catch (IOException e) {
e.printStackTrace();
}
return "403";
case 500:
return "500";
default:
return "403";
}
}
@RequestMapping("/")
public String home() {
Token token = LocalData.getToken();
if (token == null) {
return "redirect:" + loginPage;
} else {
return "redirect:" + homePage;
}
}
/**
* layoutscreen
* 使layoutViewNameTranslator
*
* @param model
* @param request
*/
@RequestMapping({"/**/*.htm"})
public String action(HttpServletRequest request, Model model) {
HttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
String servletPath = request.getServletPath();// /**/*.htm
String layout = "/layout/default";
String action = "";// **/*
Pattern compile = Pattern.compile("^/(.+)\\.htm");
Matcher matcher = compile.matcher(servletPath);
if (matcher.find()) {
action = matcher.group(1);
LocalData.setAction(action);
}
try {
LocaleResolver localeResolver = (LocaleResolver) request.getAttribute(DispatcherServlet.LOCALE_RESOLVER_ATTRIBUTE);
Locale locale = localeResolver.resolveLocale(request);
{//查询screen
String[] split = action.split("/");
StringBuilder sb = new StringBuilder("");
sb.append("screen");
for (int i = 0; i < split.length; i++) {
sb.append(File.separator);
sb.append(split[i]);
}
layout = sb.toString();
View view = viewResolver.resolveViewName(layout, locale);
if (view == null) {
response.setStatus(HttpStatus.NOT_FOUND.value());
return null;
}
// 尝试执行Screen执行器(服务器渲染),并返回视图模板
try {
Screen screenExec = LocalData.getApplicationContext().getBean(ActionConfig.SCREEN_PREFIX + action, Screen.class);
screenExec.exec(model, request, response);
} catch (BeansException e) {
}
}
{//查找layout
String[] split = action.split("/");
int lt = split.length;
while (lt > 0) {
StringBuilder sb = new StringBuilder("");
sb.append("layout");
for (int i = 0; i < lt - 1; i++) {
sb.append(File.separator);
sb.append(split[i]);
}
layout = sb.toString() + File.separator + split[split.length - 1];
View view = viewResolver.resolveViewName(layout, locale);
//无法找到对应layout使用默认layout
if (view == null) {
layout = sb.toString() + File.separator + "default";
View defaultView = viewResolver.resolveViewName(layout, locale);
if (null == defaultView && lt == 1) {
System.err.println("can not find layout/default.ftl");
} else if (null == defaultView) {
lt--;
} else {
break;
}
} else {
break;
}
}
}
} catch (Exception e) {
return exceptionHandler(request, response, model, e);
}
//todo 可在此获取共性数据(也可以在全局拦截器GlobalHandlerInterceptor、拦截器作用域比此更高)
//todo 例如用户信息等。其他业务数据在页面渲染后通过Ajax请求
return layout;
}
@RequestMapping("/upload")
@ResponseBody
public BaseResponse upload(HttpServletRequest request) {
FileUploadResponse fileUploadResponse = new FileUploadResponse();
MultipartHttpServletRequest multipartHttpServletRequest = (MultipartHttpServletRequest) request;
MultipartFile target = multipartHttpServletRequest.getFile("file");
String fileName = target.getOriginalFilename();
//========
//处理文件
//========
fileUploadResponse.setId(1L);
fileUploadResponse.setUrl("example.com\\img\\1.jpg");
fileUploadResponse.setDownloadUrl("example.com\\img\\1.jpg");
if (target != null) {
fileUploadResponse.addError(ErrorType.BUSINESS_ERROR, "文件上传成功,但未处理文件[" + fileName + "]!");
} else {
fileUploadResponse.addError(ErrorType.BUSINESS_ERROR, "文件上传失败!");
}
return fileUploadResponse;
}
@RequestMapping("/ajax/{module}/{target}/{method}")
@ResponseBody
public BaseResponse ajax(@PathVariable String module, @PathVariable String target, @PathVariable String method, @RequestBody String param) {
BaseResponse baseResponse = null;
try {
Object ajax = LocalData.getApplicationContext().getBean(ActionConfig.AJAX_PREFIX + "." + module + "." + target);
Class ajaxClass = ajax.getClass();
Method methodC = ajaxClass.getMethod(method, String.class);
Object invoke = methodC.invoke(ajax, param);
if (invoke instanceof BaseResponse) {
baseResponse = (BaseResponse) invoke;
} else {
baseResponse = new BaseResponse();
baseResponse.addError(ErrorType.BUSINESS_ERROR, "方法返回值错误!");
}
} catch (BeansException e) {
baseResponse = new BaseResponse();
baseResponse.addError(ErrorType.BUSINESS_ERROR, "未找到对应的目标!");
} catch (NoSuchMethodException e) {
baseResponse = new BaseResponse();
baseResponse.addError(ErrorType.BUSINESS_ERROR, "未找到对应的方法!");
} catch (IllegalAccessException e) {
baseResponse = new BaseResponse();
baseResponse.addError(ErrorType.BUSINESS_ERROR, "方法执必须公开!");
} catch (InvocationTargetException e) {
baseResponse = new BaseResponse();
baseResponse.addError(ErrorType.BUSINESS_ERROR, "方法执行错误!");
}
return baseResponse;
}
@RequestMapping("/download")
@ResponseBody
public ResponseEntity<byte[]> download(@RequestParam(value = "file", required = false) String file) throws IOException {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
//========
//下载DEMO
//========
if (file == null) {
file = "test.txt";
headers.setContentDispositionFormData("attachment", new String(file.getBytes("UTF-8"), "iso-8859-1"));
return new ResponseEntity<byte[]>("test".getBytes(),
headers, HttpStatus.CREATED);
}
return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(new File(file)),
headers, HttpStatus.CREATED);
}
private static ConcurrentHashMap<String, SseEmitter> sseMap = new ConcurrentHashMap();
/**
* Ssejs
* Sse{@link GlobalController#sseMap}
* Sse{@link GlobalController#pushAll}
*/
@RequestMapping(value = "/sse/{userId}", produces = "text/event-stream;charset=UTF-8")
public SseEmitter sse(@PathVariable String userId) {
SseEmitter sseEmitter = new SseEmitter(10000000L);
if (sseMap.get(userId) != null) {
sseMap.remove(userId);
}
sseMap.put(userId, sseEmitter);
return sseEmitter;
}
/**
* Sse
*
* @param data
*/
public static void pushAll(Object data) {
for (String s : sseMap.keySet()) {
try {
sseMap.get(s).send(MapperUtil.toJson(data), MediaType.APPLICATION_JSON);
} catch (IOException e) {
sseMap.remove(s);
}
}
}
}

@ -30,12 +30,14 @@ import java.io.IOException;
public class ActionConfig implements BeanDefinitionRegistryPostProcessor {
public static final String SCREEN_PREFIX = "screen";
public static final String CONTROL_PREFIX = "control";
public static final String AJAX_PREFIX = "ajax";
@Override
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry beanDefinitionRegistry) throws BeansException {
String aPackage = this.getClass().getPackage().getName();
int i = registryScreen("${basePackage}.action.screen", beanDefinitionRegistry);
int i1 = registryControl("${basePackage}.action.control", beanDefinitionRegistry);
int i2 = registryAjax("${basePackage}.action.ajax", beanDefinitionRegistry);
System.out.println();
}
@ -87,4 +89,26 @@ public class ActionConfig implements BeanDefinitionRegistryPostProcessor {
});
return classPathBeanDefinitionScanner.scan(basePackage);
}
private int registryAjax(String basePackage, BeanDefinitionRegistry beanDefinitionRegistry) {
ClassPathBeanDefinitionScanner classPathBeanDefinitionScanner = new ClassPathBeanDefinitionScanner(beanDefinitionRegistry);
classPathBeanDefinitionScanner.addIncludeFilter(new TypeFilter() {
@Override
public boolean match(MetadataReader metadataReader, MetadataReaderFactory metadataReaderFactory) throws IOException {
return true;
}
});
classPathBeanDefinitionScanner.setBeanNameGenerator(new BeanNameGenerator() {
@Override
public String generateBeanName(BeanDefinition beanDefinition, BeanDefinitionRegistry beanDefinitionRegistry) {
String beanClassName = beanDefinition.getBeanClassName();
if (beanClassName != null && beanClassName.endsWith("Ajax")) {
beanClassName = beanClassName.substring(0, beanClassName.length() - 4);
}
String s = beanClassName.replaceAll(basePackage, AJAX_PREFIX);
return s.toLowerCase();
}
});
return classPathBeanDefinitionScanner.scan(basePackage);
}
}

@ -0,0 +1,118 @@
package ${basePackage}.config;
import ${basePackage}.frame.auth.LocalData;
import ${basePackage}.frame.base.Control;
import freemarker.template.SimpleScalar;
import freemarker.template.TemplateMethodModelEx;
import freemarker.template.TemplateModelException;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.validation.support.BindingAwareModelMap;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.servlet.DispatcherServlet;
import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.View;
import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver;
import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.util.List;
import java.util.Locale;
@Configuration
public class FreeMarkerConfig {
@Autowired
private FreeMarkerViewResolver viewResolver;
@Autowired
private freemarker.template.Configuration configuration;
@Value("${r'${server.servlet.context-path}'}")
private String context;
private String screenPrefix = "/screen/";
private String controlPrefix = "/control/";
private String suffix = ".ftl";
@PostConstruct
public void setSharedVariable() throws TemplateModelException {
configuration.setSharedVariable("context", context);
configuration.setSharedVariable("screenHolder", new ScreenHolder());
configuration.setSharedVariable("controlHolder", new ControlHolder());
}
private class ScreenHolder implements TemplateMethodModelEx {
@Override
public Object exec(List list) throws TemplateModelException {
try {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
LocaleResolver localeResolver = (LocaleResolver) request.getAttribute(DispatcherServlet.LOCALE_RESOLVER_ATTRIBUTE);
String servletPath = LocalData.getAction();
servletPath = servletPath.replaceAll("^/", "");
String[] split = servletPath.split("/");
StringBuilder sb = new StringBuilder("");
// 分割组装路径
for (int i = 0; i < split.length; i++) {
sb.append(split[i]);
if (i != split.length - 1) {
sb.append(File.separator);
}
}
Locale locale = localeResolver.resolveLocale(request);
String viewName = "screen" + File.separator + sb.toString();
View view = viewResolver.resolveViewName(viewName, locale);
//无法找到对应screen
if (view == null) {
return "";
} else {
return screenPrefix + servletPath + suffix;
}
} catch (Exception e) {
e.printStackTrace();
}
return "";
}
}
private class ControlHolder implements TemplateMethodModelEx {
@Override
public Object exec(List list) throws TemplateModelException {
String control = "";
if (list.size() != 1) {
return "";
}
Object o = list.get(0);
if (o instanceof SimpleScalar) {
control = ((SimpleScalar) o).getAsString();
}
// 查找是否存在对应控制面板执行器
Control controlExec = null;
try {
controlExec = LocalData.getApplicationContext().getBean(ActionConfig.CONTROL_PREFIX + "." + control, Control.class);
HttpServletRequest request = LocalData.getRequest();
HttpServletResponse response = LocalData.getResponse();
BindingAwareModelMap modelMap = new BindingAwareModelMap();
controlExec.exec(modelMap, request, response);
for (String key : modelMap.keySet()) {
request.setAttribute(key, modelMap.get(key));
}
} catch (BeansException e) {
}
control = control.replaceAll("/", File.separator);
return controlPrefix + control + suffix;
}
}
}

@ -18,6 +18,8 @@ import javax.servlet.http.HttpServletRequest;
@EnableGlobalMethodSecurity(securedEnabled = true)
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Value("${r"${web.url.auth.included}"}")
private String[] included;
@Value("${r"${web.url.auth.excluded}"}")
private String[] excluded;
@Value("${r"${spring.mvc.static-path-pattern}"}")
@ -29,7 +31,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.authorizeRequests()
.antMatchers(staticPath).permitAll()
.antMatchers(excluded).permitAll()
.anyRequest().access("@Authorization.hasPermission(request,authentication)")
.antMatchers(included).access("@Authorization.hasPermission(request,authentication)")
.and().cors()
.and().headers().frameOptions().disable()
.and().csrf().disable();

@ -1,5 +1,6 @@
package ${basePackage}.config;
import ${basePackage}.action.GlobalController;
import ${basePackage}.frame.utils.LogUtil;
import ${basePackage}.frame.utils.ProcessUtil;
import org.springframework.context.annotation.Configuration;
@ -8,7 +9,9 @@ import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.concurrent.Executors;
/**
@ -22,7 +25,10 @@ public class TaskConfig implements SchedulingConfigurer {
@Scheduled(cron="0/30 * * * * ? ")
public void task(){
LogUtil.i("--------------------Task--------------------");
SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss");
HashMap<String, String> data = new HashMap<>();
data.put("time", format.format(new Date()));
GlobalController.pushAll(data);
}
/**

@ -37,20 +37,6 @@ public class WebMvcConfig implements WebMvcConfigurer {
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new HandlerInterceptorAdapter() {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
// 处理根Url
String servletPath = request.getServletPath();
if (servletPath.matches("(.+)\\.htm")) {
Pattern compile = Pattern.compile("(.+)\\.htm");
Matcher matcher = compile.matcher(servletPath);
if (matcher.find()) {
servletPath = matcher.group(1);
}
}
LocalData.setTarget(servletPath);
return super.preHandle(request, response, handler);
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
@ -64,13 +50,6 @@ public class WebMvcConfig implements WebMvcConfigurer {
//获取当前用户信息
Token token = LocalData.getToken();
modelAndView.addObject("token", token);
//主页
modelAndView.addObject("homePath", homePage);
//获取项目路径,在项目非根路径下用于拼接URL
String contextPath = request.getContextPath();
modelAndView.addObject("contextPath", contextPath);
}
@Override

@ -47,14 +47,14 @@ public class LocalData {
/**
* target = '/aa/bb'
*/
private static final ThreadLocal<String> targetHolder = new ThreadLocal();
private static final ThreadLocal<String> actionHolder = new ThreadLocal();
public static String getTarget() {
return targetHolder.get();
public static String getAction() {
return actionHolder.get();
}
public static void setTarget(String target) {
targetHolder.set(target);
public static void setAction(String action) {
actionHolder.set(action);
}
/**

@ -1,6 +1,6 @@
# 开发环境
server.port=8080
server.servlet.context-path=/
server.servlet.context-path=
spring.mvc.static-path-pattern=/static/**
spring.resources.static-locations=classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/,file:/file-upload
spring.application.name=${projectName?default("SpringBoot")}
@ -14,10 +14,6 @@ spring.http.encoding.force=true
spring.http.encoding.charset=UTF-8
spring.http.encoding.enabled=true
server.tomcat.uri-encoding=UTF-8
# 根路径、欢迎页
web.welcome.page=/index.htm
# 不需要验证授权, 或该请求有自己的验证机制
web.url.auth.excluded=/api,/,/index.htm,/home.htm,/login.htm
# 日志配置
logging.path=D://
logging.levels=DEBUG
@ -71,3 +67,13 @@ spring.freemarker.settings.url_escaping_charset=utf-8
spring.servlet.multipart.resolveLazily=false
spring.servlet.multipart.max-file-size=100MB
spring.servlet.multipart.max-request-size=100MB
# 自定义配置
# 根路径默认页,'/'跳转至该页
web.welcome.page=/index.htm
# 登录页
web.login.page=/login.htm
# 拦截验证
web.url.auth.included=/,/**/*.htm
# 直接放行
web.url.auth.excluded=/login.htm,/index.htm

@ -1,6 +1,6 @@
# 生产环境
server.port=80
server.servlet.context-path=/
server.servlet.context-path=
spring.mvc.static-path-pattern=/static/**
spring.resources.static-locations=classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/,file:/file-upload
spring.application.name=${projectName}
@ -14,10 +14,6 @@ spring.http.encoding.force=true
spring.http.encoding.charset=UTF-8
spring.http.encoding.enabled=true
server.tomcat.uri-encoding=UTF-8
# 根路径、欢迎页
web.welcome.page=/index.htm
# 不需要验证授权, 或该请求有自己的验证机制
web.url.auth.excluded=/favicon.ico,/static/**,/api,/login.htm
# 日志配置
logging.path=/root/
logging.levels=INFO
@ -71,3 +67,13 @@ spring.freemarker.settings.url_escaping_charset=utf-8
spring.servlet.multipart.resolveLazily=false
spring.servlet.multipart.max-file-size=100MB
spring.servlet.multipart.max-request-size=100MB
# 自定义配置
# 根路径默认页,'/'跳转至该页
web.welcome.page=/index.htm
# 登录页
web.login.page=/login.htm
# 拦截验证
web.url.auth.included=/,/**/*.htm
# 直接放行
web.url.auth.excluded=/login.htm,/index.htm,/home.htm

@ -2,6 +2,8 @@
instance = axios.create({
method: 'post',
timeout: 30000,
baseURL: '/ajax',
headers: {'Content-Type': 'application/json;charset=UTF-8'},
});
// 添加请求拦截器
@ -67,15 +69,9 @@ instance.interceptors.response.use(function (response) {
}
return Promise.reject(rsp);
});
jsonRequest = function (config) {
return instance.request({
params: {
method: config.method
},
url: '${contextPath?default("")}/ajax',
headers: {'Content-Type': 'text/plain'},
data: config.data
}).then(function (response) {
jsonRequest = function (data) {
return instance.request(data)
.then(function (response) {
return Promise.resolve(response.data);
}, function (response) {
return Promise.resolve(response);
@ -83,7 +79,7 @@ jsonRequest = function (config) {
};
fileRequest = function (config) {
return instance.request({
url: '${contextPath?default("")}/upload',
url: '/upload',
data: config.data,
headers: {'Content-Type': 'multipart/form-data'},
onUploadProgress: function (progressEvent) {
@ -97,10 +93,10 @@ fileRequest = function (config) {
})
};
window.ajax = {
example: function (data) {
authLogin: function (data) {
return jsonRequest({
method: "ajax.example.example",
data: data
url: "/system/auth/login",
data: JSON.stringify(data),
})
},
fileUpload: function (file) {
@ -115,7 +111,7 @@ window.ajax = {
<#if table.getCreate()>
${table.getFName()}Create: function (data) {
return jsonRequest({
method:"ajax.${db.moduleName}.${table.getLName()}.create",
url: "/${db.moduleName}/${table.getLName()}/create",
data: JSON.stringify(data),
})
},
@ -123,7 +119,7 @@ window.ajax = {
<#if table.getDelete()>
${table.getFName()}Delete: function (data) {
return jsonRequest({
method:"ajax.${db.moduleName}.${table.getLName()}.delete",
url: "/${db.moduleName}/${table.getLName()}/delete",
data: JSON.stringify(data),
})
},
@ -131,7 +127,7 @@ window.ajax = {
<#if table.getUpdate()>
${table.getFName()}Update: function (data) {
return jsonRequest({
method:"ajax.${db.moduleName}.${table.getLName()}.update",
url: "/${db.moduleName}/${table.getLName()}/update",
data: JSON.stringify(data),
})
},
@ -139,7 +135,7 @@ window.ajax = {
<#if table.getFind()>
${table.getFName()}Find: function (data) {
return jsonRequest({
method:"ajax.${db.moduleName}.${table.getLName()}.find",
url: "/${db.moduleName}/${table.getLName()}/find",
data: JSON.stringify(data),
})
},
@ -147,7 +143,7 @@ window.ajax = {
<#if table.getGet()>
${table.getFName()}Get: function(data) {
return jsonRequest({
method:"ajax.${db.moduleName}.${table.getLName()}.get",
url: "/${db.moduleName}/${table.getLName()}/get",
data: JSON.stringify(data),
})
},
@ -155,7 +151,7 @@ window.ajax = {
<#if table.getSearch()>
${table.getFName()}Search: function (data) {
return jsonRequest({
method:"ajax.${db.moduleName}.${table.getLName()}.search",
url: "/${db.moduleName}/${table.getLName()}/search",
data: JSON.stringify(data),
})
},
@ -163,7 +159,7 @@ window.ajax = {
<#if table.getGetAll()>
${table.getFName()}GetAll: function (data) {
return jsonRequest({
method:"ajax.${db.moduleName}.${table.getLName()}.get.all",
url: "/${db.moduleName}/${table.getLName()}/getAll",
data: JSON.stringify(data),
})
},

@ -124,7 +124,7 @@
<div class="message">您没有足够的权限哦!</div>
<div class="message2">您正在试图访问一个没有事先授权的页面.或登录已失效。</div>
<div class="message3" id="timer">5 秒后自动跳转登录页</div>
<a class="login" href="${Uri.getUrl("/login")}">立即跳转</a>
<a class="login" href="${context}/login.htm">立即跳转</a>
</div>
</div>

@ -1,23 +1,23 @@
<div id="header">
<div class="logo">
<img @click="this.nav.toHome()" src="${Uri.getUrl('/static/img/logo.png')}">
<img @click="this.nav.toHome()" src="${context}/static/img/logo.png">
</div>
<a class="home" href="${Uri.getUrl('/')}">Home</a>
<a class="home" href="${context}">Home</a>
<div class="menu">
<ul>
<li>
<a href="${Uri.getUrl('/1')}">首页</a>
<a href="${context}/1">首页</a>
</li>
<li>
<a href="${Uri.getUrl('/2')}">工作台</a>
<a href="${context}/2">工作台</a>
</li>
<li>
<a href="${Uri.getUrl('/3')}">消息中心</a>
<a href="${context}/3">消息中心</a>
</li>
<li>
<a href="${Uri.getUrl('/4')}">关于我</a>
<a href="${context}/4">关于我</a>
</li>
</ul>
</div>

@ -4,13 +4,11 @@
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<#--baseJs-->
<script src="${Uri.getUrl('/static/dist/lib.min.js')}" type="text/javascript"></script>
<#--移动端ui-->
<script src="${Uri.getUrl('/static/dist/mint-ui.min.js')}" type="text/javascript"></script>
<link href="${Uri.getUrl('/static/dist/mint-ui.min.css')}" rel="stylesheet"/>
<#--ajax接口-->
<script src="${Uri.getUrl('/static/js/ajax.js')}" type="text/javascript"></script>
<script src="${context}/static/dist/lib.min.js" type="text/javascript"></script>
<script src="${context}/static/dist/mint-ui.min.js" type="text/javascript"></script>
<link href="${context}/static/dist/mint-ui.min.css" rel="stylesheet"/>
<script src="${context}/static/js/ajax.js" type="text/javascript"></script>
<link href="${context}/static/favicon.ico" rel="icon" type="image/x-icon"/>
<style>
* {
padding: 0px;
@ -184,7 +182,7 @@
if (window.android) {
android.finish()
} else {
location.href = "${Uri.getUrl('/app/index.htm')}"
location.href = "${context}/app/index.htm"
}
},
handleFile: function (file, call) {

@ -3,18 +3,16 @@
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<#--baseJs-->
<script src="${Uri.getUrl('/static/dist/lib.min.js')}" type="text/javascript"></script>
<#--element-ui-->
<script src="${Uri.getUrl('/static/dist/index.min.js')}" type="text/javascript"></script>
<link href="${Uri.getUrl('/static/dist/index.min.css')}" rel="stylesheet"/>
<#--ajax接口-->
<script src="${Uri.getUrl('/static/js/ajax.js')}" type="text/javascript"></script>
<link href="${Uri.getUrl('/static/css/base.css')}" rel="stylesheet"/>
<script src="${context}/static/dist/lib.min.js" type="text/javascript"></script>
<script src="${context}/static/dist/index.min.js" type="text/javascript"></script>
<link href="${context}/static/dist/index.min.css" rel="stylesheet"/>
<script src="${context}/static/js/ajax.js" type="text/javascript"></script>
<link href="${context}/static/css/base.css" rel="stylesheet"/>
<link href="${context}/static/favicon.ico" rel="icon" type="image/x-icon"/>
</head>
<body>
<#include Layout.setControl("macro")/>
<#include Layout.setControl("nav")/>
<#include Layout.setScreen()/>
<#include controlHolder("macro")/>
<#include controlHolder("nav")/>
<#include screenHolder()/>
</body>
</html>

@ -3,13 +3,12 @@
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<#--baseJs-->
<script src="${Uri.getUrl('/static/dist/lib.min.js')}" type="text/javascript"></script>
<#--element-ui-->
<script src="${Uri.getUrl('/static/dist/index.min.js')}" type="text/javascript"></script>
<link href="${Uri.getUrl('/static/dist/index.min.css')}" rel="stylesheet"/>
<script src="${context}/static/dist/lib.min.js" type="text/javascript"></script>
<script src="${context}/static/dist/index.min.js" type="text/javascript"></script>
<link href="${context}/static/dist/index.min.css" rel="stylesheet"/>
<link href="${context}/static/favicon.ico" rel="icon" type="image/x-icon"/>
</head>
<body>
<#include Layout.setScreen()/>
<#include screenHolder()/>
</body>
</html>

@ -995,7 +995,7 @@
},
methods: {
doAjax: function () {
ajax.example({}).then(function (response) {
ajax.authLogin({}).then(function (response) {
if (response.errors.length > 0) {
nav.e(response.errors[0].message);
} else {

@ -116,12 +116,15 @@
this.$refs[formName].validate(function (valid) {
if (valid) {
this.isLogin = true;
setTimeout(function(){
this.isLogin = false;
ajax.authLogin(this.form).then(function (response) {
if (response.errors.length > 0) {
nav.e(response.errors[0].message);
} else {
nav.i("登录成功!", function () {
location.href = "/index.htm"
});
},1000)
}
})
} else {
return false;
}

@ -1,249 +0,0 @@
<head>
<style>
body {
margin: 0px;
padding: 0px;
background-color: #f2f2f2;
}
.box {
width: 700px;
margin: 50px auto;
display: table;
}
.container {
display: table-cell;
vertical-align: middle;
}
.code {
font-weight: 500;
top: 100px;
left: 400px;
text-align: center;
width: 300px;
margin-top: 30px;
margin-bottom: 10px;
font-family: 'Varela Round', sans-serif;
font-size: 60px;
color: #6bbee0;
letter-spacing: 3px;
text-shadow: 0 0 5px #78d0ec;
animation: flux 2s linear infinite;
}
.message {
font-family: 'Poppins', sans-serif;
font-size: 20px;
color: #505050;
font-weight: 500;
}
.message2 {
font-family: 'Poppins', sans-serif;
font-size: 15px;
color: #505050;
font-weight: 300;
width: 360px;
white-space: nowrap;
}
.door-frame {
height: 340px;
width: 220px;
border-radius: 90px 90px 0 0;
background-color: #8594A5;
display: flex;
justify-content: center;
align-items: center;
}
.door {
height: 280px;
width: 170px;
border-radius: 70px 70px 0 0;
background-color: #A0AEC0;
}
.eye {
top: 15px;
left: 25px;
height: 5px;
width: 15px;
border-radius: 50%;
background-color: white;
animation: eye 7s ease-in-out infinite;
position: absolute;
}
.eye2 {
left: 65px;
}
.window {
height: 40px;
width: 130px;
background-color: #1C2127;
border-radius: 3px;
margin: 80px auto;
position: relative;
}
.leaf {
height: 40px;
width: 130px;
background-color: #8594A5;
border-radius: 3px;
margin: 80px auto;
animation: leaf 7s infinite;
transform-origin: right;
}
.handle {
height: 8px;
width: 30px;
border-radius: 4px;
background-color: #EBF3FC;
position: absolute;
margin-top: 195px;
margin-left: 30px;
}
.rectangle {
height: 60px;
width: 20px;
background-color: #CBD8E6;
border-radius: 4px;
position: absolute;
margin-top: 160px;
margin-left: 20px;
}
.message3 {
margin-top: 20px;
font-size: 12px;
}
a.login {
font-size: 15px;
text-decoration: none;
color: rgba(0, 130, 192, 0.69);
}
a.login:hover {
color: #0074c0;
}
@keyframes leaf {
0% {
transform: scaleX(1);
}
5% {
transform: scaleX(0.2);
}
70% {
transform: scaleX(0.2);
}
75% {
transform: scaleX(1);
}
100% {
transform: scaleX(1);
}
}
@keyframes eye {
0% {
opacity: 0;
transform: translateX(0)
}
5% {
opacity: 0;
}
15% {
opacity: 1;
transform: translateX(0)
}
20% {
transform: translateX(15px)
}
35% {
transform: translateX(15px)
}
40% {
transform: translateX(-15px)
}
60% {
transform: translateX(-15px)
}
65% {
transform: translateX(0)
}
}
@keyframes flux {
0%,
100% {
text-shadow: 0 0 5px #00FFC6, 0 0 15px #00FFC6, 0 0 50px #00FFC6, 0 0 50px #00FFC6, 0 0 2px #B9FFE8, 2px 2px 3px #12E29C;
color: #4BFFEF;
}
50% {
text-shadow: 0 0 3px #00B58D, 0 0 7px #00B58D, 0 0 25px #00B58D, 0 0 25px #00B58D, 0 0 2px #00B58D, 2px 2px 3px #006A60;
color: #63D3AE;
}
}
</style>
<script>
window.onload = function () {
var count = 4;
function go() {
if (count > 0) {
var e = document.getElementById("timer");
e.innerHTML = count + " 秒后自动跳转登录页"
count--;
} else {
location.href = '${Uri.getUrl("/login.htm")}';
}
}
setInterval(go, 1000);
};
</script>
</head>
<body>
<div class="box">
<div class="container">
<div class="door-frame">
<div class="door">
<div class="rectangle">
</div>
<div class="handle">
</div>
<div class="window">
<div class="eye">
</div>
<div class="eye eye2">
</div>
<div class="leaf">
</div>
</div>
</div>
</div>
</div>
<div class="container">
<div class="code">403</div>
<div class="message">您没有足够的权限哦!</div>
<div class="message2">您正在试图访问一个没有事先授权的页面.或登录已失效。</div>
<div class="message3" id="timer">5 秒后自动跳转登录页</div>
<a class="login" href="${Uri.getUrl("/login.htm")}">立即跳转</a>
</div>
</div>
</body>

@ -1,78 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>404-对不起!您访问的页面不存在</title>
<style type="text/css">
body {
background-color: #dfdfdf;
}
.box {
border: 10px solid #0000002b;
margin: 100px auto;
padding: 50px;
width: 700px;
background-color: #ffffff;
display: table;
}
.box div {
vertical-align: top;
display: table-cell;
}
.box div.img {
width: 200px;
}
.box div.info {
width: 500px;
padding-left: 50px;
padding-top: 20px;
}
.box div.info {
font-size: 14px;
}
.box div.info a {
margin-top: 50px;
text-decoration: none;
background: #f2f2f2;
cursor: pointer;
border: 3px solid #0000002b;
padding: 5px;
}
.box div.info a:hover {
background: #e6e6e6;
border: 3px solid #0000002b
}
</style>
</head>
<body>
<div class="box">
<div class="img">
<svg t="1571230949474" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
p-id="793" width="200" height="200">
<path d="M931.6 585.6v79c28.6-60.2 44.8-127.4 44.8-198.4C976.4 211 769.4 4 514.2 4S52 211 52 466.2c0 3.2 0.2 6.4 0.2 9.6l166-206h96.4L171.8 485.6h46.4v-54.8l99.2-154.6V668h-99.2v-82.4H67.6c43 161 170.6 287.4 332.4 328.6-10.4 26.2-40.6 89.4-90.8 100.6-62.2 14 168.8 3.4 333.6-104.6C769.4 873.6 873.6 784.4 930.2 668h-97.6v-82.4H666.4V476l166.2-206.2h94L786.2 485.6h46.4v-59l99.2-154v313zM366.2 608c-4.8-11.2-7.2-23.2-7.2-36V357.6c0-12.8 2.4-24.8 7.2-36 4.8-11.2 11.4-21 19.6-29.2 8.2-8.2 18-14.8 29.2-19.6 11.2-4.8 23.2-7.2 36-7.2h81.6c12.8 0 24.8 2.4 36 7.2 11 4.8 20.6 11.2 28.8 19.2l-88.6 129.4v-23c0-4.8-1.6-8.8-4.8-12-3.2-3.2-7.2-4.8-12-4.8s-8.8 1.6-12 4.8c-3.2 3.2-4.8 7.2-4.8 12v72L372.6 620c-2.4-3.8-4.6-7.8-6.4-12z m258.2-36c0 12.8-2.4 24.8-7.2 36-4.8 11.2-11.4 21-19.6 29.2-8.2 8.2-18 14.8-29.2 19.6-11.2 4.8-23.2 7.2-36 7.2h-81.6c-12.8 0-24.8-2.4-36-7.2-11.2-4.8-21-11.4-29.2-19.6-3.6-3.6-7-7.8-10-12l99.2-144.6v50.6c0 4.8 1.6 8.8 4.8 12 3.2 3.2 7.2 4.8 12 4.8s8.8-1.6 12-4.8c3.2-3.2 4.8-7.2 4.8-12v-99.6L601 296.4c6.6 7.4 12 15.8 16 25.2 4.8 11.2 7.2 23.2 7.2 36V572z"
p-id="794"></path>
</svg>
</div>
<div class="info">
<p>抱歉,您所请求的页面不存在或暂时不可用、也可能已被永久移除!</p>
<br>
<a onclick="history.back()">返回上页</a> <a href="/">返回首页</a>
</div>
</div>
</body>
</html>

@ -1,80 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>500-服务器走了下神!</title>
<style type="text/css">
body {
background-color: #dfdfdf;
}
.box {
border: 10px solid #0000002b;
margin: 100px auto;
padding: 50px;
width: 700px;
background-color: #ffffff;
display: table;
}
.box > div {
vertical-align: top;
display: table-cell;
}
.box > div.img {
width: 200px;
}
.box > div.info {
width: 500px;
padding-left: 50px;
padding-top: 20px;
}
.box > div.info {
font-size: 14px;
}
.box > div.info a {
display: inline-block;
text-decoration: none;
background: #f2f2f2;
cursor: pointer;
border: 3px solid #0000002b;
padding: 5px;
}
.box > div.info a:hover {
background: #e6e6e6;
border: 3px solid #0000002b
}
</style>
</head>
<body>
<div class="box">
<div class="img">
<svg t="1571233328721" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
p-id="4252" width="198" height="198">
<path d="M969.143 548.571q0 14.848-10.862 25.71t-25.71 10.862h-128q0 97.719-38.29 165.705L885.138 870.29Q896 881.152 896 896t-10.862 25.71q-10.276 10.861-25.71 10.861t-25.71-10.861L720.568 809.143q-2.853 2.852-8.558 7.424t-23.99 16.274-37.157 20.846-46.848 16.567-55.443 7.424v-512H475.43v512q-29.148 0-58.003-7.717t-49.7-18.87-37.705-22.273-24.869-18.578l-8.558-8.01-104.557 118.273q-11.447 11.995-27.429 11.995-13.714 0-24.576-9.143-10.862-10.276-11.703-25.417t8.85-26.587L252.6 741.632q-33.134-65.134-33.134-156.562h-128q-14.848 0-25.71-10.862t-10.861-25.71 10.861-25.71 25.71-10.861h128v-168.01l-98.852-98.852q-10.862-10.862-10.862-25.71t10.862-25.71 25.71-10.861 25.709 10.862l98.853 98.852h482.304l98.852-98.852q10.862-10.862 25.71-10.862t25.71 10.862 10.861 25.71-10.861 25.71l-98.853 98.852v168.009h128q14.848 0 25.71 10.862t10.861 25.71zM694.857 219.43H329.143q0-75.996 53.43-129.427T512 36.572t129.426 53.43 53.431 129.427z"
fill="" p-id="4253"></path>
</svg>
</div>
<div class="info">
<p style="font-size: 18px;font-weight: bold">服务器内部错误,错误信息如下:</p>
<p>${msg}</p>
<br>
<a onclick="history.back()">返回上页</a> <a href="/">返回首页</a>
</div>
</div>
</body>
</html>

@ -1,5 +0,0 @@
<div style="height: 50px;background-color: #303133">
<center>
<h3 style="color: #ffffff">------------------------------this is footer html------------------------------</h3>
</center>
</div>

@ -1,50 +0,0 @@
<div id="header" v-cloak>
<div class="table full">
<div class="table-cell v-center">
<div class="logo">
<img src="${Url.setUrl('/static/img/logo.png')}">
</div>
</div>
<div class="table-cell v-right">
<el-menu
:default-active="activeIndex2"
mode="horizontal"
@select="handleSelect">
<el-menu-item index="1">首页</el-menu-item>
<el-submenu index="2">
<template slot="title">我的工作台</template>
<el-menu-item index="2-1">选项1</el-menu-item>
<el-menu-item index="2-2">选项2</el-menu-item>
<el-menu-item index="2-3">选项3</el-menu-item>
<el-submenu index="2-4">
<template slot="title">选项4</template>
<el-menu-item index="2-4-1">选项1</el-menu-item>
<el-menu-item index="2-4-2">选项2</el-menu-item>
<el-menu-item index="2-4-3">选项3</el-menu-item>
</el-submenu>
</el-submenu>
<el-menu-item index="3" disabled>消息中心</el-menu-item>
<el-menu-item index="4">关于</el-menu-item>
</el-menu>
</div>
</div>
</div>
<script>
$(function () {
var header = new Vue({
el: '#header',
data: {
activeIndex: '1',
activeIndex2: '1'
},
methods: {
handleSelect: function (key, keyPath) {
console.log(key, keyPath);
}
}
})
})
</script>

@ -1,6 +0,0 @@
<#macro print items >
<#nested>:
<#list items as item>
<a>${item}</a>
</#list>
</#macro>

@ -1,19 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<script src="${Url.setUrl('/static/dist/lib.min.js')}" type="text/javascript"></script>
<link href="${Url.setUrl('/static/dist/lib.min.css')}" rel="stylesheet"/>
<script src="${Url.setUrl('/static/js/services.js')}" type="text/javascript"></script>
<link href="${Url.setUrl('/static/css/base.css')}" rel="stylesheet"/>
<link href="${Url.setUrl('/static/img/favicon.ico')}" rel="Shortcut Icon" type="image/x-icon"/>
</head>
<body>
<#include Layout.setControl("macro")/>
<#include Layout.setControl("header")/>
<#include Layout.setScreen()/>
<#--<#include Layout.setControl("footer")/>-->
</body>
</html>

@ -1,44 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<title>Mint UI</title>
</head>
<body>
<div id="app">
<router-link to="/">首页</router-link>
<router-link to="/next">next</router-link>
<transition name="wb-zoom-in-top">
<router-view></router-view>
</transition>
</div>
<template id="home"><div>home</div></template>
<template id="next"><div>next</div></template>
<script src="${Url.setUrl('/static/lib/vue/vue.min.js')}" type="text/javascript"></script>
<script src="${Url.setUrl('/static/lib/vue/vue-router.min.js')}" type="text/javascript"></script>
<script src="${Url.setUrl('/static/lib/fastclick.js')}" type="text/javascript"></script>
<script>
var router = new VueRouter({
routes:[
{
path: '/',
name: 'home',
component:Vue.extend({template: '#home'})
},
{
path: '/next',
name: 'next',
component:Vue.extend({template: '#next'})
}
]
});
var app = new Vue({
el: '#app',
router:router
})
</script>
</html>

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save

Powered by TurnKey Linux.