const http = uni.$u.http function SetBaseUrl(url){ http.setConfig((config) => { /* config 为默认全局配置*/ config.baseURL = url; /* 根域名 */ return config }) } function GetToken(url, username, password) { return http.post(url, {username, password}, { custom:{auth: false} }) } function GetConfig(url) { return http.get(url) } function SetConfig(url, conf) { return http.put(url, conf) } function UploadFile(url, imei, file, name){ return http.upload(url,{ filePath: plus.io.convertAbsoluteFileSystem(file), name, formData: { imei } }) } export default { SetBaseUrl, GetToken, GetConfig, SetConfig, UploadFile }