球星卡微信小程序
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.

24 lines
519 B

  1. import { BASE_URL } from "@/config/index.js"
  2. module.exports = (vm) => {
  3. // 请求全局配置
  4. uni.$u.http.setConfig((config) => {
  5. config.baseURL = BASE_URL;
  6. return config
  7. })
  8. // 请求前拦截, 现在不做拦截
  9. uni.$u.http.interceptors.request.use(config => {
  10. return config;
  11. })
  12. // 响应拦截
  13. uni.$u.http.interceptors.response.use(res => {
  14. if(res.code == 0) {
  15. return res;
  16. } else {
  17. vm.$msg(res.msg);
  18. return false;
  19. }
  20. // res.code == 9998 手机号 res.code == 9999 用户信息
  21. })
  22. }