Commit 5955f8dd authored by hewenhao's avatar hewenhao

feat: fix skynet error

parent 94fd1b39
......@@ -46,6 +46,7 @@ function UserGuideView<T extends ComponentType<any> = typeof View> (props: UserG
createSelectorQuery()
.select(`#${domRef.current.uid}`)
.boundingClientRect().exec(([_rect]) => {
if (!_rect) return
setRect({ ..._rect, top: _rect.top + scrollRef.current })
setIsActive(true)
})
......
......@@ -102,7 +102,7 @@ function convert (inQuestion: QuestionType): CompleteQuestion {
if (isSelectionQuestion(inQuestion)) {
return {
...inQuestion,
userAnswers: inQuestion.options.filter(c => c.userAnswer).map(c => c.index)
userAnswers: inQuestion.options.filter(c => c?.userAnswer).map(c => c?.index)
}
}
......@@ -114,7 +114,7 @@ function convert (inQuestion: QuestionType): CompleteQuestion {
) {
return {
...inQuestion,
userAnswers: inQuestion.answers.map(c => c.userAnswer!),
userAnswers: inQuestion.answers.map(c => c?.userAnswer!),
}
}
......@@ -124,7 +124,7 @@ function convert (inQuestion: QuestionType): CompleteQuestion {
/** 已答题目 */
export function answeredQuestion (question: QuestionType) {
if (isSelectionQuestion(question)) {
return question.options.some(c => c.userAnswer)
return question.options.some(c => c?.userAnswer)
}
if (
......@@ -133,7 +133,7 @@ export function answeredQuestion (question: QuestionType) {
isFractionAddMinusQuestion(question) ||
isVerticalAddMinusQuestion(question)
) {
return question.answers.every(c => c.userAnswer)
return question.answers.every(c => c?.userAnswer)
}
throw new Error('question type not supported')
......@@ -142,7 +142,7 @@ export function answeredQuestion (question: QuestionType) {
/** 判题 */
export function determinQuestion (question: QuestionType) {
if (isSelectionQuestion(question)) {
return question.options.every(c => c.answer === c.userAnswer)
return question.options.every(c => c.answer === c?.userAnswer)
}
if (
......@@ -151,7 +151,7 @@ export function determinQuestion (question: QuestionType) {
isFractionAddMinusQuestion(question) ||
isVerticalAddMinusQuestion(question)
) {
return question.answers.every(c => c.userAnswer === c.contentText)
return question.answers.every(c => c?.userAnswer === c.contentText)
}
throw new Error('question type not supported')
......
......@@ -30,7 +30,7 @@ const AnswerBlank = (props: AnswerBlankProps) => {
}, [question])
const isWrong = useMemo(() => {
return currentInputOption?.contentText !== currentInputOption.userAnswer || !currentInput
return currentInputOption?.contentText !== currentInputOption?.userAnswer || !currentInput
}, [currentInputOption, currentInput])
return (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment