Browse Source

fix(front): 修复下拉框

Go 4 years ago
parent
commit
5b4287aba9

+ 2 - 1
front/project/admin/routes/subject/question/page.js

@@ -315,7 +315,7 @@ export default class extends Page {
         let handler;
         data.associationContent = this.state.associationContentQuestionNos.map(row => row.id);
         data.stem = data.stem || '';
-        data.description = (data.stem || '').replace(/<[^>]+>/g, '');
+        data.description = (data.stem || '').replace(/<[^>]+>/g, '').replace(/#select#/, '').replace(/#table#/, '');
         data.qxContent = data.qxContent || '';
         data.officialContent = data.officialContent || '';
 
@@ -427,6 +427,7 @@ export default class extends Page {
                 ['bold', 'underline', 'blockquote'],
                 [{ color: [] }, { background: [] }],
                 [{ list: 'ordered' }, { list: 'bullet' }, { indent: '-1' }, { indent: '+1' }],
+                ['clean'],
               ],
               handlers: {
                 table: (quill) => {

+ 5 - 0
front/project/www/components/AnswerSelect/index.js

@@ -20,6 +20,11 @@ export default class AnswerSelect extends Component {
       if (row) index = i;
       if (row !== answer[type][i]) result = false;
     });
+    if (index === -1) {
+      (answer[type] || []).forEach((row, i) => {
+        if (row) index = i;
+      });
+    }
     this.state = { selecting: false, select, index, result };
   }
 

+ 2 - 1
front/project/www/routes/paper/question/detail/index.js

@@ -139,8 +139,9 @@ export default class extends Component {
 
   formatStem(text) {
     if (!text) return '';
-    const { showAnswer, question = { content: {} }, userQuestion } = this.props;
+    const { question = { content: {} }, userQuestion } = this.props;
     const { table = {}, questions = [] } = question.content;
+    const { showAnswer } = this.state;
     text = text.replace(/#select#/g, "<span class='#select#' />");
     text = text.replace(/#table#/g, "<span class='#table#' />");
     setTimeout(() => {

+ 1 - 1
front/src/components/Editor/index.js

@@ -10,7 +10,7 @@ const defaultContainer = [
   [{ list: 'ordered' }, { list: 'bullet' }, { indent: '-1' }, { indent: '+1' }],
   // ['image'],
   // ['link', 'video'],
-  // ['clean'],
+  ['clean'],
 ];
 
 const formats = [