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
5d4609a0
Commit
5d4609a0
authored
Mar 18, 2021
by
yuananting
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/yuananting/20210221/question-bank-tools' into dev
parents
8fe8995a
8b5aea7c
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
142 additions
and
109 deletions
+142
-109
src/modules/teach-tool/AddNewQuestion.jsx
+33
-25
src/modules/teach-tool/QuestionCategoryManage.less
+6
-5
src/modules/teach-tool/components/NewQuestionTab.jsx
+70
-59
src/modules/teach-tool/components/QuestionBankSider.less
+6
-1
src/modules/teach-tool/components/QuestionEditor.jsx
+12
-5
src/modules/teach-tool/components/QuestionManageContent.jsx
+2
-2
src/modules/teach-tool/modal/BatchImportQuestionModal.jsx
+6
-4
src/modules/teach-tool/modal/BatchImportQuestionModal.less
+0
-1
src/modules/teach-tool/modal/QuestionPreviewModal.jsx
+7
-7
No files found.
src/modules/teach-tool/AddNewQuestion.jsx
View file @
5d4609a0
...
...
@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-02-25 13:46:35
* @LastEditors: yuananting
* @LastEditTime: 2021-03-18 1
1:15:19
* @LastEditTime: 2021-03-18 1
4:12:22
* @Description: 助学工具-题库-题目管理-新增题目
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -12,7 +12,7 @@ import Breadcrumbs from "@/components/Breadcrumbs";
import
ShowTips
from
"@/components/ShowTips"
;
import
"./AddNewQuestion.less"
;
import
NewQuestionTab
from
"./components/NewQuestionTab"
;
import
{
defineOptionInfo
,
defineQuestionInfo
}
from
"./components/model"
;
import
{
define
JudgeOptionInfo
,
define
OptionInfo
,
defineQuestionInfo
}
from
"./components/model"
;
import
QuestionBankService
from
"@/domains/question-bank-domain/QuestionBankService"
;
import
User
from
"@/common/js/user"
;
import
UploadOss
from
"@/core/upload"
;
...
...
@@ -37,12 +37,14 @@ class AddNewQuestion extends Component {
judgeContent
:
defineQuestionInfo
(
"JUDGE"
),
// 判断题
gapFillingContent
:
defineQuestionInfo
(
"GAP_FILLING"
),
// 填空题
indefiniteChoiceContent
:
defineQuestionInfo
(
"INDEFINITE_CHOICE"
),
// 不定项选择题
currentOperate
:
"new"
,
};
}
componentDidMount
()
{
if
(
getParameterByName
(
"id"
))
{
// 编辑
this
.
setState
({
currentOperate
:
"edit"
});
this
.
queryQuestionDetails
();
}
}
...
...
@@ -78,19 +80,29 @@ class AddNewQuestion extends Component {
};
handleRest
=
(
type
)
=>
{
this
.
setState
({
currentOperate
:
"add"
});
switch
(
type
)
{
case
"SINGLE_CHOICE"
:
this
.
setState
({
singleChoiceContent
:
defineQuestionInfo
(
"SINGLE_CHOICE"
),
},
()
=>
this
.
state
.
singleChoiceContent
.
optionList
.
push
(
defineOptionInfo
()));
let
singleChoiceContent
=
defineQuestionInfo
(
"SINGLE_CHOICE"
);
for
(
var
i
=
0
;
i
<
4
;
i
++
)
{
singleChoiceContent
.
optionList
.
push
(
defineOptionInfo
());
}
this
.
setState
({
singleChoiceContent
});
break
;
case
"MULTI_CHOICE"
:
this
.
setState
({
multiChoiceContent
:
defineQuestionInfo
(
"MULTI_CHOICE"
),
},
()
=>
this
.
state
.
multiChoiceContent
.
optionList
.
push
(
defineOptionInfo
()));
let
multiChoiceContent
=
defineQuestionInfo
(
"MULTI_CHOICE"
);
for
(
var
i
=
0
;
i
<
4
;
i
++
)
{
multiChoiceContent
.
optionList
.
push
(
defineOptionInfo
());
}
this
.
setState
({
multiChoiceContent
});
break
;
case
"JUDGE"
:
this
.
setState
({
judgeContent
:
defineQuestionInfo
(
"JUDGE"
)
});
let
judgeContent
=
defineQuestionInfo
(
"JUDGE"
);
var
judgeOptions
=
[
"正确"
,
"错误"
];
judgeOptions
.
forEach
(
item
=>
{
judgeContent
.
optionList
.
push
(
defineJudgeOptionInfo
(
item
));
})
this
.
setState
({
judgeContent
});
break
;
case
"GAP_FILLING"
:
this
.
setState
({
...
...
@@ -98,10 +110,11 @@ class AddNewQuestion extends Component {
});
break
;
case
"INDEFINITE_CHOICE"
:
this
.
setState
({
indefiniteChoiceContent
:
defineQuestionInfo
(
"INDEFINITE_CHOICE"
),
},
()
=>
this
.
state
.
indefiniteChoiceContent
.
optionList
.
push
(
defineOptionInfo
()));
break
;
let
indefiniteChoiceContent
=
defineQuestionInfo
(
"INDEFINITE_CHOICE"
);
for
(
var
i
=
0
;
i
<
4
;
i
++
)
{
indefiniteChoiceContent
.
optionList
.
push
(
defineOptionInfo
());
}
this
.
setState
({
indefiniteChoiceContent
});
}
};
...
...
@@ -127,8 +140,7 @@ class AddNewQuestion extends Component {
});
let
params
=
{};
let
categoryId
=
getParameterByName
(
"categoryId"
);
if
(
getParameterByName
(
"id"
))
{
if
(
getParameterByName
(
"id"
)
&&
this
.
state
.
currentOperate
===
"edit"
)
{
params
=
{
...
content
,
id
:
getParameterByName
(
"id"
),
...
...
@@ -142,10 +154,10 @@ class AddNewQuestion extends Component {
if
(
res
.
success
)
{
message
.
success
(
"保存成功"
);
if
(
next
===
"add"
)
{
//
this.handleRest(type);
window
.
RCHistory
.
push
({
pathname
:
`/create-new-question?categoryId=
${
params
.
categoryId
}
&key=
${
type
}
`
,
});
this
.
handleRest
(
type
);
//
window.RCHistory.push({
//
pathname: `/create-new-question?categoryId=${params.categoryId}&key=${type}`,
//
});
}
if
(
next
===
"close"
)
{
window
.
RCHistory
.
push
({
...
...
@@ -166,9 +178,7 @@ class AddNewQuestion extends Component {
if
(
res
.
success
)
{
message
.
success
(
"保存成功"
);
if
(
next
===
"add"
)
{
window
.
RCHistory
.
push
({
pathname
:
`/create-new-question?categoryId=
${
params
.
categoryId
}
&key=
${
type
}
`
,
});
this
.
handleRest
(
type
);
}
if
(
next
===
"close"
)
{
window
.
RCHistory
.
push
({
...
...
@@ -254,7 +264,7 @@ class AddNewQuestion extends Component {
return
(
<
div
className=
"page add-new-question"
>
<
Breadcrumbs
navList=
{
getParameterByName
(
"id"
)
?
"编辑题目"
:
"新增题目"
}
navList=
{
getParameterByName
(
"id"
)
&&
this
.
state
.
currentOperate
===
"edit"
?
"编辑题目"
:
"新增题目"
}
goBack=
{
()
=>
this
.
handleGoBack
()
}
/>
<
div
className=
"box"
>
...
...
@@ -279,7 +289,6 @@ class AddNewQuestion extends Component {
}
}
questionInfo=
{
singleChoiceContent
}
onSetState=
{
(
newContent
)
=>
{
console
.
log
(
"newContent:"
,
newContent
);
Object
.
assign
(
singleChoiceContent
,
newContent
);
}
}
onLogger=
{
this
.
handleLogger
}
...
...
@@ -328,7 +337,6 @@ class AddNewQuestion extends Component {
questionInfo=
{
gapFillingContent
}
onSetState=
{
(
newContent
)
=>
{
Object
.
assign
(
gapFillingContent
,
newContent
);
console
.
log
(
"gapFillingContent:"
,
newContent
);
}
}
/>
</
TabPane
>
...
...
src/modules/teach-tool/QuestionCategoryManage.less
View file @
5d4609a0
...
...
@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-02-23 19:41:42
* @LastEditors: yuananting
* @LastEditTime: 2021-03-18
09:32:37
* @LastEditTime: 2021-03-18
13:58:30
* @Description: 助学工具-题库-题目分类管理样式
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -53,10 +53,11 @@
}
}
}
// .ant-tree-treenode-selected:hover::before,
// .ant-tree-treenode-selected::before {
// background: rgb(255 251 240);
// }
.ant-tree-treenode-selected:hover::before,
.ant-tree-treenode-selected::before {
background: #ffb714;
opacity: 0.06;
}
}
}
.xm-show-tip {
...
...
src/modules/teach-tool/components/NewQuestionTab.jsx
View file @
5d4609a0
...
...
@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-02-25 14:34:29
* @LastEditors: yuananting
* @LastEditTime: 2021-03-18 1
1:03:21
* @LastEditTime: 2021-03-18 1
5:57:39
* @Description: 助学工具-题库-题目管理-新建题目Tab
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -23,7 +23,6 @@ import XMRecord from "./XMRecord";
import
ScanFileModal
from
"@/modules/resource-disk/modal/ScanFileModal"
;
import
SelectPrepareFileModal
from
"@/modules/prepare-lesson/modal/SelectPrepareFileModal"
;
import
_
from
"lodash"
;
import
UploadOss
from
"@/core/upload"
;
class
NewQuestionTab
extends
Component
{
constructor
(
props
)
{
...
...
@@ -84,7 +83,6 @@ class NewQuestionTab extends Component {
};
static
getDerivedStateFromProps
(
nextProps
,
prevState
)
{
console
.
log
(
"nextProps:"
,
nextProps
)
// 控制录音组件展示
if
(
nextProps
.
showBox
&&
!
prevState
.
showBox
)
{
return
{
...
...
@@ -100,7 +98,12 @@ class NewQuestionTab extends Component {
shouldComponentUpdate
(
nextProps
,
nextState
)
{
const
{
questionInfo
}
=
nextProps
;
if
(
this
.
props
.
questionInfo
!==
questionInfo
)
{
console
.
log
(
"*********改变了:"
,
questionInfo
)
if
(
questionInfo
.
gapFillingAnswerList
!==
this
.
state
.
gapFillingAnswer
)
{
console
.
log
(
999
,
questionInfo
.
gapFillingAnswerList
)
this
.
setState
({
gapFillingAnswer
:
questionInfo
.
gapFillingAnswerList
})
}
this
.
setState
(
{
stemContent
:
JSON
.
parse
(
...
...
@@ -108,12 +111,15 @@ class NewQuestionTab extends Component {
),
},
()
=>
{
const
editorHtml
=
this
.
transferStemDocument
(
questionInfo
.
questionStemList
[
0
].
content
);
const
_blanksList
=
editorHtml
.
getElementsByClassName
(
"fill-line"
);
// this.setState({blanksList:_blanksList})
console
.
log
(
"转:"
,
editorHtml
.
getElementsByClassName
(
"fill-line"
));
if
(
this
.
props
.
questionTypeKey
===
"GAP_FillING"
)
{
const
con
=
questionInfo
.
questionStemList
[
0
].
content
;
const
input
=
con
.
match
(
/<input
([^
<>
]
*
)
>/g
)
const
_blanksList
=
input
.
map
(
item
=>
{
return
this
.
transferStemDocument
(
item
).
firstChild
})
console
.
log
(
"-----"
,
_blanksList
)
this
.
setState
({
blanksList
:
_blanksList
})
}
}
);
// 题干内容
this
.
setState
({
...
...
@@ -199,7 +205,7 @@ class NewQuestionTab extends Component {
const
{
chooseOptions
}
=
this
.
state
;
if
(
this
.
props
.
questionTypeKey
===
"GAP_FILLING"
)
{
this
.
state
.
blanksList
.
forEach
((
item
,
index
)
=>
{
if
(
item
.
answerTag
List
.
length
===
0
)
{
if
(
item
.
correctAnswer
List
.
length
===
0
)
{
this
.
setState
({
[
`optionsValidate_
${
index
}
`
]:
"error"
});
this
.
setState
({
[
`optionsText_
${
index
}
`
]:
"请输入答案"
});
validateError
++
;
...
...
@@ -217,7 +223,7 @@ class NewQuestionTab extends Component {
if
(
optionContent
.
length
===
1
&&
optionContent
[
0
].
type
===
"RICH_TEXT"
&&
optionContent
[
0
].
content
.
l
ength
===
0
optionContent
[
0
].
textL
ength
===
0
)
{
this
.
setState
({
[
`optionsValidate_
${
index
}
`
]:
"error"
});
this
.
setState
({
[
`optionsText_
${
index
}
`
]:
"请输入选项"
});
...
...
@@ -328,8 +334,8 @@ class NewQuestionTab extends Component {
const
voiceMediaArr
=
_
.
filter
(
uploadItemTarget
,
(
mediaItem
)
=>
{
return
mediaItem
.
type
===
"VOICE"
;
});
const
record
MediaArr
=
_
.
filter
(
uploadItemTarget
,
(
mediaItem
)
=>
{
return
mediaItem
.
type
===
"
RECORD
"
;
const
audio
MediaArr
=
_
.
filter
(
uploadItemTarget
,
(
mediaItem
)
=>
{
return
mediaItem
.
type
===
"
AUDIO
"
;
});
const
videodMediaArr
=
_
.
filter
(
uploadItemTarget
,
(
mediaItem
)
=>
{
return
mediaItem
.
type
===
"VIDEO"
;
...
...
@@ -343,8 +349,8 @@ class NewQuestionTab extends Component {
if
(
voiceMediaArr
.
length
>
0
)
{
existType
.
push
(
"VOICE"
);
}
if
(
record
MediaArr
.
length
>
0
)
{
existType
.
push
(
"
RECORD
"
);
if
(
audio
MediaArr
.
length
>
0
)
{
existType
.
push
(
"
AUDIO
"
);
}
if
(
videodMediaArr
.
length
>
0
)
{
existType
.
push
(
"VIDEO"
);
...
...
@@ -371,8 +377,8 @@ class NewQuestionTab extends Component {
if
(
voiceMediaArr
.
length
>
0
)
{
existType
.
push
(
"VOICE"
);
}
if
(
record
MediaArr
.
length
>
0
)
{
existType
.
push
(
"
RECORD
"
);
if
(
audio
MediaArr
.
length
>
0
)
{
existType
.
push
(
"
AUDIO
"
);
}
if
(
videodMediaArr
.
length
>
0
)
{
existType
.
push
(
"VIDEO"
);
...
...
@@ -389,8 +395,8 @@ class NewQuestionTab extends Component {
if
(
voiceMediaArr
.
length
>
0
)
{
existType
.
push
(
"VOICE"
);
}
if
(
record
MediaArr
.
length
>
0
)
{
existType
.
push
(
"
RECORD
"
);
if
(
audio
MediaArr
.
length
>
0
)
{
existType
.
push
(
"
AUDIO
"
);
}
if
(
videodMediaArr
.
length
>
0
)
{
existType
.
push
(
"VIDEO"
);
...
...
@@ -404,7 +410,7 @@ class NewQuestionTab extends Component {
if
(
key
===
"VOICE"
&&
voiceMediaArr
.
length
>
2
)
{
return
message
.
warning
(
"只能添加3个音频"
);
}
if
(
key
===
"
RECORD"
&&
record
MediaArr
.
length
>
2
)
{
if
(
key
===
"
AUDIO"
&&
audio
MediaArr
.
length
>
2
)
{
return
message
.
warning
(
"只能添加3个录音"
);
}
if
(
key
===
"VIDEO"
&&
videodMediaArr
.
length
>
2
)
{
...
...
@@ -427,13 +433,13 @@ class NewQuestionTab extends Component {
},
()
=>
{
this
.
uploadInput
.
current
.
value
=
""
;
this
.
setState
({
showSelectFileModal
:
key
!==
"
RECORD
"
});
this
.
setState
({
showSelectFileModal
:
key
!==
"
AUDIO
"
});
// this.uploadInput.current.click();
}
);
// 录音
if
(
key
===
"
RECORD
"
)
{
if
(
key
===
"
AUDIO
"
)
{
this
.
setState
({
showRecord
:
true
,
});
...
...
@@ -528,9 +534,9 @@ class NewQuestionTab extends Component {
changeBlankCount
=
(
data
)
=>
{
console
.
log
(
"data:"
,
data
);
data
.
forEach
((
item
)
=>
{
if
(
!
item
.
answerTag
List
)
{
item
.
answerTag
List
=
[];
data
&&
data
.
length
>
0
&&
data
.
forEach
((
item
)
=>
{
if
(
!
item
.
correctAnswer
List
)
{
item
.
correctAnswer
List
=
[];
}
item
.
inputVisible
=
false
;
item
.
errorHold
=
false
;
...
...
@@ -552,19 +558,26 @@ class NewQuestionTab extends Component {
handleInputConfirm
=
(
optionItem
,
val
)
=>
{
const
_blanksList
=
this
.
state
.
blanksList
;
var
gapFillingAnswer
=
[];
_blanksList
.
forEach
((
item
)
=>
{
// const { gapFillingAnswer } = this.state;
let
_gapFillingAnswer
=
[];
_blanksList
.
forEach
((
item
,
index
)
=>
{
gapFillingAnswer
.
push
({
correctAnswerList
:
item
.
answerTagList
});
// if (gapFillingAnswer[index] && gapFillingAnswer[index].correctAnswerList) {
// _gapFillingAnswer[index] = gapFillingAnswer[index]
// } else {
// _gapFillingAnswer.push({ correctAnswerList: item.correctAnswerList });
// }
if
(
item
.
id
===
optionItem
.
id
)
{
if
(
val
)
{
optionItem
.
answerTag
List
.
push
(
val
);
optionItem
.
correctAnswer
List
.
push
(
val
);
optionItem
.
inputVisible
=
false
;
}
else
{
optionItem
.
errorHold
=
true
;
}
}
});
this
.
setState
({
gapFillingAnswer
},
()
=>
this
.
_onSetState
());
console
.
log
(
8888
,
_gapFillingAnswer
)
this
.
setState
({
gapFillingAnswer
:
_gapFillingAnswer
},
()
=>
this
.
_onSetState
());
this
.
setState
({
blanksList
:
_blanksList
});
};
...
...
@@ -572,7 +585,7 @@ class NewQuestionTab extends Component {
const
_blanksList
=
this
.
state
.
blanksList
;
_blanksList
.
forEach
((
item
)
=>
{
if
(
item
.
id
===
optionItem
.
id
)
{
optionItem
=
optionItem
.
answerTag
List
.
filter
(
optionItem
=
optionItem
.
correctAnswer
List
.
filter
(
(
tag
)
=>
tag
!==
removedTag
);
}
...
...
@@ -584,13 +597,17 @@ class NewQuestionTab extends Component {
const
_blanksList
=
this
.
state
.
blanksList
;
_blanksList
.
forEach
((
item
)
=>
{
if
(
item
.
id
===
optionItem
.
id
)
{
item
.
answerTag
List
.
map
();
item
.
correctAnswer
List
.
map
();
}
});
this
.
setState
({
blanksList
:
_blanksList
});
};
renderGapFillingAnswer
=
(
optionItem
,
optionIndex
)
=>
{
console
.
log
(
11111
,
optionItem
)
const
{
gapFillingAnswer
}
=
this
.
state
;
console
.
log
(
222
,
gapFillingAnswer
)
const
list
=
gapFillingAnswer
[
optionIndex
]
&&
gapFillingAnswer
[
optionIndex
].
correctAnswerList
;
return
(
<
div
className=
"gap-answer-box"
key=
{
optionIndex
}
>
<
span
className=
"gap-answer-label"
>
...
...
@@ -598,7 +615,7 @@ class NewQuestionTab extends Component {
{
optionIndex
+
1
}
.
</
span
>
<
div
className=
"gap-answer-content"
>
{
optionItem
.
answerTagL
ist
.
map
((
tag
,
index
)
=>
{
{
list
&&
l
ist
.
map
((
tag
,
index
)
=>
{
return
optionItem
.
editInput
?
(
<
Input
placeholder=
{
optionItem
.
errorHold
?
"请输入"
:
""
}
...
...
@@ -607,7 +624,7 @@ class NewQuestionTab extends Component {
}
}
value=
{
tag
}
size=
"small"
suffix=
{
<
CloseOutlined
style=
{
{
color
:
"#999999"
}
}
/>
}
suffix=
{
<
CloseOutlined
onClick=
{
()
=>
this
.
handleInputConfirm
(
optionItem
)
}
style=
{
{
color
:
"#999999"
}
}
/>
}
onBlur=
{
(
e
)
=>
this
.
handleInputConfirm
(
optionItem
,
e
.
target
.
value
,
index
)
}
...
...
@@ -675,6 +692,7 @@ class NewQuestionTab extends Component {
contentType
,
validateStatus
)
=>
{
const
{
blanksList
}
=
this
.
state
;
const
isGapFilling
=
this
.
props
.
questionTypeKey
===
"GAP_FILLING"
;
const
editorContent
=
_
.
find
(
contentList
,
...
...
@@ -686,8 +704,8 @@ class NewQuestionTab extends Component {
const
voiceMediaList
=
_
.
filter
(
contentList
,
(
mediaItem
)
=>
{
return
mediaItem
.
type
===
"VOICE"
;
});
const
record
MediaList
=
_
.
filter
(
contentList
,
(
mediaItem
)
=>
{
return
mediaItem
.
type
===
"
RECORD
"
;
const
audio
MediaList
=
_
.
filter
(
contentList
,
(
mediaItem
)
=>
{
return
mediaItem
.
type
===
"
AUDIO
"
;
});
const
videoMediaList
=
_
.
filter
(
contentList
,
(
mediaItem
)
=>
{
return
mediaItem
.
type
===
"VIDEO"
;
...
...
@@ -704,6 +722,7 @@ class NewQuestionTab extends Component {
isGapFilling=
{
isGapFilling
}
contentType=
{
contentType
}
mediaBtn=
{
mediaBtn
}
blanksList=
{
blanksList
}
changeBlankCount=
{
this
.
changeBlankCount
.
bind
(
this
)
}
bindChangeContent=
{
(
cb
,
textElemId
)
=>
{
this
.
setState
({
textElemId
});
...
...
@@ -768,26 +787,26 @@ class NewQuestionTab extends Component {
})
}
</
div
>
)
}
{
record
MediaList
.
length
>
0
&&
(
{
audio
MediaList
.
length
>
0
&&
(
<
div
className=
"desc-audio-box"
>
{
_
.
map
(
recordMediaList
,
(
recordItem
,
record
Index
)
=>
{
let
{
content
,
status
,
size
}
=
record
Item
;
{
_
.
map
(
audioMediaList
,
(
audioItem
,
audio
Index
)
=>
{
let
{
content
,
status
,
size
}
=
audio
Item
;
if
([
"init"
,
"fail"
].
includes
(
status
))
{
return
(
<
div
className=
"mt12"
key=
{
record
Index
}
>
<
div
className=
"mt12"
key=
{
audio
Index
}
>
<
UploadingProgress
fileDesc=
{
record
Item
}
fileDesc=
{
audio
Item
}
canCancelUpload
onReupload=
{
()
=>
this
.
handleReupload
(
record
Item
)
}
onReupload=
{
()
=>
this
.
handleReupload
(
audio
Item
)
}
onAbort=
{
()
=>
this
.
handleAbort
(
recordItem
,
record
Index
)
this
.
handleAbort
(
audioItem
,
audio
Index
)
}
/>
</
div
>
);
}
else
{
return
(
<
div
className=
"audio-box"
key=
{
record
Index
}
>
<
div
className=
"audio-box"
key=
{
audio
Index
}
>
<
XMAudio
forbidParse
url=
{
content
}
...
...
@@ -795,14 +814,14 @@ class NewQuestionTab extends Component {
size
=
durationSize
;
this
.
setState
({});
}
}
index=
{
record
Index
}
index=
{
audio
Index
}
size=
{
size
||
1000
}
/>
<
span
className=
"icon_sider iconfont"
onClick=
{
()
=>
{
contentList
.
map
((
item
,
index
)
=>
{
if
(
item
.
contentName
===
record
Item
.
contentName
)
{
if
(
item
.
contentName
===
audio
Item
.
contentName
)
{
contentList
.
splice
(
index
,
1
);
return
item
;
}
...
...
@@ -962,7 +981,7 @@ class NewQuestionTab extends Component {
</
div
>
);
break
;
case
"
RECORD
"
:
case
"
AUDIO
"
:
dom
=
(
<
div
className=
"audio-box"
>
<
XMAudio
...
...
@@ -1034,7 +1053,6 @@ class NewQuestionTab extends Component {
* @memberof QuestionInputItem
*/
handleReupload
=
(
uploadItem
)
=>
{
console
.
log
(
"uploadItem:"
,
uploadItem
);
uploadItem
.
status
=
"init"
;
Upload
.
uploadToOSSEvent
(
uploadItem
.
mediaFile
,
...
...
@@ -1089,7 +1107,7 @@ class NewQuestionTab extends Component {
const
{
uploadItemTarget
,
contentType
}
=
this
.
state
;
uploadItemTarget
.
push
({
contentType
,
type
:
"
RECORD
"
,
type
:
"
AUDIO
"
,
contentName
:
`
${
window
.
random_string
(
16
)}
.
${
originType
}
`
,
// 文件名
fileType
:
originType
,
// 文件后缀
content
:
mp3URL
,
...
...
@@ -1145,7 +1163,6 @@ class NewQuestionTab extends Component {
);
let
acceptType
=
""
;
let
selectTypeList
=
[];
console
.
log
(
"mediaType"
,
mediaType
);
switch
(
mediaType
)
{
case
"PICTURE"
:
acceptType
=
MEDIA_FILE_ACCEPT
.
PICTURE
;
...
...
@@ -1161,8 +1178,6 @@ class NewQuestionTab extends Component {
break
;
}
console
.
log
(
acceptType
,
selectTypeList
);
return
(
<
div
className=
"question-input-item_wrapper"
>
{
/* 题干 */
}
...
...
@@ -1177,7 +1192,7 @@ class NewQuestionTab extends Component {
{
this
.
renderContent
(
stemContent
,
placehold
,
[
"VOICE"
,
"
RECORD
"
,
"PICTURE"
],
[
"VOICE"
,
"
AUDIO
"
,
"PICTURE"
],
"QUESTION_STEM"
,
stemValidate
)
}
...
...
@@ -1232,12 +1247,8 @@ class NewQuestionTab extends Component {
questionOptionContentList
,
isCorrectAnswer
,
}
=
optionItem
;
console
.
log
(
"questionOptionContentList:"
,
questionOptionContentList
);
optionItem
.
optionSort
=
optionIndex
;
const
mediaBtn
=
[
"VOICE"
,
"
RECORD
"
,
"PICTURE"
];
const
mediaBtn
=
[
"VOICE"
,
"
AUDIO
"
,
"PICTURE"
];
const
placeHold
=
"必填(1000字以内,可粘贴小图;可以不输入文字,只添加音频或图片)"
;
return
(
...
...
@@ -1366,7 +1377,7 @@ class NewQuestionTab extends Component {
{
this
.
renderContent
(
questionAnswerDesc
,
"1000字以内,可粘贴小图"
,
[
"VOICE"
,
"
RECORD
"
,
"PICTURE"
,
"VIDEO"
],
[
"VOICE"
,
"
AUDIO
"
,
"PICTURE"
,
"VIDEO"
],
"QUESTION_ANSWER_DESC"
)
}
</
div
>
...
...
src/modules/teach-tool/components/QuestionBankSider.less
View file @
5d4609a0
...
...
@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-02-22 12:02:34
* @LastEditors: yuananting
* @LastEditTime: 2021-03-18
09:34:06
* @LastEditTime: 2021-03-18
13:59:24
* @Description: 助学工具-题库-题库主页面侧边栏样式
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -54,6 +54,11 @@
color: #666666;
}
}
.ant-tree-treenode-selected:hover::before,
.ant-tree-treenode-selected::before {
background: #ffb714;
opacity: 0.06;
}
}
}
}
src/modules/teach-tool/components/QuestionEditor.jsx
View file @
5d4609a0
...
...
@@ -12,7 +12,7 @@ const MEDIA_MAP = [
{
title
:
"录音"
,
icon
:
<
React
.
Fragment
>

</
React
.
Fragment
>,
key
:
"
RECORD
"
,
key
:
"
AUDIO
"
,
},
{
title
:
"图片"
,
...
...
@@ -56,12 +56,18 @@ class QuestionEditor extends Component {
}
shouldComponentUpdate
(
nextProps
,
nextState
)
{
const
{
detailInfo
}
=
nextProps
;
const
{
detailInfo
,
blanksList
}
=
nextProps
;
if
(
this
.
state
.
detailInfo
!==
detailInfo
)
{
this
.
setState
({
detailInfo
:
nextProps
.
detailInfo
},
()
=>
{
this
.
renderEditor
();
});
}
if
(
blanksList
!==
this
.
state
.
blanksList
)
{
console
.
log
(
"+++++++"
,
blanksList
)
this
.
setState
({
blanksList
})
}
return
true
;
}
...
...
@@ -148,6 +154,7 @@ class QuestionEditor extends Component {
this
.
setState
({
isShowSingleInput
:
true
});
}
if
(
this
.
state
.
isGapFilling
)
{
console
.
log
(
9999
,
this
.
state
.
isGapFilling
)
this
.
props
.
changeBlankCount
(
this
.
state
.
blanksList
);
}
this
.
setState
(
...
...
@@ -204,7 +211,7 @@ class QuestionEditor extends Component {
}
insertBlank
=
(
blanks
)
=>
{
var
blanks
=
`<input class="add-fill-line" disabled
answerTagList="
" id=
${
window
.
random_string
(
var
blanks
=
`<input class="add-fill-line" disabled
correctAnswerList="[]
" id=
${
window
.
random_string
(
16
)}
value="填空"/>`
;
this
.
editorRoot
.
cmd
.
do
(
"insertHTML"
,
blanks
);
...
...
@@ -215,7 +222,7 @@ class QuestionEditor extends Component {
this
.
setState
({
visiblePlacehold
:
false
,
});
//
this.props.changeBlankCount(_blanksList);
this
.
props
.
changeBlankCount
(
_blanksList
);
};
render
()
{
...
...
@@ -233,7 +240,7 @@ class QuestionEditor extends Component {
}
=
this
.
state
;
const
{
placehold
,
mediaBtn
=
[
"VOICE"
,
"
RECORD
"
,
"PICTURE"
,
"VIDEO"
],
mediaBtn
=
[
"VOICE"
,
"
AUDIO
"
,
"PICTURE"
,
"VIDEO"
],
limitLength
=
1000
,
markKey
,
}
=
this
.
props
;
...
...
src/modules/teach-tool/components/QuestionManageContent.jsx
View file @
5d4609a0
...
...
@@ -2,7 +2,7 @@
* @Author: yuananting
* @Date: 2021-02-25 11:23:47
* @LastEditors: yuananting
* @LastEditTime: 2021-03-18 1
0:24:47
* @LastEditTime: 2021-03-18 1
4:21:22
* @Description: 助学工具-题库-题目管理主页面列表数据
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
...
...
@@ -69,7 +69,7 @@ class QuestionManageContent extends Component {
query
:
{
current
:
1
,
size
:
10
,
order
:
"
ACCURACY
_DESC"
,
// 排序规则[ ACCURACY_DESC, ACCURACY_ASC, CREATED_DESC, CREATED_ASC, UPDATED_DESC, UPDATED_ASC ]
order
:
"
UPDATED
_DESC"
,
// 排序规则[ ACCURACY_DESC, ACCURACY_ASC, CREATED_DESC, CREATED_ASC, UPDATED_DESC, UPDATED_ASC ]
categoryId
:
null
,
// 当前题库分类Id
questionName
:
null
,
// 题目名称
questionType
:
null
,
// 题目类型
...
...
src/modules/teach-tool/modal/BatchImportQuestionModal.jsx
View file @
5d4609a0
...
...
@@ -39,7 +39,6 @@ class BatchImportQuestionModal extends Component {
// 选择云盘资源
handleSelectExcel
=
(
file
)
=>
{
console
.
log
(
file
);
this
.
setState
({
uploadFile
:
file
});
this
.
setState
({
showSelectFileModal
:
false
,
...
...
@@ -133,6 +132,9 @@ class BatchImportQuestionModal extends Component {
</
div
>
<
div
className=
"step-section"
>
<
h4
className=
"step-title"
>
2.选择需要导入的Excel文件
</
h4
>
<
p
style=
{
{
marginBottom
:
16
,
color
:
"gray"
}
}
>
导入限制:一次最多导入1000个题目
</
p
>
<
Button
type=
"primary"
className=
"add-btn"
...
...
@@ -220,9 +222,9 @@ class BatchImportQuestionModal extends Component {
type=
"primary"
className=
"down-btn"
onClick=
{
()
=>
{
this
.
setState
({
status
:
"init"
})
this
.
setState
({
uploadFile
:
null
})
this
.
setState
({
showSelectFileModal
:
true
})
this
.
setState
({
status
:
"init"
})
;
this
.
setState
({
uploadFile
:
null
})
;
this
.
setState
({
showSelectFileModal
:
true
})
;
}
}
>
重新上传文件
...
...
src/modules/teach-tool/modal/BatchImportQuestionModal.less
View file @
5d4609a0
...
...
@@ -6,7 +6,6 @@
.step-title {
font-size: 16px;
font-weight: 400;
margin-bottom: 16px;
color: #333;
}
.tip-box {
...
...
src/modules/teach-tool/modal/QuestionPreviewModal.jsx
View file @
5d4609a0
...
...
@@ -87,8 +87,8 @@ class QuestionPreviewModal extends Component {
const
voiceDescList
=
_
.
filter
(
questionAnswerDescList
,
(
descItem
)
=>
{
return
descItem
.
type
===
"VOICE"
;
});
const
record
DescList
=
_
.
filter
(
questionAnswerDescList
,
(
descItem
)
=>
{
return
descItem
.
type
===
"
RECORD
"
;
const
audio
DescList
=
_
.
filter
(
questionAnswerDescList
,
(
descItem
)
=>
{
return
descItem
.
type
===
"
AUDIO
"
;
});
const
videoDeacList
=
_
.
filter
(
questionAnswerDescList
,
(
descItem
)
=>
{
return
descItem
.
type
===
"VIDEO"
;
...
...
@@ -327,12 +327,12 @@ class QuestionPreviewModal extends Component {
})
}
</
div
>
)
}
{
record
DescList
.
length
>
0
&&
(
{
audio
DescList
.
length
>
0
&&
(
<
div
className=
"desc-audio-box"
>
{
_
.
map
(
recordDescList
,
(
recordItem
,
record
Index
)
=>
{
let
{
content
,
size
}
=
record
Item
;
{
_
.
map
(
audioDescList
,
(
audioItem
,
audio
Index
)
=>
{
let
{
content
,
size
}
=
audio
Item
;
return
(
<
div
className=
"audio-box"
key=
{
record
Index
}
>
<
div
className=
"audio-box"
key=
{
audio
Index
}
>
<
XMAudio
forbidParse
url=
{
content
}
...
...
@@ -340,7 +340,7 @@ class QuestionPreviewModal extends Component {
size
=
durationSize
;
this
.
setState
({});
}
}
index=
{
record
Index
}
index=
{
audio
Index
}
size=
{
size
||
1000
}
/>
</
div
>
...
...
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