提交
This commit is contained in:
+58
@@ -0,0 +1,58 @@
|
||||
// const baseUrl = "https://api.collect.hs.hnzhwlkj.club/"; //这里放置url域名32044
|
||||
// const baseUrl = "https://userdcar-server.hnxinyouhe.com/"; //这里放置url域名32044
|
||||
const baseUrl = "https://usedcar.dev.hnxinyouhe.com/"; //这里放置url域名32044
|
||||
// const baseUrl = "http://219.157.255.213:36010/"; //这里放置url域名32044
|
||||
export function request(options){//封装的requset
|
||||
let { url,data,method,loginType } = options;
|
||||
data = data || {},
|
||||
uni.showLoading({
|
||||
title: ''
|
||||
});
|
||||
|
||||
// 获取登录类型,优先使用传入的参数,否则从storage读取
|
||||
const loginTypeValue = loginType || uni.getStorageSync('loginType') || 'feishu'
|
||||
|
||||
return new Promise((resolve,rejext)=>{
|
||||
uni.request({//这里是uniapp网络请求的api
|
||||
url: baseUrl + url, //仅为示例,并非真实接口地址。
|
||||
data,
|
||||
header:{
|
||||
'Fdesk-Auth-Token':uni.getStorageSync('token'),
|
||||
'Fdesk-Login-Type': loginTypeValue,
|
||||
'Fdesk-System-Code':'fdesk'
|
||||
},
|
||||
method:method||"GET",//默认请求方式是get
|
||||
success: (res) => {
|
||||
resolve(res)
|
||||
},
|
||||
complete: (data)=>{
|
||||
uni.hideLoading();
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
export function requestx(options){//封装的requset
|
||||
let { url,data,method } = options;
|
||||
data = data || {};
|
||||
return new Promise((resolve,rejext)=>{
|
||||
uni.request({//这里是uniapp网络请求的api
|
||||
url: baseUrl + url, //仅为示例,并非真实接口地址。
|
||||
data,
|
||||
header:{'Authorization': 'Bearer ' + uni.getStorageSync('openid')},
|
||||
method:method||"GET",//默认请求方式是get
|
||||
success: (res) => {
|
||||
resolve(res)
|
||||
},
|
||||
complete: (data)=>{
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
export function showToast(options){//封装Toast
|
||||
let { title,duration,icon } = options;
|
||||
uni.showToast({
|
||||
title:title,
|
||||
duration: 2000,
|
||||
icon:icon || "none"
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user