diff --git a/src/components/operation-set/OperationSetEditor.tsx b/src/components/operation-set/OperationSetEditor.tsx index 0f92502c..b306c79a 100644 --- a/src/components/operation-set/OperationSetEditor.tsx +++ b/src/components/operation-set/OperationSetEditor.tsx @@ -200,6 +200,18 @@ function OperationSetForm({ operationSet, onSubmit }: FormProps) { const localOnSubmit = handleSubmit(async (values) => { try { + + // 方便以后拓展关键字 + const titleHasPersonal = values.name.includes('自用') + + // 标题含“自用”,但未勾选“自用”(status !== PRIVATE) → 提示 + if (titleHasPersonal && values.status !== 'PRIVATE') { + setGlobalError( + t.components.operationSet.OperationSetEditor.personal_use_warning + ) + return + } + await onSubmit( { ...values, @@ -288,17 +300,15 @@ function OperationSetForm({ operationSet, onSubmit }: FormProps) { field.onChange( (e.target as HTMLInputElement).checked - ? 'PUBLIC' - : 'PRIVATE', + ? 'PRIVATE' + : 'PUBLIC' ) } - label={ - t.components.operationSet.OperationSetEditor.visible_to_all - } + label={t.components.operationSet.OperationSetEditor.for_personal_use} /> )} /> diff --git a/src/i18n/translations.json b/src/i18n/translations.json index 1f2f5d74..374a3fed 100644 --- a/src/i18n/translations.json +++ b/src/i18n/translations.json @@ -2498,9 +2498,13 @@ "cn": "描述", "en": "Description" }, - "visible_to_all": { - "cn": "对所有人可见", - "en": "Visible to everyone" + "for_personal_use": { + "cn": "仅对自己可见(自用)", + "en": "For Personal Use" + }, + "personal_use_warning": { + "cn": "自用作业集请勾选「仅对自己可见(自用)」哦", + "en": "Personal use job sets should be marked as 'For Personal Use'" }, "click_save": { "cn": "修改后请点击保存按钮", @@ -2545,6 +2549,14 @@ "reverse_list": { "cn": "反转列表", "en": "Reverse List" + }, + "private_usage_warning": { + "cn": "自用作业集请勾选「自用」哦", + "en": "Personal use job sets should be marked as 'For Personal Use'" + }, + "private_usage_public_warning": { + "cn": "标题含有「自用」关键字且勾选了公开,请取消勾选公开再次提交", + "en": "Title contains 'personal use' keyword and is marked as public, please uncheck public and submit again" } } },