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({