ソースを参照

新增小题后滚动到对应的小题处

刘洋 1 年間 前
コミット
ebe8755a49
1 ファイル変更385 行追加307 行削除
  1. 385 307
      src/modules/paper/views/EditPaper.vue

+ 385 - 307
src/modules/paper/views/EditPaper.vue

@@ -225,7 +225,16 @@
       </div>
     </div>
 
-    <div class="edit-body" style="margin: 0 16px; padding-top: 140px">
+    <div
+      class="edit-body"
+      style="
+        margin: 0 16px;
+        padding-top: 0;
+        display: flex;
+        flex-direction: column;
+        height: 100%;
+      "
+    >
       <div
         class="edit-warning-wrap"
         :class="{ hid: this.checkPaperQuestionAllHasScore() }"
@@ -235,26 +244,27 @@
           <span>有小题未设置分值</span>
         </div>
       </div>
-      <!-- 考试说明 -->
-      <div class="edit-part-list">
-        <div class="edit-part">
-          <div class="edit-cont">
-            <div
-              class="edit-cont-title"
-              style="display: flex; align-items: center"
-            >
-              <h3>考试说明</h3>
-              <svg-btn
-                name="bianji"
-                color="#6D5FF6"
-                hoverBgColor="#F0EFFE"
-                class="hover-show"
-                @click="toEditExamRemark"
-                style="margin-left: 10px"
-                >编辑</svg-btn
+      <div style="flex: 1; overflow: auto" ref="editPaperBody">
+        <!-- 考试说明 -->
+        <div class="edit-part-list">
+          <div class="edit-part">
+            <div class="edit-cont">
+              <div
+                class="edit-cont-title"
+                style="display: flex; align-items: center"
               >
-            </div>
-            <!-- <div class="edit-cont-action">
+                <h3>考试说明</h3>
+                <svg-btn
+                  name="bianji"
+                  color="#6D5FF6"
+                  hoverBgColor="#F0EFFE"
+                  class="hover-show"
+                  @click="toEditExamRemark"
+                  style="margin-left: 10px"
+                  >编辑</svg-btn
+                >
+              </div>
+              <!-- <div class="edit-cont-action">
               <el-button
                 type="primary"
                 plain
@@ -263,58 +273,58 @@
                 >编辑</el-button
               >
             </div> -->
-            <div class="edit-cont-body">
-              <rich-text :text-json="paper.examRemark"></rich-text>
+              <div class="edit-cont-body">
+                <rich-text :text-json="paper.examRemark"></rich-text>
+              </div>
             </div>
           </div>
         </div>
-      </div>
 
-      <!-- 循环大题 -->
-      <div
-        v-for="(paperDetail, detailIndex) in paper.paperDetails"
-        :key="paperDetail.id"
-        class="edit-part-list"
-      >
-        <div class="edit-part level1">
-          <div class="edit-cont">
-            <div class="edit-cont-title">
-              <h3>
-                <span>{{ paperDetail.cnNum }}</span> <span>.</span>
-                <span>{{ paperDetail.name }}</span>
-              </h3>
-            </div>
-            <rich-text
-              class="edit-cont-body"
-              :text-json="paperDetail.description"
-            ></rich-text>
-          </div>
-          <div class="level1-hover-show">
-            <div style="color: #595959; margin-bottom: 5px">
-              共{{ paperDetail.unitCount }}小题,满分{{ paperDetail.score }}分
-            </div>
-            <div class="gray-btn-group">
-              <span @click="toSelectPaperDetailQues(paperDetail)">选题</span>
-              <span @click="toEditPaperDetail(paperDetail)">编辑</span>
-              <span
-                v-if="detailIndex"
-                @click="toMovePaperDetail(paperDetail, 'up')"
-                >上移</span
-              >
-              <span
-                v-if="detailIndex < paper.paperDetails.length - 1"
-                @click="toMovePaperDetail(paperDetail, 'down')"
-                >下移</span
-              >
-              <span @click="toDeletePaperDetail(paperDetail)">删除</span>
-              <span
-                @click.stop="
-                  paperDetail.showQuestions = !paperDetail.showQuestions
-                "
-                >{{ paperDetail.showQuestions ? "收起" : "展开" }}</span
-              >
+        <!-- 循环大题 -->
+        <div
+          v-for="(paperDetail, detailIndex) in paper.paperDetails"
+          :key="paperDetail.id"
+          class="edit-part-list"
+        >
+          <div class="edit-part level1">
+            <div class="edit-cont">
+              <div class="edit-cont-title">
+                <h3>
+                  <span>{{ paperDetail.cnNum }}</span> <span>.</span>
+                  <span>{{ paperDetail.name }}</span>
+                </h3>
+              </div>
+              <rich-text
+                class="edit-cont-body"
+                :text-json="paperDetail.description"
+              ></rich-text>
             </div>
-            <!-- 
+            <div class="level1-hover-show">
+              <div style="color: #595959; margin-bottom: 5px">
+                共{{ paperDetail.unitCount }}小题,满分{{ paperDetail.score }}分
+              </div>
+              <div class="gray-btn-group">
+                <span @click="toSelectPaperDetailQues(paperDetail)">选题</span>
+                <span @click="toEditPaperDetail(paperDetail)">编辑</span>
+                <span
+                  v-if="detailIndex"
+                  @click="toMovePaperDetail(paperDetail, 'up')"
+                  >上移</span
+                >
+                <span
+                  v-if="detailIndex < paper.paperDetails.length - 1"
+                  @click="toMovePaperDetail(paperDetail, 'down')"
+                  >下移</span
+                >
+                <span @click="toDeletePaperDetail(paperDetail)">删除</span>
+                <span
+                  @click.stop="
+                    paperDetail.showQuestions = !paperDetail.showQuestions
+                  "
+                  >{{ paperDetail.showQuestions ? "收起" : "展开" }}</span
+                >
+              </div>
+              <!-- 
               <div>
                 <el-button
                   size="small"
@@ -366,109 +376,116 @@
                   "
                 ></el-button>
               </div> -->
-          </div>
-          <div v-show="quesTagShow" class="edit-property">
-            <div class="edit-property-box">
-              <div
-                v-for="(paperDetailTag, tagIndex) in paperDetail.tags"
-                :key="tagIndex"
-                class="edit-property-item"
-              >
-                <div class="edit-property-body level1">
-                  <div class="edit-property-title">
-                    {{ paperDetailTag.tag }}
-                  </div>
-                  <div class="edit-property-content">
-                    {{ paperDetailTag.content }}
-                  </div>
-                </div>
-              </div>
-              <template v-if="paperDetail.selective">
-                <div class="edit-property-item">
+            </div>
+            <div v-show="quesTagShow" class="edit-property">
+              <div class="edit-property-box">
+                <div
+                  v-for="(paperDetailTag, tagIndex) in paperDetail.tags"
+                  :key="tagIndex"
+                  class="edit-property-item"
+                >
                   <div class="edit-property-body level1">
-                    <div class="edit-property-title">选做题数</div>
+                    <div class="edit-property-title">
+                      {{ paperDetailTag.tag }}
+                    </div>
                     <div class="edit-property-content">
-                      {{ paperDetail.selectiveCount }}
+                      {{ paperDetailTag.content }}
                     </div>
                   </div>
                 </div>
-                <div class="edit-property-item">
-                  <div class="edit-property-body level1">
-                    <div class="edit-property-title">取分规则</div>
-                    <div class="edit-property-content">
-                      {{ paperDetail.selectiveRule | selectiveRuleTypeFilter }}
+                <template v-if="paperDetail.selective">
+                  <div class="edit-property-item">
+                    <div class="edit-property-body level1">
+                      <div class="edit-property-title">选做题数</div>
+                      <div class="edit-property-content">
+                        {{ paperDetail.selectiveCount }}
+                      </div>
                     </div>
                   </div>
-                </div>
-              </template>
+                  <div class="edit-property-item">
+                    <div class="edit-property-body level1">
+                      <div class="edit-property-title">取分规则</div>
+                      <div class="edit-property-content">
+                        {{
+                          paperDetail.selectiveRule | selectiveRuleTypeFilter
+                        }}
+                      </div>
+                    </div>
+                  </div>
+                </template>
+              </div>
             </div>
           </div>
-        </div>
-        <!-- 循环小题 -->
-        <div v-show="paperDetail.showQuestions" class="edit-paper-questions">
-          <template
-            v-for="(paperDetailUnit, unitIndex) in paperDetail.paperDetailUnits"
-          >
-            <div
-              :key="`question-${unitIndex}`"
-              :class="[
-                'edit-part',
-                'level2',
-                {
-                  'question-duplicate':
-                    paperDetailUnit.question.checkDuplicateStatus ==
-                    'TO_BE_DISPOSE',
-                  'is-danger': !paperDetailUnit.score,
-                },
-              ]"
+          <!-- 循环小题 -->
+          <div v-show="paperDetail.showQuestions" class="edit-paper-questions">
+            <template
+              v-for="(
+                paperDetailUnit, unitIndex
+              ) in paperDetail.paperDetailUnits"
             >
-              <div class="level2-hover-show">
-                <div class="box-justify">
-                  <div class="gray-btn-group">
-                    <span
-                      v-if="
-                        paperDetailUnit.question.checkDuplicateStatus ===
-                        'TO_BE_DISPOSE'
-                      "
-                      @click="
-                        toCheckDuplicateQuestion(paperDetailUnit.question.id)
-                      "
-                      >进入查重</span
-                    >
-                    <span @click="toChangeQues(paperDetailUnit)">换题</span>
-                    <span @click="toEditQues(paperDetailUnit)">编辑</span>
-                    <span
-                      v-if="unitIndex"
-                      @click="
-                        toMoveQues(paperDetail.id, paperDetailUnit.id, 'up')
-                      "
-                      >上移</span
-                    >
-                    <span
-                      v-if="unitIndex < paperDetail.paperDetailUnits.length - 1"
-                      @click="
-                        toMoveQues(paperDetail.id, paperDetailUnit.id, 'down')
-                      "
-                      >下移</span
-                    >
-                    <span @click="toDeleteQues(paperDetailUnit)">删除</span>
-                    <span
-                      v-if="isNested(paperDetailUnit.questionType)"
-                      @click="
-                        paperDetailUnit.showSubQuestions =
-                          !paperDetailUnit.showSubQuestions
-                      "
-                      >{{
-                        paperDetailUnit.showSubQuestions ? "收起" : "展开"
-                      }}</span
-                    >
+              <div
+                :key="`question-${unitIndex}`"
+                :class="[
+                  'edit-part',
+                  'level2',
+                  `small-${detailIndex}-${unitIndex}`,
+                  {
+                    'question-duplicate':
+                      paperDetailUnit.question.checkDuplicateStatus ==
+                      'TO_BE_DISPOSE',
+                    'is-danger': !paperDetailUnit.score,
+                  },
+                ]"
+              >
+                <div class="level2-hover-show">
+                  <div class="box-justify">
+                    <div class="gray-btn-group">
+                      <span
+                        v-if="
+                          paperDetailUnit.question.checkDuplicateStatus ===
+                          'TO_BE_DISPOSE'
+                        "
+                        @click="
+                          toCheckDuplicateQuestion(paperDetailUnit.question.id)
+                        "
+                        >进入查重</span
+                      >
+                      <span @click="toChangeQues(paperDetailUnit)">换题</span>
+                      <span @click="toEditQues(paperDetailUnit)">编辑</span>
+                      <span
+                        v-if="unitIndex"
+                        @click="
+                          toMoveQues(paperDetail.id, paperDetailUnit.id, 'up')
+                        "
+                        >上移</span
+                      >
+                      <span
+                        v-if="
+                          unitIndex < paperDetail.paperDetailUnits.length - 1
+                        "
+                        @click="
+                          toMoveQues(paperDetail.id, paperDetailUnit.id, 'down')
+                        "
+                        >下移</span
+                      >
+                      <span @click="toDeleteQues(paperDetailUnit)">删除</span>
+                      <span
+                        v-if="isNested(paperDetailUnit.questionType)"
+                        @click="
+                          paperDetailUnit.showSubQuestions =
+                            !paperDetailUnit.showSubQuestions
+                        "
+                        >{{
+                          paperDetailUnit.showSubQuestions ? "收起" : "展开"
+                        }}</span
+                      >
+                    </div>
+                    <span class="tips-info">
+                      {{ paperDetailUnit.question.bodyLengthText }}
+                    </span>
                   </div>
-                  <span class="tips-info">
-                    {{ paperDetailUnit.question.bodyLengthText }}
-                  </span>
-                </div>
 
-                <!-- <el-button
+                  <!-- <el-button
                     v-if="
                       paperDetailUnit.question.checkDuplicateStatus ===
                       'TO_BE_DISPOSE'
@@ -534,148 +551,51 @@
                         !paperDetailUnit.showSubQuestions
                     "
                   ></el-button> -->
-              </div>
-              <div class="edit-cont">
-                <div class="edit-cont-title">
-                  <span>{{ paperDetailUnit.number }}.</span>
-                  <rich-text
-                    :text-json="paperDetailUnit.question.quesBody"
-                  ></rich-text>
-                  <span :class="{ 'color-danger': !paperDetailUnit.score }">
-                    ({{ paperDetailUnit.score }}分)
-                  </span>
-                </div>
-                <div class="edit-cont-body">
-                  <div
-                    v-for="(quesOption, optionIndex) in paperDetailUnit.question
-                      .quesOptions"
-                    :key="optionIndex"
-                    class="paper-option"
-                  >
-                    <span>{{ optionIndex | optionOrderWordFilter }}. </span>
-                    <rich-text :text-json="quesOption.optionBody"></rich-text>
-                  </div>
-                  <div v-if="!isNested(paperDetailUnit.questionType)">
-                    <div v-show="quesAnswerShow" class="paper-answer">
-                      <span>答案:</span>
-                      <question-answer
-                        :data="paperDetailUnit.question"
-                      ></question-answer>
-                    </div>
-                  </div>
-                </div>
-                <div
-                  v-if="paperDetailUnit.question.quesProperties"
-                  class="edit-cont-props"
-                  style="margin-top: 10px"
-                >
-                  <el-tag
-                    v-for="(content, propIndex) in paperDetailUnit.question
-                      .quesProperties"
-                    :key="propIndex"
-                    type="primary"
-                    effect="dark"
-                    style="margin-right: 5px; margin-bottom: 5px"
-                  >
-                    <!-- {{ content.courseProperty && content.courseProperty.name }}
-                    <span style="margin: 0 3px">/</span> -->
-                    {{ content.firstProperty && content.firstProperty.name }}
-                    <span v-if="content.secondProperty" style="margin: 0 3px"
-                      >/</span
-                    >
-                    {{ content.secondProperty && content.secondProperty.name }}
-                  </el-tag>
-                </div>
-              </div>
-              <div v-show="quesTagShow" class="edit-property">
-                <div class="edit-property-box">
-                  <div
-                    v-for="(questionTag, tagIndex) in paperDetailUnit.question
-                      .tags"
-                    :key="tagIndex"
-                    class="edit-property-item"
-                  >
-                    <div class="edit-property-body level2">
-                      <div class="edit-property-title">
-                        {{ questionTag.tag }}
-                      </div>
-                      <div class="edit-property-content">
-                        {{ questionTag.content }}
-                      </div>
-                    </div>
-                  </div>
                 </div>
-              </div>
-            </div>
-            <div
-              v-if="isNested(paperDetailUnit.questionType)"
-              v-show="paperDetailUnit.showSubQuestions"
-              :key="`question-sub-${unitIndex}`"
-              class="edit-paper-question-subs"
-            >
-              <div
-                v-for="(subQuestion, subIndex) in paperDetailUnit.question
-                  .subQuestions"
-                :key="subIndex"
-                :class="[
-                  'edit-part',
-                  {
-                    'is-danger': !paperDetailUnit.subScoreList[subIndex],
-                  },
-                ]"
-              >
                 <div class="edit-cont">
                   <div class="edit-cont-title">
-                    <span>{{ subIndex + 1 }}. </span>
-                    <rich-text :text-json="subQuestion.quesBody"></rich-text>
-                    <span
-                      :class="{
-                        'color-danger': !paperDetailUnit.subScoreList[subIndex],
-                      }"
-                    >
-                      ({{ paperDetailUnit.subScoreList[subIndex] }}分)
+                    <span>{{ paperDetailUnit.number }}.</span>
+                    <rich-text
+                      :text-json="paperDetailUnit.question.quesBody"
+                    ></rich-text>
+                    <span :class="{ 'color-danger': !paperDetailUnit.score }">
+                      ({{ paperDetailUnit.score }}分)
                     </span>
                   </div>
-
-                  <div
-                    v-if="!isMatchingQuestion(paperDetailUnit.questionType)"
-                    class="edit-cont-body"
-                  >
+                  <div class="edit-cont-body">
                     <div
-                      v-for="(
-                        subQuesOption, subOptIndex
-                      ) in subQuestion.quesOptions"
-                      :key="subOptIndex"
+                      v-for="(quesOption, optionIndex) in paperDetailUnit
+                        .question.quesOptions"
+                      :key="optionIndex"
                       class="paper-option"
                     >
-                      <span>{{ subOptIndex | optionOrderWordFilter }}. </span>
-                      <rich-text
-                        :text-json="subQuesOption.optionBody"
-                      ></rich-text>
+                      <span>{{ optionIndex | optionOrderWordFilter }}. </span>
+                      <rich-text :text-json="quesOption.optionBody"></rich-text>
+                    </div>
+                    <div v-if="!isNested(paperDetailUnit.questionType)">
+                      <div v-show="quesAnswerShow" class="paper-answer">
+                        <span>答案:</span>
+                        <question-answer
+                          :data="paperDetailUnit.question"
+                        ></question-answer>
+                      </div>
                     </div>
-                  </div>
-
-                  <div v-show="quesAnswerShow" class="paper-answer">
-                    <span>答案:</span>
-                    <question-answer :data="subQuestion"></question-answer>
-                    <!-- <rich-text :text-json="subQuestion.quesAnswer"></rich-text> -->
                   </div>
                   <div
-                    v-if="subQuestion.quesProperties"
+                    v-if="paperDetailUnit.question.quesProperties"
                     class="edit-cont-props"
                     style="margin-top: 10px"
                   >
                     <el-tag
-                      v-for="(content, propIndex) in subQuestion.quesProperties"
+                      v-for="(content, propIndex) in paperDetailUnit.question
+                        .quesProperties"
                       :key="propIndex"
                       type="primary"
                       effect="dark"
                       style="margin-right: 5px; margin-bottom: 5px"
                     >
-                      <!-- {{
-                        content.courseProperty && content.courseProperty.name
-                      }}
-                      <span style="margin: 0 3px">/</span> -->
+                      <!-- {{ content.courseProperty && content.courseProperty.name }}
+                    <span style="margin: 0 3px">/</span> -->
                       {{ content.firstProperty && content.firstProperty.name }}
                       <span v-if="content.secondProperty" style="margin: 0 3px"
                         >/</span
@@ -686,7 +606,113 @@
                     </el-tag>
                   </div>
                 </div>
-                <!-- <div
+                <div v-show="quesTagShow" class="edit-property">
+                  <div class="edit-property-box">
+                    <div
+                      v-for="(questionTag, tagIndex) in paperDetailUnit.question
+                        .tags"
+                      :key="tagIndex"
+                      class="edit-property-item"
+                    >
+                      <div class="edit-property-body level2">
+                        <div class="edit-property-title">
+                          {{ questionTag.tag }}
+                        </div>
+                        <div class="edit-property-content">
+                          {{ questionTag.content }}
+                        </div>
+                      </div>
+                    </div>
+                  </div>
+                </div>
+              </div>
+              <div
+                v-if="isNested(paperDetailUnit.questionType)"
+                v-show="paperDetailUnit.showSubQuestions"
+                :key="`question-sub-${unitIndex}`"
+                class="edit-paper-question-subs"
+              >
+                <div
+                  v-for="(subQuestion, subIndex) in paperDetailUnit.question
+                    .subQuestions"
+                  :key="subIndex"
+                  :class="[
+                    'edit-part',
+                    {
+                      'is-danger': !paperDetailUnit.subScoreList[subIndex],
+                    },
+                  ]"
+                >
+                  <div class="edit-cont">
+                    <div class="edit-cont-title">
+                      <span>{{ subIndex + 1 }}. </span>
+                      <rich-text :text-json="subQuestion.quesBody"></rich-text>
+                      <span
+                        :class="{
+                          'color-danger':
+                            !paperDetailUnit.subScoreList[subIndex],
+                        }"
+                      >
+                        ({{ paperDetailUnit.subScoreList[subIndex] }}分)
+                      </span>
+                    </div>
+
+                    <div
+                      v-if="!isMatchingQuestion(paperDetailUnit.questionType)"
+                      class="edit-cont-body"
+                    >
+                      <div
+                        v-for="(
+                          subQuesOption, subOptIndex
+                        ) in subQuestion.quesOptions"
+                        :key="subOptIndex"
+                        class="paper-option"
+                      >
+                        <span>{{ subOptIndex | optionOrderWordFilter }}. </span>
+                        <rich-text
+                          :text-json="subQuesOption.optionBody"
+                        ></rich-text>
+                      </div>
+                    </div>
+
+                    <div v-show="quesAnswerShow" class="paper-answer">
+                      <span>答案:</span>
+                      <question-answer :data="subQuestion"></question-answer>
+                      <!-- <rich-text :text-json="subQuestion.quesAnswer"></rich-text> -->
+                    </div>
+                    <div
+                      v-if="subQuestion.quesProperties"
+                      class="edit-cont-props"
+                      style="margin-top: 10px"
+                    >
+                      <el-tag
+                        v-for="(
+                          content, propIndex
+                        ) in subQuestion.quesProperties"
+                        :key="propIndex"
+                        type="primary"
+                        effect="dark"
+                        style="margin-right: 5px; margin-bottom: 5px"
+                      >
+                        <!-- {{
+                        content.courseProperty && content.courseProperty.name
+                      }}
+                      <span style="margin: 0 3px">/</span> -->
+                        {{
+                          content.firstProperty && content.firstProperty.name
+                        }}
+                        <span
+                          v-if="content.secondProperty"
+                          style="margin: 0 3px"
+                          >/</span
+                        >
+                        {{
+                          content.secondProperty && content.secondProperty.name
+                        }}
+                      </el-tag>
+                    </div>
+                  </div>
+                  <!-- <div
                   v-if="subQuestion.quesProperties"
                   class="edit-cont-props"
                   style="margin-top: 10px"
@@ -707,27 +733,28 @@
                     {{ content.secondProperty && content.secondProperty.name }}
                   </el-tag>
                 </div> -->
-                <div v-show="quesTagShow" class="edit-property">
-                  <div class="edit-property-box">
-                    <div
-                      v-for="(subQuestionTag, tagIndex) in subQuestion.tags"
-                      :key="tagIndex"
-                      class="edit-property-item"
-                    >
-                      <div class="edit-property-body level2">
-                        <div class="edit-property-title">
-                          {{ subQuestionTag.tag }}
-                        </div>
-                        <div class="edit-property-content">
-                          {{ subQuestionTag.content }}
+                  <div v-show="quesTagShow" class="edit-property">
+                    <div class="edit-property-box">
+                      <div
+                        v-for="(subQuestionTag, tagIndex) in subQuestion.tags"
+                        :key="tagIndex"
+                        class="edit-property-item"
+                      >
+                        <div class="edit-property-body level2">
+                          <div class="edit-property-title">
+                            {{ subQuestionTag.tag }}
+                          </div>
+                          <div class="edit-property-content">
+                            {{ subQuestionTag.content }}
+                          </div>
                         </div>
                       </div>
                     </div>
                   </div>
                 </div>
               </div>
-            </div>
-          </template>
+            </template>
+          </div>
         </div>
       </div>
     </div>
@@ -885,6 +912,8 @@ export default {
       // upload property
       propertyTemplateUrl: "",
       uploadPropertyUrl: "",
+      bigOpenStatusIds: [],
+      smallOpenStatusIds: [],
     };
   },
   computed: {
@@ -910,26 +939,73 @@ export default {
     this.initPaper();
   },
   methods: {
-    async initPaper(bool) {
+    saveOpenStatus() {
+      let bigOpenStatusIds = [];
+      let smallOpenStatusIds = [];
+      for (let i = 0; i < this.paper.paperDetails.length; i++) {
+        let detail = this.paper.paperDetails[i];
+        bigOpenStatusIds.push({
+          id: detail.id,
+          showQuestions: detail.showQuestions,
+        });
+        for (let j = 0; j < detail.paperDetailUnits.length; j++) {
+          let question = detail.paperDetailUnits[j];
+          smallOpenStatusIds.push({
+            id: question.id,
+            showSubQuestions: question.showSubQuestions,
+          });
+        }
+      }
+      this.bigOpenStatusIds = bigOpenStatusIds;
+      this.smallOpenStatusIds = smallOpenStatusIds;
+    },
+    async initPaper(type) {
+      this.saveOpenStatus();
       const res = await paperDetailApi(this.paperId);
       res.data.paperDetails.forEach((detail) => {
-        detail.showQuestions = true;
+        detail.showQuestions =
+          this.bigOpenStatusIds.find((item) => item.id == detail.id)
+            ?.showQuestions ?? true;
+        if (type == "addSmall" && detail.id == this.curDetail.id) {
+          detail.showQuestions = true;
+        }
         detail.paperDetailUnits.forEach((question) => {
-          question.showSubQuestions = true;
+          question.showSubQuestions =
+            this.smallOpenStatusIds.find((item) => item.id == question.id)
+              ?.showSubQuestions ?? true;
         });
       });
 
       this.paper = res.data;
       this.paper.title = this.paper.title || this.paper.name;
       this.showCheckDuplicate();
-      if (bool) {
-        this.$nextTick(() => {
-          this.$refs.editPaper.scrollTo({
+      if (type == "addBig") {
+        setTimeout(() => {
+          this.$refs.editPaperBody.scrollTo({
             left: 0,
             top: 100000,
             behavior: "smooth",
           });
-        });
+        }, 20);
+      } else if (type == "addSmall") {
+        let bigIndex = this.paper.paperDetails.findIndex(
+          (item) => item.id == this.curDetail.id
+        );
+        if (bigIndex > -1) {
+          let cls = `small-${bigIndex}-${
+            this.paper.paperDetails[bigIndex].paperDetailUnits.length - 1
+          }`;
+          setTimeout(() => {
+            const el = document.querySelector("." + cls);
+            // this.$refs.editPaperBody.scrollTo({
+            //   left: 0,
+            //   top: el.getBoundingClientRect().top - 210,
+            //   behavior: "smooth",
+            // });
+
+            el.scrollIntoView({ behavior: "smooth", block: "start" });
+          }, 100);
+        }
       }
       if (!this.checkPaperQuestionAllHasScore()) {
         this.$notify.error("有小题未设置分值!");
@@ -1123,7 +1199,7 @@ export default {
       if (!res) return;
 
       this.$message.success("添加成功!");
-      this.initPaper();
+      this.initPaper("addSmall");
     },
     addBigQuestion() {
       this.curDetail = {};
@@ -1143,7 +1219,9 @@ export default {
         }).catch(() => {});
         if (!res) return;
         this.$message.success("新增成功!");
-        this.initPaper(true);
+        setTimeout(() => {
+          this.initPaper("addBig");
+        }, 50);
       } else {
         detail.name = detail.detailName;
         const res = await paperDetailUpdateApi(this.paperId, detail).catch(
@@ -1317,8 +1395,8 @@ export default {
 </script>
 <style lang="scss" scoped>
 .edit-paper {
-  height: 100vh;
-  overflow: auto;
+  height: calc(100vh - 140px);
+  margin-top: 140px;
   .edit-warning-wrap {
     height: 69px;