fix(通用功能): 修复定时任务输入错误表达式反解析页面崩溃问题
--bug=1020403 --user=赵勇 [接口测试]github #20262定时任务Cron表达式导致页面崩溃 https://www.tapd.cn/55049933/s/1307046
This commit is contained in:
parent
ddaf913744
commit
2eb05bcee2
|
@ -19,20 +19,21 @@
|
||||||
"@fortawesome/free-solid-svg-icons": "^5.15.2",
|
"@fortawesome/free-solid-svg-icons": "^5.15.2",
|
||||||
"@fortawesome/vue-fontawesome": "^2.0.2",
|
"@fortawesome/vue-fontawesome": "^2.0.2",
|
||||||
"axios": "^0.27.2",
|
"axios": "^0.27.2",
|
||||||
|
"cron-parser": "^4.7.0",
|
||||||
"element-ui": ">2.15.9 || 2.15.8",
|
"element-ui": ">2.15.9 || 2.15.8",
|
||||||
"fit2cloud-ui": "^1.8.0",
|
"fit2cloud-ui": "^1.8.0",
|
||||||
"js-cookie": "^2.2.1",
|
"js-cookie": "^2.2.1",
|
||||||
"jsencrypt": "^3.1.0",
|
"jsencrypt": "^3.1.0",
|
||||||
|
"jsondiffpatch": "^0.4.1",
|
||||||
|
"mavon-editor": "2.10.4",
|
||||||
"normalize.css": "^8.0.1",
|
"normalize.css": "^8.0.1",
|
||||||
"nprogress": "^0.2.0",
|
"nprogress": "^0.2.0",
|
||||||
"pinia": "^2.0.14",
|
"pinia": "^2.0.14",
|
||||||
"pinia-plugin-persistedstate": "^1.6.3",
|
"pinia-plugin-persistedstate": "^1.6.3",
|
||||||
"mavon-editor": "2.10.4",
|
|
||||||
"qiankun": "^2.8.0",
|
"qiankun": "^2.8.0",
|
||||||
"vue": "^2.7.3",
|
"vue": "^2.7.3",
|
||||||
"vue-i18n": "^8.22.4",
|
"vue-i18n": "^8.22.4",
|
||||||
"vuedraggable": "^2.24.3",
|
"vuedraggable": "^2.24.3"
|
||||||
"jsondiffpatch": "^0.4.1"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.12.16",
|
"@babel/core": "^7.12.16",
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import parser from "cron-parser";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validates a cron expression.
|
* Validates a cron expression.
|
||||||
*
|
*
|
||||||
|
@ -5,6 +7,11 @@
|
||||||
* @return True is expression is valid
|
* @return True is expression is valid
|
||||||
*/
|
*/
|
||||||
export function cronValidate(cronExpression ){
|
export function cronValidate(cronExpression ){
|
||||||
|
try {
|
||||||
|
parser.parseExpression(cronExpression);
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!cronExpression) {
|
if (!cronExpression) {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue