10.18前的开发
This commit is contained in:
@@ -3,13 +3,23 @@ import config from '../config'
|
||||
// import store from '../store'
|
||||
|
||||
const loginUrl = 'pages/user/login';
|
||||
|
||||
// function JSON_to_URLEncoded(element,key,list){
|
||||
// var list = list || [];
|
||||
// if(typeof(element)=='object'){
|
||||
// for (var idx in element)
|
||||
// JSON_to_URLEncoded(element[idx],key?key+'['+idx+']':idx,list);
|
||||
// } else {
|
||||
// list.push(key+'='+encodeURIComponent(element));
|
||||
// }
|
||||
// return list.join('&');
|
||||
// }
|
||||
export default {
|
||||
REQUEST(url, method = 'GET', data, checkLogin = true, header) {
|
||||
let token = uni.getStorageSync('access_token') || 'Basic ZGV20mRldjEyMw==';
|
||||
|
||||
let token = uni.getStorageSync('access_token') || 'Basic ZGV2OmRldjEyMw==';
|
||||
const headers = {
|
||||
"Content-Type": "application/json",
|
||||
// "Content-Type": "application/x-www-form-urlencoded",
|
||||
// "Content-Type": "application/json",
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"Authorization": token,
|
||||
"x-token": token,
|
||||
"token":token,
|
||||
@@ -18,10 +28,6 @@ export default {
|
||||
}
|
||||
var pages = getCurrentPages();
|
||||
var page = pages[pages.length - 1];
|
||||
if(!header) {
|
||||
headers["Content-Type"] = 'application/x-www-form-urlencode'
|
||||
}
|
||||
console.log("headers :",headers)
|
||||
return uni.request({
|
||||
url: config.baseUrl + url,
|
||||
method,
|
||||
|
||||
Reference in New Issue
Block a user