|  |  | 
 |  |  | export const http = function (options) { | 
 |  |  |    { | 
 |  |  |       return new Promise((resolve, reject) => { | 
 |  |  |          let token = uni.getStorageSync('token') || '' | 
 |  |  |          let token = uni.getStorageSync('token') || null | 
 |  |  |          // 在登录的时候需要储存 token uni.setStorageSync("authorization","这里是登录获取的token值") | 
 |  |  |  | 
 |  |  |          // uni.showLoading({ | 
 |  |  |          //    title:"加载中..." | 
 |  |  |          // }) | 
 |  |  |          uni.showLoading({ | 
 |  |  |             title: '加载中', | 
 |  |  |             mask: true | 
 |  |  | 
 |  |  |             header: options.header || { | 
 |  |  |                // 根据实际接口设计 key 取 token 或者 authorization | 
 |  |  |                dm_user_token: token, | 
 |  |  |                "content-type": 'application/json' | 
 |  |  |                "content-type": 'application/json;charset=UTF-8' | 
 |  |  |             }, | 
 |  |  |             success: (res) => { | 
 |  |  |                let data = res.data | 
 |  |  |                // 控制台显示数据信息 | 
 |  |  |                uni.hideLoading() | 
 |  |  |                // 登录过期 | 
 |  |  |                if (data.code === 5112 || data.code === 5111) { | 
 |  |  |                   setTimeout(() => { | 
 |  |  |                      uni.showToast({ | 
 |  |  |                         title: data.message, | 
 |  |  |                         icon: "none", | 
 |  |  |                         duration: 2000 | 
 |  |  |                      }) | 
 |  |  |                   }) | 
 |  |  |                   uni.navigateTo({ | 
 |  |  |                      url: '/pages/index/login' | 
 |  |  |                   }) | 
 |  |  |                   return | 
 |  |  |                } | 
 |  |  |                if (data.code !== 200) { | 
 |  |  |                   setTimeout(() => { | 
 |  |  |                      uni.showToast({ | 
 |  |  | 
 |  |  |                   }) | 
 |  |  |                   return | 
 |  |  |                } | 
 |  |  |                if (data.code === 5112) { | 
 |  |  |                   return uni.navigateTo({ | 
 |  |  |                      url: '/pages/login/login' | 
 |  |  |                   }) | 
 |  |  |                } | 
 |  |  |                resolve(data) | 
 |  |  |                // return response.data | 
 |  |  |             }, | 
 |  |  |             fail: (err) => { | 
 |  |  |                // 页面中弹框显示失败 | 
 |  |  |                uni.showToast({ | 
 |  |  |                   title: '请求接口失败' | 
 |  |  |                   title: '请求接口失败', | 
 |  |  |                   icon: "none", | 
 |  |  |                }) | 
 |  |  |  | 
 |  |  |                console.log('err', err) | 
 |  |  |                console.log('msg', baseUrl + options.url) | 
 |  |  |                // 返回错误消息 | 
 |  |  |                reject(err) | 
 |  |  |                uni.hideLoading() | 
 |  |  |                return Promise.reject(err) | 
 |  |  |             }, | 
 |  |  |             catch: (e) => { | 
 |  |  |                console.log(e) |