/**  
 | 
 * 响应拦截  
 | 
 * @param {Object} http   
 | 
 */ 
 | 
import { coustomLogin, wxEmpower } from '@/util/api/index'  
 | 
module.exports = (vm) => {  
 | 
    uni.$u.http.interceptors.response.use((response) => {  
 | 
        /* 对响应成功做点什么 可使用async await 做异步操作*/  
 | 
        const data = response.data  
 | 
        // 自定义参数  
 | 
        const custom = response.config?.custom  
 | 
        if (data.code !== 200) { // 服务端返回的状态码不等于200,则reject() 
 | 
            uni.$u.toast(data.message) 
 | 
            if (data.code === 5112) { 
 | 
                // 未登录、登录失效 
 | 
                uni.reLaunch({ 
 | 
                    url: '/pages/index/index' 
 | 
                }) 
 | 
            } 
 | 
            return Promise.reject(data)  
 | 
        } 
 | 
        // console.log(data.data);  
 | 
        return data.data || {}  
 | 
    }, (response) => {  
 | 
        /*  对响应错误做点什么 (statusCode !== 200)*/ 
 | 
        return Promise.reject(response)  
 | 
    })  
 | 
} 
 |