提交 0daa50b1 authored 作者: 王鹏飞's avatar 王鹏飞

feat: 更新预览模块,使用新的审计API获取章节列表和章节信息

上级 d8150ad8
...@@ -10,3 +10,9 @@ export const getExamineList = async (id: string | number) => ...@@ -10,3 +10,9 @@ export const getExamineList = async (id: string | number) =>
(await post('/api/admin/book/teacher/getExamineList', { id })).data (await post('/api/admin/book/teacher/getExamineList', { id })).data
export const addExamine = (data: Record<string, unknown>) => export const addExamine = (data: Record<string, unknown>) =>
post('/api/admin/book/examine/add', data) post('/api/admin/book/examine/add', data)
export const getAuditChapters = (data: Record<string, unknown>) =>
post('/api/admin/book/examine/chapter/getAllList', data)
export const getAuditSection = async (data: Record<string, unknown>) =>
(await post('/api/admin/book/examine/section/getInfoByChapterId', data)).data
...@@ -9,7 +9,7 @@ import React, { ...@@ -9,7 +9,7 @@ import React, {
} from 'react' } from 'react'
import { Modal, Drawer, Tree, Spin, Space, Button, Input, Image } from 'antd' import { Modal, Drawer, Tree, Spin, Space, Button, Input, Image } from 'antd'
import { BarsOutlined, CloseOutlined, LeftOutlined, RightOutlined } from '@ant-design/icons' import { BarsOutlined, CloseOutlined, LeftOutlined, RightOutlined } from '@ant-design/icons'
import { getInfoByChapterId, getAllList } from '@/modules/books/management/chapters/api' import { getAuditSection, getAuditChapters } from '../api'
import { getChapterTopic, expandReadInfo } from '@/components/editor/wangeditor-customer/public-api' import { getChapterTopic, expandReadInfo } from '@/components/editor/wangeditor-customer/public-api'
import { import {
convertToAntdTreeData, convertToAntdTreeData,
...@@ -146,7 +146,7 @@ const PreviewScreen = (props, ref) => { ...@@ -146,7 +146,7 @@ const PreviewScreen = (props, ref) => {
} }
const getChapterTreeList = async () => { const getChapterTreeList = async () => {
setLoading(true) setLoading(true)
const data = await getAllList({ book_id: bookId }) const data = await getAuditChapters({ book_id: bookId })
if (!data.data.length) { if (!data.data.length) {
setLoading(false) setLoading(false)
return return
...@@ -214,7 +214,7 @@ const PreviewScreen = (props, ref) => { ...@@ -214,7 +214,7 @@ const PreviewScreen = (props, ref) => {
const getChapterId = async () => { const getChapterId = async () => {
setLoading(true) setLoading(true)
newId.current = newChapterId newId.current = newChapterId
const data = await getInfoByChapterId({ chapter_id: newChapterId }) const data = await getAuditSection({ chapter_id: newChapterId })
if (data) { if (data) {
const content = get(data, 'content', '') const content = get(data, 'content', '')
setPrviewHtml(content) setPrviewHtml(content)
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论