|
|
@ -1,4 +1,6 @@ |
|
|
|
import {showLoading,hideLoading} from "./plugIn/globalLoading"; |
|
|
|
|
|
|
|
|
|
|
|
const request = (url, data, method = 'GET') => { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
let header = { |
|
|
@ -9,22 +11,26 @@ const request = (url, data, method = 'GET') => { |
|
|
|
if (token) { |
|
|
|
header['Authorization'] = token |
|
|
|
} |
|
|
|
|
|
|
|
var project = ""; |
|
|
|
// #ifdef H5
|
|
|
|
var fullUrl = window.location.search; |
|
|
|
if (fullUrl.indexOf("?") != -1) { |
|
|
|
fullUrl = fullUrl.substring(1); |
|
|
|
var paramStrs = fullUrl.split("&"); |
|
|
|
for(let i=0;i<paramStrs.length;i++){ |
|
|
|
const newStrs = paramStrs[i].split("="); |
|
|
|
if(newStrs[0] === 'project'){ |
|
|
|
header['project'] = newStrs[1] |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(header['project'] == undefined || header['project']== ''){ |
|
|
|
header['project'] = '0' |
|
|
|
} |
|
|
|
if (fullUrl.indexOf("?") != -1) { |
|
|
|
fullUrl = fullUrl.substring(1); |
|
|
|
var paramStrs = fullUrl.split("&"); |
|
|
|
for(let i=0;i<paramStrs.length;i++){ |
|
|
|
const newStrs = paramStrs[i].split("="); |
|
|
|
if(newStrs[0] === 'project'){ |
|
|
|
project = newStrs[1] |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// #endif
|
|
|
|
if(!project){ |
|
|
|
project = uni.getStorageSync('project'); |
|
|
|
} |
|
|
|
header['project'] = project |
|
|
|
|
|
|
|
var locale = uni.getLocale() || 'zh' |
|
|
|
if(locale == 'zh-Hans'){ |
|
|
|
locale = 'zh' |
|
|
|