Parcourir la source

配置baseUrl

luolei il y a 5 ans
Parent
commit
0adb50492c
1 fichiers modifiés avec 2 ajouts et 1 suppressions
  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,