提交 2eb37c9e authored 作者: 钟是志's avatar 钟是志

优化代码

上级 2a143da5
...@@ -63,7 +63,7 @@ export const qqCw = ({ ...@@ -63,7 +63,7 @@ export const qqCw = ({
return undefined; return undefined;
}; };
const objectToQuery = function (param, key, encode) { const objectToQuery = function(param, key, encode) {
if (param == null) return ''; if (param == null) return '';
var paramStr = ''; var paramStr = '';
var t = typeof param; var t = typeof param;
...@@ -134,8 +134,12 @@ export const request = (url, data, options = {}) => { ...@@ -134,8 +134,12 @@ export const request = (url, data, options = {}) => {
if (url && test === 'true') { if (url && test === 'true') {
console.log(url, data); console.log(url, data);
} }
if(url.indexOf('queryInfo') > -1){
debugger;
}
return giveBase16EnCode(data, url) return giveBase16EnCode(data, url)
.then((newData) => { .then((newData) => {
if (typeof newData === 'object' && newData.url && newData.datas) { if (typeof newData === 'object' && newData.url && newData.datas) {
return requestFileInfo(newData.url, newData.datas); return requestFileInfo(newData.url, newData.datas);
} }
...@@ -150,6 +154,7 @@ export const requestOrigin = (url, data, options = {}) => { ...@@ -150,6 +154,7 @@ export const requestOrigin = (url, data, options = {}) => {
? JSON.parse(localStorage.getItem('version')) ? JSON.parse(localStorage.getItem('version'))
: null; : null;
if (options.method === 'GET') { if (options.method === 'GET') {
const pp = { const pp = {
...data, ...data,
...@@ -258,10 +263,15 @@ export const requestOrigin = (url, data, options = {}) => { ...@@ -258,10 +263,15 @@ export const requestOrigin = (url, data, options = {}) => {
url = '/UserApi/login'; // 通过 proxy代理 解决登录接口本地跨域问题 url = '/UserApi/login'; // 通过 proxy代理 解决登录接口本地跨域问题
options.prefix = ''; options.prefix = '';
} }
if (getToken()) {
options.headers = {
Authorization: `bearer ${getToken()}`,
};
}
return fetchRequest(url, { return fetchRequest(url, {
data: pp, data: pp,
// method: "POST", // method: "POST",
requestType: 'form', requestType: 'form',
...options, ...options,
}) })
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论