liukangdong
2024-07-29 0c02f1bf5f00e6de2c379dc121047b84a5b7c153
wechat_jiaxuan/utils/request.js
@@ -1,10 +1,10 @@
import { baseUrl } from "./config"
import { wxLoginCustomer } from '../api/index'
let number = 0
export function request(options){
  let loading = options.loading || '1' // 默认值1显示,否则不显示
  if(loading == '1'){
    wx.showLoading()
    number ++
  }
  return new Promise(resolve => {
    wx.request({
@@ -40,9 +40,12 @@
      },
      complete() {
        if(loading == '1'){
          number --
          if(number == 0){
          wx.hideLoading()
        }
      }
      }
    })
  } )
}