From 5bbcc138214edd46bf94ef928a1a0a5bc9438a79 Mon Sep 17 00:00:00 2001 From: huangdeliang Date: Fri, 6 Aug 2021 14:52:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=BE=E7=89=87=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/TemplateDialog/index.vue | 90 ++++++++++--------- .../RecipesView/RecipesHeaderCom/index.vue | 2 +- 2 files changed, 51 insertions(+), 41 deletions(-) diff --git a/stdiet-ui/src/components/TemplateDialog/index.vue b/stdiet-ui/src/components/TemplateDialog/index.vue index 8c700337a..4e918a5a2 100644 --- a/stdiet-ui/src/components/TemplateDialog/index.vue +++ b/stdiet-ui/src/components/TemplateDialog/index.vue @@ -30,26 +30,26 @@ - + - - - - - + + + + { if (valid && this.checkFormat(this.form.keyWordArray)) { - this.form.keyWord = (this.form.keyWordArray != null && this.form.keyWordArray.length > 0) ? this.form.keyWordArray.join(",") : null; - this.form.keyWord = this.form.keyWord.replace(",",","); + this.form.keyWord = + this.form.keyWordArray != null && this.form.keyWordArray.length > 0 + ? this.form.keyWordArray.join(",").replaceAll(",", ",") + : null; + // this.form.keyWord = (this.form.keyWord || "").replace(",", ","); this.$emit("onConfirm", this.form); this.visible = false; } @@ -145,29 +151,33 @@ export default { nutritionistId: null, remark: null, keyWordArray: null, - keyWord: null + keyWord: null, }; this.resetForm("form"); }, cancel() { this.visible = false; }, - checkFormat(keyWordArray){ + checkFormat(keyWordArray) { let flag = true; let msg = ""; - if(keyWordArray != null && keyWordArray.length > 0){ - keyWordArray.forEach((item,index) => { - if(item.indexOf(",") != -1 || item.indexOf(",") != -1 || item.indexOf(" ") != -1){ - msg = "关键词中不能含有逗号和空格"; - flag = false; - } - }); + if (keyWordArray != null && keyWordArray.length > 0) { + keyWordArray.forEach((item, index) => { + if ( + item.indexOf(",") != -1 || + item.indexOf(",") != -1 || + item.indexOf(" ") != -1 + ) { + msg = "关键词中不能含有逗号和空格"; + flag = false; + } + }); } - if(!flag){ - this.msgError(msg); + if (!flag) { + this.msgError(msg); } return flag; - } + }, }, }; diff --git a/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesHeaderCom/index.vue b/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesHeaderCom/index.vue index 8f713478a..0ff8f9c41 100644 --- a/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesHeaderCom/index.vue +++ b/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesHeaderCom/index.vue @@ -252,7 +252,7 @@ export default { } const tmpNum = document.getElementById(`day_num_${idx}`); if (tmpNum) { - tmpNum.innerText = `第${startNum + idx}天`; + tmpNum.innerText = `第${parseInt(startNum) + idx}天`; } });