Browse Source

配置baseUrl

luolei 5 năm trước cách đây
mục cha
commit
0adb50492c
1 tập tin đã thay đổi với 2 bổ sung1 xóa
  1. 2 1
      src/js/utils.js

+ 2 - 1
src/js/utils.js

@@ -94,10 +94,11 @@ const post = function (url, data) {
   if(!token&&window.location.href.indexOf('login')==-1){
     window.location.href = "../login.html"
   }
+  let need = window.location.href.indexOf('localhost')==-1
   return new Utils((resolve, reject) => {
     $.ajax({
       method: 'post',
-      url: baseUrl+url,
+      url: need?baseUrl:''+url,
       async:true,
       cache: false,
       contentType: false,