import http from './http.js'
|
|
|
|
const config = {
|
|
getInfo : {url : '/api/getInfo', method : 'GET', auth : false},
|
|
getUserInfo : {url : '/api/getUserInfo', method : 'GET', auth : false, showLoading : true, loadingTitle : '搜索中...'},
|
|
getConfList : {url : '/api/getConfList', method : 'GET', auth : false, showLoading : true, loadingTitle : '搜索中...'},
|
|
}
|
|
|
|
|
|
|
|
export function api(key, data, callback, loadingTitle){
|
|
if (!config[key]) {
|
|
return console.error('无效key' + key);
|
|
}
|
|
|
|
// if (config[key].auth) {
|
|
// if (!localStorage.getItem('token')) {
|
|
// uni.navigateTo({
|
|
// url: '/pages/login/mobile'
|
|
// })
|
|
// console.error('需要登录')
|
|
// return {
|
|
// then() {}
|
|
// };
|
|
// }
|
|
// }
|
|
|
|
http.http(config[key].url, data, callback, config[key].method,
|
|
loadingTitle || config[key].showLoading, loadingTitle || config[key].loadingTitle)
|
|
}
|
|
|
|
|
|
|
|
export default api
|