| | |
| | | var Fly = require("./wx.umd.min")
|
| | | var fly = new Fly
|
| | | var fly = new Fly |
| | | const log = false
|
| | |
|
| | |
|
| | | fly.config.loading = true;
|
| | | //实例级配置
|
| | | //fly.config.timeout=6000;
|
| | | fly.config.timeout=10000;
|
| | | //添加拦截器
|
| | | fly.interceptors.request.use((config, promise) => {
|
| | | console.info(fly.config.loading)
|
| | | if (fly.config.loading) {
|
| | | uni.showLoading({
|
| | | title: '加载中'
|
| | |
| | | if (userinfo) {
|
| | | config.headers["X-Tenant-Id"] = userinfo.loginTenantId;
|
| | | }
|
| | | console.log('========================================== ')
|
| | | console.log('== 请求数据:' + JSON.stringify(config))
|
| | | console.log('=========================================== ')
|
| | | if(log){ |
| | | console.log('========================================== ') |
| | | console.log('== 请求数据:' + JSON.stringify(config)) |
| | | console.log('=========================================== ') |
| | | }
|
| | | return config;
|
| | | })
|
| | |
|
| | |
| | | fly.interceptors.response.use(
|
| | | (response) => {
|
| | |
|
| | | console.log('========================================')
|
| | | console.log('== 响应数据:' + JSON.stringify(response.request.url))
|
| | | console.log('== ' + JSON.stringify(response.data))
|
| | | console.log('======================================== ')
|
| | | if(log){ |
| | | console.log('========================================') |
| | | console.log('== 响应数据:' + JSON.stringify(response.request.url)) |
| | | console.log('== ' + JSON.stringify(response.data)) |
| | | console.log('======================================== ') |
| | | }
|
| | |
|
| | | //只将请求结果的data字段返回
|
| | |
|