正在显示
1 个修改的文件
包含
4 行增加
和
2 行删除
| ... | ... | @@ -55,13 +55,15 @@ module.exports = (vm) => { |
| 55 | 55 | }) |
| 56 | 56 | |
| 57 | 57 | // 请求拦截 |
| 58 | - uni.$u.http.interceptors.request.use((config) => { // 可使用async await 做异步操作 | |
| 58 | + uni.$u.http.interceptors.request.use((config) => { // 可使用async await 做异步操作 | |
| 59 | + console.log(config); | |
| 59 | 60 | // 初始化请求拦截器时,会执行此方法,此时data为undefined,赋予默认{} |
| 60 | 61 | config.data = config.data || {} |
| 61 | 62 | // 根据custom参数中配置的是否需要token,添加对应的请求头 |
| 62 | 63 | if (!(config && config.custom && config.custom.auth === false)) { |
| 63 | 64 | // 可以在此通过vm引用vuex中的变量,具体值在vm.$store.state中 |
| 64 | - config.header.Authorization = vm.$store.state.vuex_token | |
| 65 | + config.header.Authorization = vm.$store.state.vuex_token; | |
| 66 | + config.baseURL = "https://api-isx.workai.com.cn"; | |
| 65 | 67 | } |
| 66 | 68 | return config |
| 67 | 69 | }, config => { // 可使用async await 做异步操作 | ... | ... |
请
注册
或
登录
后发表评论