class Config{
constructor(){
}
}
Config.requestUrl = 'your url';
export {Config};
/
import {Config} from '../utils/config.js';
class Base{
constructor(){
this.baseRequestUrl = Config.requestUrl;
}
request(params){
var url = this.baseRequestUrl + params.url;
if(!params.type){
params.type='GET';
}
wx.request({
url:url,
data:params.data,
method:
header:{
'content-type':'application/json',
'token':wx.getStorageSync('token')
},
success:function(res){
//if(params,sCallBack){
//params.sCallBack(res);
//}
params.sCallBack&¶ms.sCallBack(res);
},
fail:function(err){
console.log(err);
}
})
}
}