Bläddra i källkod

feat: 修改默认

linwenxin 1 år sedan
förälder
incheckning
e3bd60cb80
1 ändrade filer med 9 tillägg och 9 borttagningar
  1. 9 9
      src/common/http/index.js

+ 9 - 9
src/common/http/index.js

@@ -16,14 +16,14 @@ const program = {
 };
 const whiteCodes = [200, 201, 4444]
 
-export const $http = (url, method, data, json, loadingBool = true) => {
+export const $http = (url, method, data, json, loadingBool = false) => {
   //设置请求前拦截器
   http.interceptor.request = (config) => {
-    // if (loadingBool && url !== '/homepage/study') {
-    //   uni.showLoading({
-    //     title: '加载中...'
-    //   })
-    // }
+    if (loadingBool && url !== '/homepage/study') {
+      uni.showLoading({
+        title: '加载中...'
+      })
+    }
 
     config.header = {
       "content-type": json ? 'application/json' : 'application/x-www-form-urlencoded',
@@ -35,9 +35,9 @@ export const $http = (url, method, data, json, loadingBool = true) => {
   //设置请求结束后拦截器
   http.interceptor.response = async (response) => {
     //判断返回状态 执行相应操作
-    // if (loadingBool) {
-    //   uni.hideLoading()
-    // }
+    if (loadingBool) {
+      uni.hideLoading()
+    }
     const res = response.data;
     if (whiteCodes.indexOf(res.code) < 0) {
       if (res.code === 1001) {