28 lines
491 B
JavaScript
28 lines
491 B
JavaScript
|
import {
|
||
|
runInterceptors
|
||
|
} from "./interceptors";
|
||
|
|
||
|
const config = {
|
||
|
timeout: 10000
|
||
|
};
|
||
|
|
||
|
// #ifdef H5
|
||
|
config['baseURL'] = '/'
|
||
|
// #endif
|
||
|
|
||
|
// #ifdef MP-WEIXIN
|
||
|
config['baseURL'] = 'https://www.lonsungsh.com:8083' //request url
|
||
|
// #endif
|
||
|
|
||
|
const instance = createHttp(config)
|
||
|
|
||
|
export default runInterceptors(instance);
|
||
|
|
||
|
|
||
|
function createHttp(con) {
|
||
|
const instance = uni.$u.http.setConfig((config) => {
|
||
|
Object.keys(con).forEach(k => config[k] = con[k])
|
||
|
return config
|
||
|
})
|
||
|
return uni.$u.http;
|
||
|
}
|