diff --git a/admin/package.json b/admin/package.json
index 4150cdf..fc2241e 100644
--- a/admin/package.json
+++ b/admin/package.json
@@ -73,6 +73,7 @@
"gg-editor": "^2.0.2",
"lodash": "^4.17.11",
"lodash-decorators": "^6.0.0",
+ "mediainfo.js": "^0.1.7",
"moment": "^2.25.3",
"numeral": "^2.0.6",
"nzh": "^1.0.3",
@@ -83,6 +84,7 @@
"react-dom": "^17.0.0",
"react-fittext": "^1.0.0",
"react-helmet-async": "^1.0.4",
+ "react-mediainfo": "^0.0.42",
"react-quill": "^1.3.5",
"react-router": "^4.3.1",
"umi": "^3.5.20",
diff --git a/admin/src/app.tsx b/admin/src/app.tsx
index 6122197..625529f 100644
--- a/admin/src/app.tsx
+++ b/admin/src/app.tsx
@@ -11,6 +11,25 @@ import { ResponseError } from 'umi-request';
import { notification } from 'antd';
import cookie from 'react-cookies';
+const codeMessage = {
+ 200: '服务器成功返回请求的数据。',
+ 201: '新建或修改数据成功。',
+ 202: '一个请求已经进入后台排队(异步任务)。',
+ 204: '删除数据成功。',
+ 400: '发出的请求有错误,服务器没有进行新建或修改数据的操作。',
+ 401: '用户没有权限(令牌、用户名、密码错误)。',
+ 403: '用户得到授权,但是访问是被禁止的。',
+ 404: '发出的请求针对的是不存在的记录,服务器没有进行操作。',
+ 405: '请求方法不被允许。',
+ 406: '请求的格式不可得。',
+ 410: '请求的资源被永久删除,且不会再得到的。',
+ 422: '当创建一个对象时,发生一个验证错误。',
+ 500: '服务器发生错误,请检查服务器。',
+ 502: '网关错误。',
+ 503: '服务不可用,服务器暂时过载或维护。',
+ 504: '网关超时。',
+};
+
const isDev = process.env.NODE_ENV === 'development';
const loginPath = '/user/login';
@@ -87,6 +106,32 @@ export const layout: RunTimeLayoutConfig = ({ initialState }) => {
};
};
+/** 全局请求 */
+/*
+const requestInterceptor = (url: string, options: any) => {
+ return {
+ url: 'http://localhost:3009' + url, // 此处可以添加域名前缀
+ options: {
+ ...options,
+ headers: {
+ authorization: 'Bearer',
+ },
+ },
+ };
+};*/
+
+/** 全局响应拦截 */
+const responseInterceptor = async (response: any, options: any) => {
+ const data = await response.clone().json();
+ if (data && data?.status === '0') {
+ //location.href = location.pathname + '#/user/login'; // /#/user/login
+ history.push('/user/login')
+ }
+ console.log('返回了', response);
+ console.log('options', options);
+ return response;
+};
+
/** request 用于配置全局的网络请求,你可以在这里做拦截器,全局错误处理,鉴权的配置。*/
export const request: RequestConfig = {
errorHandler: (error: ResponseError) => {
@@ -99,6 +144,6 @@ export const request: RequestConfig = {
throw error;
},
//middlewares?: OnionMiddleware[],
- //requestInterceptors?: RequestInterceptor[], // 新增自动添加AccessToken的请求前拦截器
- //responseInterceptors?: ResponseInterceptor[],
+ //requestInterceptors: [requestInterceptor], // 请求前拦截器
+ responseInterceptors: [responseInterceptor], // 响应拦截器
};
\ No newline at end of file
diff --git a/admin/src/pages/demo/index.tsx b/admin/src/pages/demo/index.tsx
index 4b03e7a..94c8bc3 100644
--- a/admin/src/pages/demo/index.tsx
+++ b/admin/src/pages/demo/index.tsx
@@ -2,6 +2,7 @@ import { DingdingOutlined, UploadOutlined } from '@ant-design/icons';
import { Button, Card, Steps, Result, Descriptions, Modal, Input, Upload, Popconfirm, Menu, Radio } from 'antd';
import { Fragment, useEffect, useRef, useState } from 'react';
import { GridContent } from '@ant-design/pro-layout';
+import { getInfo } from 'react-mediainfo';
import { Line } from '@ant-design/charts';
import { DualAxes } from "@ant-design/charts";
import styles from './index.less';
@@ -57,12 +58,12 @@ const formatSeconds= (value)=>{
// if (day > 0) {
// result = '' + parseInt(day) + '天' + result
// }
- console.log('result:', result)
+ //console.log('result:', result)
return result
}
export default () => {
const uuid = uuidv4()
- console.log('uuid', uuidv4());
+ //console.log('uuid', uuidv4());
const data = [
{
year: "1991",
@@ -194,10 +195,11 @@ export default () => {
return queryCourseList();
});
useEffect(() => {
- console.log('listData', listData)
+ //console.log('listData', listData)
+ /*
setInterval(() => {
setChartData(Math.random() > 0.5 ? [data, data] : [data2, data2]);
- }, 1000);
+ }, 1000);*/
@@ -205,7 +207,7 @@ export default () => {
const menuItems = [];
if(listData?.length > 0){
- console.log('push');
+ //console.log('push');
listData.list.forEach((item: {code: number, name: string})=>{
menuItems.push(
{item?.course_name})
})
@@ -234,7 +236,7 @@ export default () => {
{
saveInputRef.current.focus({})
- console.log('ref', saveInputRef.current)
+ //console.log('ref', saveInputRef.current)
}}>焦点
{handleModalVisible(true)}}>课程
uuid: {uuidv4()}
@@ -256,6 +258,18 @@ export default () => {
{
+ const {media: {track:[General, Video, Audio]}} = await getInfo(file)
+ console.log('General:', General)
+ console.log('Video:', Video)
+ console.log('Video:', Video.format) // AVC
+ console.log('Audio:', Audio.format) // AAC
+ /*
+ console.log('info:', media)
+ console.log('track[0]:', media.track[0])
+ console.log('track[1]:', media.track[1])
+ console.log('track[2]:', media.track[2])*/
+ }}
data={
{
name: '4.jpg',
@@ -305,10 +319,9 @@ export default () => {
Delete
-
+ {/*
-
-
+*/}
{
}}>
A
diff --git a/admin/src/pages/examinationrules/attestation/index.tsx b/admin/src/pages/examinationrules/attestation/index.tsx
index cac562b..43bd05e 100644
--- a/admin/src/pages/examinationrules/attestation/index.tsx
+++ b/admin/src/pages/examinationrules/attestation/index.tsx
@@ -119,6 +119,7 @@ const ExaminationRules: React.FC = () => {
},
{
title: '考试时长',
+ width: 80,
dataIndex: 'examination_time',
valueType: 'text',
sorter: false,
@@ -171,6 +172,7 @@ const ExaminationRules: React.FC = () => {
},
{
title: '试卷数量',
+ width: 80,
dataIndex: 'paper_count',
sorter: false,
valueType: 'text',
@@ -181,6 +183,7 @@ const ExaminationRules: React.FC = () => {
},
{
title: '总分',
+ width: 50,
dataIndex: 'sum_score',
sorter: false,
valueType: 'text',
@@ -190,6 +193,7 @@ const ExaminationRules: React.FC = () => {
},
{
title: '通过线',
+ width: 60,
dataIndex: 'pass_score',
sorter: false,
valueType: 'text',
@@ -201,6 +205,7 @@ const ExaminationRules: React.FC = () => {
title: '操作',
dataIndex: 'option',
valueType: 'option',
+ width: 100,
render: (_dom: any, record: React.SetStateAction) => {
console.log(record, 'record')
return [
diff --git a/admin/src/pages/examinationrules/components/QuestionPaper.tsx b/admin/src/pages/examinationrules/components/QuestionPaper.tsx
index 23a6be9..5bebbfe 100644
--- a/admin/src/pages/examinationrules/components/QuestionPaper.tsx
+++ b/admin/src/pages/examinationrules/components/QuestionPaper.tsx
@@ -345,7 +345,7 @@ const QuestionPaper = (props: any, ref: any) => {
正确答案:
{answer}
- 解析:
+ 【解析】:
);
}else{
diff --git a/admin/src/pages/examinationrules/normal/index.tsx b/admin/src/pages/examinationrules/normal/index.tsx
index b1237af..867a9ef 100644
--- a/admin/src/pages/examinationrules/normal/index.tsx
+++ b/admin/src/pages/examinationrules/normal/index.tsx
@@ -167,6 +167,7 @@ const ExaminationRules: React.FC = () => {
title: '操作',
dataIndex: 'option',
valueType: 'option',
+ width: 160,
render: (_dom: any, record: React.SetStateAction) => {
return [
// {
}}
formProps={{
layout: "horizontal",
- labelCol: { span: 8 },
+ labelCol: { span: 7 },
wrapperCol: { span: 12 },
validateMessages: {
required: '此项为必填项',
@@ -266,7 +258,7 @@ export default () => {
{
/>
{
return querySubjectList().then(({ data }) => {
@@ -306,8 +298,23 @@ export default () => {
name="subject_id"
label="关联主题"
/>
- {
+ const val = `${e.currentTarget?.value}`;
+ if(val.length > 3) {
+ e.currentTarget.value = val.slice(0,3)
+ }
+ }
+ //style:{width: '100%'}
+ }}
initialValue={ruleData?.examination_time}
rules={[
{
@@ -318,7 +325,7 @@ export default () => {
pattern: /^[^\s]*$/,
message: '禁止输入空格'
}]}
- tooltip="单位(分钟)" />
+ />
>
)}
@@ -344,6 +351,7 @@ export default () => {
}}
>
+
{rulesName}
{/** 一旦录入另一项将禁用,清空组卷后可选另一项 */}
{
@@ -358,7 +366,7 @@ export default () => {
-
+
{
sorter: false,
hideInTable: true,
hideInForm: false,
- hideInSearch: false,
+ hideInSearch: true,
fieldProps: {
mode: "multiple"
},
@@ -136,7 +136,11 @@ const QuestionBank = () => {
},
]
},
- renderText: (val: string) => `${val}`,
+ /*
+ renderFormItem:(item,{ type, defaultRender, formItemProps, fieldProps, ...rest },form)=>{
+ return defaultRender
+ },*/
+ //renderText: (val: string) => `${val}`,
request: async () => {
const { data: Items } = await queryTagList({});
console.log('queryTagList...')
@@ -155,7 +159,7 @@ const QuestionBank = () => {
sorter: false,
hideInTable: false,
hideInForm: false,
- hideInSearch: false,
+ hideInSearch: true,
fieldProps: {
//mode: "multiple"
},
@@ -188,7 +192,7 @@ const QuestionBank = () => {
hideInTable: false,
hideInDescriptions: false,
hideInForm: false,
- hideInSearch: false,
+ hideInSearch: true,
formItemProps: {
rules: [
{
@@ -302,19 +306,7 @@ const QuestionBank = () => {
/>
),
},
- {
- title: '创建时间',
- dataIndex: 'create_time',
- valueType: 'text',
- sorter: false,
- hideInTable: true,
- hideInForm: true,
- hideInSearch: false,
- // renderText: (val: string) => (),
- renderFormItem: (item, { defaultRender, ...rest }, form) => (
-<>>
- ),
- },
+
]
@@ -351,7 +343,9 @@ const QuestionBank = () => {
showSizeChanger: false,
showQuickJumper: true
}}
- search={{}}
+ search={{
+ labelWidth: 120,
+ }}
toolBarRender={() => {
const menuItems = [];
console.log('toolBarRender', questionType);
@@ -487,10 +481,14 @@ const QuestionBank = () => {
showExtra="always"
metas={{
title: {
+ title: '题干',
+ search: false,
dataIndex: 'question_stem',
render: (text: React.ReactNode, record: T, index: number) => (<>{record?.id} {text}>),
},
avatar: {
+ title: '题型',
+ search: false,
dataIndex: 'question_type',
valueType: 'text',
render: (text: React.ReactNode, record: T, index: number) => {
@@ -506,6 +504,7 @@ const QuestionBank = () => {
},
},
description: {
+ search: false,
dataIndex: 'answers',
valueType: 'checkbox',
render: (text: React.ReactNode, record: T, index: number) => {
@@ -528,8 +527,11 @@ const QuestionBank = () => {
);
},
},
- subTitle: { },
+ subTitle: {
+ search: false
+ },
content: {
+ search: false,
render: (text: React.ReactNode, record: T, index: number) => {
let answer = '';
const answertrue = record?.answertrue?.split(',');
@@ -567,6 +569,7 @@ const QuestionBank = () => {
},
},
actions: {
+ search: false,
cardActionProps: 'extra',
render: (text: React.ReactNode, record: T, _index: number) => {
let eye
@@ -638,6 +641,75 @@ const QuestionBank = () => {
)
}
},
+ /** 搜索定义 */
+ question_type:{
+ title: '题型',
+ valueType: 'select',
+ search: true,
+ dataIndex: 'question_type',
+ request: async () => {
+ const { list: Items } = await queryQuestionType();
+ console.log('queryQuestionType...', Items)
+ const types = []
+ for (let i = 0; i < Items.length; i++) {
+ types.push({ label: Items[i]?.name, value: Items[i]?.code })
+ }
+ console.log(types, 'types:::');
+ return types;
+ },
+ },
+ tags: {
+ title: '标签',
+ search: true,
+ valueType: 'select',
+ dataIndex: 'tag_ids',
+ fieldProps: {
+ mode: "multiple"
+ },
+ request: async () => {
+ const { data: Items } = await queryTagList({});
+ console.log('queryTagList...')
+ const tags = []
+ for (let i = 0; i < Items.length; i++) {
+ tags.push({ label: Items[i]?.tag_name, value: Items[i]?.tag_id })
+ }
+ console.log(tags, 'tags:::');
+ return tags;
+ },
+ },
+ course_id: {
+ title: '课程',
+ search: true,
+ valueType: 'select',
+ dataIndex: 'course_id',
+ fieldProps: {
+ //mode: "multiple"
+ },
+ dependencies: ['tag_ids'],
+ request: async (params) => {
+ 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++) {
+ courses.push({ label: Items[i]?.course_name, value: Items[i]?.course_id })
+ }
+ console.log(courses, 'courses:::');
+ return courses;
+ }
+ },
+ question_stem: {
+ title: '搜索', // 题干
+ search: true,
+ dataIndex: 'question_stem',
+ valueType: 'text',
+ },
+ create_time: {
+ title: '创建时间',
+ search: true,
+ dataIndex: 'create_time',
+ valueType: 'dateRange',
+ },
}}
/>