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

// 按欢哥的要求 getSqlData 接口要加上appId 参数

// 解决北电科接口越权的问题.
上级 f84eaaa1
import encryptApiList, { resBinaryApiList } from '@/webPublic/one_stop_public/Base16/encryptApiList';
import encryptApiList, {
resBinaryApiList,
} from '@/webPublic/one_stop_public/Base16/encryptApiList';
import { getToken, getUserInfo } from '@/webPublic/one_stop_public/utils/token';
import { queryApiActionPath } from '@/webPublic/one_stop_public/utils/queryConfig';
import { qqCw } from '@/webPublic/one_stop_public/utils/request';
......@@ -11,15 +13,22 @@ import { strToBinary } from './strToBinary'; // 字符串转二进制 混淆代
import { binaryToStr } from './binaryToStr';
import { getVisitorToken } from '@/webPublic/zyd_public/utils/getHeaders'; // 二进制字符串转JSON字符串 混淆代码
const test = !!(getUrlInfo().test);
const test = !!getUrlInfo().test;
function formatDatas(datas, url = '') {
if (url && url.indexOf('getSqlData') > -1 && window.smartFormGlobalProps?.data) {
// 按欢哥的要求 getSqlData 接口要加上appId 参数
// 解决北电科接口越权的问题.
datas.appId = window.smartFormGlobalProps?.data.appId || window.smartFormGlobalProps?.data.id;
console.log('getSqlData,AppId', datas.appId);
}
let datasCode = JSON.stringify(datas);
const openIsBinary = window.CONFIG?.IS_BINARY;
if (test) {
console.log(url, datas);
}
if (openIsBinary) {
datasCode = strToBinary(datasCode);
}
......@@ -35,14 +44,13 @@ function formatDatas(datas, url = '') {
if (window.CONFIG?.ALL_R_BIN) {
datasTrue.rbin = true;
} else {
let findIndexA = resBinaryApiList.findIndex(g => {
let findIndexA = resBinaryApiList.findIndex((g) => {
return url.includes(g.api);
});
if (findIndexA >= 0) {
datasTrue.rbin = true;
}
}
}
return datasTrue;
}
......@@ -105,13 +113,7 @@ export async function requestFileInfo(url, datas) {
}
let trueUrl = url && url.indexOf('http') > -1 ? url : queryApiActionPath() + url;
if (test) {
console.log('转换前', trueUrl);
}
const {transformApi, headersApi } = await getTransformApi(trueUrl);
if (test) {
console.log('转换后' + transformApi, headersApi);
}
const { transformApi, headersApi } = await getTransformApi(trueUrl);
return fetch(transformApi, {
headers: {
Accept: 'application/json',
......@@ -124,7 +126,7 @@ export async function requestFileInfo(url, datas) {
mode: 'cors',
body: formData,
})
.then(res => {
.then((res) => {
if (res.status === 401) {
qqCw({
title: '登录过期401',
......@@ -141,9 +143,8 @@ export async function requestFileInfo(url, datas) {
}
return res.json();
})
.then(res => {
.then((res) => {
if (res && typeof res === 'object' && res.rbin) {
res = binaryToStr(res.rbin);
if (isJSON(res)) {
res = JSON.parse(res);
......
......@@ -14,6 +14,9 @@ export default function prepareShow(postData = {}, content = '') {
giveSmartFormGlobalProps({
data: postData || content,
});
if(process.env.NODE_ENV === 'development'){
// console.log(window.smartFormGlobalProps.data);
}
let agg = deepCopy(postData);
window.beforeApplySubmit = undefined; // 流程发起时执行的异步回调函数 这里清空 防止泄露
window.beforeAuditSubmit = undefined; // 流程审批时执行的异步回调函数 这里清空 防止泄露
......@@ -25,7 +28,7 @@ export default function prepareShow(postData = {}, content = '') {
window.moment = moment;
return new Promise((resolve, reject) => {
console.log(agg?.unifiedServicePatternModel?.id); // 表单id;
if (agg?.unifiedServicePatternModel?.id && (window.location.href.indexOf('localhost') > -1 || test)) {
if (agg?.unifiedServicePatternModel?.id && process.env.NODE_ENV === 'development' || test) {
const SystemConfig = window.specialImportantSystemConfig || {};
console.log('%c' + `${SystemConfig?.gateWayPort}/onestop/#/admin/processServices/modelConfig/templateDetail/designById?id=${agg.unifiedServicePatternModel.id}&token=${getToken()}`, 'color: green;background: white;font-size: 14px');
console.log('%c' + `${SystemConfig?.gateWayPort}/wisdomSchool/#/designFormByUrl?id=${agg.unifiedServicePatternModel.id}&token=${getToken()}`, 'color: green;background: white;font-size: 14px');
......
......@@ -26,7 +26,7 @@ export function getVisitorToken(){
headers: {},
};
if(process.env.NODE_ENV === 'development'){
if(process.env.NODE_ENV === 'development' && getIsBei_Dian()){
res.headers.env = 'test';
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论