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.
|
|
|
|
module.exports = (vm) => {
|
|
|
|
|
// 初始化请求配置
|
|
|
|
|
uni.$u.http.setConfig((config) => {
|
|
|
|
|
/* config 为默认全局配置*/
|
|
|
|
|
config.baseURL = "https://www.hzkjai.com"; /* 根域名 */
|
|
|
|
|
|
|
|
|
|
return config;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 请求拦截(从Storage中获取token加到header中的Authorization)
|
|
|
|
|
uni.$u.http.interceptors.request.use(
|
|
|
|
|
(config) => {
|
|
|
|
|
config.header.Authorization = "Bearer " + uni.getStorageSync("jwt");
|
|
|
|
|
return config;
|
|
|
|
|
},
|
|
|
|
|
(config) => {
|
|
|
|
|
return Promise.reject(config);
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
//如果需要响应拦截,请参考如下地址
|
|
|
|
|
//https://uviewui.com/js/http.html
|
|
|
|
|
};
|