diff --git a/web/src/pages/QuestionList.module.less b/web/src/pages/QuestionList.module.less index 2880851..fe61904 100644 --- a/web/src/pages/QuestionList.module.less +++ b/web/src/pages/QuestionList.module.less @@ -74,13 +74,16 @@ color: #262626; } -.blank { +.blankAnswer { display: inline-block; - border-bottom: 2px solid #1677ff; - min-width: 60px; + font-size: 15px; + font-weight: 600; + color: #52c41a; + border-bottom: 2px solid #52c41a; + padding: 0 4px 2px 4px; margin: 0 4px; - color: transparent; - user-select: none; + min-width: 60px; + text-align: center; } .options { diff --git a/web/src/pages/QuestionList.tsx b/web/src/pages/QuestionList.tsx index f9ea977..7b9d2b6 100644 --- a/web/src/pages/QuestionList.tsx +++ b/web/src/pages/QuestionList.tsx @@ -87,9 +87,9 @@ const QuestionList: React.FC = () => { setFilteredQuestions(filtered) }, [selectedType, searchKeyword, questions]) - // 渲染填空题内容,将****替换为下划线 - const renderFillInBlankContent = (content: string): React.ReactNode => { - // 将 **** 替换为下划线样式 + // 渲染填空题内容,将****替换为答案(带下划线样式) + const renderFillInBlankContent = (content: string, answers: string[]): React.ReactNode => { + // 将 **** 替换为答案 const parts = content.split('****') return ( <> @@ -97,7 +97,7 @@ const QuestionList: React.FC = () => { {part} {index < parts.length - 1 && ( - ______ + {answers[index] || '______'} )} ))} @@ -250,7 +250,10 @@ const QuestionList: React.FC = () => {
{question.type === 'fill-in-blank' - ? renderFillInBlankContent(question.content) + ? renderFillInBlankContent( + question.content, + Array.isArray(question.answer) ? question.answer : [] + ) : question.content } @@ -259,16 +262,18 @@ const QuestionList: React.FC = () => { {/* 选项 */} {renderOptions(question)} - {/* 答案 */} -
- - - 正确答案: - - - {formatAnswer(question)} - -
+ {/* 答案 - 填空题不显示答案区域,因为答案已经在横线上方 */} + {question.type !== 'fill-in-blank' && ( +
+ + + 正确答案: + + + {formatAnswer(question)} + +
+ )} ) }}