Ver Fonte

close console.log

epans há 11 meses atrás
pai
commit
0ed24d3011
2 ficheiros alterados com 20 adições e 20 exclusões
  1. 8 8
      src/App.vue
  2. 12 12
      src/utils/request.js

+ 8 - 8
src/App.vue

@@ -11,14 +11,14 @@ export default {
 }
 
 // 控制是否屏蔽全局console.log 日志;isDebug设为false即可屏蔽
-// const isDebug = false;  
-// console.log = (function (oldLogFunc) {
-//   return function () {
-//     if (isDebug) {
-//       oldLogFunc.apply(this, arguments);
-//     }
-//   }
-// })(console.log);
+const isDebug = false;  
+console.log = (function (oldLogFunc) {
+  return function () {
+    if (isDebug) {
+      oldLogFunc.apply(this, arguments);
+    }
+  }
+})(console.log);
  
 </script>
 

+ 12 - 12
src/utils/request.js

@@ -9,22 +9,22 @@ import { MessageBox, Message } from 'element-ui'
 
 //自动打包、让内外网都能登陆的设置,但是npm run dev 后只能选localhost展示了
 //后端框架才需要这段——本地手动打包时可注释
-// const DoMainString = document.querySelector("html").getAttribute("domain");
-// axios.defaults.baseURL = process.env.VUE_APP_BASE_API
-// if (DoMainString) {
-//   axios.defaults.baseURL = DoMainString
-// }
-
-// var reg =  /(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)\.(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)\.(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)\.(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)/;
-// var browserUrl = window.location.hostname
-// if (reg.test(browserUrl)){
-//   axios.defaults.baseURL = window.location.protocol +"//"+ browserUrl + ":8087/"
-// }
+const DoMainString = document.querySelector("html").getAttribute("domain");
+axios.defaults.baseURL = process.env.VUE_APP_BASE_API
+if (DoMainString) {
+  axios.defaults.baseURL = DoMainString
+}
+
+var reg =  /(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)\.(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)\.(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)\.(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)/;
+var browserUrl = window.location.hostname
+if (reg.test(browserUrl)){
+  axios.defaults.baseURL = window.location.protocol +"//"+ browserUrl + ":8087/"
+}
 //后端框架才需要这段——本地手动打包时可注释
 
 
 //正常本地打包地址
-axios.defaults.baseURL = process.env.VUE_APP_BASE_API
+//axios.defaults.baseURL = process.env.VUE_APP_BASE_API