request.js
547 字节
// 引入拦截器配置
import {requestInterceptors, responseInterceptors} from './interceptors.js'
// 引入luch-request
import { http } from '@/uni_modules/uview-plus'
// 初始化请求配置
const initRequest=(vm)=>{
http.setConfig((defaultConfig) => {
/* defaultConfig 为默认全局配置 */
defaultConfig.baseURL = 'https://bxcxhd.gxbx.com.cn'
// defaultConfig.baseURL = 'http://192.168.2.13:6512'
defaultConfig.timeout = 60000
return defaultConfig
})
requestInterceptors()
responseInterceptors()
}
export {
initRequest
}