diff --git a/src/views/contentManagement/TagManagementView.vue b/src/views/contentManagement/TagManagementView.vue index af5cd24..43121d3 100644 --- a/src/views/contentManagement/TagManagementView.vue +++ b/src/views/contentManagement/TagManagementView.vue @@ -33,6 +33,7 @@ const DEFAULT_TAG_COLOR = '#E5484D' const emptyForm = () => ({ locales: { zh: '' }, bgColor: DEFAULT_TAG_COLOR, + code: '', sort: 1, status: 1 }) @@ -66,6 +67,7 @@ function openEdit(row) { Object.assign(form, { locales, bgColor: row.bgColor || DEFAULT_TAG_COLOR, + code: row.code || '', sort: row.sort ?? 0, status: row.status ?? 1 }) @@ -83,12 +85,18 @@ async function save() { ElMessage.warning(`请填写${languageLabel(missing)}名称`) return } + const code = (form.code || '').trim().toUpperCase() + if (code && !/^[A-Z][A-Z0-9_]{0,31}$/.test(code)) { + ElMessage.warning('语义码需为大写字母、数字或下划线,且以字母开头') + return + } saving.value = true try { const payload = { name: locales.zh, locales, bgColor: form.bgColor || DEFAULT_TAG_COLOR, + code, sort: form.sort, status: form.status } @@ -209,6 +217,16 @@ onMounted(load) + + +
+ 客户端按语义码判断板块(如「上新」横滑),改名或换语言都不受影响。 +
+
@@ -236,4 +254,11 @@ onMounted(load) height: 16px; border-radius: 4px; } + +.form-hint { + margin-top: 4px; + font-size: 12px; + line-height: 1.5; + color: var(--el-text-color-secondary); +}