1.28 更换echarts文件
This commit is contained in:
141
unpackage/dist/dev/mp-weixin/request/http.js
vendored
Normal file
141
unpackage/dist/dev/mp-weixin/request/http.js
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../common/vendor.js");
|
||||
let baseURL = "";
|
||||
{
|
||||
baseURL = "https://api.valuefrontier.cn:5002";
|
||||
}
|
||||
function get(url, params, isNotPort) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let token = common_vendor.index.getStorageSync("token");
|
||||
common_vendor.index.showLoading({
|
||||
title: "加载中"
|
||||
});
|
||||
let baseUrl = baseURL;
|
||||
if (isNotPort) {
|
||||
baseUrl = "https://api.valuefrontier.cn";
|
||||
}
|
||||
common_vendor.index.request({
|
||||
url: baseUrl + url,
|
||||
data: params,
|
||||
header: {
|
||||
"Accept": "application/json",
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"Authorization": token ? "Bearer " + token : ""
|
||||
},
|
||||
method: "GET",
|
||||
success: (response) => {
|
||||
common_vendor.index.__f__("log", "at request/http.js:44", response);
|
||||
common_vendor.index.hideLoading();
|
||||
if (response.data.code == 401) {
|
||||
common_vendor.index.removeStorageSync("token");
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/pages/login/login"
|
||||
});
|
||||
} else {
|
||||
resolve(response.data);
|
||||
}
|
||||
},
|
||||
fail: (error) => {
|
||||
common_vendor.index.hideLoading();
|
||||
common_vendor.index.showToast({
|
||||
title: "请求失败",
|
||||
icon: "error"
|
||||
});
|
||||
reject(error.response);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
function post(url, params, isNotPort) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let token = common_vendor.index.getStorageSync("token");
|
||||
let isJson = 0;
|
||||
let isFile = 0;
|
||||
if (params) {
|
||||
isJson = params.isJson;
|
||||
}
|
||||
if (params) {
|
||||
isFile = params.isFile;
|
||||
}
|
||||
common_vendor.index.showLoading({
|
||||
title: "加载中"
|
||||
});
|
||||
if (isFile) {
|
||||
let token2 = common_vendor.index.getStorageSync("token");
|
||||
common_vendor.index.uploadFile({
|
||||
url: baseURL + url,
|
||||
filePath: params.avatar,
|
||||
name: "avatar",
|
||||
header: {
|
||||
"Authorization": token2 ? "Bearer " + token2 : ""
|
||||
},
|
||||
formData: params,
|
||||
success: (response) => {
|
||||
common_vendor.index.__f__("log", "at request/http.js:100", response);
|
||||
common_vendor.index.hideLoading();
|
||||
if (response.data.code == 401) {
|
||||
common_vendor.index.removeStorageSync("token");
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/pages/login/login"
|
||||
});
|
||||
reject(response.data);
|
||||
} else {
|
||||
resolve(response.data);
|
||||
}
|
||||
},
|
||||
fail: (error) => {
|
||||
common_vendor.index.__f__("log", "at request/http.js:113", "上传失败" + error.errMsg);
|
||||
common_vendor.index.hideLoading();
|
||||
common_vendor.index.showToast({
|
||||
title: "请求失败",
|
||||
icon: "error"
|
||||
});
|
||||
reject();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
let baseUrl = baseURL;
|
||||
if (url.indexOf("concept-api") > -1 || url.indexOf("api/market/trade/batch") > -1) {
|
||||
baseUrl = "https://api.valuefrontier.cn";
|
||||
}
|
||||
common_vendor.index.request({
|
||||
url: baseUrl + url,
|
||||
data: params,
|
||||
header: {
|
||||
"Accept": "application/json",
|
||||
"Content-Type": isJson ? "application/json" : isFile ? "multipart/form-data" : "application/x-www-form-urlencoded",
|
||||
"Authorization": token ? "Bearer " + token : ""
|
||||
},
|
||||
method: "POST",
|
||||
success: (response) => {
|
||||
common_vendor.index.hideLoading();
|
||||
if (params && params.isNotNeedLogin)
|
||||
;
|
||||
else {
|
||||
common_vendor.index.__f__("log", "at request/http.js:144", response.data);
|
||||
if (response.data.code == 401) {
|
||||
common_vendor.index.removeStorageSync("token");
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/pages/login/login"
|
||||
});
|
||||
reject(response.data);
|
||||
} else {
|
||||
resolve(response.data);
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: (error) => {
|
||||
common_vendor.index.hideLoading();
|
||||
common_vendor.index.showToast({
|
||||
title: "请求失败",
|
||||
icon: "error"
|
||||
});
|
||||
reject(error.response);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.get = get;
|
||||
exports.post = post;
|
||||
//# sourceMappingURL=../../.sourcemap/mp-weixin/request/http.js.map
|
||||
Reference in New Issue
Block a user