Bläddra i källkod

配置baseUrl

luolei 5 år sedan
förälder
incheckning
0adb50492c
1 ändrade filer med 2 tillägg och 1 borttagningar
  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){
   if(!token&&window.location.href.indexOf('login')==-1){
     window.location.href = "../login.html"
     window.location.href = "../login.html"
   }
   }
+  let need = window.location.href.indexOf('localhost')==-1
   return new Utils((resolve, reject) => {
   return new Utils((resolve, reject) => {
     $.ajax({
     $.ajax({
       method: 'post',
       method: 'post',
-      url: baseUrl+url,
+      url: need?baseUrl:''+url,
       async:true,
       async:true,
       cache: false,
       cache: false,
       contentType: false,
       contentType: false,