Browse Source
* commit 'fa9edeaa61dd5676269b221acc332b7419f5a2eb': REPORT-94752【视觉验收】数据连接 fix:修复视觉问题 REPORT-94654 fix:数据连接异常报错问题修复 REPORT-94752【视觉验收】数据连接 fix: 视觉修复 REPORT-93097 fix: 修复数据连接多次连接报错问题 REPORT-91727 对用户输入的参数进行统一校验 DCM仓库也要改下 feat:产品逻辑变更,要求关键字校验不区分大小写 REPORT-93847 fix: 数据连接样式问题 REPORT-93628 fix:修改下文件上传的组件样式 无JIRA任务,顺带处理下数据连接样式 REPORT-93627【迭代】【平台视觉适配】数据连接管理-模式选择处有滚动条 fix: 并非这次迭代导致,之前就有问题。 调整一下间距的设置大小,防止挤出滚动条 REPORT-93628【迭代】【平台视觉适配】数据连接管理-修改下密码处的视觉展示 fix: 其实适配6.0的改动不涉及数据连接部分。 但是主风格改为输入框border-bottom风格了,那么这里也需要同步改一下。 REPORT-93513 fix: 修复长文本显示问题 REPORT-91727 对用户输入的参数进行统一校验 feat:dcm仓库里面有两个场景,这里引入进来补充final/11.0
superman
2 years ago
18 changed files with 125 additions and 38 deletions
@ -0,0 +1,52 @@
|
||||
/* |
||||
https://work.fineres.com/browse/REPORT-91724 用于参数统一校验
|
||||
*/ |
||||
import { ILLEGAL_STRINGS } from "./constant"; |
||||
export type CheckResult = { |
||||
legal: boolean, |
||||
errorMsg: string, |
||||
} |
||||
export const CHECK_CORRECT: CheckResult = { |
||||
legal: true, |
||||
errorMsg: "", |
||||
}; |
||||
|
||||
/** |
||||
* 检测非法字符,返回错误提示 |
||||
* @param value 要校验的字符串 |
||||
*/ |
||||
export function checkIllegalStrings(value: string): CheckResult { |
||||
// 后端传入的校验开关,如果没传,那也默认开启
|
||||
const enabled = Dec.system.enableParameterVerify ?? true; |
||||
let result = CHECK_CORRECT; |
||||
if (enabled) { |
||||
// 关键字不区分大小写
|
||||
ILLEGAL_STRINGS.every(s => { |
||||
const sIndex = value.toLowerCase().indexOf(s); |
||||
if (sIndex !== -1) { |
||||
result = { |
||||
legal: false, |
||||
errorMsg: `${BI.i18nText("Dec-Basic_Check_Illegal_Strings")}${value.substr(sIndex, s.length)}`, |
||||
}; |
||||
|
||||
return false; |
||||
} |
||||
|
||||
return true; |
||||
}); |
||||
|
||||
return result; |
||||
} |
||||
|
||||
return result; |
||||
} |
||||
|
||||
export function checkIllegalStringsInWidgetAndShowError(widget: any) { |
||||
const value = widget.getValue(); |
||||
const result = checkIllegalStrings(value); |
||||
if (!result.legal) { |
||||
widget.showError(result.errorMsg); |
||||
} |
||||
|
||||
return result.legal; |
||||
} |
@ -0,0 +1,15 @@
|
||||
/** |
||||
* 参数检验的非法字符数组,由于不区分大小写,统一用小写 |
||||
*/ |
||||
export const ILLEGAL_STRINGS = [ |
||||
"\"", |
||||
"<", |
||||
">", |
||||
"&", |
||||
"/script", |
||||
"javascript:", |
||||
"onblur", |
||||
"getruntime", |
||||
"processbuilder", |
||||
"java.lang.processimpl", |
||||
]; |
@ -0,0 +1 @@
|
||||
export { checkIllegalStringsInWidgetAndShowError, checkIllegalStrings } from "./checkIllegalStrings/checkIllegalStrings" |
Loading…
Reference in new issue