diff --git a/generator-web/src/main/resources/statics/js/main.js b/generator-web/src/main/resources/statics/js/main.js index 369de1c..3cd412d 100644 --- a/generator-web/src/main/resources/statics/js/main.js +++ b/generator-web/src/main/resources/statics/js/main.js @@ -121,7 +121,7 @@ const vm = new Vue({ generate : function(){ //get value from codemirror vm.formData.tableSql=$.inputArea.getValue(); - axios.post("code/generate",vm.formData).then(function(res){ + axios.post(basePath+"/code/generate",vm.formData).then(function(res){ if(res.code===500){ error("生成失败"); return; @@ -146,7 +146,7 @@ const vm = new Vue({ }, created: function () { //load all templates for selections 加载所有模板供选择 - axios.post("template/all",{ + axios.post(basePath+"/template/all",{ id:1234 }).then(function(res){ //console.log(res.templates); diff --git a/generator-web/src/main/resources/templates/header.html b/generator-web/src/main/resources/templates/header.html index aaa6bf3..93a22a9 100644 --- a/generator-web/src/main/resources/templates/header.html +++ b/generator-web/src/main/resources/templates/header.html @@ -13,6 +13,9 @@ var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); + + var basePath = "${request.contextPath}"; + console.log("basePath",basePath) <#if value.mode=='local'> diff --git a/generator-web/src/main/resources/templates/index.html b/generator-web/src/main/resources/templates/index.html index bae48d5..b0557f1 100644 --- a/generator-web/src/main/resources/templates/index.html +++ b/generator-web/src/main/resources/templates/index.html @@ -113,7 +113,7 @@ by https://zhengkai.blog.csdn.net