Explorar o código

部署生产调试,添加VUE_APP_BaseURL

yunxing %!s(int64=4) %!d(string=hai) anos
pai
achega
1b96ee447d

+ 2 - 1
.env.aly

@@ -1,2 +1,3 @@
 NODE_ENV=production
-VUE_APP_RealEnv=aly
+VUE_APP_RealEnv=aly
+VUE_APP_BaseURL=

+ 2 - 1
.env.development

@@ -1 +1,2 @@
-VUE_APP_RealEnv=development
+VUE_APP_RealEnv=development
+VUE_APP_BaseURL=

+ 2 - 1
.env.production

@@ -1,2 +1,3 @@
 NODE_ENV=production
-VUE_APP_RealEnv=production
+VUE_APP_RealEnv=production
+VUE_APP_BaseURL=/glsms

+ 1 - 1
src/api/httputils.js

@@ -5,7 +5,7 @@ import router from '@/router'
 import { Toast } from 'vant'
 var CancelToken = axios.CancelToken
 var cancel
-
+axios.defaults.baseURL = process.env.VUE_APP_BaseURL;
 // 创建axios实例
 const axiosservice = axios.create({
     timeout: 60 * 1000, // 请求超时时间

+ 3 - 1
src/views/FloorFunc.vue

@@ -41,7 +41,7 @@
             <td>
               <div class="cell">
                 <div v-if='tr.Url' class="Url-img">
-                  <img :src="`/serve/topology-wanda/Picture/query/${tr.Url}`" alt>
+                  <img :src="`/glsms/serve/topology-wanda/Picture/query/${tr.Url}`" alt>
                 </div>
                 <div v-else>{{'--'}}</div>
               </div>
@@ -107,6 +107,7 @@ export default {
       showImgPreview: false,
       imgList: [], //图片列表
       imgKey: `img${new Date().getTime()}`,
+      VUE_APP_BaseURL: '',
     }
   },
   computed: {
@@ -115,6 +116,7 @@ export default {
   components: { ImagePreview },
   beforeMount() { },
   created() {
+    this.VUE_APP_BaseURL = process.env.VUE_APP_BaseURL
     this.getGraphElement();
   },
   methods: {

+ 5 - 1
src/views/overview/MapOther.vue

@@ -13,7 +13,7 @@
       <div class="legendBox" v-show="show" @touchmove="show=false">
         <ul class="legend-list">
           <li class="legend-item" v-for="(item, index) in legendList" :key="`legend${index}`">
-            <img :src="`/serve/topology-wanda/Picture/query/${item.Url}`" alt>
+            <img :src="`/glsms/serve/topology-wanda/Picture/query/${item.Url}`" alt>
             {{`${item.Name}×${item.Num}`}}
           </li>
         </ul>
@@ -80,9 +80,13 @@ export default {
       direction: '竖屏',
       show: false,
       legendList: [], // 图例列表
+      VUE_APP_BaseURL: '',
     }
   },
   props: {},
+  created() {
+    this.VUE_APP_BaseURL = process.env.VUE_APP_BaseURL
+  },
   beforeMount() { },
   mounted() {
     window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", () => {

+ 4 - 1
src/views/overview/MapView.vue

@@ -12,7 +12,7 @@
       <div class="legendBox" v-show="show" @touchmove="show=false">
         <ul class="legend-list">
           <li class="legend-item" v-for="(item, index) in legendList" :key="`legend${index}`">
-            <img :src="`/serve/topology-wanda/Picture/query/${item.Url}`" alt>
+            <img :src="`/glsms/topology-wanda/Picture/query/${item.Url}`" alt>
             {{`${item.Name}×${item.Num}`}}
           </li>
         </ul>
@@ -82,6 +82,9 @@ export default {
     }
   },
   props: {},
+  created() {
+    this.VUE_APP_BaseURL = process.env.VUE_APP_BaseURL
+  },
   beforeMount() { },
   mounted() {
     window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", () => {

+ 13 - 9
vue.config.js

@@ -9,22 +9,24 @@ module.exports = {
         port: 8092,
         open: true,
         proxy: {
-            '/data': {
+            'glsms/data': {
                 // target: 'http://10.199.143.126', //生产环境
-                target: 'http://60.205.177.43', //阿里云
+                // target: 'http://60.205.177.43', //阿里云
+                target: 'http://gcgl.wanda.cn/glsms',
                 changeOrigin: true,
                 secure: false,
                 pathRewrite: {
-                    '^/data': '/data',
+                    '^/glsms/data': '/glsms/data',
                 },
             },
             // 绘图服务
-            '/serve': {
+            'glsms/serve': {
                 //    target: 'http://10.199.143.129:8080', //生产环境
-                target: 'http://60.205.177.43:28888', //阿里云
+                // target: 'http://60.205.177.43:28888', //阿里云
+                target: 'http://gcgl.wanda.cn/glsms',
                 changeOrigin: true,
                 pathRewrite: {
-                    '^/serve': '',
+                    '^/glsms/serve': '',
                 },
             },
         },
@@ -41,9 +43,11 @@ module.exports = {
     },
     lintOnSave: false,
     // 测试包路径修改
-    publicPath: process.env.VUE_APP_RealEnv === 'alyTest' ? '/wandaBmGuideH5Test' : '/wandaBmGuideH5',
-    // 打包名称
-    outputDir: process.env.VUE_APP_RealEnv === 'alyTest' ? 'wandaBmGuideH5Test' : 'wandaBmGuideH5',
+    // publicPath: process.env.VUE_APP_RealEnv === 'alyTest' ? '/wandaBmGuideH5Test' : '/wandaBmGuideH5',
+    // // 打包名称
+    // outputDir: process.env.VUE_APP_RealEnv === 'alyTest' ? 'wandaBmGuideH5Test' : 'wandaBmGuideH5',
+    publicPath: '/glsms/wandaBmGuideH5', //生产域名,需要加 glsms
+    outputDir: 'wandaBmGuideH5',
     // 放置生成的静态资源 (js、css、img、fonts) 的 (相对于 outputDir 的) 目录
     assetsDir: 'static',
     transpileDependencies: [