diff --git a/admin/src/pages/course/option/index.tsx b/admin/src/pages/course/option/index.tsx
index 0db2bb8..4328530 100644
--- a/admin/src/pages/course/option/index.tsx
+++ b/admin/src/pages/course/option/index.tsx
@@ -181,10 +181,10 @@ const CourseList: React.FC = () => {
required: true,
message: '此项为必填项',
},
- {
+ /*{
max: 4,
message: '最大长度为4字符',
- }
+ }*/
],
}, // 传递给 Form.Item 的配置
},
@@ -559,11 +559,13 @@ const CourseList: React.FC = () => {
console.log('uploadFileName', uploadFileName)
//return false;
// values.attachment_json.response.file.response.url
+ //console.log('currentRow', currentRow)
await handleAdd({
...values,
+ //course_id: currentRow?.course_id,
attachment_json: `{"img":"", "name": "${values.attachment_json.file.name}", "url": "down/M3u8/${uuid?.substr(0, 2)}/${uuid}.m3u8"}`
});
- handleCreateModalVisible(false);
+ handleCreateModalVisible(false); // 隐藏创建窗口
actionRef.current?.reloadAndRest?.();
}}
submitter={{
@@ -586,8 +588,8 @@ const CourseList: React.FC = () => {
width="60%"
visible={updateModalVisible}
destroyOnClose
- onCancel={() => {
- handleUpdateModalVisible(false);
+ onCancel={() => {
+ handleUpdateModalVisible(false); // 隐藏编辑窗口
}}
footer={null}
>
@@ -598,6 +600,14 @@ const CourseList: React.FC = () => {
labelCol={{ span: 8 }}
wrapperCol={{ span: 12 }}
onFinish={async (values) => {
+ alert(0)
+ console.log('currentRow', currentRow)
+ await handleUpdate({
+ ...values,
+ course_id: currentRow?.course_id,
+ //attachment_json: `{"img":"", "name": "${values.attachment_json.file.name}", "url": "down/M3u8/${uuid?.substr(0, 2)}/${uuid}.m3u8"}`
+ });
+ handleUpdateModalVisible(false); // 隐藏编辑窗口
console.log(values);
}}
submitter={{
diff --git a/admin/src/pages/questionbank/components/AnswersEditor.tsx b/admin/src/pages/questionbank/components/AnswersEditor.tsx
new file mode 100644
index 0000000..62a5282
--- /dev/null
+++ b/admin/src/pages/questionbank/components/AnswersEditor.tsx
@@ -0,0 +1,114 @@
+/** 试题答案选项添加/编辑*/
+//import { AlignLeftOutlined, PlusOutlined } from '@ant-design/icons';
+import { Switch, Button, Card, Col, List, Menu, Progress, Row, Typography, Space, Divider, Radio, Checkbox, Tag, Dropdown, Upload, Modal, Form, Input } from 'antd';
+import { PageContainer } from '@ant-design/pro-layout';
+//import { useRequest } from 'umi';
+//import { queryFakeList } from './service';
+//import type { CardListItemDataType } from './data';
+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 { PlusOutlined, DeleteOutlined, DownloadOutlined, UploadOutlined, EditOutlined, EyeOutlined, EyeInvisibleOutlined, DownOutlined, MinusCircleOutlined } from '@ant-design/icons';
+import { useParams, useRequest, history, useRouteMatch } from 'umi';
+import { queryCourseView } from '@/pages/course/option/service';
+import { queryQuestionById, queryQuestionList, queryQuestionType } from '@/pages/questionbank/service';
+import ProForm, { ProFormSelect } from '@ant-design/pro-form';
+import ProTable, { ActionType, ProColumns } from '@ant-design/pro-table';
+
+
+
+//const { Paragraph } = Typography;
+const formItemLayout = {
+ labelCol: {
+ xs: { span: 24 },
+ sm: { span: 4 },
+ },
+ wrapperCol: {
+ xs: { span: 24 },
+ sm: { span: 20 },
+ },
+};
+const formItemLayoutWithOutLabel = {
+ wrapperCol: {
+ xs: { span: 24, offset: 0 },
+ sm: { span: 20, offset: 4 },
+ },
+};
+console.log('first');
+const AnswersSelector = () => {
+
+ return (
+
{
+ if (!names || names.length < 2) {
+ return Promise.reject(new Error('At least 2 passengers'));
+ }
+ },
+ },
+ ]}
+ >
+ {(fields, { add, remove }, { errors }) => (
+ <>
+ {fields.map((field, index) => (
+
+
+
+
+ {fields.length > 1 ? (
+ remove(field.name)}
+ />
+ ) : null}
+
+ ))}
+
+
+
+
+
+ >
+ )}
+
+
+ );
+};
+
+export default AnswersSelector;
diff --git a/admin/src/pages/questionbank/index.tsx b/admin/src/pages/questionbank/index.tsx
index 30ee1cb..9f049bb 100644
--- a/admin/src/pages/questionbank/index.tsx
+++ b/admin/src/pages/questionbank/index.tsx
@@ -1,6 +1,6 @@
/** 资质考试 */
//import { AlignLeftOutlined, PlusOutlined } from '@ant-design/icons';
-import { Switch, Button, Card, Col, List, Menu, Progress, Row, Typography, Space, Divider, Radio, Checkbox, Tag, Dropdown, Upload, Modal, Form } from 'antd';
+import { Switch, Button, Card, Col, List, Menu, Progress, Row, Typography, Space, Divider, Radio, Checkbox, Tag, Dropdown, Upload, Modal, Form, Input } from 'antd';
import { PageContainer } from '@ant-design/pro-layout';
//import { useRequest } from 'umi';
//import { queryFakeList } from './service';
@@ -10,7 +10,7 @@ import styles from './style.less';
//import ProCard from '@ant-design/pro-card';
import ProList from '@ant-design/pro-list';
import { ReactText, useEffect, useRef, useState } from 'react';
-import { PlusOutlined, DeleteOutlined, DownloadOutlined, UploadOutlined, EditOutlined, EyeOutlined, EyeInvisibleOutlined, DownOutlined } from '@ant-design/icons';
+import { PlusOutlined, DeleteOutlined, DownloadOutlined, UploadOutlined, EditOutlined, EyeOutlined, EyeInvisibleOutlined, DownOutlined, UserOutlined } from '@ant-design/icons';
import { exportQuestionTemplate, queryQuestionById, queryQuestionList, queryQuestionType } from './service';
import { useParams, useRequest, history, useRouteMatch } from 'umi';
import { queryCourseListByTag, queryCourseView, queryTagList } from '@/pages/course/option/service';
@@ -19,8 +19,10 @@ import { DataItem } from '../dashboard/analysis/data';
import { ActionType, ProColumns } from '@ant-design/pro-table';
import ProFormRichEdit from '../course/subject/components/ProFormRichEdit';
import { TableListItem } from '../course/option/data';
+import AnswersSelector from './components/AnswersEditor';
//const { Paragraph } = Typography;
+const labels = ['A','B','C','D','E','F','G','H','I','J','K'];
const parsingMap = new Map()
console.log('first');
const QuestionBank = () => {
@@ -114,32 +116,7 @@ const QuestionBank = () => {
hideInForm: false,
hideInSearch: true,
renderFormItem: (item, { defaultRender, ...rest }, form) => (
- {
- return {doms};
- }}
- >
- {(f, index, action) => {
- console.log(f, index, action);
- return (
-
- )
- }}
-
+
)
/*
formItemProps: {
@@ -161,7 +138,7 @@ const QuestionBank = () => {
hideInSearch: true,
renderFormItem: (item, { defaultRender, ...rest }, form) => (
{
const [expandedDescRowKeys, setExpandedDescRowKeys] = useState([]); // 展开解析设置
const [addType, setAddType] = useState({name: '', value: 0});
- const labels = ['A','B','C','D','E']
+
/** 获取题型 */
const { data } = useRequest(() => {
diff --git a/admin/src/pages/questionbank/style.less b/admin/src/pages/questionbank/style.less
index a59b424..9c2feb3 100644
--- a/admin/src/pages/questionbank/style.less
+++ b/admin/src/pages/questionbank/style.less
@@ -19,5 +19,25 @@
display: inline-block;
width: 100%;
}
+ .ant-input-group-addon{
+ min-width: 40px;
+ }
+
+ .dynamic-delete-button {
+ position: relative;
+ top: 4px;
+ margin: 0 8px;
+ color: #999;
+ font-size: 24px;
+ cursor: pointer;
+ transition: all 0.3s;
+ }
+ .dynamic-delete-button:hover {
+ color: #777;
+ }
+ .dynamic-delete-button[disabled] {
+ cursor: not-allowed;
+ opacity: 0.5;
+ }
}
}
diff --git a/web/config/config.ts b/web/config/config.ts
index e4d4849..1b57cae 100644
--- a/web/config/config.ts
+++ b/web/config/config.ts
@@ -5,6 +5,9 @@ import defaultSettings from './defaultSettings';
import proxy from './proxy';
const { REACT_APP_ENV } = process.env;
export default defineConfig({
+ history: {
+ type: 'hash'
+ },
hash: true,
antd: {},
dva: {