gx
queenwuli
2021-01-12 a6653e19d20a61e7b8f788037d2a4df3f93a4f32
hive-app/common/jssdk/httpUtils.js
@@ -22,13 +22,19 @@
      let timeStamp = new Date().getTime();
      return encrypt.encrypt(token + '_' + timeStamp + '_' + url);
   },
   request (url, data = {}, method = 'GET', extraObj = {}) {
   request (url, data = {}, method = 'GET', extraObj = {isShowLoad: false}) {
      let header = {
         'Authorization': 'Bearer ' + this.handleToken(url),
         'lang': 'zh_CN',
         'content-type': 'application/json; charset=utf-8'
      }
      return new Promise((resolve, reject) => {
         if(extraObj.isShowLoad){
            uni.showLoading({
               mask: true,
               title: '加载中'
            })
         }
         uni.request({
             url: this.baseUrl + url,
            method,
@@ -36,6 +42,7 @@
             header,
            sslVerify: false,
             success: (res) => {
               extraObj.isShowLoad && uni.hideLoading()
               let result = res.data;
               if(!this.isNotLogin(result)){
                  resolve(result);
@@ -59,6 +66,7 @@
               }
             },
            fail: (error) => {
               extraObj.isShowLoad && uni.hideLoading()
               reject(error);
            }
         });