Selaa lähdekoodia

提交题库页面代码

weiwenhai 6 vuotta sitten
vanhempi
commit
5e21454e65

+ 3 - 0
package.json

@@ -10,10 +10,13 @@
     "test:unit": "vue-cli-service test:unit"
   },
   "dependencies": {
+    "@ckeditor/ckeditor5-build-inline": "^11.2.0",
+    "@ckeditor/ckeditor5-vue": "^1.0.0-beta.1",
     "axios": "^0.18.0",
     "element-ui": "^2.4.9",
     "lodash": "^4.17.11",
     "moment": "^2.22.2",
+    "randomcolor": "^0.5.3",
     "rasterizehtml": "^1.3.0",
     "register-service-worker": "^1.0.0",
     "vue": "^2.5.17",

+ 0 - 3
src/modules/questions/component/ckeditor.vue

@@ -1,3 +0,0 @@
-<template>
-  <div>CKeditor</div>
-</template>

+ 32 - 30
src/modules/questions/constants/constants.js

@@ -1,5 +1,6 @@
 import Vue from "vue";
 import _ from "lodash";
+import CKEditor from "@ckeditor/ckeditor5-vue";
 export const CORE_API = "/api/ecs_core"; //基础信息API
 export const EXAM_WORK_API = "/api/ecs_exam_work"; //考务信息API
 export const Q_API = "/api/ecs_ques"; //题库API
@@ -61,35 +62,36 @@ Vue.filter("exportTypesFilter", function(value) {
 });
 
 Vue.prototype._ = _;
+Vue.use(CKEditor);
 
-// Vue.directive("questionAudio", {
-//   bind: function(el, binding, vnode) {
-//     addAudio(el, binding, vnode);
-//   },
-//   inserted: function(el, binding, vnode) {},
-//   update: function(el, binding, vnode) {},
-//   componentUpdated: function(el, binding, vnode) {},
-//   unbind: function(el, binding, vnode) {}
-// });
+Vue.directive("questionAudio", {
+  bind: function(el, binding, vnode) {
+    addAudio(el, binding, vnode);
+  }
+});
 
-// function addAudio(el, binding, vnode) {
-//   let $el = $(el);
-//   if (vnode.data.attrs.hasAudio) {
-//     $el.find("p>a").each(function() {
-//       var questionAudioId = $(this).attr("id");
-//       if (questionAudioId) {
-//         vnode.context.$http
-//           .get(Q_API + "/questionAudio/" + questionAudioId)
-//           .then(response => {
-//             if (response && response.body) {
-//               let audioFlag =
-//                 '<audio controls><source src="http://exam-cloud-test.b0.upaiyun.com' +
-//                 response.body.fileUrl +
-//                 '" type="audio/mpeg"></audio>';
-//               $(this).append(audioFlag);
-//             }
-//           });
-//       }
-//     });
-//   }
-// }
+function addAudio(el, binding, vnode) {
+  // console.log(el, binding, vnode);
+  var list = el.getElementsByTagName("a");
+  for (let obj of list) {
+    var questionAudioId = obj.getAttribute("id");
+    if (questionAudioId) {
+      console.log("come in");
+      vnode.context.$http
+        .get(Q_API + "/questionAudio/" + questionAudioId)
+        .then(response => {
+          console.log("response:", response);
+          if (response && response.data) {
+            let audioFlag =
+              '<audio controls><source src="http://exam-cloud-test.b0.upaiyun.com' +
+              response.data.fileUrl +
+              '" type="audio/mpeg"></audio>';
+            var b = document.createElement("span");
+            b.innerHTML = audioFlag;
+            obj.append(b);
+          }
+        });
+    }
+  }
+  console.log("el:", el);
+}

+ 12 - 6
src/modules/questions/views/EditOtherQuestion.vue

@@ -157,8 +157,9 @@
             <el-col :xs="30" :sm="30" :md="30" :lg="30">
               <el-form-item label="题干" prop="quesBody">
                 <ckeditor
+                  :editor="editor"
                   v-model="quesModel.quesBody"
-                  :height="'100px'"
+                  :config="editorConfig"
                 ></ckeditor>
               </el-form-item>
             </el-col>
@@ -172,8 +173,9 @@
             <el-col :xs="30" :sm="30" :md="30" :lg="30">
               <el-form-item :label="quesOption.number">
                 <ckeditor
-                  v-model="quesOption.optionBody"
-                  :height="'50px'"
+                  :editor="editor"
+                  v-model="quesOption.quesBody"
+                  :config="editorConfig"
                 ></ckeditor>
               </el-form-item>
             </el-col>
@@ -188,8 +190,9 @@
           >
             <el-form-item label="答案" prop="quesAnswer">
               <ckeditor
+                :editor="editor"
                 v-model="quesModel.quesAnswer"
-                :height="'100px'"
+                :config="editorConfig"
               ></ckeditor>
             </el-form-item>
           </div>
@@ -233,11 +236,14 @@
 </template>
 <script>
 import { CORE_API, QUESTION_TYPES } from "../constants/constants";
-import ckeditor from "../component/ckeditor.vue";
+import ClassicEditor from "@ckeditor/ckeditor5-build-inline";
 export default {
-  components: { ckeditor },
   data() {
     return {
+      editor: ClassicEditor,
+      editorConfig: {
+        // The configuration of the editor.
+      },
       fullscreenLoading: false,
       questionTypes: QUESTION_TYPES,
       courseName: "",

+ 1574 - 0
src/modules/questions/views/EditPaper.vue

@@ -0,0 +1,1574 @@
+<template>
+  <div
+    class="paper"
+    v-loading="loading"
+    element-loading-text="拼命加载中。。。"
+  >
+    <div class="edit-paper-top">
+      <div class="edit-paper-top-inline">
+        <div class="paper-top-div">
+          <span class="paper-top-title">课程代码:</span>
+          <span class="paper-top-value">{{ paper.course.code }}</span>
+        </div>
+        <div class="paper-top-div">
+          <span class="paper-top-title">课程名称:</span>
+          <span class="paper-top-value">{{ paper.course.name }}</span>
+        </div>
+        <div class="paper-top-div">
+          <span class="paper-top-title">试卷名称:</span>
+          <input
+            class="paperName-input"
+            placeholder="试卷名称"
+            v-model="paper.name"
+          />
+        </div>
+        <div class="paper-top-div">
+          <span class="paper-top-title">试卷难度:</span>
+          <span class="paper-top-value">{{ paper.difficultyDegree }}</span>
+        </div>
+        <div>
+          <el-button type="primary" @click="savePaper" size="small">
+            保存
+          </el-button>
+          <el-button type="danger" @click="deletePaper(paper.id);" size="small">
+            删除
+          </el-button>
+          <el-button
+            type="info"
+            :loading="duplicateLoading"
+            @click="getreduplicateQuestions"
+            size="small"
+          >
+            查重
+          </el-button>
+          <el-button @click="back" size="small"> 退回 </el-button>
+          <el-button
+            v-show="parentView == 'import_paper'"
+            type="warning"
+            @click="openDialog"
+            size="small"
+          >
+            上传音频文件
+          </el-button>
+        </div>
+      </div>
+    </div>
+    <div class="paperName">
+      <div>
+        <br />
+        <h3 class="text-center">{{ paper.course.name }}&nbsp;试卷</h3>
+        <h5 class="text-center">
+          <span v-show="paper.hasAudio">(含音频试卷)</span>
+        </h5>
+        <br />
+        <h4 class="text-center">(课程代码&nbsp;{{ paper.course.code }})</h4>
+        <br />
+      </div>
+      <div class="text-left">
+        <el-table
+          :data="paper.paperDetails"
+          border
+          style="width: 100%;text-align:center;"
+        >
+          <el-table-column header-align="center" label="大题名称">
+            <template slot-scope="scope">
+              <span>{{ scope.row.name }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column header-align="center" label="大题总分">
+            <template slot-scope="scope">
+              <span>{{ scope.row.score }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column header-align="center" label="小题数量">
+            <template slot-scope="scope">
+              <span>{{ scope.row.unitCount }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column header-align="center" label="公开数量">
+            <template slot-scope="scope">
+              <span>{{ scope.row.pubCount }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column header-align="center" label="非公开数量">
+            <template slot-scope="scope">
+              <span>{{ scope.row.noPubCount }}</span>
+            </template>
+          </el-table-column>
+        </el-table>
+        <!-- create by wwh -->
+        <div class="mainQues" style="margin-top:20px;margin-left:0px;">
+          <div class="mainQuesTitle">
+            <span>考试说明:</span>
+            <span>
+              <el-button size="small" @click="openEditExamPaperRemark"
+                >编辑</el-button
+              >
+            </span>
+            <div style="width:550px;margin-left:20px;margin-top:20px;">
+              <span v-html="paper.examRemark"></span>
+            </div>
+          </div>
+        </div>
+        <!-- end by wwh -->
+        <div>
+          <h1>本试卷满分{{ paper.totalScore }}分。</h1>
+        </div>
+        <br />
+      </div>
+    </div>
+    <div>
+      <!-- 循环大题 -->
+      <div
+        class="mainQues"
+        v-show="paperDetailShow(paperDetail)"
+        v-for="(paperDetail, index) in paper.paperDetails"
+        :key="index"
+      >
+        <div
+          class="mainQuesTitle"
+          @mouseover="quesMouseOver(paperDetail.id);"
+          @mouseout="quesMouseOut(paperDetail.id);"
+        >
+          <span>{{ paperDetail.cnNum }}</span> <span>.</span>
+          <span>{{ paperDetail.name }}</span>
+          <span
+            >({{ !paperDetail.title ? "本大题" : paperDetail.title + "," }}共{{
+              paperDetail.unitCount
+            }}小题,满分{{ paperDetail.score }}分)</span
+          >
+          <span class="btnDiv" :id="paperDetail.id">
+            <el-button
+              v-show="parentView == 'gen_paper'"
+              size="small"
+              @click="selectQues(paperDetail.id);"
+              >选题</el-button
+            >
+            <el-button size="small" @click="openEditPaperDetail(paperDetail);"
+              >编辑</el-button
+            >
+            <el-button
+              size="small"
+              type="danger"
+              @click="deletePaperDetail(paperDetail.id);"
+              >删除</el-button
+            >
+            <el-button
+              size="small"
+              icon="arrow-up"
+              @click.stop="hideContent(index);"
+              >1</el-button
+            >
+            <el-button
+              size="small"
+              icon="arrow-down"
+              @click.stop="showContent(index);"
+              >2</el-button
+            >
+          </span>
+        </div>
+        <!-- 循环小题 -->
+        <div v-show="showQuestions[index].is_show">
+          <div
+            class="ques"
+            v-show="quesShow(paperDetailUnit.id)"
+            v-for="(paperDetailUnit, n) in paperDetail.paperDetailUnits"
+            :key="n"
+          >
+            <reduplicate_mark
+              :id="paperDetailUnit.id"
+              :show="reduplicateMarkShow(paperDetailUnit.id)"
+              :fillColor="reduplicateMarkColor(paperDetailUnit.id)"
+              :checked="reduplicateMarkCheck(paperDetailUnit.id)"
+              @reduplicate_mark_check="reduplicate_mark_check"
+            >
+            </reduplicate_mark>
+            <div
+              class="quesSelect"
+              @mouseover="quesMouseOver(paperDetailUnit.id);"
+              @mouseout="quesMouseOut(paperDetailUnit.id);"
+            >
+              <div class="btnDiv" :id="paperDetailUnit.id">
+                <el-button
+                  size="small"
+                  @click="editQues(paperDetailUnit, paperDetailUnit.question);"
+                  >编辑
+                </el-button>
+                <el-button
+                  type="danger"
+                  size="small"
+                  @click="deleteQues(paperDetailUnit);"
+                  >删除</el-button
+                >
+              </div>
+              <div class="quesBody">
+                <span class="ques-title">{{ paperDetailUnit.number }}.</span>
+                <span
+                  class="ques-body"
+                  v-question-audio
+                  :hasAudio="paperDetailUnit.question.hasAudio"
+                  :questionId="paperDetailUnit.question.id"
+                  v-html="paperDetailUnit.question.quesBody"
+                ></span>
+                <span class="score-span"
+                  >({{ paperDetailUnit.score }}分)</span
+                >
+              </div>
+              <div
+                class="quesOption"
+                v-for="(quesOption, index) in paperDetailUnit.question
+                  .quesOptions"
+                :key="index"
+              >
+                <span class="ques-title"
+                  >{{ index | optionOrderWordFilter }}.</span
+                >
+                <span
+                  class="ques-body"
+                  v-question-audio
+                  :hasAudio="paperDetailUnit.question.hasAudio"
+                  :questionId="paperDetailUnit.question.id"
+                  v-html="quesOption.optionBody"
+                ></span>
+              </div>
+            </div>
+            <br />
+            <div
+              class="subQues"
+              v-show="quesShow(subQuestion.id)"
+              v-for="(subQuestion, m) in paperDetailUnit.question.subQuestions"
+              :key="m"
+            >
+              <reduplicate_mark
+                :show="reduplicateMarkShow(subQuestion.id)"
+              ></reduplicate_mark>
+              <div
+                class="quesSelect"
+                @mouseover="
+                  quesMouseOver(getSubQuesEditId(paperDetailUnit, subQuestion));
+                "
+                @mouseout="
+                  quesMouseOut(getSubQuesEditId(paperDetailUnit, subQuestion));
+                "
+              >
+                <div
+                  class="btnDiv"
+                  :id="getSubQuesEditId(paperDetailUnit, subQuestion)"
+                >
+                  <el-button
+                    size="small"
+                    @click="editQues(paperDetailUnit, subQuestion);"
+                    >编辑</el-button
+                  >
+                </div>
+                <div class="quesBody">
+                  <span class="ques-title"
+                    >{{ subQuestion.quesParams.number }}.</span
+                  >
+                  <span v-html="subQuestion.quesBody"></span>
+                  <span>({{ paperDetailUnit.subScoreList[index] }}分)</span>
+                </div>
+                <div
+                  class="quesOption"
+                  v-for="(subQuesOption, index) in subQuestion.quesOptions"
+                  :key="index"
+                >
+                  <span class="ques-title"
+                    >{{ index | optionOrderWordFilter }}.</span
+                  >
+                  <span v-html="subQuesOption.optionBody"></span>
+                </div>
+                <br />
+              </div>
+            </div>
+          </div>
+          <br />
+        </div>
+      </div>
+    </div>
+    <div class="text-left">
+      <!-- 编辑大题弹框 -->
+      <el-dialog
+        @close="closeQuesDialog"
+        title="大题名称编辑"
+        v-loading.body="detailLoading"
+        element-loading-text="保存中。。。"
+        :visible.sync="paperDatailDialog"
+      >
+        <el-form
+          :model="editpaperDetail"
+          label-position="right"
+          label-width="80px"
+        >
+          <el-row :gutter="10">
+            <el-col :xs="10" :sm="10" :md="10" :lg="10">
+              <el-form-item label="大题名称" placeholder="大题名称">
+                <el-input v-model="editpaperDetail.name" />
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row>
+            <el-form-item>
+              <el-button
+                type="primary"
+                @click="savePaperDatail(editpaperDetail);"
+                >保存</el-button
+              >
+              <el-button @click="closePaperDatailDialog();">取消</el-button>
+            </el-form-item>
+          </el-row>
+        </el-form>
+      </el-dialog>
+      <!-- 编辑试题弹框 -->
+      <el-dialog
+        @close="closeQuesDialog"
+        title="试题编辑"
+        v-loading.body="dialogLoading"
+        element-loading-text="保存中。。。"
+        :visible.sync="quesDialog"
+      >
+        <el-form :model="quesModel" label-position="right" label-width="80px">
+          <el-row :gutter="10">
+            <el-col :xs="10" :sm="10" :md="10" :lg="10">
+              <el-form-item label="题型">
+                <el-select
+                  :disabled="true"
+                  v-model="quesModel.questionType"
+                  placeholder="请输入题型"
+                >
+                  <el-option
+                    v-for="item in questionTypes"
+                    :label="item.label"
+                    :value="item.value"
+                    :key="item.value"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :xs="10" :sm="10" :md="10" :lg="10">
+              <el-form-item label="分值">
+                <el-input
+                  placeholder="分值"
+                  :disabled="quesModel.questionType == 'NESTED_ANSWER_QUESTION'"
+                  v-model="quesModel.score"
+                ></el-input>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <!-- create by  weiwenhai 添加难度,公开度,试题属性 -->
+          <el-row :gutter="10">
+            <el-col :xs="10" :sm="10" :md="10" :lg="10">
+              <el-form-item label="难度">
+                <el-select
+                  v-model="quesModel.difficultyDegree"
+                  placeholder="请输入难度"
+                  :disabled="
+                    quesModel.questionType == 'NESTED_ANSWER_QUESTION'
+                      ? true
+                      : updatePorperty
+                  "
+                >
+                  <el-option
+                    v-for="item in difficultyDegreeList"
+                    :label="item.label"
+                    :value="item.value"
+                    :key="item.value"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :xs="10" :sm="10" :md="10" :lg="10">
+              <el-form-item label="公开度">
+                <el-select
+                  v-model="quesModel.publicity"
+                  placeholder="请输入公开度"
+                  :disabled="updatePorperty"
+                >
+                  <el-option
+                    v-for="item in publicityList"
+                    :label="item.label"
+                    :value="item.value"
+                    :key="item.value"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row :gutter="10">
+            <el-col :xs="20" :sm="20" :md="20" :lg="20">
+              <el-form-item label="属性列表">
+                <el-tooltip
+                  placement="top"
+                  v-for="(content, index) in quesModel.quesProperties"
+                  :key="index"
+                >
+                  <div slot="content">
+                    <span v-if="content.firstProperty != null"
+                      >一级属性:{{ content.firstProperty.name }}</span
+                    ><br />
+                    <span v-if="content.secondProperty != null"
+                      >二级属性:{{ content.secondProperty.name }}</span
+                    >
+                  </div>
+                  <span>
+                    <el-tag
+                      style="margin-right:5px;"
+                      :key="content.id"
+                      :closable="!updatePorperty"
+                      type="success"
+                      @close="handleClose(content);"
+                    >
+                      {{ content.coursePropertyName }}
+                    </el-tag>
+                  </span>
+                </el-tooltip>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row :gutter="20">
+            <el-col :xs="6" :sm="6" :md="6" :lg="6">
+              <el-form-item label="属性名">
+                <el-select
+                  v-model="coursePropertyName"
+                  placeholder="属性名"
+                  @change="searchFirst"
+                  class="property_with"
+                  :disabled="updatePorperty"
+                >
+                  <el-option label="请选择" value=""></el-option>
+                  <el-option
+                    v-for="item in coursePropertyList"
+                    :label="item.name"
+                    :value="item.name"
+                    :key="item.name"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :xs="6" :sm="6" :md="6" :lg="6">
+              <el-form-item label="一级">
+                <el-select
+                  v-model="firstPropertyId"
+                  placeholder="一级"
+                  @change="searchSecond"
+                  class="property_with"
+                  :disabled="updatePorperty"
+                >
+                  <el-option label="请选择" value=""></el-option>
+                  <el-option
+                    v-for="item in firstPropertyList"
+                    :label="item.name"
+                    :value="item.id"
+                    :key="item.id"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :xs="6" :sm="6" :md="6" :lg="6">
+              <el-form-item label="二级">
+                <el-select
+                  v-model="secondPropertyId"
+                  placeholder="二级"
+                  class="property_with"
+                  :disabled="updatePorperty"
+                >
+                  <el-option label="请选择" value=""></el-option>
+                  <el-option
+                    v-for="item in secondPropertyList"
+                    :label="item.name"
+                    :value="item.id"
+                    :key="item.id"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :xs="3" :sm="3" :md="3" :lg="3">
+              <el-form-item>
+                <el-button
+                  type="info"
+                  @click="insertProperty"
+                  style="margin-left:-30px;"
+                  :disabled="updatePorperty"
+                  >新增属性
+                </el-button>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <!-- end by weiwenhai -->
+          <div v-if="paper.paperType == 'IMPORT'">
+            <el-row>
+              <el-col>
+                <el-form-item label="题目">
+                  <ckeditor
+                    :editor="editor"
+                    v-model="quesModel.quesBody"
+                    :config="editorConfig"
+                  ></ckeditor>
+                </el-form-item>
+              </el-col>
+            </el-row>
+            <el-form-item
+              v-for="(quesOption, index) in quesModel.quesOptions"
+              :key="index"
+            >
+              <el-col :span="2">
+                <el-radio
+                  v-model="singleRightAnswer"
+                  :label="index | optionOrderWordFilter"
+                  v-if="quesModel.questionType === 'SINGLE_ANSWER_QUESTION'"
+                ></el-radio>
+                <el-checkbox
+                  v-model="multipleRightAnswer"
+                  :label="index | optionOrderWordFilter"
+                  v-if="quesModel.questionType === 'MULTIPLE_ANSWER_QUESTION'"
+                ></el-checkbox>
+              </el-col>
+              <el-col :span="20">
+                <ckeditor
+                  :editor="editor"
+                  v-model="quesOption.optionBody"
+                  :config="editorConfig"
+                ></ckeditor>
+              </el-col>
+              <el-col :span="2">
+                <i
+                  class="el-icon-delete"
+                  @click.prevent="removeQuesOption(quesOption);"
+                  title="删除"
+                ></i>
+              </el-col>
+            </el-form-item>
+            <div
+              v-if="
+                quesModel.questionType != 'NESTED_ANSWER_QUESTION' &&
+                  quesModel.questionType != 'SINGLE_ANSWER_QUESTION' &&
+                  quesModel.questionType != 'MULTIPLE_ANSWER_QUESTION' &&
+                  quesModel.questionType != 'BOOL_ANSWER_QUESTION'
+              "
+            >
+              <el-form-item label="答案">
+                <ckeditor
+                  :editor="editor"
+                  v-model="quesModel.quesAnswer"
+                  :config="editorConfig"
+                ></ckeditor>
+              </el-form-item>
+            </div>
+            <!-- 单选或多选 -->
+            <div
+              v-if="
+                quesModel.questionType == 'SINGLE_ANSWER_QUESTION' ||
+                  quesModel.questionType == 'MULTIPLE_ANSWER_QUESTION'
+              "
+            >
+              <el-form-item label="答案">
+                <span v-html="answer"></span>
+              </el-form-item>
+            </div>
+            <div v-if="quesModel.questionType == 'BOOL_ANSWER_QUESTION'">
+              <el-row>
+                <el-col>
+                  <el-form-item label="答案" prop="quesAnswer">
+                    <el-select
+                      v-model="quesModel.quesAnswer"
+                      placeholder="请选择"
+                    >
+                      <el-option
+                        v-for="op in options"
+                        :label="op"
+                        :value="op"
+                        :key="op"
+                      >
+                      </el-option>
+                    </el-select>
+                  </el-form-item>
+                </el-col>
+              </el-row>
+            </div>
+          </div>
+          <div>
+            <el-form-item>
+              <el-button
+                @click="addQuesOption"
+                v-if="
+                  paper.paperType == 'IMPORT' &&
+                    (quesModel.questionType == 'SINGLE_ANSWER_QUESTION' ||
+                      quesModel.questionType == 'MULTIPLE_ANSWER_QUESTION')
+                "
+              >
+                新增选项
+              </el-button>
+              <el-button type="primary" @click="savePaperDetailUnit();"
+                >保存</el-button
+              >
+              <el-button @click="closeQuesDialog">取消</el-button>
+            </el-form-item>
+          </div>
+        </el-form>
+      </el-dialog>
+      <!-- 考试说明弹框 -->
+      <el-dialog title="考试说明编辑" :visible.sync="paperRemarkDialog">
+        <el-form label-position="right" label-width="80px">
+          <el-row :gutter="10">
+            <el-col :xs="10" :sm="10" :md="10" :lg="10">
+              <el-form-item label="考试说明">
+                <div style="width:550px;">
+                  <ckeditor
+                    :editor="editor"
+                    v-model="examRemark"
+                    :config="editorConfig"
+                  ></ckeditor>
+                </div>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <div style="margin-top:20px;margin-left:40%">
+            <el-button type="primary" @click="savePaperRemark">保存</el-button>
+            <el-button @click="closPaperRemark">取消</el-button>
+          </div>
+        </el-form>
+      </el-dialog>
+      <!-- 上传音频弹框 -->
+      <el-dialog
+        title="上传音频文件"
+        :visible.sync="dialogRadioFile"
+        :before-close="closeAudioDialog"
+      >
+        <el-upload
+          ref="upload"
+          class="upload-demo"
+          :action="uploadAction"
+          :headers="uploadHeaders"
+          :on-preview="handlePreview"
+          :on-remove="handleRemove"
+          :before-remove="beforeRemove"
+          :before-upload="beforeUpload"
+          multiple
+          :limit="6"
+          :on-exceed="handleExceed"
+          :file-list="fileList"
+          :auto-upload="false"
+        >
+          <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
+          <el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传到服务器</el-button>
+          <div slot="tip" class="el-upload__tip">
+            只能上传mp3文件,且一次不超过6个
+          </div>
+        </el-upload>
+      </el-dialog>
+    </div>
+  </div>
+</template>
+
+<script>
+import { Q_API, QUESTION_TYPES } from "../constants/constants";
+import { mapState } from "vuex";
+import reduplicate_mark from "../component/reduplicate_mark.vue";
+import randomColor from "randomcolor";
+import ClassicEditor from "@ckeditor/ckeditor5-build-inline";
+export default {
+  components: {
+    reduplicate_mark
+  },
+  data() {
+    return {
+      uploadAction: "",
+      fileList: [],
+      editor: ClassicEditor,
+      editorConfig: {
+        // The configuration of the editor.
+      },
+      paperId: "",
+      paperDetailId: "",
+      editPaperDetailUnit: "",
+      quesDialog: false,
+      paperDatailDialog: false,
+      paperRemarkDialog: false,
+      parentView: "",
+      paper: {
+        course: {
+          code: "",
+          name: ""
+        },
+        examRemark: ""
+      },
+      loading: false,
+      dialogLoading: false,
+      detailLoading: false,
+      uploadAudioLoading: false,
+      questionTypes: QUESTION_TYPES,
+      questionType: "",
+      quesModel: { quesProperties: [] },
+      editpaperDetail: {},
+      reduplicateQuestions: [],
+      reduplicateGroup: [],
+      reduplicateQuesColor: [],
+      singleRightAnswer: "", //接收单选答案
+      multipleRightAnswer: [], //接收多选答案
+      options: ["正确", "错误"],
+      duplicateLoading: false,
+      dialogRadioFile: false,
+      isUpload: true,
+      message: "",
+      checkResult: false,
+      fileNameList: [],
+      defaultColor: [
+        "Red",
+        "Blue",
+        "LimeGreen",
+        "GoldenRod",
+        "Black",
+        "BlueViolet",
+        "Chocolate",
+        "DarkCyan",
+        "HotPink",
+        "Orange",
+        "IndianRed",
+        "Indigo",
+        "Green",
+        "Aqua",
+        "CadetBlue",
+        "SkyBlue",
+        "SlateBlue",
+        "SlateGray",
+        "Tomato",
+        "VioletRed"
+      ],
+      difficultyDegreeList: [
+        { label: 0.1, value: 0.1 },
+        { label: 0.2, value: 0.2 },
+        { label: 0.3, value: 0.3 },
+        { label: 0.4, value: 0.4 },
+        { label: 0.5, value: 0.5 },
+        { label: 0.6, value: 0.6 },
+        { label: 0.7, value: 0.7 },
+        { label: 0.8, value: 0.8 },
+        { label: 0.9, value: 0.9 },
+        { label: 1.0, value: 1.0 }
+      ],
+      publicityList: [
+        { label: "公开", value: true },
+        { label: "非公开", value: false }
+      ],
+      coursePropertyList: [],
+      coursePropertyName: "", //课程属性名
+      firstPropertyList: [], //一级属性集合
+      firstPropertyId: "", //一级属性id
+      secondPropertyList: [], //二级属性集合
+      secondPropertyId: "", //二级属性id
+      examRemark: "",
+      showQuestions: []
+    };
+  },
+  methods: {
+    submitUpload (){
+      this.$refs.upload.submit();
+    },
+    handleRemove(file, fileList) {
+      console.log(file, fileList);
+    },
+    handlePreview(file) {
+      console.log(file);
+    },
+    handleExceed(files, fileList) {
+      this.$message.warning(
+        `当前限制选择 6 个文件,本次选择了 ${
+          files.length
+        } 个文件,共选择了 ${files.length + fileList.length} 个文件`
+      );
+    },
+    beforeRemove(file) {
+      return this.$confirm(`确定移除 ${file.name}?`);
+    },
+    beforeUpload(file, fileList) {
+      this.fileList.push(file);
+      console.log("beforeUpload:", file, fileList);
+    },
+    //隐藏大题下的所有小题
+    hideContent(index) {
+      this.showQuestions[index].is_show = false;
+    },
+    //展开大题下所有小题
+    showContent(index) {
+      this.showQuestions[index].is_show = true;
+    },
+    quesMouseOver(index) {
+      document.getElementById(index).style.visibility = "visible";
+    },
+    quesMouseOut(index) {
+      document.getElementById(index).style.visibility = "hidden";
+    },
+    selectQues(id) {
+      this.paperDetailId = id;
+      var courseCode = this.paper.course.code;
+      var courseName = this.paper.course.name;
+      this.$router.push({
+        path:
+          "/select_question/" +
+          this.paper.id +
+          "/" +
+          courseCode +
+          "/" +
+          encodeURIComponent(courseName) +
+          "/" +
+          this.paperDetailId +
+          "/" +
+          this.parentView
+      });
+    },
+    //打开编辑大题题目弹窗
+    openEditPaperDetail(paperDetail) {
+      this.paperDatailDialog = true;
+      this.editpaperDetail = Object.assign({}, paperDetail); //浅拷贝
+    },
+    //关闭编辑大题题目弹窗
+    closePaperDatailDialog() {
+      this.paperDatailDialog = false;
+      this.editpaperDetail = {};
+    },
+    //保存大题题目信息
+    savePaperDatail(editpaperDetail) {
+      this.detailLoading = true;
+      var paperId = this.paper.id;
+      var param = JSON.stringify(editpaperDetail);
+      this.$http
+        .post(Q_API + "/updatePaperDetail/" + paperId, param)
+        .then(() => {
+          this.$notify({
+            message: "保存成功",
+            type: "success"
+          });
+          this.detailLoading = false;
+          this.closePaperDatailDialog();
+          this.initPaper();
+        });
+    },
+    //初始化试卷
+    initPaper() {
+      this.loading = true;
+      this.paper = {
+        course: {
+          code: "",
+          name: ""
+        }
+      };
+      this.$http.get(Q_API + "/paper/" + this.paperId).then(response => {
+        this.paper = response.data;
+        //查询所有课程属性名
+        this.initCourseProperty(this.paper.course.code);
+        //将所有小题分为公开和非公开
+        if (this.paper.paperDetails && this.paper.paperDetails.length > 0) {
+          for (let paperDetil of this.paper.paperDetails) {
+            this.showQuestions.push({ is_show: true });
+            paperDetil.pubCount = 0;
+            paperDetil.noPubCount = 0;
+            if (
+              paperDetil.paperDetailUnits &&
+              paperDetil.paperDetailUnits.length > 0
+            ) {
+              for (let paperDetilUt of paperDetil.paperDetailUnits) {
+                if (
+                  paperDetilUt.question.questionType != "NESTED_ANSWER_QUESTION"
+                ) {
+                  //非套题
+                  if (paperDetilUt.question.publicity) {
+                    paperDetil.pubCount = paperDetil.pubCount + 1;
+                  } else {
+                    paperDetil.noPubCount = paperDetil.noPubCount + 1;
+                  }
+                } else {
+                  //循环所有子题
+                  for (let ques of paperDetilUt.question.subQuestions) {
+                    if (ques.publicity) {
+                      paperDetil.pubCount = paperDetil.pubCount + 1;
+                    } else {
+                      paperDetil.noPubCount = paperDetil.noPubCount + 1;
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+        this.loading = false;
+      });
+    },
+    //查询所有课程属性名
+    initCourseProperty(courseCode) {
+      this.$http
+        .get(Q_API + "/courseProperty/enable/" + courseCode)
+        .then(response => {
+          this.coursePropertyList = response.data;
+        });
+    },
+    //删除大题
+    deletePaperDetail(paperDetailsId) {
+      //先判断大题下面是否还有小题
+      var count = 0;
+      for (var i = 0, imax = this.paper.paperDetails.length; i < imax; i++) {
+        if (paperDetailsId == this.paper.paperDetails[i].id) {
+          if (this.paper.paperDetails[i].paperDetailUnits) {
+            count += this.paper.paperDetails[i].paperDetailUnits.length;
+            break;
+          }
+        }
+      }
+      if (count == 0) {
+        this.$alert("您确定删除吗?", "提示", {
+          confirmButtonText: "确定",
+          callback: action => {
+            if (action == "confirm") {
+              this.loading = true;
+              this.$http
+                .delete(Q_API + "/paperDetail/" + paperDetailsId)
+                .then(() => {
+                  this.initPaper();
+                  this.loading = true;
+                  this.$notify({
+                    message: "删除成功",
+                    type: "success"
+                  });
+                  this.loading = false;
+                });
+            }
+          }
+        });
+      } else {
+        this.$alert("大题下还有小题,不可删除!", "提示", {
+          confirmButtonText: "确定",
+          callback: () => {}
+        });
+      }
+    },
+    quesShow(id) {
+      if (this.reduplicateGroup.length < 1) {
+        return true;
+      }
+      for (var i = 0, imax = this.reduplicateGroup.length; i < imax; i++) {
+        if (id == this.reduplicateGroup[i]) {
+          return true;
+        }
+      }
+      return false;
+    },
+    reduplicateMarkShow(id) {
+      var found = false;
+      for (var i = 0, imax = this.reduplicateQuestions.length; i < imax; i++) {
+        for (
+          var j = 0, jmax = this.reduplicateQuestions[i].length;
+          j < jmax;
+          j++
+        ) {
+          if (this.reduplicateQuestions[i][j] == id) {
+            found = true;
+            break;
+          }
+        }
+        if (found) {
+          break;
+        }
+      }
+      return found;
+    },
+    reduplicateMarkColor(id) {
+      for (var i = 0, imax = this.reduplicateQuestions.length; i < imax; i++) {
+        for (
+          var j = 0, jmax = this.reduplicateQuestions[i].length;
+          j < jmax;
+          j++
+        ) {
+          if (this.reduplicateQuestions[i][j] == id) {
+            return this.reduplicateQuesColor[i];
+          }
+        }
+      }
+    },
+    reduplicateMarkCheck(id) {
+      for (var i = 0, imax = this.reduplicateGroup.length; i < imax; i++) {
+        if (id == this.reduplicateGroup[i]) {
+          return true;
+        }
+      }
+      return false;
+    },
+    reduplicate_mark_check(id, checked) {
+      console.log(checked);
+      console.log(this.reduplicateQuestions);
+      console.log(id);
+      if (!checked) {
+        for (
+          var i = 0, imax = this.reduplicateQuestions.length;
+          i < imax;
+          i++
+        ) {
+          for (
+            var j = 0, jmax = this.reduplicateQuestions[i].length;
+            j < jmax;
+            j++
+          ) {
+            if (this.reduplicateQuestions[i][j] == id) {
+              this.reduplicateGroup = [];
+              for (
+                var k = 0, kmax = this.reduplicateQuestions[i].length;
+                k < kmax;
+                k++
+              ) {
+                this.reduplicateGroup.push(this.reduplicateQuestions[i][k]);
+              }
+              return;
+            }
+          }
+        }
+      } else {
+        this.reduplicateGroup = [];
+      }
+    },
+    //编辑题目
+    editQues(paperDetailUnit, question) {
+      console.log("question:", question);
+      this.coursePropertyName = "";
+      this.firstPropertyId = "";
+      this.secondPropertyId = "";
+      this.editPaperDetailUnit = paperDetailUnit;
+      this.quesModel = JSON.parse(JSON.stringify(question)); //深拷贝
+      this.quesModel.score = paperDetailUnit.score;
+      //如果是套题下面的小题编辑 ( paperDetailUnit的类型是套题,question的类型不是套题)
+      if (
+        paperDetailUnit.questionType == "NESTED_ANSWER_QUESTION" &&
+        question.questionType != "NESTED_ANSWER_QUESTION"
+      ) {
+        for (var i = 0; i < paperDetailUnit.question.subQuestions.length; i++) {
+          if (
+            paperDetailUnit.question.subQuestions[i].id == this.quesModel.id
+          ) {
+            this.quesModel.score = paperDetailUnit.subScoreList[i];
+            break;
+          }
+        }
+      }
+      this.assignAnswers(); //给singleRightAnswer或multipleRightAnswer赋值
+      this.openQuesDialog();
+    },
+    //给singleRightAnswer和multipleRightAnswer赋值
+    assignAnswers() {
+      if (this.quesModel.quesOptions && this.quesModel.quesOptions.length > 0) {
+        this.singleRightAnswer = "";
+        this.multipleRightAnswer = [];
+        for (let i = 0; i < this.quesModel.quesOptions.length; i++) {
+          let option = this.quesModel.quesOptions[i];
+          if (
+            this.quesModel.questionType == "SINGLE_ANSWER_QUESTION" &&
+            option.isCorrect == 1
+          ) {
+            this.singleRightAnswer = String.fromCharCode(65 + i);
+          }
+          if (
+            this.quesModel.questionType == "MULTIPLE_ANSWER_QUESTION" &&
+            option.isCorrect == 1
+          ) {
+            this.multipleRightAnswer.push(String.fromCharCode(65 + i));
+          }
+        }
+      }
+    },
+    //打开修改试题编辑框
+    openQuesDialog() {
+      this.quesDialog = true;
+    },
+    //关闭试题编辑框
+    closeQuesDialog() {
+      this.quesDialog = false;
+      this.quesModel = {};
+    },
+    //删除属性
+    handleClose(tag) {
+      this.quesModel.quesProperties.splice(
+        this.quesModel.quesProperties.indexOf(tag),
+        1
+      );
+    },
+    //查询一级属性
+    searchFirst() {
+      this.firstPropertyId = "";
+      this.secondPropertyId = "";
+      this.secondPropertyList = [];
+      if (this.coursePropertyName) {
+        for (let courseProperty of this.coursePropertyList) {
+          if (courseProperty.name == this.coursePropertyName) {
+            this.$http
+              .get(Q_API + "/property/first/" + courseProperty.id)
+              .then(response => {
+                this.firstPropertyList = response.data;
+              });
+          }
+        }
+      }
+    },
+    //查询二级属性
+    searchSecond() {
+      this.secondPropertyId = "";
+      if (this.firstPropertyId) {
+        this.$http
+          .get(Q_API + "/property/second/" + this.firstPropertyId)
+          .then(response => {
+            this.secondPropertyList = response.data;
+          });
+      }
+    },
+    //新增属性
+    insertProperty() {
+      if (!this.checkInsertPro()) {
+        return false;
+      }
+      var quesProperty = {
+        id: "",
+        coursePropertyName: "",
+        firstProperty: {},
+        secondProperty: {}
+      };
+      if (
+        this.quesModel.quesProperties == null ||
+        this.quesModel.quesProperties.length == 0
+      ) {
+        this.quesModel.quesProperties = [];
+      }
+      if (this.secondPropertyId) {
+        quesProperty.id =
+          this.coursePropertyName +
+          "-" +
+          this.firstPropertyId +
+          "-" +
+          this.secondPropertyId;
+      } else {
+        quesProperty.id = this.coursePropertyName + "-" + this.firstPropertyId;
+      }
+      for (let quesPro of this.quesModel.quesProperties) {
+        if (quesPro.id == quesProperty.id) {
+          this.$notify({
+            message: "该属性已存在,请重新选择",
+            type: "error"
+          });
+          return false;
+        }
+      }
+      quesProperty.coursePropertyName = this.coursePropertyName;
+      //取到一级属性对象
+      for (let property of this.firstPropertyList) {
+        if (property.id == this.firstPropertyId) {
+          quesProperty.firstProperty = property;
+        }
+      }
+      //判断是否有二级属性
+      if (
+        this.secondPropertyList != undefined &&
+        this.secondPropertyList.length > 0
+      ) {
+        if (!this.secondPropertyId) {
+          this.$notify({
+            message: "请选择二级属性",
+            type: "error"
+          });
+          return false;
+        }
+      }
+      //取到二级属性对象
+      for (let property of this.secondPropertyList) {
+        if (property.id == this.secondPropertyId) {
+          quesProperty.secondProperty = property;
+        }
+      }
+      this.quesModel.quesProperties.push(quesProperty);
+      this.quesModel = Object.assign({}, this.quesModel);
+      //清空下拉框
+      this.coursePropertyName = "";
+      this.firstPropertyId = "";
+      this.secondPropertyId = "";
+      this.firstPropertyList = [];
+      this.secondPropertyList = [];
+    },
+    //新增属性验证
+    checkInsertPro() {
+      if (!this.coursePropertyName) {
+        this.$notify({
+          message: "请选择属性",
+          type: "error"
+        });
+        return false;
+      }
+      if (!this.firstPropertyId) {
+        this.$notify({
+          message: "请选择一级属性",
+          type: "error"
+        });
+        return false;
+      }
+      return true;
+    },
+    //删除选项
+    removeQuesOption(option) {
+      this.singleRightAnswer = "";
+      this.multipleRightAnswer = [];
+      let index = this.quesModel.quesOptions.indexOf(option);
+      if (index !== -1) {
+        this.quesModel.quesOptions.splice(index, 1);
+      }
+      if (this.quesModel.quesOptions.length > 0) {
+        for (var i = 0; i < this.quesModel.quesOptions.length; i++) {
+          var quesOption = this.quesModel.quesOptions[i];
+          quesOption["number"] = i + 1;
+          if (quesOption.isCorrect == 1) {
+            var answerOrderNum = String.fromCharCode(65 + i);
+            if (this.quesModel.questionType == "SINGLE_ANSWER_QUESTION") {
+              this.singleRightAnswer = answerOrderNum;
+            }
+            if (this.quesModel.questionType == "MULTIPLE_ANSWER_QUESTION") {
+              this.multipleRightAnswer.push(answerOrderNum);
+            }
+          }
+        }
+      }
+    },
+    //新增选项
+    addQuesOption() {
+      this.quesModel.quesOptions.push({
+        number: "",
+        optionBody: "",
+        isCorrect: ""
+      });
+      for (var i = 0; i < this.quesModel.quesOptions.length; i++) {
+        this.quesModel.quesOptions[i]["number"] = i + 1;
+      }
+    },
+    savePaperDetailUnit() {
+      //跟新难度值
+      if (this.quesModel.difficultyDegree < 0.4) {
+        this.quesModel.difficulty = "难";
+      } else if (
+        this.quesModel.difficultyDegree > 0.3 &&
+        this.quesModel.difficultyDegree < 0.8
+      ) {
+        this.quesModel.difficulty = "中";
+      } else {
+        this.quesModel.difficulty = "易";
+      }
+      this.setRightAnswer();
+      if (/^\d+(?=\.{0,1}\d+$|$)/.test(this.quesModel.score)) {
+        console.log("正确");
+      } else {
+        this.$notify({
+          message: "分数只能为正数",
+          type: "error"
+        });
+        return;
+      }
+      let paperDetailUnitExp = {
+        id: this.editPaperDetailUnit.id,
+        question: this.quesModel,
+        score: this.quesModel.score
+      };
+      if (
+        this.quesModel.quesOptions &&
+        this.quesModel.quesOptions.length == 0
+      ) {
+        this.$confirm("无选项将删除该试题, 是否继续?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(() => {
+          this.dialogLoading = true;
+          this.$http
+            .delete(Q_API + "/paper/deleteQuestion/" + this.quesModel.id)
+            .then(response => {
+              if (response.data.length > 0) {
+                var deleteInfo =
+                  "该试题被试卷:" +
+                  response.data.join(" , ") +
+                  "使用,不能删除";
+                this.$notify({
+                  message: deleteInfo,
+                  type: "error"
+                });
+              } else {
+                this.$notify({
+                  message: "保存成功",
+                  type: "success"
+                });
+              }
+              this.dialogLoading = false;
+            });
+        });
+      } else {
+        this.dialogLoading = true;
+        this.$http
+          .put(Q_API + "/paperDetailUnit", paperDetailUnitExp)
+          .then(() => {
+            this.$notify({
+              message: "保存成功",
+              type: "success"
+            });
+            this.dialogLoading = false;
+            this.closeQuesDialog();
+            this.initPaper();
+          });
+      }
+    },
+    //在正确的option上设置isCorrect=1
+    setRightAnswer() {
+      if (
+        !this.quesModel.quesOptions ||
+        this.quesModel.quesOptions.length == 0
+      ) {
+        return false;
+      }
+      for (var i = 0; i < this.quesModel.quesOptions.length; i++) {
+        var option = this.quesModel.quesOptions[i];
+        var answerOrderNum = String.fromCharCode(65 + i);
+        if (this.quesModel.questionType == "SINGLE_ANSWER_QUESTION") {
+          option["isCorrect"] =
+            answerOrderNum == this.singleRightAnswer ? 1 : 0;
+        }
+        if (this.quesModel.questionType == "MULTIPLE_ANSWER_QUESTION") {
+          option["isCorrect"] =
+            this.multipleRightAnswer.indexOf(answerOrderNum) > -1 ? 1 : 0;
+        }
+      }
+    },
+    //删除试题
+    deleteQues(paperDetailUnit) {
+      let paperDetailUnitId = paperDetailUnit.id;
+      if (this.paper.paperType == "GENERATE") {
+        this.deleteQues01(paperDetailUnitId);
+      } else {
+        let questionId = paperDetailUnit.question.id;
+        this.deleteQues02(questionId);
+      }
+    },
+    deleteQues01(paperDetailUnitId) {
+      this.$alert("您确定删除吗?", "提示", {
+        confirmButtonText: "确定",
+        callback: action => {
+          if (action == "confirm") {
+            this.loading = true;
+            this.$http
+              .delete(Q_API + "/paperDetailUnit/" + paperDetailUnitId)
+              .then(() => {
+                this.initPaper();
+                this.getreduplicateQuestions();
+                this.reduplicateGroup = [];
+                this.loading = true;
+                this.$notify({
+                  message: "删除成功",
+                  type: "success"
+                });
+                this.loading = false;
+              });
+          }
+        }
+      });
+    },
+    deleteQues02(questionId) {
+      this.$alert("您确定删除吗?", "提示", {
+        confirmButtonText: "确定",
+        callback: action => {
+          if (action == "confirm") {
+            this.loading = true;
+            this.$http
+              .delete(Q_API + "/paper/deleteQuestion/" + questionId)
+              .then(response => {
+                if (response.data.length > 0) {
+                  var deleteInfo =
+                    "该试题被试卷:" +
+                    response.data.join(" , ") +
+                    "使用,不能删除";
+                  this.$notify({
+                    message: deleteInfo,
+                    type: "error"
+                  });
+                } else {
+                  this.initPaper();
+                  this.getreduplicateQuestions();
+                  this.reduplicateGroup = [];
+                  this.loading = true;
+                  this.$notify({
+                    message: "保存成功",
+                    type: "success"
+                  });
+                }
+                this.loading = false;
+              });
+          }
+        }
+      });
+    },
+    //获取重复试题
+    getreduplicateQuestions() {
+      this.duplicateLoading = true;
+      this.$http
+        .get(Q_API + "/paper/" + this.paperId + "/reduplicate-questions")
+        .then(response => {
+          this.reduplicateQuestions = response.data;
+          this.duplicateLoading = false;
+          this.initReduplicateQuesColor();
+          var ques = document.getElementsByClassName("ques")[0];
+          ques.style.display = "inline";
+        });
+    },
+    initReduplicateQuesColor() {
+      var colorCount = this.reduplicateQuestions.length;
+      if (colorCount > 20) {
+        this.reduplicateQuesColor = randomColor({
+          luminosity: "bright",
+          count: colorCount
+        });
+      } else {
+        this.reduplicateQuesColor = this.defaultColor;
+      }
+    },
+    getSubQuesEditId(paperDetailUnit, subQuestion) {
+      return paperDetailUnit.question.id + "_" + subQuestion.quesParams.number;
+    },
+    //打开考试说明编辑框
+    openEditExamPaperRemark() {
+      if (this.paper.examRemark) {
+        this.examRemark = this.paper.examRemark;
+      } else {
+        this.examRemark = "";
+      }
+      this.paperRemarkDialog = true;
+    },
+    //保存考试说明
+    savePaperRemark() {
+      this.paper.examRemark = this.examRemark;
+      this.savePaper();
+      this.paperRemarkDialog = false;
+    },
+    //关闭考试说明编辑框
+    closPaperRemark() {
+      this.examRemark = "";
+      this.paperRemarkDialog = false;
+    },
+    //保存试卷
+    savePaper() {
+      this.loading = true;
+      this.$http
+        .put(Q_API + "/paper", this.paper)
+        .then(() => {
+          this.$notify({
+            message: "保存成功",
+            type: "success"
+          });
+          this.loading = false;
+          this.initPaper();
+        })
+        .catch(error => {
+          this.loading = false;
+          this.$notify({
+            type: "error",
+            message: error.body.msg
+          });
+        });
+    },
+    //删除试卷
+    deletePaper(id) {
+      this.$confirm("确认删除试卷吗?", "提示", {
+        type: "warning"
+      }).then(() => {
+        this.loading = true;
+        this.$http.delete(Q_API + "/paper/" + id).then(
+          () => {
+            this.$notify({
+              message: "删除成功",
+              type: "success"
+            });
+            this.back();
+          },
+          error => {
+            this.$notify({
+              message: error.data.msg,
+              type: "error"
+            });
+            this.loading = false;
+          }
+        );
+      });
+    },
+    //打开上传音频弹框
+    openDialog() {
+      this.dialogRadioFile = true;
+      this.fileList = [];
+    },
+    //关闭音频弹框
+    closeAudioDialog() {
+      this.dialogRadioFile = this.uploadAudioLoading;
+    },
+    //返回
+    back() {
+      this.$router.push({
+        path: "/questions/" + this.parentView + "/1"
+      });
+    },
+    paperDetailShow(paperDetail) {
+      if (this.reduplicateGroup.length == 0) {
+        return true;
+      }
+      let paperDetailUnits = paperDetail.paperDetailUnits;
+      for (let i = 0, imax = paperDetailUnits.length; i < imax; i++) {
+        for (var j = 0, jmax = this.reduplicateGroup.length; j < jmax; j++) {
+          if (paperDetailUnits[i].id == this.reduplicateGroup[j]) {
+            return true;
+          }
+        }
+      }
+      return false;
+    }
+  },
+  computed: {
+    ...mapState({
+      user: state => state.user
+    }),
+    updatePorperty() {
+      if (this.parentView === "gen_paper") {
+        return true;
+      }
+      return false;
+    },
+    answer() {
+      if (this.quesModel.questionType == "SINGLE_ANSWER_QUESTION") {
+        return this.singleRightAnswer;
+      } else if (this.quesModel.questionType == "MULTIPLE_ANSWER_QUESTION") {
+        var obj = Object.assign({}, this.multipleRightAnswer); //浅拷贝;
+        return obj.sort().toString();
+      }
+    }
+  },
+  watch: {},
+  created() {
+    // $("body").attr("style", "");
+    document.getElementsByTagName("body")[0].style = "";
+    this.paperId = this.$route.params.id;
+    this.parentView = this.$route.params.parentView;
+    this.initPaper();
+    this.getreduplicateQuestions();
+    this.uploadAction = Q_API + "/uploadRadio/" + this.paperId;
+    this.uploadHeaders = {
+      key: this.user.key,
+      token: this.user.token
+    };
+  },
+  mounted() {}
+};
+</script>
+
+<style scoped>
+@import "../styles/EditPaper.css";
+
+.property_with {
+  width: 100px;
+}
+</style>

+ 12 - 4
src/modules/questions/views/EditSelectQuestion.vue

@@ -161,8 +161,9 @@
             <!-- end -->
             <el-form-item label="题干" prop="quesBody">
               <ckeditor
+                :editor="editor"
                 v-model="quesModel.quesBody"
-                :height="'100px'"
+                :config="editorConfig"
               ></ckeditor>
             </el-form-item>
             <el-form-item
@@ -182,7 +183,11 @@
                 ></el-checkbox>
               </el-col>
               <el-col :span="20">
-                <ckeditor v-model="option.optionBody"></ckeditor>
+                <ckeditor
+                  :editor="editor"
+                  v-model="option.optionBody"
+                  :config="editorConfig"
+                ></ckeditor>
               </el-col>
               <el-col :span="2">
                 <i
@@ -221,11 +226,14 @@
 </template>
 <script>
 import { Q_API, QUESTION_TYPES } from "../constants/constants";
-import ckeditor from "../component/ckeditor.vue";
+import ClassicEditor from "@ckeditor/ckeditor5-build-inline";
 export default {
-  components: { ckeditor },
   data() {
     return {
+      editor: ClassicEditor,
+      editorConfig: {
+        // The configuration of the editor.
+      },
       questionTypes: QUESTION_TYPES,
       fullscreenLoading: false,
       paperId: "",

+ 10 - 3
src/modules/questions/views/InsertBluePaperStructure.vue

@@ -100,7 +100,11 @@
             </el-row>
             <el-form-item label="考试说明">
               <div style="width:550px;">
-                <ckeditor v-model="blueStruct.examRemark"></ckeditor>
+                <ckeditor
+                  :editor="editor"
+                  v-model="blueStruct.examRemark"
+                  :config="editorConfig"
+                ></ckeditor>
               </div>
             </el-form-item>
           </el-form>
@@ -218,11 +222,14 @@
 </template>
 <script>
 import { CORE_API, Q_API, QUESTION_TYPES } from "../constants/constants";
-import ckeditor from "../component/ckeditor.vue";
+import ClassicEditor from "@ckeditor/ckeditor5-build-inline";
 export default {
-  components: { ckeditor },
   data() {
     return {
+      editor: ClassicEditor,
+      editorConfig: {
+        // The configuration of the editor.
+      },
       blueStruct: {
         name: "",
         totalScore: 0, //结构总分

+ 10 - 3
src/modules/questions/views/InsertPaperStructure.vue

@@ -76,7 +76,11 @@
             <el-row>
               <el-form-item label="考试说明">
                 <div style="width:550px;">
-                  <ckeditor v-model="paperStruct.examRemark"></ckeditor>
+                  <ckeditor
+                    :editor="editor"
+                    v-model="paperStruct.examRemark"
+                    :config="editorConfig"
+                  ></ckeditor>
                 </div>
               </el-form-item>
             </el-row>
@@ -197,11 +201,14 @@
 
 <script>
 import { CORE_API, Q_API } from "../constants/constants";
-import ckeditor from "../component/ckeditor.vue";
+import ClassicEditor from "@ckeditor/ckeditor5-build-inline";
 export default {
-  components: { ckeditor },
   data() {
     return {
+      editor: ClassicEditor,
+      editorConfig: {
+        // The configuration of the editor.
+      },
       loading: false,
       courseList: [],
       paperDetailStructForm: {

+ 15 - 0
yarn.lock

@@ -650,6 +650,16 @@
     lodash "^4.17.10"
     to-fast-properties "^2.0.0"
 
+"@ckeditor/ckeditor5-build-inline@^11.2.0":
+  version "11.2.0"
+  resolved "http://registry.npm.taobao.org/@ckeditor/ckeditor5-build-inline/download/@ckeditor/ckeditor5-build-inline-11.2.0.tgz#9715282eb4e2c4a05b6f6ac5778c15e8682f0190"
+  integrity sha1-lxUoLrTixKBbb2rFd4wV6GgvAZA=
+
+"@ckeditor/ckeditor5-vue@^1.0.0-beta.1":
+  version "1.0.0-beta.1"
+  resolved "http://registry.npm.taobao.org/@ckeditor/ckeditor5-vue/download/@ckeditor/ckeditor5-vue-1.0.0-beta.1.tgz#976bf7b00bd5f9d99637bfa8279e35f2e899c334"
+  integrity sha1-l2v3sAvV+dmWN7+oJ5418uiZwzQ=
+
 "@intervolga/optimize-cssnano-plugin@^1.0.5":
   version "1.0.6"
   resolved "https://registry.yarnpkg.com/@intervolga/optimize-cssnano-plugin/-/optimize-cssnano-plugin-1.0.6.tgz#be7c7846128b88f6a9b1d1261a0ad06eb5c0fdf8"
@@ -7784,6 +7794,11 @@ randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5:
   dependencies:
     safe-buffer "^5.1.0"
 
+randomcolor@^0.5.3:
+  version "0.5.3"
+  resolved "http://registry.npm.taobao.org/randomcolor/download/randomcolor-0.5.3.tgz#7f90f2f2a7f6d5a52232161eeaeeaea9ac3b5815"
+  integrity sha1-f5Dy8qf21aUiMhYe6u6uqaw7WBU=
+
 randomfill@^1.0.3:
   version "1.0.4"
   resolved "https://registry.yarnpkg.com/randomfill/-/randomfill-1.0.4.tgz#c92196fc86ab42be983f1bf31778224931d61458"