diff --git a/admin/config/config.ts b/admin/config/config.ts index 907d6e1..8bd160c 100644 --- a/admin/config/config.ts +++ b/admin/config/config.ts @@ -162,8 +162,8 @@ export default defineConfig({ component: './examinationrules/normal', }, { - name: '创建模拟考试规则', - icon: 'smile', + //name: '创建模拟考试规则', + //icon: 'smile', path: '/examinationrules/normal/step', component: './examinationrules/normal/step', hideInMenu: true, @@ -182,8 +182,8 @@ export default defineConfig({ component: './examinationrules/attestation', }, { - name: '新建资质考试规则', - icon: 'smile', + //name: '新建资质考试规则', + //icon: 'smile', path: '/examinationrules/attestation/step', component: './examinationrules/attestation/step', hideInMenu: true, diff --git a/admin/src/pages/course/option/index.tsx b/admin/src/pages/course/option/index.tsx index 1a3242e..e591844 100644 --- a/admin/src/pages/course/option/index.tsx +++ b/admin/src/pages/course/option/index.tsx @@ -28,7 +28,7 @@ const uuid = uuidv4(); const handleAdd = async (fields: TableListItem) => { const hide = message.loading('正在添加'); try { - await saveCourse({ ...fields, attachment_filesize: 0, }); + await saveCourse({ ...fields }); hide(); message.success('添加成功'); return true; @@ -45,7 +45,7 @@ const handleAdd = async (fields: TableListItem) => { * @param fields */ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => { - const hide = message.loading('正在配置'); + const hide = message.loading('正在更新'); console.log('fields',fields) try { await saveCourse({ @@ -53,11 +53,11 @@ console.log('fields',fields) ...fields, }); hide(); - message.success('配置成功'); + message.success('操作成功'); return true; } catch (error) { hide(); - message.error('配置失败请重试!'); + message.error('操作失败请重试!'); return false; } }; @@ -176,7 +176,12 @@ const CourseList: React.FC = () => { hideInTable: true, hideInForm: false, hideInSearch: true, - renderText: (val: string) => `${val} 分钟`, + render: (text: React.ReactNode, _: any, index: number) => { + return( +
{text}分钟
+ ) + }, + // renderText: (val: string) => `${val} 分钟`, formItemProps: { // 参照 https://ant.design/components/form-cn/#Rule rules: [ @@ -255,7 +260,8 @@ const CourseList: React.FC = () => { beforeUpload={async (file) => { /** 获取视频文件信息 */ const {media: {track:[General, Video, Audio]}} = await getInfo(file) - if(Video.format !== 'AVC' || Audio.format !== 'AAC'){ + console.log('media',General,Video,Audio) + if(Video.Format !== 'AVC' || Audio.Format !== 'AAC'){ message.error('视频编码格式不正确(视频采用AVC,音频采用AAC)') return false; } @@ -276,7 +282,7 @@ const CourseList: React.FC = () => { maxCount={1} multiple={false} file={()=>{ - // location.pathname + // location.pathname }} > @@ -300,7 +306,7 @@ const CourseList: React.FC = () => { hideInForm: true, hideInSearch: true, width: 100, - renderText: (val: string) => `${val} 字节`, + renderText: (val: number) => `${(val / 1024).toFixed(2)} KB`, formItemProps: { // 参照 https://ant.design/components/form-cn/#Rule rules: [ @@ -489,7 +495,7 @@ const CourseList: React.FC = () => { fluid: true, // 当true时,Video.js player将拥有流体大小。换句话说,它将按比例缩放以适应其容器。 sources: [ { - src: (currentRow?.attachment_json?.url) || '/dsideal_yy/html/down/Syzx/3b/3b225da8-87a5-4619-82a4-664ae2b37e23.mp4', // 测试地址后续请删除 + src: '/dsideal_yy/html/' + currentRow?.attachment_json?.url, // 测试地址后续请删除 type: 'application/x-mpegURL' } ], @@ -578,11 +584,12 @@ const CourseList: React.FC = () => { //return false; // values.attachment_json.response.file.response.url //console.log('currentRow', currentRow) - console.log('values00000000000ss',values) + console.log('values00000000000ss',values) await handleAdd({ ...values, //course_id: currentRow?.course_id, - attachment_json: `{"img":"", "name": "${values.attachment_json.file.name}", "url": "down/Syzx/${uuid?.substr(0, 2)}/${uuid}.mp4"}` + attachment_json: `{"img":"", "name": "${values?.attachment_json?.file?.name}", "url": "down/Syzx/${uuid?.substr(0, 2)}/${uuid}.mp4"}`, + attachment_filesize: values?.attachment_json?.file?.size, // 字节 }); handleCreateModalVisible(false); // 隐藏创建窗口 actionRef.current?.reloadAndRest?.(); @@ -624,13 +631,14 @@ const CourseList: React.FC = () => { //const url = values?.upload[0]?.url?.replace('/dsideal_yy/html/','') || values?.upload[0]?.response?.url; //console.log('url', url) console.log('values编辑',values) - await handleUpdate({ - ...values, - attachment_filesize: attachment_json?.size || 0, // Bit 字节 - course_id: currentRow?.course_id, - attachment_json: `{"img":"", "name":"${values.attachment_json.file.name}", "url": "${values.attachment_json?.url}", "size": "${values.attachment_json?.size}"}` - }); - + await handleUpdate({ + ...values, + attachment_json: `{"img":"", "name": "${values.attachment_json.file.name}", "url": "down/Syzx/${uuid?.substr(0, 2)}/${uuid}.mp4"}`, + attachment_filesize: values.attachment_json?.size || 0, // Bit 字节 + course_id: currentRow?.course_id, + // attachment_json:JSON.stringify(values.attachment_json) + // attachment_json: `{"img":"", "name":"${values.attachment_json.file.name}", "url": "${values.attachment_json?.url}", "size": "${values.attachment_json?.size}"}` + }); handleUpdateModalVisible(false); // 隐藏编辑窗口 actionRef.current?.reloadAndRest?.(); console.log(values); diff --git a/admin/src/pages/course/subject/index.tsx b/admin/src/pages/course/subject/index.tsx index 7c08457..6a1a358 100644 --- a/admin/src/pages/course/subject/index.tsx +++ b/admin/src/pages/course/subject/index.tsx @@ -104,18 +104,18 @@ const handleAdd = async (fields: TableListItem) => { * @param fields */ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => { - const hide = message.loading('正在配置'); + const hide = message.loading('正在更新'); try { await updateSubject({ ...currentRow, ...fields, }); hide(); - message.success('配置成功'); + message.success('操作成功'); return true; } catch (error) { hide(); - message.error('配置失败请重试!'); + message.error('操作失败请重试!'); return false; } }; diff --git a/admin/src/pages/examination/certificate/index.tsx b/admin/src/pages/examination/certificate/index.tsx index 258dda6..06a8f0d 100644 --- a/admin/src/pages/examination/certificate/index.tsx +++ b/admin/src/pages/examination/certificate/index.tsx @@ -41,7 +41,7 @@ const handleAdd = async (fields: TableListItem) => { * @param fields */ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => { - const hide = message.loading('正在配置'); + const hide = message.loading('正在更新'); try { await saveCourse({ @@ -49,11 +49,11 @@ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) = ...fields, }); hide(); - message.success('配置成功'); + message.success('操作成功'); return true; } catch (error) { hide(); - message.error('配置失败请重试!'); + message.error('操作失败请重试!'); return false; } }; diff --git a/admin/src/pages/examination/option/index.tsx b/admin/src/pages/examination/option/index.tsx index 73d24bc..e4fc8b8 100644 --- a/admin/src/pages/examination/option/index.tsx +++ b/admin/src/pages/examination/option/index.tsx @@ -27,7 +27,7 @@ import { ConsoleMessage } from 'puppeteer-core'; */ const handleUpdate = async (fields: FormValueType) => { - const hide = message.loading('正在配置'); + const hide = message.loading('正在更新'); console.log(fields, '111111111'); try { @@ -36,11 +36,11 @@ const handleUpdate = async (fields: FormValueType) => { }); hide(); - message.success('配置成功'); + message.success('操作成功'); return true; } catch (error) { hide(); - message.error('配置失败请重试!'); + message.error('操作失败请重试!'); return false; } }; diff --git a/admin/src/pages/examination/registration/index.tsx b/admin/src/pages/examination/registration/index.tsx index a6b8c42..bd65dca 100644 --- a/admin/src/pages/examination/registration/index.tsx +++ b/admin/src/pages/examination/registration/index.tsx @@ -43,7 +43,7 @@ const handleAdd = async (fields: TableListItem) => { */ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => { - const hide = message.loading('正在配置'); + const hide = message.loading('正在更新'); try { await saveRegistration({ @@ -51,11 +51,11 @@ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) = ...fields, }); hide(); - message.success('配置成功'); + message.success('操作成功'); return true; } catch (error) { hide(); - message.error('配置失败请重试!'); + message.error('操作失败请重试!'); return false; } }; diff --git a/admin/src/pages/examinationrules/attestation/index.tsx b/admin/src/pages/examinationrules/attestation/index.tsx index 3318d02..6a552df 100644 --- a/admin/src/pages/examinationrules/attestation/index.tsx +++ b/admin/src/pages/examinationrules/attestation/index.tsx @@ -42,7 +42,7 @@ const handleAdd = async (fields: TableListItem) => { */ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => { - const hide = message.loading('正在配置'); + const hide = message.loading('正在更新'); try { await saveExamination({ @@ -50,11 +50,11 @@ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) = ...fields, }); hide(); - message.success('配置成功'); + message.success('操作成功'); return true; } catch (error) { hide(); - message.error('配置失败请重试!'); + message.error('操作失败请重试!'); return false; } }; @@ -110,7 +110,7 @@ const ExaminationRules: React.FC = () => { width: 48, }, { - title: '资质考试名称', + title: '考试规则名称', dataIndex: 'rules_name', valueType: 'text', hideInTable: false, diff --git a/admin/src/pages/examinationrules/attestation/step/index.tsx b/admin/src/pages/examinationrules/attestation/step/index.tsx index 5a510c6..894fd42 100644 --- a/admin/src/pages/examinationrules/attestation/step/index.tsx +++ b/admin/src/pages/examinationrules/attestation/step/index.tsx @@ -50,6 +50,8 @@ export default () => { /** 试卷详情窗口 */ const [paperModalVisible, handlePaperModalVisible] = useState(false); + const [paperInfo, setPaperInfo] = useState({}) + /** 查看试卷 */ const { data: questions, run } = useRequest(async (params) => { console.log('questions', questions) @@ -60,6 +62,37 @@ export default () => { return result?.question_list; }}); + + + + // + const { data: paperData, run: runPaper } = useRequest(async (params) => { + console.log('paperData', paperData) + /** + * rules_id: params?.id, + page_number: value.current, + page_size: value.pageSize + */ + return queryRulesPaper(params); + }, { + manual: true, + formatResult: (result) => { + return result?.question_list; + } + }); + + useEffect(() => { + console.log('paperData2', paperData) + if (paperData?.length > 0) { + console.log('paperData[0]', paperData[0]) + setPaperInfo(paperData[0]) + } + console.log('PaperInfo', paperInfo) + }, [paperData]); + + + + /** 列表项定义 */ const columns: ProColumns[] = [ { @@ -192,6 +225,7 @@ export default () => { ) if(success){ message.success('试卷生成成功') + actionRef.current?.reload() }else{ message.success('试卷生成失败') } @@ -406,6 +440,7 @@ export default () => { onFinish={async () => { console.log(formRef.current?.getFieldsValue()); setCurrentStep(2) + runPaper({ rules_id: params?.id || rulesId }) return true; }} > @@ -506,12 +541,13 @@ export default () => { column={1} //actionRef={actionRef} title={false} - request={async () => { - const result = await queryRulesView(params) + request={async () => { + const result = await queryRulesView({id: rulesId}) console.log('queryRulesView', result) - const subjectInfo = await getSubjectInfo({subject_id: result.bean.subject_id}) + const subjectInfo = await getSubjectInfo({ subject_id: result.bean.subject_id }) console.log('subjectInfo', subjectInfo) - return {data: {...result.bean, subject_name: subjectInfo.data.subject_name}}; + return { data: { ...result.bean, subject_name: subjectInfo.data.subject_name } }; + }} extra={false} > @@ -520,20 +556,20 @@ export default () => { (`${text} 分钟`)} /> - { + { + {/** 从试卷中读取 临时卷必须保存后才进入此页 */ } return - 共 0 道题, 100 分 - 单选: 0 道题 单选: 0 道题 单选: 0 道题 - 通过线 60 分 + 共 {paperInfo?.question_type_count?.map(item=>item.count)?.reduce((prev, curr)=>prev + curr)} 道题, {paperInfo?.sum_score || '-'} 分 + {paperInfo?.question_type_count?.map(item=>({`${item?.type_name} ${item?.count} 道题 `}))} + 通过线 {paperInfo?.pass_score || '-'} 分 - - }} /> + }} /> - { - return
0 试卷数量是学生重复考试次数
+ { + return
{entity?.paper_count} 试卷数量是学生重复考试次数
}} /> - { - return
2020/03/01 超过试卷有效期将重新生成试卷
+ { + return
{/*entity?.start_time.substring(0,10)*/} {entity?.end_time.substring(0,10)} 超过试卷有效期将重新生成试卷
}} /> diff --git a/admin/src/pages/examinationrules/components/QuestionSelector.tsx b/admin/src/pages/examinationrules/components/QuestionSelector.tsx index 4fd58be..1f5c651 100644 --- a/admin/src/pages/examinationrules/components/QuestionSelector.tsx +++ b/admin/src/pages/examinationrules/components/QuestionSelector.tsx @@ -136,6 +136,11 @@ const QuestionSelector = (props: any, ref: any) => { defaultPageSize: 10, showSizeChanger: false, }} + search={{ + optionRender: false, + collapsed: false, + labelWidth: 40, + }} actionRef={actionRef} toolBarRender={false} rowKey="id" @@ -171,7 +176,6 @@ const QuestionSelector = (props: any, ref: any) => { total: questions?.totalRow || 0, }; }} - //dataSource={dataSource} rowSelection={{ onChange: (_, selectedRows) => { setSelectedRows(selectedRows); @@ -179,25 +183,6 @@ const QuestionSelector = (props: any, ref: any) => { }} columns={columns} // grid={{ gutter: 16, column: 1 }} - /* - metas={{ - title: { - dataIndex: 'question_stem', - render: (text: React.ReactNode, record: T, index: number) => `1. ${text}`, - }, - avatar: { - dataIndex: 'question_type', - valueType: 'text', - render: (text: React.ReactNode, record: T, _: number) => { - const _type = questionType?.filter((item, idx, self)=>{ - return item?.code === record.question_type - }); - return `[${_type[0]?.name}]` - }, - }, - description: { - }, - }}*/ /> ); diff --git a/admin/src/pages/examinationrules/components/ScoreSetter.tsx b/admin/src/pages/examinationrules/components/ScoreSetter.tsx index 9253fb2..109d479 100644 --- a/admin/src/pages/examinationrules/components/ScoreSetter.tsx +++ b/admin/src/pages/examinationrules/components/ScoreSetter.tsx @@ -1,6 +1,6 @@ /** 模拟考试 | 资质考试选题 */ //import { AlignLeftOutlined, PlusOutlined } from '@ant-design/icons'; -import { Button, InputNumber, message, Space, Form} from 'antd'; +import { Button, InputNumber, message, Space, Form, Input} from 'antd'; //import { FooterToolbar, PageContainer } from '@ant-design/pro-layout'; //import { useRequest } from 'umi'; //import { queryFakeList } from './service'; @@ -194,6 +194,9 @@ const ScoreSetter = (props: any, ref: any) => { getValue: () => { return passScore; }, + getSum: () => { + return sumScore; + }, })); return ( diff --git a/admin/src/pages/examinationrules/normal/index.tsx b/admin/src/pages/examinationrules/normal/index.tsx index 8ebf588..cd16686 100644 --- a/admin/src/pages/examinationrules/normal/index.tsx +++ b/admin/src/pages/examinationrules/normal/index.tsx @@ -45,7 +45,7 @@ const handleRemove = async (selectedRows: TableListItem[], currentRow) => { * @param fields */ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => { - const hide = message.loading('正在配置'); + const hide = message.loading('正在更新'); console.log('fields', fields) try { await updateRules({ @@ -53,11 +53,11 @@ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) = ...fields, }); hide(); - message.success('配置成功'); + message.success('操作成功'); return true; } catch (error) { hide(); - message.error('配置失败请重试!'); + message.error('操作失败请重试!'); return false; } }; @@ -85,7 +85,7 @@ const ExaminationRules: React.FC = () => { width: 48, }, { - title: '考试名称', + title: '考试规则名称', dataIndex: 'rules_name', valueType: 'text', hideInTable: false, diff --git a/admin/src/pages/examinationrules/normal/step/index.tsx b/admin/src/pages/examinationrules/normal/step/index.tsx index 9f13809..4bb6c38 100644 --- a/admin/src/pages/examinationrules/normal/step/index.tsx +++ b/admin/src/pages/examinationrules/normal/step/index.tsx @@ -447,7 +447,7 @@ export default () => {
试卷信息与设置 - 共 {'0'} 题 {'-'} 分 + 共 {questions?.length} 题 {'-'} 分 {questionType.map((item) => { @@ -504,11 +504,15 @@ export default () => { //actionRef={actionRef} title={false} request={async () => { - const result = await queryRulesView(params) + console.log('rulesId...', rulesId) + //{rules_id: rulesId} + console.log('params...', params) + const result = await queryRulesView({id: rulesId}) console.log('queryRulesView', result) const subjectInfo = await getSubjectInfo({ subject_id: result.bean.subject_id }) console.log('subjectInfo', subjectInfo) return { data: { ...result.bean, subject_name: subjectInfo.data.subject_name } }; + }} extra={false} > @@ -516,13 +520,12 @@ export default () => { (`${text} 分钟`)} /> - { - {/** 需要从试卷 或 临时试卷 中读取 需要处理 */ } + {/** 从试卷中读取 临时卷必须保存后才进入此页 */ } return - 共 0 道题, {paperInfo?.sum_score} 分 - 单选: 0 道题 单选: 0 道题 单选: 0 道题 - 通过线 {paperInfo?.pass_score} 分 + 共 {paperInfo?.question_type_count?.map(item=>item.count)?.reduce((prev, curr)=>prev + curr)} 道题, {paperInfo?.sum_score || '-'} 分 + {paperInfo?.question_type_count?.map(item=>({`${item?.type_name} ${item?.count} 道题 `}))} + 通过线 {paperInfo?.pass_score || '-'} 分 }} /> @@ -569,7 +572,8 @@ export default () => { //console.log('111') //const values = autoRef?.current?.getData() //console.log('2222') - //const {code, data: paper, msg} = await autoPaper({rules_id: Number(params?.id), auto_param: JSON.stringify(values)}) + const values = [{"question_type":0,"chapter_list": [{ "chapter_id":76, "count":1 },{ "chapter_id":77, "count":1 }]}] + const {code, data: paper, msg} = await autoPaper({rules_id: Number(params?.id), auto_param: JSON.stringify(values)}) //console.log('paper', paper) //setUuidPaper(paper?.paper_uuid) // message.success('提交成功'); @@ -589,23 +593,13 @@ export default () => { console.log('typeQuestionCount', typeQuestionCount) const values = setterRef.current?.getData() // 获取题型分值数据 const passSocre = setterRef.current?.getValue() // 获取通过分数线 - + const sumCore = setterRef.current?.getSum() // 获取总分 console.log('批量设置分值v::::2', values); // 题型分数 const { code, data: paper, msg } = await saveQuestionTypeScore({ rules_id: Number(params?.id || rulesId), type_score: JSON.stringify(values) }) - // 总分及通过分 - let _sumScore = 0; - values?.forEach((item) => { - console.log('item--', item) - _sumScore += item?.score - }) - //console.log('_sumScore', _sumScore) - - //console.log('passScore',passScore) - console.log('sumScore', sumScore) - const { success } = await updateScore({ rules_id: Number(params?.id || rulesId), pass_socre: passSocre, sum_score: _sumScore }) - setSumScore(_sumScore) - console.log('paper', paper) + const { success } = await updateScore({ rules_id: Number(params?.id || rulesId), pass_socre: passSocre, sum_score: sumCore }) + //setSumScore(_sumScore) + //console.log('paper', paper) // setUuidPaper(paper?.paper_uuid) // message.success('提交成功'); handleScoreModalVisible(false) diff --git a/admin/src/pages/history/analysis/components/AchievementRow.tsx b/admin/src/pages/history/analysis/components/AchievementRow.tsx index 06e97c6..8edfe90 100644 --- a/admin/src/pages/history/analysis/components/AchievementRow.tsx +++ b/admin/src/pages/history/analysis/components/AchievementRow.tsx @@ -72,9 +72,9 @@ const TableList: React.FC = () => { 导出名单 , ]} - request={async (value) => { - console.log(value, "value11") - const _data = await getExaminationPersonStatistics({ ...value, current: value.page_number, sort_type: 2, sort_colum: 1 }); + + request={async (params) => { + const _data = await getExaminationPersonStatistics({ page_number:params.current, page_size:20,sort_type: 2, sort_colum: 1 }); return { data: _data?.table_List, }; diff --git a/admin/src/pages/history/analysis/components/IntroduceRow.tsx b/admin/src/pages/history/analysis/components/IntroduceRow.tsx index 04eead9..5b97d7b 100644 --- a/admin/src/pages/history/analysis/components/IntroduceRow.tsx +++ b/admin/src/pages/history/analysis/components/IntroduceRow.tsx @@ -7,11 +7,12 @@ import type { DataItem } from '../data.d'; import { getAsyncOrgTree, getEduUnitList,getExaminationStatistics } from '../service'; const { Option } = Select; - +import cookie from 'react-cookies'; import styles from '../style.less'; import ProForm, { ProFormSelect } from '@ant-design/pro-form'; import { useRequest } from 'umi'; import {listMyLearningChapterCourse} from "../../../../../../web/src/pages/course/list/service"; +import {number} from "prop-types"; const { RangePicker } = DatePicker; const topColResponsiveProps = { @@ -33,7 +34,7 @@ let city_id=0; let area_id=0; let school=0; const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: DataItem[] }) => { - const [provinceId, setProvinceId] = useState("100007") + const [provinceId, setProvinceId] = useState(cookie.load('background_province_id') ) const [cityList, setCityList] = useState([]); const [areaList, setAreaList] = useState([]); @@ -63,7 +64,7 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat const {data: examinationData, run } = useRequest(() => { return getExaminationStatistics({ - bureau_id:school, + bureau_id:typeof (school)===number?school:0, city_id:city_id, district_id: area_id, province_id: provinceId @@ -75,7 +76,7 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat result.num=num; }else { const percent=result.credential_person_count/result.apply_person_count; - const num=percent.toFixed(4); + const num=percent.toFixed(2); result.num=num; } @@ -154,13 +155,22 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat if (value >= 'a' && value <= 'z') { return false; } - if (value) { + if (value) { school=value; // console.log('value::', value) // setOptions([{ORG_NAME:"aaa", ORG_ID:"111"},{ORG_NAME:"aab", ORG_ID:"112"}]) + let id=provinceId; + if(city_id!==0){ + if(area_id!==0){ + id=area_id; + }else { + id=city_id; + } + } + console.log('iddidididididididi',id) const { table_List } = await getEduUnitList({ random_num: 277470, - area_id: provinceId, + area_id: id, edu_type: -1, // main_school_id: 200125116, org_name: value, @@ -291,7 +301,7 @@ const IntroduceRow = ({ loading, visitData }: { loading: boolean; visitData: Dat style={{ textAlign: 'center', marginBottom: 0 , padding:12, border:'solid 1px #f0f0f0'}} bodyStyle={{padding:0}} > - + diff --git a/admin/src/pages/history/analysis/components/TrainCard.tsx b/admin/src/pages/history/analysis/components/TrainCard.tsx index 3a848bc..c8324ac 100644 --- a/admin/src/pages/history/analysis/components/TrainCard.tsx +++ b/admin/src/pages/history/analysis/components/TrainCard.tsx @@ -32,7 +32,7 @@ const SalesCard = () => { data.push({ city: e.city_name, count: e.count, - credential_rate: e.credential_rate + credential_rate: e.credential_rate?e.credential_rate:0 }) }) @@ -48,7 +48,40 @@ const SalesCard = () => { title: { text: '证书比例', }, + label: { + formatter: (val) => `${val}%`, + }, }], + tooltip: { + customContent: (title, items) => { + return ( + <> +
{title}
+
    + {items?.map((item, index) => { + const { name, value, color } = item; + return ( +
  • + + + {name}:    + {value}{index===0?'':'%'} + +
  • + ); + })} +
+ + ); + }, + }, geometryOptions: [ { geometry: 'column', @@ -81,7 +114,7 @@ const SalesCard = () => { -
+
diff --git a/admin/src/pages/questionbank/index.tsx b/admin/src/pages/questionbank/index.tsx index fa278f2..f2949bb 100644 --- a/admin/src/pages/questionbank/index.tsx +++ b/admin/src/pages/questionbank/index.tsx @@ -99,7 +99,8 @@ const QuestionBank = () => { const type = history.location.pathname === '/questionbank/attestation' ? 1 : 0 ; // 题库类型 const actionRef = useRef(); - + const formRef = useRef(); + const [questionType, setQuestionType] = useState([]); const [parsing, setParsing] = useState(); @@ -114,6 +115,7 @@ const QuestionBank = () => { const [pageNumber, setPageNumber] = useState(1) //const [answertrueValues, setAnswertrueValues] = useState(); // 编辑试题答案项值 + //const [options, setOptions] = useState([]); // 设置当前选项, 用于删除选项时判断 /** 表单项定义 */ const columns: ProColumns[] = [ @@ -233,7 +235,7 @@ const QuestionBank = () => { dependencies:['answers'], renderFormItem: (item, { defaultRender, ...rest }, form) => { console.log('正确答案...', form.getFieldValue('answers')) - // 需要处理 关联长度变化及编辑回显 + // 关联长度变化及编辑回显 console.log('edit answertrue11', item) console.log('form::::::',form.getFieldValue('answertrue')) console.log('rest', rest) @@ -245,12 +247,13 @@ const QuestionBank = () => { for(let i=0; i { title: '题干', search: false, dataIndex: 'question_stem', - render: (text: React.ReactNode, record: T, index: number) => (<>{record?.id} {text}), + render: (text: React.ReactNode, record: T, index: number) => ({record?.id} {text}), }, avatar: { title: '题型', @@ -729,14 +732,41 @@ const QuestionBank = () => { footer={null} > + formRef={formRef} layout="horizontal" layoutType="Form" labelCol={{ span: 8 }} wrapperCol={{ span: 12 }} + onValuesChange={()=>{ + //console.log('formRef', formRef.current.getFieldInstance('answertrue')) + //console.log('formRef.current', formRef.current.getFieldsValue(['answertrue'])) + //console.log('v', value) + //console.log('answers', formRef?.current?.getFieldValue('answers')) + const answerTrue = formRef?.current?.getFieldValue('answertrue'); + let fixed_answertrue; + // 如果正确答案为字符串(单选 / 判断) + if(typeof answerTrue === 'string'){ + console.log('string.....') + fixed_answertrue = labels.indexOf(answerTrue) < (formRef?.current?.getFieldValue('answers')?.length || 0) ? answerTrue : undefined; + }else if(answerTrue?.length > 0){ + fixed_answertrue = answerTrue?.filter((item, key)=>{ + return labels.indexOf(item) < (formRef?.current?.getFieldValue('answers')?.length || 0) + }) + } + console.log('answerTrue', answerTrue) + /* + const */ + //console.log('fixed', fixed_answertrue) + formRef?.current?.setFieldsValue({answertrue: fixed_answertrue}) + }} onFinish={async (values: any) => { + //console.log('formRef.current', formRef.current.getFieldsValue(['answertrue'])) + // 表单处理 console.log('columns:', columns); - console.log('values:', values); + console.log('values:', values); + + return false const opts = []; values?.answers?.forEach((item, key)=>{ // diff --git a/admin/src/pages/training/option/index.tsx b/admin/src/pages/training/option/index.tsx index 9c30a99..06a0715 100644 --- a/admin/src/pages/training/option/index.tsx +++ b/admin/src/pages/training/option/index.tsx @@ -40,18 +40,18 @@ const handleAdd = async (fields: TableListItem) => { * @param fields */ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) => { - const hide = message.loading('正在配置'); + const hide = message.loading('正在更新'); try { await saveTrain({ ...currentRow, ...fields, }); hide(); - message.success('配置成功'); + message.success('操作成功'); return true; } catch (error) { hide(); - message.error('配置失败请重试!'); + message.error('操作失败请重试!'); return false; } };