fix(通用功能): 修复定时任务输入错误表达式反解析页面崩溃问题

--bug=1020403 --user=赵勇 [接口测试]github #20262定时任务Cron表达式导致页面崩溃 https://www.tapd.cn/55049933/s/1307046
This commit is contained in:
fit2-zhao 2022-11-29 10:40:27 +08:00 committed by fit2-zhao
parent ddaf913744
commit 2eb05bcee2
2 changed files with 11 additions and 3 deletions

View File

@ -19,20 +19,21 @@
"@fortawesome/free-solid-svg-icons": "^5.15.2",
"@fortawesome/vue-fontawesome": "^2.0.2",
"axios": "^0.27.2",
"cron-parser": "^4.7.0",
"element-ui": ">2.15.9 || 2.15.8",
"fit2cloud-ui": "^1.8.0",
"js-cookie": "^2.2.1",
"jsencrypt": "^3.1.0",
"jsondiffpatch": "^0.4.1",
"mavon-editor": "2.10.4",
"normalize.css": "^8.0.1",
"nprogress": "^0.2.0",
"pinia": "^2.0.14",
"pinia-plugin-persistedstate": "^1.6.3",
"mavon-editor": "2.10.4",
"qiankun": "^2.8.0",
"vue": "^2.7.3",
"vue-i18n": "^8.22.4",
"vuedraggable": "^2.24.3",
"jsondiffpatch": "^0.4.1"
"vuedraggable": "^2.24.3"
},
"devDependencies": {
"@babel/core": "^7.12.16",

View File

@ -1,3 +1,5 @@
import parser from "cron-parser";
/**
* Validates a cron expression.
*
@ -5,6 +7,11 @@
* @return True is expression is valid
*/
export function cronValidate(cronExpression ){
try {
parser.parseExpression(cronExpression);
} catch (e) {
return false;
}
if (!cronExpression) {
return false;