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.

22 lines
561 B

5 years ago
import Request from '@/js_sdk/luch-request/request'
const http = new Request();
http.setConfig((config) => { /* 设置全局配置 */
config.baseUrl = 'http://39.98.253.192/data'; /* 根域名不同 */
return config;
})
http.interceptor.request((config, cancel) => {
return config;
})
http.interceptor.response((response) => { /* 请求之后拦截器 */
const res = response.data
if (res.code !== 0) {
uni.showToast({title: res.msg, duration:2000})
return Promise.reject('error')
} else {
return res
}
})
export default http;