Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xiaomai-cloud-class-web
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiaomai-cloud-class
xiaomai-cloud-class-web
Commits
9c2c5504
Commit
9c2c5504
authored
Jul 13, 2021
by
yuananting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:周优化504提示,考试名称引用试卷名称
parent
806f97d6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
81 additions
and
54 deletions
+81
-54
src/common/js/axios.ts
+6
-2
src/modules/teach-tool/components/CourseCategorySiderTree.jsx
+3
-3
src/modules/teach-tool/examination-manager/AddExam.tsx
+46
-2
src/modules/teach-tool/paper-manage/OperatePaper.jsx
+21
-36
src/modules/teach-tool/question-manage/OperateQuestion.jsx
+5
-11
No files found.
src/common/js/axios.ts
View file @
9c2c5504
/*
* @Author: 吴文洁
* @Date: 2020-08-31 09:34:31
* @LastEditors:
Please set LastEditors
* @LastEditTime: 2021-0
6-24 19:34:21
* @LastEditors:
yuananting
* @LastEditTime: 2021-0
7-12 17:40:26
* @Description:
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -115,6 +115,10 @@ class Axios {
window
.
RCHistory
.
replace
(
'/login'
);
return
Promise
.
reject
();
break
;
case
504
:
message
.
error
(
'网络状况不稳定,如果出现数据异常,请刷新页面'
);
Promise
.
reject
();
break
;
default
:
message
.
error
(
error
.
message
);
break
;
...
...
src/modules/teach-tool/components/CourseCategorySiderTree.jsx
View file @
9c2c5504
/*
* @Author: yuananting
* @Date: 2021-02-22 10:59:43
* @LastEditors:
fusanqias
ng
* @LastEditTime: 2021-0
6-15 11:20:48
* @LastEditors:
yuananti
ng
* @LastEditTime: 2021-0
7-13 11:54:21
* @Description: 助学工具-侧边课程分类树
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -20,7 +20,7 @@ class CourseCategorySiderTree extends Component {
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
selectedKeys
:
[
'
QUESTION_INDEX'
,
'PAPER_INDEX'
].
includes
(
props
.
fromModule
)
?
[
getParameterByName
(
'categoryId'
)
||
'null'
]
:
[
'
null'
],
selectedKeys
:
[
'null'
],
treeData
:
props
.
treeData
||
[],
autoExpandParent
:
false
,
};
...
...
src/modules/teach-tool/examination-manager/AddExam.tsx
View file @
9c2c5504
...
...
@@ -36,12 +36,14 @@ function AddExam(props: any) {
const
[
getData
,
setGetData
]
=
useState
(
false
);
const
[
preview
,
setPreview
]
=
useState
(
false
);
const
[
examTotal
,
setExamTotal
]
=
useState
(
0
);
const
[
examList
,
setExamList
]
=
useState
([]);
const
request
=
useRef
(
false
);
const
{
match
}
=
props
;
const
[
examDuration
,
setExamDuration
]
=
useState
(
undefined
);
useEffect
(()
=>
{
queryExamList
();
switch
(
props
.
type
)
{
case
"copy"
:
// 考试列表-复制考试进入
case
"edit"
:
// 考试列表-编辑考试进入
...
...
@@ -52,6 +54,7 @@ function AddExam(props: any) {
case
"editPaperToAddExam"
:
// 组卷页面-编辑保存试卷并组织考试
setGetData
(
true
);
setPaperInfo
(
props
.
paperInfo
);
setExamName
(
props
.
paperInfo
?.
paperName
)
break
;
}
},
[])
...
...
@@ -72,6 +75,22 @@ function AddExam(props: any) {
return
current
&&
current
<
moment
().
startOf
(
'day'
);
}
function
queryExamList
()
{
let
param
=
{
current
:
1
,
size
:
9999
,
order
:
'EXAM_START_TIME_DESC'
,
userId
:
User
.
getStoreUserId
(),
tenantId
:
User
.
getStoreId
(),
source
:
0
,
}
Service
.
Hades
(
'public/hades/queryExamPageList'
,
param
).
then
(
res
=>
{
console
.
log
(
res
)
const
{
result
=
{}
}
=
res
;
setExamList
(
result
.
records
)
})
}
function
queryExamDetail
()
{
Service
.
Hades
(
"public/hades/queryExamDetail"
,
{
examId
:
match
.
params
.
id
,
...
...
@@ -137,6 +156,11 @@ function AddExam(props: any) {
return
}
if
(
checkExist
(
param
.
examName
))
{
message
.
warning
(
'此考试名称已存在'
);
return
}
if
(
!
paperId
)
{
message
.
warning
(
'请选择试卷'
);
return
...
...
@@ -250,6 +274,26 @@ function AddExam(props: any) {
})
}
// 校验考试名称是否存在
function
checkExist
(
examName
:
any
)
{
var
result
:
any
=
null
;
examList
.
forEach
((
item
:
any
)
=>
{
if
(
result
!=
null
)
{
return
result
;
}
if
(
props
.
type
===
'edit'
)
{
if
(
item
.
examName
===
examName
&&
item
.
examId
!==
match
.
params
.
id
)
{
result
=
item
;
}
}
else
{
if
(
item
.
examName
===
examName
)
{
result
=
item
;
}
}
});
return
result
;
};
let
title
=
''
;
switch
(
props
.
type
)
{
case
'add'
:
...
...
@@ -281,8 +325,8 @@ function AddExam(props: any) {
layout=
"horizontal"
>
<
Form
.
Item
label=
"考试名称"
validateStatus=
{
(
check
&&
(
!
examName
?
'请输入考试名称'
:
(
examName
.
length
>
40
)
&&
'考试名称最多40字'
))
?
'error'
:
''
}
help=
{
check
&&
(
!
examName
?
'请输入考试名称'
:
(
examName
.
length
>
40
)
&&
'考试名称最多40字'
)
}
validateStatus=
{
(
check
&&
(
!
examName
||
(
examName
.
length
>
40
||
checkExist
(
examName
))
))
?
'error'
:
''
}
help=
{
check
&&
(
!
examName
?
'请输入考试名称'
:
(
examName
.
length
>
40
?
'考试名称最多40字'
:
(
checkExist
(
examName
)
&&
'此考试名称已存在'
))
)
}
required
>
<
Input
placeholder=
'请输入考试名称(40字以内)'
maxLength=
{
40
}
value=
{
examName
}
onChange=
{
(
e
)
=>
{
...
...
src/modules/teach-tool/paper-manage/OperatePaper.jsx
View file @
9c2c5504
/*
* @Author: yuananting
* @Date: 2021-03-27 16:15:13
* @LastEditors:
fusanqias
ng
* @LastEditTime: 2021-07-
01 16:30:38
* @LastEditors:
yuananti
ng
* @LastEditTime: 2021-07-
13 12:01:37
* @Description: 助学工具-新建/复制/编辑试卷
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -118,7 +118,7 @@ class OperatePaper extends Component {
portionScore
:
0
,
totalQuestion
:
0
,
},
]
]
,
};
}
...
...
@@ -352,20 +352,6 @@ class OperatePaper extends Component {
return
result
;
};
validatePaperName
=
(
paperName
)
=>
{
if
(
this
.
state
.
check
&&
!
paperName
)
{
return
'请输入试卷名称'
;
}
if
(
this
.
checkExist
(
paperName
))
{
return
'该试卷名称已存在'
;
}
if
(
paperName
&&
paperName
.
length
>
40
)
{
return
'试卷名称最多40字'
;
}
};
// 保存试卷
savePaper
=
(
saveType
)
=>
{
this
.
setState
({
check
:
true
});
...
...
@@ -373,8 +359,17 @@ class OperatePaper extends Component {
const
categoryId
=
getParameterByName
(
'categoryId'
);
const
{
match
}
=
this
.
props
;
let
questionList
=
[];
if
(
!
formData
.
passRate
||
!
formData
.
paperName
||
this
.
checkExist
(
formData
.
paperName
)
||
(
formData
.
paperName
&&
formData
.
paperName
.
length
>
40
))
{
return
;
if
(
!
formData
.
paperName
)
{
return
message
.
warning
(
'请输入试卷名称'
)
}
if
(
formData
.
paperName
.
length
>
40
)
{
return
message
.
warning
(
'试卷名称最多40字'
)
}
if
(
this
.
checkExist
(
formData
.
paperName
))
{
return
message
.
warning
(
'该试卷名称已存在'
)
}
if
(
!
formData
.
passRate
)
{
return
message
.
warning
(
'请输入及格线'
)
}
if
(
selectQuestionList
.
length
===
0
)
{
return
message
.
warning
(
'请选择题目'
);
...
...
@@ -410,18 +405,14 @@ class OperatePaper extends Component {
});
}
else
{
message
.
success
(
currentOperate
===
'new'
?
'新建成功'
:
'复制成功'
);
window
.
RCHistory
.
push
({
pathname
:
`/paper-manage-index?categoryId=
${
categoryId
}
`
,
});
window
.
RCHistory
.
goBack
();
Bus
.
trigger
(
'queryPaperPageList'
,
categoryId
,
selectQuestionList
.
length
);
Bus
.
trigger
(
'queryCategoryTree'
,
'remain'
);
}
}
})
.
catch
((
e
)
=>
{
window
.
RCHistory
.
push
({
pathname
:
`/paper-manage-index?categoryId=
${
categoryId
}
`
,
});
window
.
RCHistory
.
goBack
();
Bus
.
trigger
(
'queryPaperPageList'
,
categoryId
,
selectQuestionList
.
length
);
Bus
.
trigger
(
'queryCategoryTree'
,
'remain'
);
});
...
...
@@ -438,17 +429,13 @@ class OperatePaper extends Component {
});
}
else
{
message
.
success
(
'编辑成功'
);
window
.
RCHistory
.
push
({
pathname
:
`/paper-manage-index?categoryId=
${
categoryId
}
`
,
});
window
.
RCHistory
.
goBack
();
Bus
.
trigger
(
'queryPaperPageList'
,
categoryId
,
selectQuestionList
.
length
);
}
}
})
.
catch
((
e
)
=>
{
window
.
RCHistory
.
push
({
pathname
:
`/paper-manage-index?categoryId=
${
categoryId
}
`
,
});
window
.
RCHistory
.
goBack
();
Bus
.
trigger
(
'queryPaperPageList'
,
categoryId
,
selectQuestionList
.
length
);
});
}
...
...
@@ -482,9 +469,7 @@ class OperatePaper extends Component {
cancelText
:
'留在本页'
,
icon
:
<
span
className=
'icon iconfont default-confirm-icon'
>

</
span
>,
onOk
:
()
=>
{
window
.
RCHistory
.
push
({
pathname
:
`/paper-manage-index?categoryId=
${
getParameterByName
(
'categoryId'
)}
`
,
});
window
.
RCHistory
.
goBack
()
Bus
.
trigger
(
'queryCategoryTree'
,
'remain'
);
Bus
.
trigger
(
'queryPaperPageList'
,
getParameterByName
(
'categoryId'
),
0
);
},
...
...
@@ -822,8 +807,8 @@ class OperatePaper extends Component {
name=
'paperName'
label=
'试卷名称:'
required
validateStatus=
{
this
.
validatePaperName
(
paperName
)
?
'error'
:
''
}
help=
{
this
.
validatePaperName
(
paperName
)
}
>
validateStatus=
{
(
check
&&
(
!
paperName
||
paperName
.
length
>
40
||
this
.
checkExist
(
paperName
))
)
?
'error'
:
''
}
help=
{
check
&&
(
!
paperName
?
'请输入试卷名称'
:
(
paperName
.
length
>
40
?
'试卷名称最多40字'
:
(
this
.
checkExist
(
paperName
)
&&
'该试卷名称已存在'
))
)
}
>
<
Input
value=
{
paperName
}
autoComplete=
'off'
...
...
src/modules/teach-tool/question-manage/OperateQuestion.jsx
View file @
9c2c5504
/*
* @Author: yuananting
* @Date: 2021-02-25 13:46:35
* @LastEditors:
wufan
* @LastEditTime: 2021-0
5-24 11:32:47
* @LastEditors:
yuananting
* @LastEditTime: 2021-0
7-13 11:51:56
* @Description: 助学工具-题库-新建/编辑题目
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -161,9 +161,7 @@ class OperateQuestion extends Component {
<
span
className=
"icon iconfont default-confirm-icon"
>

</
span
>
),
onOk
:
()
=>
{
window
.
RCHistory
.
push
({
pathname
:
`/question-manage-index?categoryId=
${
getParameterByName
(
"categoryId"
)}
`
,
});
window
.
RCHistory
.
goBack
();
Bus
.
trigger
(
"queryCategoryTree"
,
"remain"
);
Bus
.
trigger
(
"queryQuestionPageList"
,
getParameterByName
(
"categoryId"
));
},
...
...
@@ -248,9 +246,7 @@ class OperateQuestion extends Component {
this
.
handleRest
(
type
);
}
if
(
next
===
"close"
)
{
window
.
RCHistory
.
push
({
pathname
:
`/question-manage-index?categoryId=
${
categoryId
}
`
,
});
window
.
RCHistory
.
goBack
();
Bus
.
trigger
(
"queryCategoryTree"
,
"remain"
)
Bus
.
trigger
(
"queryQuestionPageList"
,
categoryId
)
}
...
...
@@ -271,9 +267,7 @@ class OperateQuestion extends Component {
this
.
handleRest
(
type
);
}
if
(
next
===
"close"
)
{
window
.
RCHistory
.
push
({
pathname
:
`/question-manage-index?categoryId=
${
categoryId
}
`
,
});
window
.
RCHistory
.
goBack
();
Bus
.
trigger
(
"queryCategoryTree"
,
"remain"
)
Bus
.
trigger
(
"queryQuestionPageList"
,
categoryId
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment