This commit is contained in:
fengerli
2026-02-03 18:56:26 +08:00
11 changed files with 109 additions and 79 deletions

View File

@ -5,7 +5,16 @@ const request = (options) => {
console.log("options" + JSON.stringify(options), BASE.BASE_URL)
return new Promise((resolve, reject) => {
// 处理GET请求参数
let url = BASE.BASE_URL + options.url;
let url ="";
if(options.url.indexOf('http://')===0 || options.url.indexOf('https://')===0){
url=options.url;
if(options.url.indexOf(BASE.BASE_UR)===-1){
options.isAuthen=false;
}
}else{
url=BASE.BASE_URL + options.url;
}
console.log("url" + url)
if (options.method === 'GET' && options.data) {
// 使用qs序列化参数
@ -48,8 +57,11 @@ const request = (options) => {
reject(err);
}
};
if (!options.url.includes('/login')) {
//是否添加身份验证undefined时默认需要
if(options.isAuthen===undefined){
options.isAuthen=true;
}
if (options.isAuthen) {
const token = uni.getStorageSync('token');
const clientid = uni.getStorageSync('clientID');
if (token) {