diff --git a/admin/src/pages/course/subject/step/index.tsx b/admin/src/pages/course/subject/step/index.tsx
index ffbcdaf..73c8c62 100644
--- a/admin/src/pages/course/subject/step/index.tsx
+++ b/admin/src/pages/course/subject/step/index.tsx
@@ -397,7 +397,7 @@ export default () => {
}}*/
onFinish={async (value: any) => {
- console.log(subjectId, 'subjectId')
+ console.log(value, 'subjectId')
const url = value?.upload[0]?.url?.replace('/dsideal_yy/html/', '') || value?.upload[0]?.response?.url;
const info = await saveSubject({
@@ -435,7 +435,7 @@ export default () => {
width="xl"
// tooltip="最长为 6 位汉字,需要与考生身份证一致"
placeholder="请输入介绍"
- rules={[{ required: true }]}
+ // rules={[{ required: true }]}
// value="锦书"
// disabled
diff --git a/admin/src/pages/examinationrules/normal/index.tsx b/admin/src/pages/examinationrules/normal/index.tsx
index cd16686..a19e290 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, Typography } from 'antd';
+import { Button, message, Input, Drawer, Modal, Col, Row, Space, Upload, Typography, Popconfirm } 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';
@@ -128,7 +128,7 @@ const ExaminationRules: React.FC = () => {
sinfo.push({ label: Items.list[i].subject_name, value: Items.list[i].subject_id })
}
console.log(sinfo, 'sinfo');
- const info = sinfo?.filter((item, idx, self)=>{
+ const info = sinfo?.filter((item, idx, self) => {
return item?.b_use === 1
});
return info;
@@ -192,18 +192,22 @@ const ExaminationRules: React.FC = () => {
>
编辑
,
- ,
+
+
+
+
+
+
+ ,
{
diff --git a/admin/src/pages/questionbank/index.tsx b/admin/src/pages/questionbank/index.tsx
index f918b9f..f3e15da 100644
--- a/admin/src/pages/questionbank/index.tsx
+++ b/admin/src/pages/questionbank/index.tsx
@@ -9,21 +9,22 @@ import styles from './style.less';
//import SubMenu from 'antd/lib/menu/SubMenu';
//import ProCard from '@ant-design/pro-card';
import ProList from '@ant-design/pro-list';
-import { ReactText, useEffect, useRef, useState } from 'react';
+import type { ReactText } from 'react';
+import { useEffect, useRef, useState } from 'react';
import { PlusOutlined, DeleteOutlined, DownloadOutlined, UploadOutlined, EditOutlined, EyeOutlined, EyeInvisibleOutlined, DownOutlined, UserOutlined } from '@ant-design/icons';
import { exportQuestionTemplate, queryQuestionById, queryQuestionList, queryQuestionType, removeQuestion, saveQuestion } from './service';
import { useParams, useRequest, history, useRouteMatch } from 'umi';
import { queryCourseListByTag, queryCourseView, queryTagList } from '@/pages/course/option/service';
import ProForm, { BetaSchemaForm, ProFormCheckbox, ProFormList, ProFormRadio, ProFormSelect, ProFormText } from '@ant-design/pro-form';
-import { DataItem } from '../dashboard/analysis/data';
-import { ActionType, ProColumns } from '@ant-design/pro-table';
+import type { DataItem } from '../dashboard/analysis/data';
+import type { ActionType, ProColumns } from '@ant-design/pro-table';
import ProFormRichEdit from '../course/subject/components/ProFormRichEdit';
-import { TableListItem } from '../course/option/data';
+import type { TableListItem } from '../course/option/data';
import AnswersSelector from './components/AnswersEditor';
//const { Paragraph } = Typography;
const { Text, Link } = Typography;
-const labels = ['A','B','C','D','E','F','G','H','I','J','K'];
+const labels = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K'];
const parsingMap = new Map()
console.log('first');
@@ -32,10 +33,10 @@ console.log('first');
*
* @param fields
*/
- const handleAdd = async (fields: TableListItem) => {
+const handleAdd = async (fields: TableListItem) => {
const hide = message.loading('正在添加');
try {
- await saveQuestion({ ...fields});
+ await saveQuestion({ ...fields });
hide();
message.success('添加成功');
return true;
@@ -51,10 +52,10 @@ console.log('first');
*
* @param fields
*/
- const handleUpdate = async (fields: TableListItem) => {
+const handleUpdate = async (fields: TableListItem) => {
const hide = message.loading('正在保存');
try {
- await saveQuestion({ ...fields});
+ await saveQuestion({ ...fields });
hide();
message.success('保存成功');
return true;
@@ -76,13 +77,13 @@ const handleRemove = async (selectedRows: TableListItem[]) => {
if (!selectedRows) return true;
try {
- const {code, msg} = await removeQuestion({
+ const { code, msg } = await removeQuestion({
key: selectedRows.map((row) => row.key),
});
hide();
- if(code === 2000 ){
+ if (code === 2000) {
message.success('删除成功,即将刷新');
- }else{
+ } else {
message.warning(msg);
}
return true;
@@ -97,26 +98,26 @@ const QuestionBank = () => {
const match = useRouteMatch();
console.log('match', match);
- const type = history.location.pathname === '/questionbank/attestation' ? 1 : 0 ; // 题库类型
+ const type = history.location.pathname === '/questionbank/attestation' ? 1 : 0; // 题库类型
const actionRef = useRef();
const formRef = useRef();
-
+
const [questionType, setQuestionType] = useState([]);
-
+
const [parsing, setParsing] = useState();
-
+
const [createModalVisible, handleCreateModalVisible] = useState(false);
const [updateModalVisible, handleUpdateModalVisible] = useState(false);
-
+
const [selectedRowsState, setSelectedRows] = useState([]);
const [currentRow, setCurrentRow] = useState();
const [expandedDescRowKeys, setExpandedDescRowKeys] = useState([]); // 展开解析设置
- const [addType, setAddType] = useState({name: '', value: ''});
-
+ const [addType, setAddType] = useState({ name: '', value: '' });
+
const [pageNumber, setPageNumber] = useState(1)
//const [answertrueValues, setAnswertrueValues] = useState(); // 编辑试题答案项值
//const [options, setOptions] = useState([]); // 设置当前选项, 用于删除选项时判断
-
+
/** 表单项定义 */
const columns: ProColumns[] = [
{
@@ -176,8 +177,8 @@ const QuestionBank = () => {
renderText: (val: string) => `${val}`,
dependencies: ['tag_ids'],
request: async (params) => {
- const {tag_ids} = params;
- const { data: Items } = await queryCourseListByTag({tag_ids: tag_ids?.toString()});
+ const { tag_ids } = params;
+ const { data: Items } = await queryCourseListByTag({ tag_ids: tag_ids?.toString() });
console.log('queryCourseListByTag...')
const courses = []
for (let i = 0; i < Items?.length; i++) {
@@ -198,7 +199,7 @@ const QuestionBank = () => {
fieldProps: {
maxLength: 50
},
- formItemProps: {
+ formItemProps: {
rules: [
{
required: true,
@@ -235,42 +236,42 @@ const QuestionBank = () => {
hideInTable: false,
hideInForm: false,
hideInSearch: true,
- dependencies:['answers'],
+ 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('form::::::', form.getFieldValue('answertrue'))
console.log('rest', rest)
console.log('question_type:::', form.getFieldValue('question_type'))
// 获取选项长度
const len = form.getFieldValue('answers')?.length || 2;
const opts = []
- for(let i=0; i
- :
-
+ return ((addType?.value === 0 || addType?.value === 2) || (Number(form.getFieldValue('question_type')) === 0) || Number(form.getFieldValue('question_type')) === 2) ?
+
+ :
+
},
formItemProps: {
@@ -295,43 +296,52 @@ const QuestionBank = () => {
{
required: true,
message: '请填写试题解析',
- },
+ }, {
+ validator: (rule, value) => {
+ console.log("表单:", value, value.replace(/(^\s*)|(\s*$)/g, ""), "|")
+ if (value.replace(/(^\s*)|(\s*$)/g, "") === "") {
+ return Promise.reject('请填写试题解析')
+ } else {
+ return Promise.resolve()
+ }
+ }
+ }
]
},
- renderText: (val: string) => (),
- renderFormItem: (item, { defaultRender, ...rest }, form) => (
-
- ),
+ renderText: (val: string) => (),
+ // renderFormItem: (item, { defaultRender, ...rest }, form) => (
+ //
+ // ),
},
-
+
]
/** 获取题型 */
const { data } = useRequest(() => {
return queryQuestionType();
- },{
+ }, {
formatResult: (result) => {
return result.list;
}
});
-/*
- const { data: template } = useRequest(() => {
- return exportQuestionTemplate();
- });
- */
+ /*
+ const { data: template } = useRequest(() => {
+ return exportQuestionTemplate();
+ });
+ */
useEffect(() => {
setQuestionType(data || []);
- return ()=>{
+ return () => {
/** 退出当前页面清空Map */
parsingMap.clear();
}
@@ -340,7 +350,7 @@ const QuestionBank = () => {
return (
- style={{minWidth:1180}}
+ style={{ minWidth: 1180 }}
rowKey='id'
itemLayout="vertical"
actionRef={actionRef}
@@ -356,34 +366,34 @@ const QuestionBank = () => {
toolBarRender={() => {
const menuItems = [];
console.log('toolBarRender', questionType);
- if(questionType?.length > 0){
+ if (questionType?.length > 0) {
console.log('push');
- questionType.forEach((item: {code: number, name: string})=>{
+ questionType.forEach((item: { code: number, name: string }) => {
menuItems.push({item?.name})
})
}
- const menu = (
-
);
return [
,
-