feat(cms):优化文章编辑功能并移除冗余代码

- 移除了打印按钮功能- 简化了文章内容验证逻辑
- 删除了未使用的图片选择和删除相关方法
- 移除了空的栏目切换处理方法-优化了编辑器类型切换逻辑
- 调整了评论功能的触发条件判断
This commit is contained in:
2025-09-26 16:37:51 +08:00
parent 1d3a94437c
commit cdb90cb60f

View File

@@ -12,7 +12,6 @@
@ok="save"
>
<template #extra>
<a-button @click="cancel">打印</a-button>
<a-button type="primary" style="margin-right: 8px" @click="save">保存</a-button>
</template>
<a-form
@@ -413,7 +412,7 @@ const rules = reactive({
type: 'string',
message: '请输入文章内容',
trigger: 'blur',
validator: async (_rule: RuleObject, value: string) => {
validator: async (_rule: RuleObject, _: string) => {
if (content.value == '') {
return Promise.reject('请输入文字内容');
}
@@ -423,15 +422,6 @@ const rules = reactive({
]
});
const chooseImage = (data: FileRecord) => {
images.value.push({
uid: data.id,
url: data.path,
status: 'done'
});
form.image = data.path;
};
// 选择栏目
const onCategoryId = (id: number) => {
form.categoryId = id;
@@ -441,10 +431,6 @@ const onCategoryId = (id: number) => {
}
};
const onChange = () => {
// 加载文章多规格
};
// 📝 编辑器类型切换处理
const onEditorTypeChange = (e: any) => {
const newEditorType = e.target.value;
@@ -568,11 +554,6 @@ const onEditor = (value: any) => {
editor.value = value.target.value;
};
const onDeleteItem = (index: number) => {
images.value.splice(index, 1);
form.image = '';
};
const onComments = () => {
if (form.comments == undefined) {
form.comments = htmlToText(content.value);