From 12761d9ac86fe5b67366e5700bd94bc232868e5a Mon Sep 17 00:00:00 2001 From: wangxi <123456> Date: Mon, 13 Jun 2022 15:31:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/src/pages/course/option/index.tsx | 18 +-- admin/src/pages/course/subject/step/index.tsx | 129 +++++++++++++----- .../attestation/step/index.tsx | 42 ++++-- 3 files changed, 135 insertions(+), 54 deletions(-) diff --git a/admin/src/pages/course/option/index.tsx b/admin/src/pages/course/option/index.tsx index 3b7507c..3f22477 100644 --- a/admin/src/pages/course/option/index.tsx +++ b/admin/src/pages/course/option/index.tsx @@ -250,20 +250,6 @@ const CourseList: React.FC = () => { onRemove={()=>{ //createFormRef?.current?.setFieldsValue({attachment_json: ""}) }} - // onChange={(info)=>{ - // console.log('file',info) - // let fileList = [...info.fileList]; - // fileList = fileList.slice(-2); - // // 2. Read from response and show file link - // fileList = fileList.map(file => { - // if (file.response) { - // // Component will show file.url as link - // file.url = file.response.url; - // console.log(222,fileList) - // } - // return file; - // }); - // this.setState({ fileList }); // console.log(999,fileList) // }} @@ -335,6 +321,10 @@ const CourseList: React.FC = () => { key="detail" onClick={async() => { const info= await viewCourse({course_id:record.course_id}); + + if(info.data.attachment_json.length===undefined){ + info.data.attachment_json=[info.data.attachment_json] + } setCurrentRow(info.data); handleDetailModalVisible(true); }} diff --git a/admin/src/pages/course/subject/step/index.tsx b/admin/src/pages/course/subject/step/index.tsx index 51a9aa5..aaba279 100644 --- a/admin/src/pages/course/subject/step/index.tsx +++ b/admin/src/pages/course/subject/step/index.tsx @@ -86,6 +86,7 @@ export default () => { const formRef = useRef(); const actionRef = useRef(); + const actionRef1 = useRef(); /** 更新窗口的弹窗 */ const [createModalVisible, handleCreateModalVisible] = useState(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(); const formMapRef = useRef | undefined>[]>([]); @@ -137,12 +139,8 @@ export default () => { hideInForm: false, hideInSearch: true, formItemProps: { - rules: [ - { - required: true, - message: '请填写章节简介', - }, - ] + required: true, + message: '请填写简介', }, renderText: (val: string) => (
), renderFormItem: (item, { defaultRender, ...rest }, form) => ( @@ -538,7 +536,7 @@ export default () => { 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; }} > + { + // 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} + > + + {subjectIntro?.subject_name} + +
+ + + + 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(',') + } - - - - 主题 {subjectIntro?.subject_name} 创建/修改成功 -
+ }) + + } + 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} - /> - - + + 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} + /> diff --git a/admin/src/pages/examinationrules/attestation/step/index.tsx b/admin/src/pages/examinationrules/attestation/step/index.tsx index 71d209e..d3b102b 100644 --- a/admin/src/pages/examinationrules/attestation/step/index.tsx +++ b/admin/src/pages/examinationrules/attestation/step/index.tsx @@ -5,7 +5,7 @@ import { ModalForm } from '@ant-design/pro-form'; import { ProFormRadio } from '@ant-design/pro-form'; import ProForm, { StepsForm, ProFormText, ProFormSelect, ProFormDateRangePicker,ProFormDigit } from '@ant-design/pro-form'; import ProCard from '@ant-design/pro-card'; -import { Button, Checkbox, Col, Divider, Input, List, Menu, message, Radio, Row, Space, Typography } from 'antd'; +import { Button, Checkbox, Col, Divider, Input, List, Menu, message, Radio, Row, Space, Typography,Popconfirm } from 'antd'; import { PageContainer } from '@ant-design/pro-layout'; import ProDescriptions from '@ant-design/pro-descriptions'; import styles from './index.less' @@ -521,16 +521,42 @@ export default () => { search={false} toolBarRender={() => ( + {questionList&&questionList.length!==0? + { + + handleAutoModalVisible(true) + }} + onCancel={()=>{}} + okText="是" + cancelText="否" + > + + : + + } +