|
|
|
@ -86,6 +86,7 @@ export default () => {
|
|
|
|
|
|
|
|
|
|
const formRef = useRef<ProFormInstance>();
|
|
|
|
|
const actionRef = useRef<ActionType>();
|
|
|
|
|
const actionRef1 = useRef<ActionType>();
|
|
|
|
|
|
|
|
|
|
/** 更新窗口的弹窗 */
|
|
|
|
|
const [createModalVisible, handleCreateModalVisible] = useState<boolean>(false);
|
|
|
|
@ -97,6 +98,7 @@ export default () => {
|
|
|
|
|
|
|
|
|
|
const [subjectIntro, setSubjectIntro] = useState({});
|
|
|
|
|
const [subjectId, setSubjectId] = useState({});
|
|
|
|
|
const [list,setList] = useState({});
|
|
|
|
|
const [chapterList, setChapterList] = useState({});
|
|
|
|
|
const [currentRow, setCurrentRow] = useState<TableListItem>();
|
|
|
|
|
const formMapRef = useRef<React.MutableRefObject<ProFormInstance<any> | undefined>[]>([]);
|
|
|
|
@ -137,12 +139,8 @@ export default () => {
|
|
|
|
|
hideInForm: false,
|
|
|
|
|
hideInSearch: true,
|
|
|
|
|
formItemProps: {
|
|
|
|
|
rules: [
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请填写章节简介',
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请填写简介',
|
|
|
|
|
},
|
|
|
|
|
renderText: (val: string) => (<div dangerouslySetInnerHTML={{ __html: val }} />),
|
|
|
|
|
renderFormItem: (item, { defaultRender, ...rest }, form) => (
|
|
|
|
@ -538,7 +536,7 @@ export default () => {
|
|
|
|
|
<ProTable<TableListItem, TableListPagination>
|
|
|
|
|
headerTitle={false}
|
|
|
|
|
actionRef={actionRef}
|
|
|
|
|
rowKey="chapter_id"
|
|
|
|
|
rowKey="chapter_id1"
|
|
|
|
|
options={false}
|
|
|
|
|
search={false}
|
|
|
|
|
params={subjectIntro}
|
|
|
|
@ -588,6 +586,13 @@ export default () => {
|
|
|
|
|
item.course_ids = item.course_ids.map(a => a * 1);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
setList({
|
|
|
|
|
current: data?.page_number,
|
|
|
|
|
data: data?.list,
|
|
|
|
|
pageSize: data?.page_size,
|
|
|
|
|
success: true,
|
|
|
|
|
total: data?.total_row || 0,
|
|
|
|
|
})
|
|
|
|
|
return {
|
|
|
|
|
current: data?.page_number,
|
|
|
|
|
data: data?.list,
|
|
|
|
@ -619,7 +624,7 @@ export default () => {
|
|
|
|
|
onFinish={async (values: any) => {
|
|
|
|
|
// 表单处理
|
|
|
|
|
// console.log('columns:', columns);
|
|
|
|
|
// console.log('values:新建', values);
|
|
|
|
|
console.log('values:新建', values);
|
|
|
|
|
const success = await handleAddChapter({
|
|
|
|
|
...values,
|
|
|
|
|
subject_id:subjectId,
|
|
|
|
@ -661,17 +666,21 @@ export default () => {
|
|
|
|
|
labelCol={{ span: 8 }}
|
|
|
|
|
wrapperCol={{ span: 12 }}
|
|
|
|
|
onFinish={async (values) => {
|
|
|
|
|
// console.log('values编辑', values)
|
|
|
|
|
console.log('values编辑', values)
|
|
|
|
|
// console.log('currentRow', currentRow)
|
|
|
|
|
const success = await handleUpdateChapter({
|
|
|
|
|
...values,
|
|
|
|
|
subject_id: subjectId,
|
|
|
|
|
chapter_id: currentRow.chapter_id
|
|
|
|
|
});
|
|
|
|
|
if (success) {
|
|
|
|
|
handleUpdateModalVisible(false);
|
|
|
|
|
actionRef.current?.reloadAndRest?.();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const success = await handleUpdateChapter({
|
|
|
|
|
...values,
|
|
|
|
|
subject_id: subjectId,
|
|
|
|
|
chapter_id: currentRow.chapter_id
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (success) {
|
|
|
|
|
handleUpdateModalVisible(false);
|
|
|
|
|
actionRef.current?.reloadAndRest?.();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
submitter={{
|
|
|
|
|
render: (props, doms) => (
|
|
|
|
@ -704,22 +713,78 @@ export default () => {
|
|
|
|
|
return true;
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<ProDescriptions
|
|
|
|
|
layout='horizontal'
|
|
|
|
|
column={1}
|
|
|
|
|
//actionRef={actionRef}
|
|
|
|
|
title="主题信息"
|
|
|
|
|
/*
|
|
|
|
|
request={async () => {
|
|
|
|
|
// console.log('step2 主题信息')
|
|
|
|
|
return Promise.resolve({
|
|
|
|
|
success: true,
|
|
|
|
|
data: { id: '这是一段文本', object: '', date: '2020-07-30 08:00', duration: '', grade: 100, through: '>60', learn: '>20 min', times: 2 },
|
|
|
|
|
});
|
|
|
|
|
}}*/
|
|
|
|
|
extra={false}
|
|
|
|
|
>
|
|
|
|
|
<ProDescriptions.Item dataIndex="subject_id" hideInDescriptions />
|
|
|
|
|
<ProDescriptions.Item dataIndex="subject_name" label="主题名称" valueType="text">{subjectIntro?.subject_name}</ProDescriptions.Item>
|
|
|
|
|
<ProDescriptions.Item dataIndex="subject_describe" label="主题介绍" valueType="text" maxLength="2">
|
|
|
|
|
<div dangerouslySetInnerHTML={{ __html: subjectIntro?.subject_describe }} />
|
|
|
|
|
</ProDescriptions.Item>
|
|
|
|
|
</ProDescriptions>
|
|
|
|
|
<ProTable<TableListItem, TableListPagination>
|
|
|
|
|
headerTitle={false}
|
|
|
|
|
actionRef={actionRef1}
|
|
|
|
|
rowKey="chapter_id"
|
|
|
|
|
options={false}
|
|
|
|
|
search={false}
|
|
|
|
|
// params={subjectIntro}
|
|
|
|
|
toolBarRender={null}
|
|
|
|
|
request={async (value) => {
|
|
|
|
|
console.log('sssssssss',value)
|
|
|
|
|
const { data } = await queryListChapterBySubject({
|
|
|
|
|
subject_id: subjectIntro.subject_id,
|
|
|
|
|
page_number: value?.current || 1,
|
|
|
|
|
page_size: value?.pageSize,
|
|
|
|
|
});
|
|
|
|
|
if (data.list.length !== 0) {
|
|
|
|
|
data.list.forEach((i) => {
|
|
|
|
|
i.course_ids = i.course_ids.split(',')
|
|
|
|
|
i.course_names = i.course_names.split(',');
|
|
|
|
|
if(i.tag_ids&&i.tag_ids!==null){
|
|
|
|
|
i.tag_ids = i.tag_ids.split(',')
|
|
|
|
|
}
|
|
|
|
|
if( i.tag_names){
|
|
|
|
|
i.tag_names = i.tag_names.split(',')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
<Row gutter={24}>
|
|
|
|
|
<Col lg={12} md={12} sm={12} offset={6}>
|
|
|
|
|
<Result
|
|
|
|
|
className={styles.registerResult}
|
|
|
|
|
status="success"
|
|
|
|
|
title={
|
|
|
|
|
<div className={styles.title}>
|
|
|
|
|
主题 <span style={{ color: '#1890ff' }}>{subjectIntro?.subject_name} </span>创建/修改成功
|
|
|
|
|
</div>
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (data.list.length !== 0) {
|
|
|
|
|
data.list.forEach((item) => {
|
|
|
|
|
if(item.tag_ids&&item.tag_ids!==null){
|
|
|
|
|
item.tag_ids = item.tag_ids.map(i => i * 1);
|
|
|
|
|
}
|
|
|
|
|
subTitle="点击提交将设置为发布状态。"
|
|
|
|
|
//extra={actions}
|
|
|
|
|
/>
|
|
|
|
|
</Col>
|
|
|
|
|
</Row>
|
|
|
|
|
|
|
|
|
|
item.course_ids = item.course_ids.map(a => a * 1);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
current: data?.page_number,
|
|
|
|
|
data: data?.list,
|
|
|
|
|
pageSize: data?.page_size,
|
|
|
|
|
success: true,
|
|
|
|
|
total: data?.total_row || 0,
|
|
|
|
|
};
|
|
|
|
|
}}
|
|
|
|
|
dataSource={list.data}
|
|
|
|
|
columns={columns}
|
|
|
|
|
rowSelection={false}
|
|
|
|
|
/>
|
|
|
|
|
</StepsForm.StepForm>
|
|
|
|
|
</StepsForm>
|
|
|
|
|
</ProCard>
|
|
|
|
|