Browse Source

环境变量

yangbifan 2 years ago
parent
commit
d986637d83

+ 3 - 2
.env.development

@@ -1,5 +1,6 @@
 VUE_APP_FILE_API = http://192.168.1.9:9114
 VUE_APP_GRID_API = http://192.168.1.19:9114
-NODE_ENV = 'development'
+NODE_ENV = development
 
-VUE_APP_ENV = 'development'
+VUE_APP_ENV = development
+outputDir = dist-dev

+ 3 - 2
.env.production

@@ -1,6 +1,7 @@
 VUE_APP_FILE_API =
 VUE_APP_GRID_API =
 
-NODE_ENV = 'production'
+NODE_ENV = production
 
-VUE_APP_ENV = 'production'
+VUE_APP_ENV = production
+outputDir = dist-production

+ 5 - 3
.env.test

@@ -1,3 +1,5 @@
-NODE_ENV = 'test'
-
-VUE_APP_ENV = 'test'
+VUE_APP_FILE_API =
+VUE_APP_GRID_API =
+NODE_ENV = 'production'
+VUE_APP_ENV = test
+outputDir = dist-test

+ 2 - 0
.gitignore

@@ -1,6 +1,7 @@
 .DS_Store
 node_modules
 /dist
+/dist-test
 
 # local env files
 .env.local
@@ -19,3 +20,4 @@ yarn-error.log*
 *.njsproj
 *.sln
 *.sw?
+*.zip

+ 1 - 0
package.json

@@ -3,6 +3,7 @@
   "version": "0.1.0",
   "private": true,
   "scripts": {
+    "abc":"vue-cli-service build",
     "serve": "vue-cli-service serve --mode development", 
     "serve:test": "vue-cli-service serve --mode test", 
     "build": "vue-cli-service build  --mode development", 

+ 7 - 3
public/index.html

@@ -30,11 +30,15 @@
   </noscript>
   <div id="app"></div>
   <!-- built files will be auto injected -->
-  <script type="text/javascript">
-
+  <!-- <script type="text/javascript">
+    // window.staticHost = 'http://10.230.26.15:8000/mkt'; // 正式
+    window.staticHost = 'http://10.149.85.91:8000/spfm'; // 测试
+    // window.staticHost = 'http://192.168.0.103:9600/';
+    // window.staticHost = 'http://43.138.50.94:9600/';
 
     // document.title = "hello";
-  </script>
+  </script> -->
+
 </body>
 
 </html>

+ 1 - 1
public/static/js/api.config.js

@@ -1,6 +1,6 @@
 // api config
 var apiConfig = {
-  ctx: window.top.staticHost ? window.top.staticHost : "http://114.215.71.182:29600/spfm/",
+  ctx: window.top.staticHost ? window.top.staticHost : "http://114.215.71.182:29600/spfm",
   // http://114.215.71.182:29600/spfm/
   // ctx: "http://localhost:9601",//接口地址http://192.168.1.76:8090/ api-gateway
   // ctx: "http://192.168.2.192:9600/",//接口地址http://192.168.1.76:8090/ api-gateway

+ 7 - 0
src/App.vue

@@ -7,6 +7,13 @@
 </template>
 <script>
 export default {
+  created(){
+    let url = 'http://127.0.0.1:8000/bpm/api/sdasd'
+    let reg = /\d+\/api\//
+    let r = reg.test(url)
+    console.log(r);
+
+  },
   watch: {
     $route(to) {
       this.$store.commit("setPages", to.path);

+ 1 - 0
src/components/p-header.vue

@@ -190,6 +190,7 @@ export default {
       }, 500);
     },
     handleLogout() {
+      console.log(123);
       this.$confirm("正在退出登录,是否继续", "提示", {
         type: "warning",
       })

+ 5 - 5
src/config/dev.js

@@ -2,29 +2,29 @@
 let devs = {
     TITLE:'本地环境',
     BASE_URL:"http://43.138.50.94:9600/", //本地环境
-    BASE_API:"http://43.138.50.94:8880",//工作流本地环境
+    BASE_API:"http://43.138.50.94:8880/api",//工作流本地环境
     EXCEL_URL:"http://43.138.50.94:7777" //本地excel路径
 }
 let dev = {
     TITLE:'本地环境',
     BASE_URL:"http://127.0.0.1:8080", //本地环境
-    BASE_API:"http://43.138.50.94:8880",//工作流本地环境
+    BASE_API:"http://43.138.50.94:8880/api",//工作流本地环境
     EXCEL_URL:"http://43.138.50.94:7777" //本地excel路径
 }
 let test = {
     TITLE:'测试环境',
     BASE_URL:"http://10.149.85.91:8000/spfm", //测试环境
-    BASE_API:"http://10.149.85.91:8000",//工作流测试环境
+    BASE_API:"http://10.149.85.91:8000/api",//工作流测试环境
     EXCEL_URL:"http://10.149.85.91:7777" //测试excel路径
 }
 let prod = {
     TITLE:'线上环境',
     BASE_URL:"http://10.230.26.15:8000/mkt", //线上环境
-    BASE_API:"http://10.230.26.15:8000",//工作流线上环境
+    BASE_API:"http://10.230.26.15:8000/api",//工作流线上环境
     EXCEL_URL:"http://10.230.26.15:7777" //线上excel路径
 }
 export const getConfig  = () =>{
-    switch(process.env.NODE_ENV){
+    switch(process.env.VUE_APP_ENV){
         case "development":
             return dev;
         case 'test':

+ 7 - 1
src/http/index.js

@@ -4,11 +4,16 @@ import VueAxios from 'vue-axios';
 import getConfig from '../config/dev.js'
 let list = getConfig()
 const status = (res) => {
-    let regexp = /8880/
+    let regexp = /\d+\/api\//
     let r = regexp.test(res)
 
     return r;
 }
+// const Rstatus = (res) => {
+//     let regexps = /8000/
+//     let qr = regexps.test(res)
+//     return qr;
+// }
 // axios.defaults.headers.post['Content-Type'] = 'application/json';
 axios.defaults.transformRequest = [function (data) {
     if (data instanceof Object && !(data instanceof FormData)) {
@@ -22,6 +27,7 @@ axios.defaults.transformRequest = [function (data) {
 axios.interceptors.request.use(function (config) {
 
     var n = status(config.url)
+    // var s = Rstatus(config.url)
 
     // console.log('[ axios.config ] >', config)
     // if (config.url.startsWith("http")) {

+ 1 - 0
src/pages/main/comWin/prosess.vue

@@ -183,6 +183,7 @@ export default {
       };
       this.common.httpPost(obj, success);
       function success(data) {
+        console.log(data);
         self.list = data.data.rows;
         self.total = data.data.total;
       }

+ 3 - 2
src/pages/main/workflowdef/index.vue

@@ -109,8 +109,9 @@ export default {
             }
             this.common.httpPost(obj, success)
             function success(data) {
-                self.list = data.data.rows
-                self.total = data.data.total
+                console.log(data);
+                self.list = data.rows
+                self.total = data.total
             }
         },
         doImport() {

+ 1 - 1
src/plugins/element-ui.js

@@ -131,7 +131,7 @@ Vue.use(Alert)
 Vue.use(InputNumber)
 Vue.use(Rate)
 Vue.use(Progress)
-// Vue.prototype.$confirm = MessageBox.confirm;
+Vue.prototype.$confirm = MessageBox.confirm;
 Vue.prototype.$prompt = MessageBox.prompt;
 Vue.prototype.$notify = Notification;
 Vue.prototype.$message = Message;

+ 1 - 0
vue.config.js

@@ -3,6 +3,7 @@ const webpack = require("webpack");
 const BundleAnalyzerPlugin =
     require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
 module.exports = {
+    outputDir: process.env.outputDir,
     publicPath: process.env.NODE_ENV === "production" ? "" : "/",
     productionSourceMap: false,
     lintOnSave: false,