Browse Source

fix: 更新环境配置,添加 kkFileView 预览服务代理

xieyong 1 day ago
parent
commit
ac39832fea
3 changed files with 15 additions and 3 deletions
  1. 3 0
      .env.development
  2. 2 1
      .gitignore
  3. 10 2
      vue.config.js

+ 3 - 0
.env.development

@@ -1,4 +1,7 @@
 VUE_APP_API_BASE_URL=/api
 #VUE_APP_API_BASE_URL=http://localhost:8080/api
 
+# 用于拼接 kkFileView 预览时 fileUrl 的绝对地址(避免本地 origin=localhost:8080 被编码进去导致 kkFileView 服务端无法访问)
+VUE_APP_API_BASE_HOST=http://aiot.zoomwin.com.cn:51001
+
 VUE_APP_PORT=8080

+ 2 - 1
.gitignore

@@ -22,4 +22,5 @@ yarn-error.log*
 *.sln
 *.sw?
 vue.config.js
-package-lock.json
+package-lock.json
+.history

+ 10 - 2
vue.config.js

@@ -38,20 +38,28 @@ module.exports = {
         // target: 'http://124.71.68.31:50001', // 测试环境
         // target: 'http://124.71.68.31:50001',
         // target: 'http://192.168.1.105:18086',
-        target: 'http://localhost:18086',
+        // target: 'http://localhost:18086',
         // target: 'http://192.168.1.116:18086',
         // target: 'http://192.168.1.3:18086',
         // target: 'http://192.168.1.251:18186',
         // target: 'http://192.168.1.251:18086',
         // target: 'http://192.168.1.3:18086',
-        // target: 'http://aiot.zoomwin.com.cn:51001/api',
+        target: 'http://aiot.zoomwin.com.cn:51001/api',
         // target: 'http://192.168.1.3:18086',
+        // target: 'http://192.168.1.147:18086',  // 陈兵
         // target: 'http://192.168.1.116:18086', // 赵沙金
+        // target: 'http://192.168.1.113:18086', // 郭丹
 
         changeOrigin: true, // 只有这个值为true的情况下 s才表示开启跨域
         pathRewrite: {
           '^/api': ''
         }
+      },
+      // kkFileView 在线预览服务代理(让本地像测试环境一样能加载 /kkfile/onlinePreview)
+      '/kkfile': {
+        target: 'http://aiot.zoomwin.com.cn:51001',
+        changeOrigin: true,
+        pathRewrite: { '^/kkfile': '/kkfile' }
       }
     }
   },