2020-06-15 02:00:14 +00:00
|
|
|
|
const install = (Vue, vm) => {
|
|
|
|
|
// 此为自定义配置参数,具体参数见上方说明
|
|
|
|
|
Vue.prototype.$u.http.setConfig({
|
2020-06-15 03:34:33 +00:00
|
|
|
|
baseUrl: 'https://dmmall.sdbairui.com/api',
|
2020-06-15 02:00:14 +00:00
|
|
|
|
loadingText: '努力加载中~',
|
|
|
|
|
loadingTime: 800
|
2020-07-21 13:01:42 +00:00
|
|
|
|
|
2020-06-15 02:00:14 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 请求拦截,配置Token等参数
|
|
|
|
|
Vue.prototype.$u.http.interceptor.request = (config) => {
|
2020-07-21 13:01:42 +00:00
|
|
|
|
|
2020-06-15 03:34:33 +00:00
|
|
|
|
const token = uni.getStorageSync('token');
|
2020-07-21 13:01:42 +00:00
|
|
|
|
|
2020-06-22 09:45:17 +00:00
|
|
|
|
config.header.Authorization = 'Bearer' + " " + token;
|
2020-07-21 13:01:42 +00:00
|
|
|
|
|
2020-06-15 02:00:14 +00:00
|
|
|
|
return config;
|
2020-07-21 13:01:42 +00:00
|
|
|
|
|
2020-06-15 02:00:14 +00:00
|
|
|
|
}
|
2020-07-21 13:01:42 +00:00
|
|
|
|
|
2020-06-15 02:00:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
install
|
|
|
|
|
}
|