位置项目根目录index.js
定义了两种请求get和post
import baseconfig from "./common/baseconfig.js"
const httpClient = {
request:function(method,url,data){
var headers={
"Content-Type": "application/x-www-form-urlencoded",
"Auth-Token": uni.getStorageSync("auth_token")
};
return new Promise((resolve,reject)=>{
uni.showLoading({
title:"加载中",
mask:true
});
uni.request({
url:url,
header:headers,
data:data,
method:method,
dataType: 'json',
success:function(res){
uni.hideLoading()
console.log("接口获取原始数据:-------------