You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
529 B
25 lines
529 B
import { BASE_URL } from "@/config/index.js"
|
|
|
|
module.exports = (vm) => {
|
|
// 请求全局配置
|
|
uni.$u.http.setConfig((config) => {
|
|
config.baseURL = BASE_URL;
|
|
return config
|
|
})
|
|
|
|
// 请求前拦截, 现在不做拦截
|
|
uni.$u.http.interceptors.request.use(config => {
|
|
return config;
|
|
})
|
|
|
|
// 响应拦截
|
|
uni.$u.http.interceptors.response.use(res => {
|
|
if(res.data.code == 0) {
|
|
return res;
|
|
} else {
|
|
vm.$msg(res.data.msg);
|
|
return false;
|
|
}
|
|
// res.code == 9998 手机号 res.code == 9999 用户信息
|
|
})
|
|
}
|