From 739ea9592edb2ed0a4aa5ff4d871703a3b0c79b3 Mon Sep 17 00:00:00 2001 From: Oliver <1069035666@qq.com> Date: Tue, 17 May 2022 06:17:55 +0000 Subject: [PATCH 1/3] =?UTF-8?q?=E5=89=8D=E7=AB=AFjs=20=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=89=93=E5=8C=85=E6=88=90jar=20=20=E7=9B=B4=E6=8E=A5=E5=9C=A8?= =?UTF-8?q?=20=20tomcat=E8=AE=BF=E9=97=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vue/VueAutoConfiguration.java | 32 +++++ .../main/resource/META-INF/spring.factories | 3 + .../src/main/resource/static/_app.config.js | 14 ++ modules/vue/pom.xml | 121 ++++++++++++++++++ root/pom.xml | 1 + web-api/pom.xml | 7 + 6 files changed, 178 insertions(+) create mode 100644 modules/vue/java/src/main/java/com/jeesite/autoconfigure/vue/VueAutoConfiguration.java create mode 100644 modules/vue/java/src/main/resource/META-INF/spring.factories create mode 100644 modules/vue/java/src/main/resource/static/_app.config.js create mode 100644 modules/vue/pom.xml diff --git a/modules/vue/java/src/main/java/com/jeesite/autoconfigure/vue/VueAutoConfiguration.java b/modules/vue/java/src/main/java/com/jeesite/autoconfigure/vue/VueAutoConfiguration.java new file mode 100644 index 000000000..ff8c89319 --- /dev/null +++ b/modules/vue/java/src/main/java/com/jeesite/autoconfigure/vue/VueAutoConfiguration.java @@ -0,0 +1,32 @@ +package com.jeesite.autoconfigure.vue; + +import org.springframework.context.annotation.Configuration; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +/** + * @author oliver foo + * @description + * @date 2022/4/14 17:54 + */ +@Configuration(proxyBeanMethods = false) +public class VueAutoConfiguration implements WebMvcConfigurer { + + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + registry.addResourceHandler("/**").addResourceLocations("classpath:/public/"); + registry.addResourceHandler("/_app.config.js").addResourceLocations("classpath:/static/"); + registry.addResourceHandler("/favicon.png").addResourceLocations("classpath:/static/"); + } + + @Controller + public static class VueRedirect { + @RequestMapping(value = "/{path:^(?!a$)(?!f$)(?!assets$)(?!resource$)(?!static$)(?!_app.config.js$)(?!favicon.png$)[^\\.]*}/**") + public String redirect() { + return "forward:/index.html"; + } + } + +} diff --git a/modules/vue/java/src/main/resource/META-INF/spring.factories b/modules/vue/java/src/main/resource/META-INF/spring.factories new file mode 100644 index 000000000..727e9992a --- /dev/null +++ b/modules/vue/java/src/main/resource/META-INF/spring.factories @@ -0,0 +1,3 @@ +# Auto Configure +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ +com.jeesite.autoconfigure.vue.VueAutoConfiguration diff --git a/modules/vue/java/src/main/resource/static/_app.config.js b/modules/vue/java/src/main/resource/static/_app.config.js new file mode 100644 index 000000000..f4c299aa4 --- /dev/null +++ b/modules/vue/java/src/main/resource/static/_app.config.js @@ -0,0 +1,14 @@ +window.__PRODUCTION__THINGSBOX__CONF__ = { + VITE_GLOB_APP_TITLE: 'Jeesite', + VITE_GLOB_APP_SHORT_NAME: 'Jeesite', + VITE_GLOB_API_URL: '', + VITE_GLOB_UPLOAD_URL: '/upload', + VITE_GLOB_WEBSOCKET_URL: '/a/ws/stomp', + VITE_GLOB_API_URL_PREFIX: '', + VITE_GLOB_ADMIN_PATH: '/a', +}; +Object.freeze(window.__PRODUCTION__THINGSBOX__CONF__); +Object.defineProperty(window, '__PRODUCTION__THINGSBOX__CONF__', { + configurable: false, + writable: false, +}); diff --git a/modules/vue/pom.xml b/modules/vue/pom.xml new file mode 100644 index 000000000..ec46b697e --- /dev/null +++ b/modules/vue/pom.xml @@ -0,0 +1,121 @@ + + + 4.0.0 + + + com.jeesite + jeesite-parent + 5.0.1-SNAPSHOT + ../../parent/pom.xml + + + jeesite-module-vue + + JeeSite Module Vue + http://vue.com + + + v16.13.2 + v8.1.2 + v1.22.17 + UTF-8 + + + + + com.jeesite + jeesite-framework + ${project.parent.version} + + + + + java/src/main/java + + + java/src/main/resources + + + ${project.build.directory}/generated-resources + + + + + com.github.eirslett + frontend-maven-plugin + 1.12.1 + + ${build.node.version} + ${build.yarn.version} + + + + + + + + install node and yarn + + install-node-and-yarn + + + generate-resources + + + yarn install + + yarn + + + install + + + + yarn build + + yarn + + + build + + + + + + + + + + oliver + oliver foo + 1069035666@qq.com + + Project lead + + +8 + + + + + + aliyun-repos + https://maven.aliyun.com/repository/public + + true + + + false + + + + + + + aliyun-repos + https://maven.aliyun.com/repository/public + + + + diff --git a/root/pom.xml b/root/pom.xml index 9bcc64b14..b9806197c 100644 --- a/root/pom.xml +++ b/root/pom.xml @@ -17,6 +17,7 @@ ../common ../modules/core ../modules/cms + ../modules/vue ../web ../web-api diff --git a/web-api/pom.xml b/web-api/pom.xml index c8e6eee06..a57b85a8d 100644 --- a/web-api/pom.xml +++ b/web-api/pom.xml @@ -48,6 +48,13 @@ jeesite-module-swagger ${project.parent.version} + +