Merge branch 'main' of http://47.107.152.87:3000/dyf/APP
This commit is contained in:
@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user