53 lines
1.8 KiB
JavaScript
53 lines
1.8 KiB
JavaScript
// const baseUrl = "https://api.collect.hs.hnzhwlkj.club/"; //这里放置url域名32044
|
|
// const baseUrl = "https://api.collect.xyh.muzili.top/"; //这里放置url域名32044
|
|
const baseUrl = "https://fdesk.hnxinyouhe.com/"; //这里放置url域名32044
|
|
// const baseUrl = "https://114.215.24.240:8106/api/v1/"; //这里放置url域名32044
|
|
export function request(options){//封装的requset
|
|
let { url,data,method } = options;
|
|
data = data || {},
|
|
uni.showLoading({
|
|
title: ''
|
|
});
|
|
|
|
return new Promise((resolve,rejext)=>{
|
|
uni.request({//这里是uniapp网络请求的api
|
|
url: baseUrl + url, //仅为示例,并非真实接口地址。
|
|
data,
|
|
header:{'Fdesk-Corp-Abbr':uni.getStorageSync('corp_abbr'),'Fdesk-Auth-Token': 'Bearer ' + uni.getStorageSync('token'),'Fdesk-Language': uni.getStorageSync('i18locale')?uni.getStorageSync('i18locale'):'zh','Fdesk-Login-Type': 'feishu','Fdesk-System-Code':'fdesk','is_mob':1},
|
|
method:method||"GET",//默认请求方式是get
|
|
success: (res) => {
|
|
uni.hideLoading();
|
|
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:{'content-type': 'application/x-www-form-urlencoded','Fdesk-Auth-Token': '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"
|
|
});
|
|
}
|