提交 07dab689 authored 作者: 钟是志's avatar 钟是志

request 函数放在公共函数库

上级 6553cb56
...@@ -86,7 +86,7 @@ export function giveFilePostData(datas, url) { ...@@ -86,7 +86,7 @@ export function giveFilePostData(datas, url) {
} }
if (url && typeof url === 'string') { if (url && typeof url === 'string') {
for (let item of encryptApiList) { for (let item of encryptApiList) {
if (window.CONFIG?.ALLBIN || url.indexOf(item.api) > -1) { if ((window.CONFIG?.ALLBIN && url.indexOf('/onestop/') > -1) || url.indexOf(item.api) > -1) {
const roleGroup = getUserInfo().groupsId; const roleGroup = getUserInfo().groupsId;
if (url.indexOf('http') > -1) { if (url.indexOf('http') > -1) {
url = url.replace('/onestop/', `/onestop/safe/${roleGroup}/`); url = url.replace('/onestop/', `/onestop/safe/${roleGroup}/`);
...@@ -109,14 +109,14 @@ export function giveFilePostData(datas, url) { ...@@ -109,14 +109,14 @@ export function giveFilePostData(datas, url) {
}); });
} }
function testPromise(d){ function testPromise(d) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
resolve(d); resolve(d);
}); });
} }
export async function requestFileInfo(url, datas) { export async function requestFileInfo(url, datas) {
for(let i = 0; i < 100; i++ ){ for (let i = 0; i < 100; i++) {
datas = await testPromise(datas); datas = await testPromise(datas);
} }
const formData = new FormData(); const formData = new FormData();
......
...@@ -10,7 +10,7 @@ export { Base16Encode, requestFileInfo, giveFilePostDataInfoForTrue }; ...@@ -10,7 +10,7 @@ export { Base16Encode, requestFileInfo, giveFilePostDataInfoForTrue };
export async function giveBase16EnCode(datas, url) { export async function giveBase16EnCode(datas, url) {
// 全局加解密函数. // 全局加解密函数.
if (queryIsSafe()) { if (queryIsSafe() && url) {
return giveFilePostData(datas, url); return giveFilePostData(datas, url);
} }
return giveBase16EncodeAsync(datas, url); return giveBase16EncodeAsync(datas, url);
......
...@@ -70,3 +70,7 @@ export function getType() { ...@@ -70,3 +70,7 @@ export function getType() {
return localStorage.getItem('antd-pro-type')||""; return localStorage.getItem('antd-pro-type')||"";
} }
export function setType(type) {
return localStorage.setItem('antd-pro-type', type);
}
...@@ -9,7 +9,7 @@ import { omit } from 'lodash'; ...@@ -9,7 +9,7 @@ import { omit } from 'lodash';
import qs from 'qs'; import qs from 'qs';
import { queryIsSafe } from '@/webPublic/one_stop_public/utils/queryConfig'; import { queryIsSafe } from '@/webPublic/one_stop_public/utils/queryConfig';
import { uaaRequest } from '@/webPublic/one_stop_public/utils/request'; import { uaaRequest } from '@/webPublic/one_stop_public/utils/request';
import { getToken, setToken, setFetchUrl, getFetchUrl, getType } from '@/webPublic/one_stop_public/utils/token'; import { getToken, setToken, setFetchUrl, getFetchUrl, getType, setType } from '@/webPublic/one_stop_public/utils/token';
const codeMessage = { const codeMessage = {
200: '服务器成功返回请求的数据。', 200: '服务器成功返回请求的数据。',
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论