forked from b2894lxlx/tuanwei-admin
feat(manuscript): 后台按正文格式标记渲染与保存
- 新增 utils/manuscript-content.ts:格式判定、bytemd 转 HTML、纯文本转段落 - 编辑弹窗打开时把 markdown / 纯文本转成富文本,否则 wangEditor 会把 # 和 ** 当成正文, 保存一次就把原稿改坏 - 保存统一写 contentFormat: 'html' - 列表加「正文格式」列,非 HTML 的行显式标出来
This commit is contained in:
@@ -58,7 +58,11 @@
|
||||
</a-card>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<ManuscriptEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
<ManuscriptEdit
|
||||
v-model:visible="showEdit"
|
||||
:data="current"
|
||||
@done="reload"
|
||||
/>
|
||||
<!-- 新增审核记录弹窗 -->
|
||||
<ReviewRecordModal
|
||||
v-model:visible="showReviewModal"
|
||||
@@ -71,7 +75,7 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { createVNode, ref } from 'vue';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import { message, Modal, Tag } from 'ant-design-vue';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
import type { EleProTable } from 'ele-admin-pro';
|
||||
import { toDateString } from 'ele-admin-pro';
|
||||
@@ -82,9 +86,14 @@
|
||||
import Search from './components/search.vue';
|
||||
import ManuscriptEdit from './components/manuscriptEdit.vue';
|
||||
import ReviewRecordModal from './components/reviewRecordModal.vue';
|
||||
import { pageManuscript, removeManuscript, removeBatchManuscript } from '@/api/cms/manuscript';
|
||||
import {
|
||||
pageManuscript,
|
||||
removeManuscript,
|
||||
removeBatchManuscript
|
||||
} from '@/api/cms/manuscript';
|
||||
import type { Manuscript, ManuscriptParam } from '@/api/cms/manuscript/model';
|
||||
import type { ReviewList } from '@/api/gxmu/reviewList/model';
|
||||
import { detectFormat, normalizeFormat } from '@/utils/manuscript-content';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
@@ -130,19 +139,36 @@
|
||||
dataIndex: 'id',
|
||||
key: 'id',
|
||||
align: 'center',
|
||||
width: 90,
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: '标题',
|
||||
dataIndex: 'title',
|
||||
key: 'title',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '封面',
|
||||
dataIndex: 'cover',
|
||||
key: 'cover',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '正文格式',
|
||||
dataIndex: 'contentFormat',
|
||||
key: 'contentFormat',
|
||||
align: 'center',
|
||||
width: 110,
|
||||
customRender: ({ record }: { record: Manuscript }) => {
|
||||
const format =
|
||||
normalizeFormat(record.contentFormat) || detectFormat(record.content);
|
||||
if (format === 'html') {
|
||||
return createVNode(Tag, { color: 'default' }, () => 'HTML');
|
||||
}
|
||||
return createVNode(Tag, { color: 'orange' }, () =>
|
||||
format === 'markdown' ? 'Markdown' : '纯文本'
|
||||
);
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
@@ -157,7 +183,7 @@
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '当前审核状态',
|
||||
|
||||
Reference in New Issue
Block a user