Browse Source

Merge pull request #396 from joewan/test_branch

端口统一配置
奇淼(piexlmax 3 years ago
parent
commit
bb3b09ab48
4 changed files with 9 additions and 6 deletions
  1. 2 0
      web/build.config.js
  2. 2 3
      web/src/main.js
  3. 3 1
      web/src/view/systemTools/formCreate/index.vue
  4. 2 2
      web/vue.config.js

+ 2 - 0
web/build.config.js

@@ -2,6 +2,8 @@
 
 module.exports = {
     title: 'GIN-VUE-ADMIN1',
+    vueClientPort: 8080,
+    goServerPort: 8888,
     baseCdnUrl: '//cdn.staticfile.org',
     cdns: [
         /**

+ 2 - 3
web/src/main.js

@@ -146,12 +146,11 @@ export default new Vue({
     store
 }).$mount('#app')
 
-
 console.log(`
        欢迎使用 Gin-Vue-Admin
        当前版本:V2.4.1
        加群方式:微信:shouzi_1994 QQ群:622360840
-       默认自动化文档地址:http://127.0.0.1%s/swagger/index.html
-       默认前端文件运行地址:http://127.0.0.1:8080
+       默认自动化文档地址:http://127.0.0.1:` + buildConfig.goServerPort + `/swagger/index.html
+       默认前端文件运行地址:http://127.0.0.1:`+ buildConfig.vueClientPort + `
        如果项目让您获得了收益,希望您能请团队喝杯可乐:https://www.gin-vue-admin.com/docs/coffee
 `)

+ 3 - 1
web/src/view/systemTools/formCreate/index.vue

@@ -1,15 +1,17 @@
 <template>
   <div style="height:80vh">
-    <iframe width="100%" height="100%" :src="'http://127.0.0.1:8888/form-generator/#/'" frameborder="0"></iframe>
+    <iframe width="100%" height="100%" :src="url" frameborder="0"></iframe>
   </div>
 </template>
 
 <script>
+import buildConf from '@/../build.config.js'
 var path = process.env.VUE_APP_BASE_API
 export default {
     name:"FormGenerator",
     data(){
       return{
+        url:'http://127.0.0.1:' + buildConf.goServerPort + '/form-generator/#/',
         basePath:path
       }
     },

+ 2 - 2
web/vue.config.js

@@ -15,7 +15,7 @@ module.exports = {
     lintOnSave: process.env.NODE_ENV === 'development',
     productionSourceMap: false,
     devServer: {
-        port: 8080,
+        port: buildConf.vueClientPort,
         open: true,
         overlay: {
             warnings: false,
@@ -25,7 +25,7 @@ module.exports = {
             // 把key的路径代理到target位置
             // detail: https://cli.vuejs.org/config/#devserver-proxy
             [process.env.VUE_APP_BASE_API]: { //需要代理的路径   例如 '/api'
-                target: `http://127.0.0.1:8888/`, //代理到 目标路径
+                target: `http://127.0.0.1:` + buildConf.goServerPort + `/`, //代理到 目标路径
                 changeOrigin: true,
                 pathRewrite: { // 修改路径数据
                     ['^' + process.env.VUE_APP_BASE_API]: '' // 举例 '^/api:""' 把路径中的/api字符串删除