diff --git a/admin/src/pages/examination/option/index.tsx b/admin/src/pages/examination/option/index.tsx index 41ca3d7..dba752f 100644 --- a/admin/src/pages/examination/option/index.tsx +++ b/admin/src/pages/examination/option/index.tsx @@ -2,7 +2,7 @@ import React, { useState, useRef } from 'react'; import { useRequest, history } from 'umi'; import { PlusOutlined, TagsOutlined, UploadOutlined } from '@ant-design/icons'; -import { Button, message, Input, Drawer, Modal, Col, Row, Space, Upload, Form, Popconfirm } from 'antd'; +import { Button, message, Input, Drawer, Modal, Col, Row, Space, Upload, Form, Popconfirm, Typography } from 'antd'; import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; import type { ActionType } from '@ant-design/pro-table'; import type { ProColumns } from '@ant-design/pro-table'; @@ -296,10 +296,9 @@ const ExaminationList: React.FC = () => { }} > - {record.b_use == 1 ? "已发布" : "未发布"} + {record.b_use == 1 ? 已发布 : 未发布} @@ -312,9 +311,6 @@ const ExaminationList: React.FC = () => { record.apply_time = [record.apply_start_time, record.apply_end_time] record.examination_time = [record.examination_end_time, record.examination_end_time] record.apply_time = [record.apply_start_time, record.apply_end_time] - - - setCurrentRow(record); }} > diff --git a/admin/src/pages/examinationrules/attestation/index.tsx b/admin/src/pages/examinationrules/attestation/index.tsx index 7b2b23c..27f10f2 100644 --- a/admin/src/pages/examinationrules/attestation/index.tsx +++ b/admin/src/pages/examinationrules/attestation/index.tsx @@ -2,7 +2,7 @@ import React, { useState, useRef } from 'react'; import { useRequest, history } from 'umi'; import { PlusOutlined, TagsOutlined, UploadOutlined } from '@ant-design/icons'; -import { Button, message, Input, Drawer, Modal, Col, Row, Space, Upload } from 'antd'; +import { Button, message, Input, Drawer, Modal, Col, Row, Space, Upload, Typography } from 'antd'; import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; import type { ProColumns, ActionType } from '@ant-design/pro-table'; import ProTable from '@ant-design/pro-table'; @@ -222,6 +222,7 @@ const ExaminationRules: React.FC = () => { }}> 删除 , + /* { @@ -229,8 +230,8 @@ const ExaminationRules: React.FC = () => { //setCurrentRow(record); }} > - 发布 - , + {record.b_use == 1 ? 已发布 : 未发布} + */, ] }, }, diff --git a/admin/src/pages/examinationrules/attestation/step/index.tsx b/admin/src/pages/examinationrules/attestation/step/index.tsx index 58da570..95baa64 100644 --- a/admin/src/pages/examinationrules/attestation/step/index.tsx +++ b/admin/src/pages/examinationrules/attestation/step/index.tsx @@ -20,7 +20,7 @@ import { saveRules, querySubjectList, queryRulesView, queryRulesList, queryRules import { queryQuestionType } from '@/pages/questionbank/service'; import ProTable, { ActionType, EditableProTable, ProColumns } from '@ant-design/pro-table'; import { TableListPagination } from '@/pages/ListTableList2/data'; -import { PlusOutlined } from '@ant-design/icons'; +import { DiffOutlined, PlusOutlined } from '@ant-design/icons'; import { TableListItem } from '../../components/QuestionSelector'; import ScoreSetter from '../../components/ScoreSetter'; import AutoSelector from '../components/AutoSelector'; @@ -62,8 +62,8 @@ export default () => { dataIndex: 'examination_time', valueType: 'text', sorter: false, - hideInTable: false, - hideInForm: false, + hideInTable: true, + hideInForm: true, hideInSearch: true, renderText: (val: string) => `${val}`, }, @@ -71,13 +71,13 @@ export default () => { title: '关联主题', dataIndex: 'subject_name', valueType: 'text', - hideInTable: false, - hideInForm: false, + hideInTable: true, + hideInForm: true, hideInSearch: true, }, { title: '题型设置', - dataIndex: 'subject_id', + dataIndex: 'question_type_count', valueType: 'text', hideInTable: true, hideInForm: false, @@ -93,9 +93,9 @@ export default () => { sinfo.push({ label: Items.list[i].subject_name, value: Items.list[i].subject_id }) } console.log(sinfo, 'sinfo'); - */ + */ return []; - }, + }, }, { title: '总分', @@ -104,7 +104,7 @@ export default () => { valueType: 'text', hideInSearch: true, hideInForm: false, - renderText: (val: string) => `${val}分`, + renderText: (val: string) => `${val || 0} 分`, }, { title: '通过线', @@ -113,12 +113,13 @@ export default () => { valueType: 'text', hideInSearch: true, hideInForm: false, - renderText: (val: string) => `${val}`, + renderText: (val: string) => `${val || '-'}`, }, { title: '操作', dataIndex: 'option', valueType: 'option', + width: 200, render: (_dom: any, record: React.SetStateAction) => { console.log(record, 'record') return [ @@ -305,32 +306,36 @@ export default () => { >
+ page headerTitle={false} actionRef={actionRef} rowKey="examination_id" options={false} search={false} - toolBarRender={() => [ - , - - ]} + toolBarRender={() => ( + + + + + )} request={async (value) => { + console.log('queryRulesPaper::') const _data = await queryRulesPaper( { rules_id: params?.id, @@ -340,7 +345,7 @@ export default () => { ); return { current: _data?.pageNumber, - data: _data?.table_List, + data: _data?.question_list, pageSize: _data?.pageSize, total: _data?.totalRow || 0, }; @@ -407,6 +412,7 @@ export default () => { console.log('paper', paper) // setUuidPaper(paper?.paper_uuid) // message.success('提交成功'); + actionRef.current?.reload() handleAutoModalVisible(false) return true; }} diff --git a/admin/src/pages/examinationrules/normal/index.tsx b/admin/src/pages/examinationrules/normal/index.tsx index 40dc00f..28fce60 100644 --- a/admin/src/pages/examinationrules/normal/index.tsx +++ b/admin/src/pages/examinationrules/normal/index.tsx @@ -2,7 +2,7 @@ import React, { useState, useRef } from 'react'; import { useRequest, history } from 'umi'; import { PlusOutlined, TagsOutlined, UploadOutlined } from '@ant-design/icons'; -import { Button, message, Input, Drawer, Modal, Col, Row, Space, Upload } from 'antd'; +import { Button, message, Input, Drawer, Modal, Col, Row, Space, Upload, Typography } from 'antd'; import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; import type { ProColumns, ActionType } from '@ant-design/pro-table'; import ProTable from '@ant-design/pro-table'; @@ -194,7 +194,7 @@ const ExaminationRules: React.FC = () => { setSelectedRows([]); actionRef.current?.reloadAndRest?.(); }}> - 删除 + 删除 , { actionRef.current?.reloadAndRest?.(); }} > - {record.b_use == 0 ? "未发布" : "已发布"} + {record.b_use == 1 ? 已发布 : 未发布} , ] }, diff --git a/admin/src/pages/examinationrules/service.ts b/admin/src/pages/examinationrules/service.ts index f485591..5e161fb 100644 --- a/admin/src/pages/examinationrules/service.ts +++ b/admin/src/pages/examinationrules/service.ts @@ -209,4 +209,4 @@ export async function autoPaperOfficial(data: Record, options?: Rec requestType: "form", ...(options || {}), }); -} +} \ No newline at end of file diff --git a/admin/src/pages/questionbank/index.tsx b/admin/src/pages/questionbank/index.tsx index f836dc6..cb0c0b3 100644 --- a/admin/src/pages/questionbank/index.tsx +++ b/admin/src/pages/questionbank/index.tsx @@ -46,6 +46,33 @@ console.log('first'); } }; +/** + * 删除试题 + * + * @param selectedRows + */ +const handleRemove = async (selectedRows: TableListItem[]) => { + const hide = message.loading('正在删除'); + if (!selectedRows) return true; + + try { + const {code, msg} = await removeQuestion({ + key: selectedRows.map((row) => row.key), + }); + hide(); + if(code === 2000 ){ + message.success('删除成功,即将刷新'); + }else{ + message.warning(msg); + } + return true; + } catch (error) { + hide(); + message.error('删除失败,请重试'); + return false; + } +}; + const QuestionBank = () => { const match = useRouteMatch(); console.log('match', match); @@ -158,21 +185,31 @@ const QuestionBank = () => { hideInForm: false, hideInSearch: true, renderFormItem: (item, { defaultRender, ...rest }, form) => ( - + { + //console.log(`checked = ${e.target.checked}`); + }}> + + + A + + + B + + + C + + + D + + + ) /* formItemProps: { rules: [ { required: true, - message: '请填写试题解析', + message: '请填答案', }, ] },*/ @@ -204,23 +241,21 @@ const QuestionBank = () => { // rules={[{ required: true }]} value="锦书" // disabled - /> ), }, - ] const [questionType, setQuestionType] = useState([]); const [parsing, setParsing] = useState(); const [createModalVisible, handleCreateModalVisible] = useState(false); + const [updateModalVisible, handleUpdateModalVisible] = useState(false); + const [selectedRowsState, setSelectedRows] = useState([]); const [expandedDescRowKeys, setExpandedDescRowKeys] = useState([]); // 展开解析设置 const [addType, setAddType] = useState({name: '', value: 0}); - - /** 获取题型 */ const { data } = useRequest(() => { return queryQuestionType(); @@ -277,9 +312,10 @@ const QuestionBank = () => { 新建 , + /* , + */, , @@ -455,7 +491,10 @@ const QuestionBank = () => { - + { + handleUpdateModalVisible(true) + return false; + }} target="_blank" rel="noopener noreferrer" key="link"> 编辑 @@ -543,6 +582,57 @@ const QuestionBank = () => { columns={columns} /> + { + handleUpdateModalVisible(false); + }} + footer={null} + > + + layout="horizontal" + layoutType="Form" + labelCol={{ span: 8 }} + wrapperCol={{ span: 12 }} + onFinish={async (values: any) => { + // 表单处理 + console.log('columns:', columns); + console.log('values:', values); + const opts = []; + values?.answers?.forEach((item)=>{ + opts.push({answer:item, is_true:0}) + }) + const success = await handleAdd({ + ...values, + type: type, // 必填,0-常规题,1-资质考试题 + answers: JSON.stringify(opts), + question_type: addType.value, + // subject_id: params?.id || 0, + }); + console.log('123') + if(success){ + handleCreateModalVisible(false); + actionRef.current?.reloadAndRest?.(); + } + }} + submitter={{ + render: (props, doms) => ( + + + {doms} + + + ), + }} + // action = '' + title="编辑" + columns={columns} + /> + ); }; diff --git a/admin/src/pages/questionbank/service.ts b/admin/src/pages/questionbank/service.ts index 39b5de0..f727b20 100644 --- a/admin/src/pages/questionbank/service.ts +++ b/admin/src/pages/questionbank/service.ts @@ -47,7 +47,6 @@ export async function saveQuestion(data: Record, options?: Record) { + console.log('data:::', data); + return request>('/dsideal_yy/zygh/training/delQuestion', { + data: { ids: data?.key[0] }, // 当前接口支持批量操作 + method: 'POST', + requestType: 'form', + ...(options || {}), + }); +} \ No newline at end of file diff --git a/web/src/pages/mockExamination/chapterList.tsx b/web/src/pages/mockExamination/chapterList.tsx index 175122b..05c1743 100644 --- a/web/src/pages/mockExamination/chapterList.tsx +++ b/web/src/pages/mockExamination/chapterList.tsx @@ -3,222 +3,200 @@ import { useEffect, useState } from 'react'; import { Button, Card, Col, Layout, List, Menu, Progress, Row, Typography } from 'antd'; import { PageContainer } from '@ant-design/pro-layout'; import { useParams, useRequest } from 'umi'; -import { viewMyLearningSubject, listMyLearningChapterCourse } from './service'; +import { viewMyLearningSubject, getCourseExaminationProgressList } from './service'; import type { CardListItemDataType } from './data.d'; import styles from './style.less'; import SubMenu from 'antd/lib/menu/SubMenu'; -console.log('course/list') const { Paragraph } = Typography; import cookie from 'react-cookies'; -// const getList = async (subject_id,chapter_id ) => { -// // const hide = message.loading('正在配置'); -// try { -// const a=await listMyLearningChapterCourse({ -// identity_id:cookie.load('identity_id'), -// person_id:cookie.load('person_id'), -// subject_id:subject_id, -// chapter_id:chapter_id, -// }); -// // message.success('配置成功'); -// return a; -// } catch (error) { -// // message.error('配置失败请重试!'); -// return false; -// } -// }; +import { history } from "@@/core/history"; +let chapterCourse=[]; +let total_process=0; const CardList = () => { - const params = useParams(); - console.log('params', params); - // const ids = params.msg.split(','); + const params = useParams(); - const [currentCourse, SetCurrentCourse] = useState() + const [currentCourse, SetCurrentCourse] = useState() - /** 获取主题下课程 */ - const { data } = useRequest(() => { - return viewMyLearningSubject({ - identity_id: cookie.load('identity_id'), - person_id: cookie.load('person_id'), - data_id: params.data_id, - data_type: params.data_type, - subject_id: params.subject_id + /** 获取主题下课程 */ + const { data } = useRequest(() => { + return viewMyLearningSubject({ + identity_id: cookie.load('identity_id'), + person_id: cookie.load('person_id'), + data_id: params?.data_id, + data_type: params?.data_type, + subject_id: params?.subject_id - }); }); + }); - const list = data?.list || []; - const subject_data = data ? data.subject : []; - const last_data = data ? data.last_learning_course : []; - const chapter_list = data ? data.chapter_list : []; + // const list = data?.list||[]; + const subject_data = data ? data.subject : []; + const last_data = data ? data.last_learning_course : []; + const chapter_list = data ? data.chapter_list : []; - //console.log('currentCourse', currentCourse) - /** 获取课程详情 */ - const { data: chapterCourse, run, loading } = useRequest((params: { subject_id: number, chapter_id: number }) => { - return listMyLearningChapterCourse({ - identity_id: cookie.load('identity_id'), - person_id: cookie.load('person_id'), - subject_id: params?.subject_id,//chapter_list[0].subject_id - chapter_id: params?.chapter_id,//chapter_list[0].chapter_id - }); - }); - - /** 首次页面 当data 变化 执行run, chapterCourse 变化 进行currentCourse赋值 */ - useEffect(() => { - console.log('chapterCourse...', chapterCourse) - if (data !== undefined && data !== null) { - run({ subject_id: data?.chapter_list[0]?.subject_id, chapter_id: data?.chapter_list[0]?.chapter_id }) - SetCurrentCourse(chapterCourse) - } + /** 获取课程详情 */ + const { chapterCourseData, run, loading } = useRequest((params: { subject_id: number, chapter_id: number }) => { + return getCourseExaminationProgressList({ + identity_id: cookie.load('identity_id'), + person_id: cookie.load('person_id'), + subject_id: params?.subject_id, + chapter_id: params?.chapter_id, - }, [data]); + // r_list[0].chapter_id + }); + },{ + formatResult: (result) => { + if(result.list.length!==0){ + let total_finish_count=0; + let total_question_count=0; + result.list.forEach((item)=>{ + total_finish_count+=item.finish_count; + total_question_count+=item.question_count; + if(item.finish_count!==0){ + let num=0; + num=result.finish_count/result.question_count; + item.process=num.toFixed(4) + }else { + item.process=0; + } + }); + if(total_finish_count!==0){ + let total_num=total_finish_count/total_question_count; + total_process=total_num.toFixed(4) - /** run后 chapterCourse 变化 进行currentCourse赋值 */ - useEffect(() => { - console.log('chapterCourse...', chapterCourse) - if (data !== undefined) { - console.log('data', data) - SetCurrentCourse(chapterCourse) + }else { + total_process=0; } - - }, [chapterCourse]); - - - const content = ( -
- {subject_data ? subject_data.subject_name : '--'}} - hoverable={false} - className={styles.card} - actions={[]} - extra={<>开始学习时间: {subject_data ? subject_data.learning_start_time : '--'}距离结束时间:{subject_data ? subject_data.distance_end_time : '--'}考核学时:{subject_data ? subject_data.total_course_hours : '--'}小时} - > - } - title={false} - description={ - <> - - - {subject_data ? subject_data.subject_describe : '--'} - - - 学习进度: - - - 上次学习:{last_data ? last_data.course_name : '--'} 主讲人:{last_data ? last_data.lecture_teacher : '--'} - - - - } - /> - -
- ); - - - console.log('iddddddd', chapter_list.length !== 0 ? chapter_list[0].chapter_id.toString() : '') - const nullData: Partial = {}; - return ( - - - - - } title="章节目录"> - { - chapter_list.length !== 0 ? - chapter_list.map((item) => { - return ( - { - run({ subject_id: item.subject_id, chapter_id: item.chapter_id }) - }} - >{item.chapter_name} - ) - - }) : '' - } - - - - - - {console.log('chapterCourse', chapterCourse)} - { - chapterCourse !== undefined ? - <> - <>{chapterCourse[0]?.course_name} - <>{chapterCourse[0]?.lecture_teacher} - - : <>暂无 - } - - - > - rowKey="id" - // loading={loading} - grid={{ - gutter: 1, - xs: 1, - sm: 2, - md: 1, - lg: 1, - xl: 1, - xxl: 1, + } + chapterCourse=result.list; + + } + }); + + /** 首次页面 当data 变化 执行run, chapterCourse 变化 进行currentCourse赋值 */ + useEffect(() => { + // console.log('chapterCourse首次页面...', chapterCourse) + if (data !== undefined && data !== null && chapter_list.length !== 0) { + run({ subject_id: data?.chapter_list[0]?.subject_id, chapter_id: data?.chapter_list[0]?.chapter_id }) + SetCurrentCourse(chapterCourse) + } + //setSelectedCourse({}) + }, [data]); + + /** run后 chapterCourse 变化 进行currentCourse赋值 */ + useEffect(() => { + // console.log('chapterCourse变化...', chapterCourse) + if (data !== undefined) { + SetCurrentCourse(chapterCourse) + } + //setSelectedCourse({}) + }, [chapterCourse]); + + + const content = ( +
+ {subject_data ? subject_data.subject_name : '--'}} + hoverable={false} + className={styles.card} + actions={[]} + > + } + title={false} + description={ + <> + + + {subject_data ? subject_data.subject_describe : '--'} + + + 章节模拟考试进度: + + + + + + + + + } + /> + +
+ ); + + const nullData: Partial = {}; + return ( + + + + + } title="章节目录"> + { + chapter_list.length !== 0 ? + chapter_list.map((item) => { + return ( + { + run({ subject_id: item.subject_id, chapter_id: item.chapter_id }) }} - dataSource={[nullData, ...chapterCourse]} - renderItem={(item) => { - if (item && item.id) { - return ( - - - {item.title}} - description={ - - - 第1讲 - - - - {item.description} - - - - 23分钟 - - - - - - - - - } - /> - - - ); - } - }} - /> - - - - - ); + >{item.chapter_name} + ) + + }) : '' + } + + + + + + { + chapterCourse !== undefined && chapterCourse !== '' ? + chapterCourse.map((item, index) => { + return ( +
+
+
第{index+1}讲
+
{item?.course_name}
+
{item?.finish_count}题/{item?.question_count}题
+
+ +
+
+ +
+
+ + +
+ ) + }) + + : <>暂无 + } + +
+ +
+ ); }; export default CardList; diff --git a/web/src/pages/mockExamination/service.ts b/web/src/pages/mockExamination/service.ts index 4a1f157..5f3b5ad 100644 --- a/web/src/pages/mockExamination/service.ts +++ b/web/src/pages/mockExamination/service.ts @@ -4,8 +4,8 @@ import type { CardListItemDataType } from './data.d'; /** * 【6.5】(教师首页)当前学习主题课程信息 * /dsideal_yy/ypt/careerTraining/learning/listMyLearningSubject - * @param params - * @returns + * @param params + * @returns */ export async function listMyLearningSubject(params: { page_size: number; @@ -18,8 +18,8 @@ export async function listMyLearningSubject(params: { /** * 【6.5】(教师首页)当前学习主题课程信息 * /dsideal_yy/ypt/careerTraining/learning/listMyLearningSubject - * @param params - * @returns + * @param params + * @returns */ export async function getRulesList(params: { page_size: number; @@ -32,8 +32,8 @@ export async function getRulesList(params: { /** * 05 组卷详情查询 * /dsideal_yy/zygh/training/rules/getRulesPaper - * @param params - * @returns + * @param params + * @returns */ export async function getRulesPaper(params: { page_size: number; @@ -46,8 +46,8 @@ export async function getRulesPaper(params: { /** * 06 获取试卷内容 * /dsideal_yy/zygh/training/rules/getPaperQuestionList - * @param params - * @returns + * @param params + * @returns */ export async function getPaperQuestionList(params: { page_size: number; @@ -79,4 +79,15 @@ export async function listMyLearningChapterCourse(params: { return request(' /dsideal_yy/ypt/careerTraining/learning/listMyLearningChapterCourse', { params, }); -} \ No newline at end of file +} + +export async function getCourseExaminationProgressList(params: { + chapter_id: number; + identity_id: number; + person_id: number; + subject_id: number +}){ + return request('/dsideal_yy/zygh/training/mock/getCourseExaminationProgressList', { + params, + }); +}