提交 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 { getToken, getUserInfo } from '@/webPublic/one_stop_public/utils/token';
import { queryApiActionPath } from '@/webPublic/one_stop_public/utils/queryConfig'; import { queryApiActionPath } from '@/webPublic/one_stop_public/utils/queryConfig';
import { qqCw } from '@/webPublic/one_stop_public/utils/request'; import { qqCw } from '@/webPublic/one_stop_public/utils/request';
...@@ -11,15 +13,22 @@ import { strToBinary } from './strToBinary'; // 字符串转二进制 混淆代 ...@@ -11,15 +13,22 @@ import { strToBinary } from './strToBinary'; // 字符串转二进制 混淆代
import { binaryToStr } from './binaryToStr'; import { binaryToStr } from './binaryToStr';
import { getVisitorToken } from '@/webPublic/zyd_public/utils/getHeaders'; // 二进制字符串转JSON字符串 混淆代码 import { getVisitorToken } from '@/webPublic/zyd_public/utils/getHeaders'; // 二进制字符串转JSON字符串 混淆代码
const test = !!(getUrlInfo().test); const test = !!getUrlInfo().test;
function formatDatas(datas, url = '') { 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); let datasCode = JSON.stringify(datas);
const openIsBinary = window.CONFIG?.IS_BINARY; const openIsBinary = window.CONFIG?.IS_BINARY;
if (test) { if (test) {
console.log(url, datas); console.log(url, datas);
} }
if (openIsBinary) { if (openIsBinary) {
datasCode = strToBinary(datasCode); datasCode = strToBinary(datasCode);
} }
...@@ -35,14 +44,13 @@ function formatDatas(datas, url = '') { ...@@ -35,14 +44,13 @@ function formatDatas(datas, url = '') {
if (window.CONFIG?.ALL_R_BIN) { if (window.CONFIG?.ALL_R_BIN) {
datasTrue.rbin = true; datasTrue.rbin = true;
} else { } else {
let findIndexA = resBinaryApiList.findIndex(g => { let findIndexA = resBinaryApiList.findIndex((g) => {
return url.includes(g.api); return url.includes(g.api);
}); });
if (findIndexA >= 0) { if (findIndexA >= 0) {
datasTrue.rbin = true; datasTrue.rbin = true;
} }
} }
} }
return datasTrue; return datasTrue;
} }
...@@ -105,13 +113,7 @@ export async function requestFileInfo(url, datas) { ...@@ -105,13 +113,7 @@ export async function requestFileInfo(url, datas) {
} }
let trueUrl = url && url.indexOf('http') > -1 ? url : queryApiActionPath() + url; let trueUrl = url && url.indexOf('http') > -1 ? url : queryApiActionPath() + url;
if (test) { const { transformApi, headersApi } = await getTransformApi(trueUrl);
console.log('转换前', trueUrl);
}
const {transformApi, headersApi } = await getTransformApi(trueUrl);
if (test) {
console.log('转换后' + transformApi, headersApi);
}
return fetch(transformApi, { return fetch(transformApi, {
headers: { headers: {
Accept: 'application/json', Accept: 'application/json',
...@@ -124,7 +126,7 @@ export async function requestFileInfo(url, datas) { ...@@ -124,7 +126,7 @@ export async function requestFileInfo(url, datas) {
mode: 'cors', mode: 'cors',
body: formData, body: formData,
}) })
.then(res => { .then((res) => {
if (res.status === 401) { if (res.status === 401) {
qqCw({ qqCw({
title: '登录过期401', title: '登录过期401',
...@@ -141,9 +143,8 @@ export async function requestFileInfo(url, datas) { ...@@ -141,9 +143,8 @@ export async function requestFileInfo(url, datas) {
} }
return res.json(); return res.json();
}) })
.then(res => { .then((res) => {
if (res && typeof res === 'object' && res.rbin) { if (res && typeof res === 'object' && res.rbin) {
res = binaryToStr(res.rbin); res = binaryToStr(res.rbin);
if (isJSON(res)) { if (isJSON(res)) {
res = JSON.parse(res); res = JSON.parse(res);
......
...@@ -14,6 +14,9 @@ export default function prepareShow(postData = {}, content = '') { ...@@ -14,6 +14,9 @@ export default function prepareShow(postData = {}, content = '') {
giveSmartFormGlobalProps({ giveSmartFormGlobalProps({
data: postData || content, data: postData || content,
}); });
if(process.env.NODE_ENV === 'development'){
// console.log(window.smartFormGlobalProps.data);
}
let agg = deepCopy(postData); let agg = deepCopy(postData);
window.beforeApplySubmit = undefined; // 流程发起时执行的异步回调函数 这里清空 防止泄露 window.beforeApplySubmit = undefined; // 流程发起时执行的异步回调函数 这里清空 防止泄露
window.beforeAuditSubmit = undefined; // 流程审批时执行的异步回调函数 这里清空 防止泄露 window.beforeAuditSubmit = undefined; // 流程审批时执行的异步回调函数 这里清空 防止泄露
...@@ -25,7 +28,7 @@ export default function prepareShow(postData = {}, content = '') { ...@@ -25,7 +28,7 @@ export default function prepareShow(postData = {}, content = '') {
window.moment = moment; window.moment = moment;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
console.log(agg?.unifiedServicePatternModel?.id); // 表单id; 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 || {}; 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}/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'); 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(){ ...@@ -26,7 +26,7 @@ export function getVisitorToken(){
headers: {}, headers: {},
}; };
if(process.env.NODE_ENV === 'development'){ if(process.env.NODE_ENV === 'development' && getIsBei_Dian()){
res.headers.env = 'test'; res.headers.env = 'test';
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论