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

Merge remote-tracking branch 'origin/master'

...@@ -11,7 +11,10 @@ import { ...@@ -11,7 +11,10 @@ import {
getWord, getWord,
getFileAndShow, getFileAndShow,
renderContentAll, renderContentAll,
renderContentRow, downloadFile, getListWord renderContentRow,
downloadFile,
getListWord,
upObjKey
} from './globalFunction'; } from './globalFunction';
import { getTransformApi } from '@/webPublic/one_stop_public/2022beidianke/localstorageTransform'; import { getTransformApi } from '@/webPublic/one_stop_public/2022beidianke/localstorageTransform';
...@@ -47,6 +50,7 @@ export function giveSmartFormGlobalProps({ ...@@ -47,6 +50,7 @@ export function giveSmartFormGlobalProps({
renderContentAll, renderContentAll,
renderContentRow, renderContentRow,
getTransformApi, getTransformApi,
upObjKey,
md5, md5,
remark: { remark: {
downloadFile: '下载文件函数.', downloadFile: '下载文件函数.',
...@@ -71,6 +75,7 @@ export function giveSmartFormGlobalProps({ ...@@ -71,6 +75,7 @@ export function giveSmartFormGlobalProps({
'renderContentRow(value, row, index, key, spanData, cloumnNames) ': 'renderContentRow(value, row, index, key, spanData, cloumnNames) ':
`ant表头纵向合并 ;参数->所有必填 value, row, index, key, spanData, cloumnNames 实例:render:(value, row, index)=>{return renderContentRow(value, row, index,"inst_name",spanData,cloumnNames)}`, `ant表头纵向合并 ;参数->所有必填 value, row, index, key, spanData, cloumnNames 实例:render:(value, row, index)=>{return renderContentRow(value, row, index,"inst_name",spanData,cloumnNames)}`,
'getTransformApi': '接口转换函数用于一站式接口地址加密', 'getTransformApi': '接口转换函数用于一站式接口地址加密',
'upObjKey({}/[{}],{lodKey:newKey})': '用于修改对象或数组对象KEY',
md5: 'md5加密函数', md5: 'md5加密函数',
}, },
}, },
......
...@@ -712,6 +712,44 @@ function setObjectKey(data) { ...@@ -712,6 +712,44 @@ function setObjectKey(data) {
); );
} }
/**
* 修改对象key
* 支持对象、数组对象
* @param {*} obj 数组对象或者对象
* @param {*} setKey {"被修改的key":"修改后的key"}
* @returns
*/
export function upObjKey(obj, setKey = {}) {
try {
let objType = Object.prototype.toString.call(obj);
if (obj && (objType.indexOf("Array") > -1 || objType.indexOf("Object") > -1) && Object.keys(setKey).length > 0) {
if (objType === "[object Object]" && Object.keys(obj).length > 0) {
for (var e in setKey) {
let upKey = setKey[e];
obj[upKey] = obj[e];
delete obj[e];
}
}
if (objType === "[object Array]" && obj.length > 0) {
obj.forEach((v, i) => {
for (var e in setKey) {
let upKey = setKey[e];
v[upKey] = v[e];
delete v[e];
}
})
}
return obj;
} else {
return null;
}
} catch (error) {
console.log("upObjKey",error);
return undefined;
}
}
// 下载附件FormdataWrapper // 下载附件FormdataWrapper
function isObject(value) { function isObject(value) {
return value === Object(value); return value === Object(value);
......
...@@ -35,13 +35,13 @@ export function getVisitorToken(){ ...@@ -35,13 +35,13 @@ export function getVisitorToken(){
res.headers.Authorization = `bearer ${token}`; // 这个必须要带上 res.headers.Authorization = `bearer ${token}`; // 这个必须要带上
} }
if (getIsBei_Dian() && userId) { // if (getIsBei_Dian() && userId) {
res.headers.Authorization = `bearer ${token}`; // res.headers.Authorization = `bearer ${token}`;
res.headers.auth = gg5xxxxx(secretString); // res.headers.auth = gg5xxxxx(secretString);
res.headers.timestamp = timestamp; // res.headers.timestamp = timestamp;
// if (headersApi) { // if (headersApi) {
// res.headers.apis = headersApi; // res.headers.apis = headersApi;
// } // }
} // }
return res; return res;
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论