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

代码修改

上级 0e9afcb2
......@@ -8,6 +8,7 @@ import FormdataWrapper from '@/utils/object-to-formdata-custom';
import { getToken } from '@/utils/authority';
import { offline } from './Toast';
import systemConfig from '@/config/config';
import { uaaRequest } from "@/webPublic/one_stop_public/utils/request";
const codeMessage = {
200: '服务器成功返回请求的数据。',
......@@ -111,26 +112,6 @@ export const request = (url, data, options = {}) => {
});
};
const setRequestConfig = (config) => {
return (url, data, options = {}) => {
if (Array.isArray(url)) {
return Promise.all(
url.map((ags) => {
return request(ags[0], ags[1], Object.assign({}, ags[2], config));
}),
);
}
return request(url, data, { ...options, ...config });
};
};
const createServerRequest = (config = {}) => {
return setRequestConfig(config);
};
export const apiRequest = createServerRequest({
method: 'POST',
prefix: systemConfig.sqlFormsServer || 'http://scjoyedu.eicp.net:18888/onestop/',
});
export const apiRequest = uaaRequest;
export default request;
import baseX from 'base-x';
import { isEmpty, template } from 'lodash';
import { apiRequest } from '../utils/request';
var BASE16 = '0123456789abcdef';
import baseX from "base-x";
import { isEmpty, template } from "lodash";
import { apiRequest } from "../utils/request";
import { isJSON } from "@/webPublic/zyd_public/utils/utils";
var BASE16 = "0123456789abcdef";
var bs16 = baseX(BASE16);
export function Base16Encode(value) {
let is_open_base14 = sessionStorage.getItem('is_open_base16')
? JSON.parse(sessionStorage.getItem('is_open_base16'))
let is_open_base14 = sessionStorage.getItem("is_open_base16")
? JSON.parse(sessionStorage.getItem("is_open_base16"))
: false;
if (is_open_base14) return value ? bs16.encode(new Buffer(value)) : null;
return value;
......@@ -22,107 +24,112 @@ const giveKey = (key, datas) => {
const encryptApiList = [
{
api: 'DataColumnApi/getOptions',
key: ['filterSql'],
api: "DataColumnApi/getOptions",
key: ["filterSql"]
},
{
api: 'DataColumnApi/getLabels',
key: ['allValues'],
api: "DataColumnApi/getLabels",
key: ["allValues"],
query: true,
setNull: true,
setNull: true
},
{
api: 'DataColumnApi/getSqlOptions',
key: ['allValues'],
query: true,
api: "DataColumnApi/getSqlOptions",
key: ["allValues"],
query: true
},
{
api: 'DataColumnApi/getSqlLabels',
key: ['allValues'],
query: true,
api: "DataColumnApi/getSqlLabels",
key: ["allValues"],
query: true
},
{
api: 'DataColumnApi/getSqlData',
key: ['allValues', 'sqlKey'],
query: true,
api: "DataColumnApi/getSqlData",
key: ["allValues", "sqlKey"],
query: true
},
{
api: 'DataRightApi/add',
key: ['filterSql'],
api: "DataRightApi/add",
key: ["filterSql"]
},
{
api: 'DataRightApi/addBatch',
key: ['filterSql'],
api: "DataRightApi/addBatch",
key: ["filterSql"]
},
{
api: 'DataObjApi/add',
key: ['sqlScript'],
api: "DataObjApi/add",
key: ["sqlScript"]
},
{
api: 'DataObjApi/getFormDataList',
key: ['custom'],
api: "DataObjApi/getFormDataList",
key: ["custom"]
},
{
api: 'DataObjApi/getFormDataPage',
key: ['sql', 'custom'],
api: "DataObjApi/getFormDataPage",
key: ["sql", "custom"]
},
{
api: 'UserApi/getPage',
key: ['addSignSql'],
api: "UserApi/getPage",
key: ["addSignSql"]
},
{
api: 'UnifiedAppFormApi/examineProcess',
key: ['taskForm'],
api: "UnifiedAppFormApi/examineProcess",
key: ["taskForm"]
},
{
api: 'UnifiedAppFormApi/saveDraft',
key: ['content'],
api: "UnifiedAppFormApi/saveDraft",
key: ["content"]
},
{
api: 'UnifiedAppFormApi/startProcess',
key: ['content'],
api: "UnifiedAppFormApi/startProcess",
key: ["content"]
},
{
api: 'UnifiedAppFormApi/startProcessByService',
key: ['content'],
api: "UnifiedAppFormApi/startProcessByService",
key: ["content"]
},
{
api: 'UnifiedAppFormApi/getHandleUser',
key: ['content'],
},
]
export async function giveBase16EnCode(datas, url) { // 全局加解密函数.
if (url && typeof url === 'string') {
api: "UnifiedAppFormApi/getHandleUser",
key: ["content"]
}
];
export function giveBase16EnCode(datas, url) { // 全局加解密函数.
if (url && typeof url === "string") {
for (let item of encryptApiList) {
if (url.indexOf(item.api) > -1) {
for (let g of item.key) {
if (g == "allValues") {
if (item.setNull) {
datas.allValues = "{}";
} else {
if (item.query) {
if (datas.sqlKey.length < 13) {
const response = await apiRequest("/SqlManageEntityApi/findParamsKey", { sqlKey: datas.sqlKey });
if (response.length == 0) {
datas.allValues = "{}";
} else {
const x = JSON.parse(allValues);
const y = {};
for (var i in response) {
if (x[i]) {
y[i] = x[i]
}
datas.allValues = JSON.stringify(y);
}
}
} else {
datas.allValues = "{}";
}
}
}
datas = giveKey(g, datas);
}
// if (g === "allValues" && false) {
// if (item.setNull) {
// datas.allValues = "{}";
// } else {
// if (item.query) {
// if (datas.sqlKey.length < 13) {
// const response = await apiRequest("/SqlManageEntityApi/findParamsKey", { sqlKey: datas.sqlKey });
//
// if (response.length === 0) {
// datas.allValues = "{}";
// } else {
// const x = isJSON(data.allValues) && JSON.parse(data.allValues) || {};
// const y = {};
// for (let i in response) {
// if (x[i]) {
// y[i] = x[i];
// }
// datas.allValues = JSON.stringify(y);
// }
// }
// } else {
// datas.allValues = "{}";
// }
// }
// }
// // datas = giveKey(g, datas);
// } else {
// datas = giveKey(g, datas);
// }
}
return datas;
}
......
......@@ -315,6 +315,7 @@ const setRequestConfig = config => {
}),
);
}
console.log(url, config);
return request(url, data, { ...options, ...config });
};
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论