From 6d803b0b7b883629aab5e15bf9202e462358b2d0 Mon Sep 17 00:00:00 2001 From: zhangrenyuan <18990852002@163.com> Date: Fri, 28 Nov 2025 11:00:04 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=A6=84=20refactor:=20=E5=A4=9A=E8=AF=AD?= =?UTF-8?q?=E8=A8=80=E9=85=8D=E7=BD=AE=E7=BA=AF=E6=96=87=E6=9C=AC=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/language/languageTranslate.vue | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/views/language/languageTranslate.vue b/src/views/language/languageTranslate.vue index 7101170..d5e3fc1 100644 --- a/src/views/language/languageTranslate.vue +++ b/src/views/language/languageTranslate.vue @@ -336,11 +336,21 @@ const handleAdd = () => { // 保存翻译 const handleSave = async () => { - if (!editForm.value.chineseSimplified) { - ElMessage.error('请输入原文内容') + // 原文必填校验 + if (!editForm.value.chineseSimplified || editForm.value.chineseSimplified.trim() === '') { + ElMessage.error('原文为必填项') return } + // 纯文本校验 + const fields = ['english', 'thai', 'chineseTraditional', 'malay', 'vietnamese'] + for (const field of fields) { + if (editForm.value[field] && /<[^>]*>/.test(editForm.value[field])) { + ElMessage.error('译文仅支持纯文本,不支持HTML标签') + return + } + } + try { const url = editForm.value.id ? '/language/updateTranslation' : '/language/addTranslation' const res = await API({