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
9bb63fd4
Commit
9bb63fd4
authored
Mar 25, 2021
by
yuananting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:调试
parent
ff15b763
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
52 deletions
+68
-52
src/modules/teach-tool/components/NewQuestionTab.jsx
+4
-1
src/modules/teach-tool/components/QuestionEditor.jsx
+64
-51
No files found.
src/modules/teach-tool/components/NewQuestionTab.jsx
View file @
9bb63fd4
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: yuananting
* @Author: yuananting
* @Date: 2021-02-25 14:34:29
* @Date: 2021-02-25 14:34:29
* @LastEditors: yuananting
* @LastEditors: yuananting
* @LastEditTime: 2021-03-25 1
8:50:43
* @LastEditTime: 2021-03-25 1
9:10:32
* @Description: 助学工具-题库-题目管理-新建题目Tab
* @Description: 助学工具-题库-题目管理-新建题目Tab
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
*/
...
@@ -596,10 +596,13 @@ class NewQuestionTab extends Component {
...
@@ -596,10 +596,13 @@ class NewQuestionTab extends Component {
data
.
forEach
((
item
,
index
)
=>
{
data
.
forEach
((
item
,
index
)
=>
{
if
(
index
===
idx
)
{
if
(
index
===
idx
)
{
if
(
_gap
.
length
<
data
.
length
)
{
if
(
_gap
.
length
<
data
.
length
)
{
console
.
log
(
1
)
_gap
.
splice
(
idx
,
0
,
{
correctAnswerList
:
[]
});
_gap
.
splice
(
idx
,
0
,
{
correctAnswerList
:
[]
});
}
else
if
(
_gap
.
length
>
data
.
length
)
{
}
else
if
(
_gap
.
length
>
data
.
length
)
{
console
.
log
(
2
)
_gap
.
splice
(
idx
,
1
);
_gap
.
splice
(
idx
,
1
);
}
else
{
}
else
{
console
.
log
(
3
)
_gap
.
splice
(
idx
,
1
,
{
correctAnswerList
:
[]
});
_gap
.
splice
(
idx
,
1
,
{
correctAnswerList
:
[]
});
}
}
}
}
...
...
src/modules/teach-tool/components/QuestionEditor.jsx
View file @
9bb63fd4
...
@@ -160,60 +160,62 @@ class QuestionEditor extends Component {
...
@@ -160,60 +160,62 @@ class QuestionEditor extends Component {
}
}
editorRoot
.
config
.
onchange
=
(
html
)
=>
{
editorRoot
.
config
.
onchange
=
(
html
)
=>
{
const
conLen
=
html
.
replace
(
/<
(?!
img|input
)
.*
?
>/g
,
""
).
length
;
setTimeout
(()
=>
{
counter
++
;
const
conLen
=
html
.
replace
(
/<
(?!
img|input
)
.*
?
>/g
,
""
).
length
;
const
{
focusFlag
}
=
this
.
state
;
counter
++
;
const
textLength
=
editorRoot
.
txt
.
text
().
replace
(
/
\&
nbsp
\;
/gi
,
" "
)
const
{
focusFlag
}
=
this
.
state
;
.
length
;
const
textLength
=
editorRoot
.
txt
.
text
().
replace
(
/
\&
nbsp
\;
/gi
,
" "
)
const
imgLength
=
html
.
match
(
/<img/g
)
.
length
;
?
html
.
match
(
/<img/g
).
length
*
2
const
imgLength
=
html
.
match
(
/<img/g
)
:
0
;
?
html
.
match
(
/<img/g
).
length
*
2
const
contentLength
=
imgLength
+
textLength
;
:
0
;
const
divHeight
=
document
.
getElementById
(
`editor
${
editorId
}
_content`
)
const
contentLength
=
imgLength
+
textLength
;
.
firstChild
.
offsetHeight
;
const
divHeight
=
document
.
getElementById
(
`editor
${
editorId
}
_content`
)
if
(
divHeight
>
30
||
imgLength
>
0
)
{
.
firstChild
.
offsetHeight
;
this
.
setState
({
isShowSingleInput
:
false
});
if
(
divHeight
>
30
||
imgLength
>
0
)
{
}
else
{
this
.
setState
({
isShowSingleInput
:
false
});
this
.
setState
({
isShowSingleInput
:
true
});
}
else
{
}
this
.
setState
({
isShowSingleInput
:
true
});
if
(
this
.
state
.
isGapFilling
&&
this
.
state
.
contentType
===
"QUESTION_STEM"
)
{
const
stemHtml
=
this
.
transferStemDocument
(
html
);
var
_blanksList
=
stemHtml
.
getElementsByClassName
(
"add-fill-line"
);
const
ids
=
[...
_blanksList
].
map
((
item
)
=>
item
.
id
);
const
isEdit
=
getParameterByName
(
"id"
);
if
(
isEdit
&&
counter
===
1
)
{
const
prev
=
localStorage
.
getItem
(
"gap_ques_prevList"
);
prevList
=
prev
&&
JSON
.
parse
(
prev
);
}
}
if
(
this
.
state
.
isGapFilling
&&
this
.
state
.
contentType
===
"QUESTION_STEM"
)
{
const
stemHtml
=
this
.
transferStemDocument
(
html
);
var
_blanksList
=
stemHtml
.
getElementsByClassName
(
"add-fill-line"
);
const
ids
=
[...
_blanksList
].
map
((
item
)
=>
item
.
id
);
let
idx
=
0
;
const
isEdit
=
getParameterByName
(
"id"
);
if
(
prevList
&&
ids
)
{
if
(
isEdit
&&
counter
===
1
)
{
console
.
log
(
prevList
,
ids
)
const
prev
=
localStorage
.
getItem
(
"gap_ques_prevList"
);
idx
=
this
.
getNewArr
(
prevList
,
ids
);
prevList
=
prev
&&
JSON
.
parse
(
prev
);
const
oldLen
=
prevList
.
length
;
}
idx
=
idx
>=
oldLen
?
idx
-
oldLen
:
idx
;
}
prevList
=
[...
ids
];
let
idx
=
0
;
if
(
prevList
&&
ids
)
{
console
.
log
(
prevList
,
ids
);
idx
=
this
.
getNewArr
(
prevList
,
ids
);
const
oldLen
=
prevList
.
length
;
idx
=
idx
>=
oldLen
?
idx
-
oldLen
:
idx
;
}
this
.
setState
({
blanksList
:
_blanksList
},
()
=>
prevList
=
[...
ids
];
this
.
props
.
changeBlankCount
(
_blanksList
,
idx
)
);
this
.
setState
({
blanksList
:
_blanksList
},
()
=>
}
this
.
props
.
changeBlankCount
(
_blanksList
,
idx
)
this
.
setState
(
);
{
contentLength
,
visiblePlacehold
:
(
conLen
===
0
||
(
conLen
===
1
&&
html
===
" "
))
&&
!
focusFlag
,
},
()
=>
{
onChange
&&
onChange
(
html
,
this
.
state
.
contentLength
);
}
}
);
this
.
setState
(
{
contentLength
,
visiblePlacehold
:
(
conLen
===
0
||
(
conLen
===
1
&&
html
===
" "
))
&&
!
focusFlag
,
},
()
=>
{
onChange
&&
onChange
(
html
,
this
.
state
.
contentLength
);
}
);
},
0
);
};
};
editorRoot
.
config
.
onblur
=
()
=>
{
editorRoot
.
config
.
onblur
=
()
=>
{
...
@@ -325,7 +327,10 @@ class QuestionEditor extends Component {
...
@@ -325,7 +327,10 @@ class QuestionEditor extends Component {
}
}
style=
{
{
style=
{
{
border
:
border
:
this
.
props
.
validateStatus
===
"error"
||
contentLength
>
limitLength
?
"1px solid red"
:
""
,
this
.
props
.
validateStatus
===
"error"
||
contentLength
>
limitLength
?
"1px solid red"
:
""
,
}
}
}
}
>
>
<
div
<
div
...
@@ -362,7 +367,15 @@ class QuestionEditor extends Component {
...
@@ -362,7 +367,15 @@ class QuestionEditor extends Component {
<
div
className=
"editor-placehold"
>
{
placehold
}
</
div
>
<
div
className=
"editor-placehold"
>
{
placehold
}
</
div
>
)
}
)
}
{
visibleMediaBox
&&
!
_
.
isEmpty
(
mediaBtn
)
&&
(
{
visibleMediaBox
&&
!
_
.
isEmpty
(
mediaBtn
)
&&
(
<
div
className=
"edtior-media_box"
style=
{
{
top
:
isGapFilling
&&
contentType
===
"QUESTION_STEM"
?
"53%"
:
"100%"
}
}
>
<
div
className=
"edtior-media_box"
style=
{
{
top
:
isGapFilling
&&
contentType
===
"QUESTION_STEM"
?
"53%"
:
"100%"
,
}
}
>
<
div
className=
"edtior-media_list"
>
<
div
className=
"edtior-media_list"
>
{
_
.
map
(
mediaBtn
,
(
mediaItem
)
=>
{
{
_
.
map
(
mediaBtn
,
(
mediaItem
)
=>
{
const
mediaBtnMap
=
_
.
find
(
const
mediaBtnMap
=
_
.
find
(
...
...
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