feat(cms):优化文章编辑功能并移除冗余代码
- 移除了打印按钮功能- 简化了文章内容验证逻辑 - 删除了未使用的图片选择和删除相关方法 - 移除了空的栏目切换处理方法-优化了编辑器类型切换逻辑 - 调整了评论功能的触发条件判断
This commit is contained in:
@@ -12,7 +12,6 @@
|
|||||||
@ok="save"
|
@ok="save"
|
||||||
>
|
>
|
||||||
<template #extra>
|
<template #extra>
|
||||||
<a-button @click="cancel">打印</a-button>
|
|
||||||
<a-button type="primary" style="margin-right: 8px" @click="save">保存</a-button>
|
<a-button type="primary" style="margin-right: 8px" @click="save">保存</a-button>
|
||||||
</template>
|
</template>
|
||||||
<a-form
|
<a-form
|
||||||
@@ -413,7 +412,7 @@ const rules = reactive({
|
|||||||
type: 'string',
|
type: 'string',
|
||||||
message: '请输入文章内容',
|
message: '请输入文章内容',
|
||||||
trigger: 'blur',
|
trigger: 'blur',
|
||||||
validator: async (_rule: RuleObject, value: string) => {
|
validator: async (_rule: RuleObject, _: string) => {
|
||||||
if (content.value == '') {
|
if (content.value == '') {
|
||||||
return Promise.reject('请输入文字内容');
|
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) => {
|
const onCategoryId = (id: number) => {
|
||||||
form.categoryId = id;
|
form.categoryId = id;
|
||||||
@@ -441,10 +431,6 @@ const onCategoryId = (id: number) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onChange = () => {
|
|
||||||
// 加载文章多规格
|
|
||||||
};
|
|
||||||
|
|
||||||
// 📝 编辑器类型切换处理
|
// 📝 编辑器类型切换处理
|
||||||
const onEditorTypeChange = (e: any) => {
|
const onEditorTypeChange = (e: any) => {
|
||||||
const newEditorType = e.target.value;
|
const newEditorType = e.target.value;
|
||||||
@@ -568,11 +554,6 @@ const onEditor = (value: any) => {
|
|||||||
editor.value = value.target.value;
|
editor.value = value.target.value;
|
||||||
};
|
};
|
||||||
|
|
||||||
const onDeleteItem = (index: number) => {
|
|
||||||
images.value.splice(index, 1);
|
|
||||||
form.image = '';
|
|
||||||
};
|
|
||||||
|
|
||||||
const onComments = () => {
|
const onComments = () => {
|
||||||
if (form.comments == undefined) {
|
if (form.comments == undefined) {
|
||||||
form.comments = htmlToText(content.value);
|
form.comments = htmlToText(content.value);
|
||||||
|
|||||||
Reference in New Issue
Block a user