<template>
  <!--微课内容的编辑，课件，作业，考试，评估，传入的是内容列表，本组件内自行处理内容的切换处理-->
  <div>
  <el-tabs type="border-card" @tab-click="changeContent"  v-model="activeName" :style="{'min-height': minHeight}">
    <el-tab-pane label="课件" name="courseware">
      <!--课件类型选择-->
      <div v-if="cware.show==1">
        <div style="">
            <div v-for="(ctype,ctypeIdx) in cwareTypes" :key="ctypeIdx" style="width: 120px;height: 120px;margin: 10px; float: left;cursor: pointer;">
              <div @click="chooseCWareType(ctype)" style="text-align: center;border: 1px solid #e7e7e7;padding: 10px;">
                <div> <i :class="ctype.img" style="font-size: 40px;"></i></div>
                <div><span>{{ctype.name}}</span></div>
              </div>
            </div>
        </div>
      </div>
      <div v-if="cware.show==2" style="border: 0px solid #d6d6d6;">
            <!--操作区-->
            <div style="display: flex;justify-content: space-between;border-bottom: 1px solid #CCCCCC;">
              <div>{{getType(cware.content.contentType)}}</div>
              <div style="display: flex;justify-content: flex-end;">
                  <div><el-button type="danger" size="mini" @click="toCWareReChoose()">重新选择</el-button></div>
              </div>
            </div>
            <!--内容区-->
            <div style="margin-top: 10px;">
                <div v-if="cware.content.contentType<51 && cware.content.contentType!=41 && !cware.findShow">
                  <div v-if="cware.content.contentRefId==''">
                        <div style="padding-top: 0px;">
                          <!-- <div> -->
                            <choose-course-file :orgId="course.orgId" :orgName="course.orgName" ref="coursewarePanel" :resType="cware.content.contentType" @choose="chooseFile"></choose-course-file>

                             <!-- <file-upload
                                :fileType="getFileTypes(cware.content.contentType)"
                                dir="course"
                                :isShowTip="false"
                                :showList="true"
                                size="small"
                                :text="'上传新'+getType(cware.content.contentType)"
                                @success="handleUploadSuccess"
                                @remove="handleRemoveSuccess">
                              </file-upload> -->
                         <!-- </div>
                          <div style="margin-left: 10px;">
                              <el-button  type="primary" size="small" @click="toFindCWare()" >选择已有{{getType(cware.content.contentType)}}</el-button>
                          </div> -->
                        </div>
                  </div>
                  <div v-else>

                      <div style="text-align: center;">
                          <!--展示内容区域-->
                          <!--视频-->
                          <div v-if="cware.content.contentType==10">
                            <video  controls v-if="cware.content.content!=''" style="width: 100%;">
                              <source :src="fileBaseUrl+cware.curriculumData.url" type="video/mp4">
                              您的浏览器不支持video
                            </video>
                             <div style="display: flex;justify-content:space-between;margin-top: 20px;">
                              <div>
                                  <div style="text-align: left;margin-bottom:10px">是否允许拖拽：
                                    <el-radio-group v-model="cware.curriculumData.isDrag">
                                      <el-radio :label="true">是</el-radio>
                                      <el-radio :label="false">否</el-radio>
                                    </el-radio-group>
                                  </div>
                                  <div style="text-align: left;">完成规则设置：
                                  <el-radio-group v-model="cware.curriculumData.completeSetup">
                                    <el-radio :label="0" >默认(系统自动控制)</el-radio>
                                    <el-radio :label="1" >按进度
                                          <el-input-number  style="margin-top:10px" v-model="cware.curriculumData.setupTage"  size="mini"  :min="0" :max="100" label="描述文字" controls-position="right"></el-input-number>
                                      %</el-radio>
                                    <!-- <el-radio :label="2">时长
                                   <el-input-number  style="margin-top:10px" v-model="cware.curriculumData.second"  size="mini"  :min="5" :max="9999" label="描述文字" controls-position="right"></el-input-number>
                                   秒</el-radio> -->
                                  </el-radio-group>
                                </div>
                              </div>
                              </div>
                               <div style="margin-top:35px;text-align: center;"> <el-button :loading="loading" type="primary" @click="saveContent(1)"  size="mini">保存</el-button> </div>
                          </div>
                          <!--音频-->
                          <div v-if="cware.content.contentType==20">
                            <audioPlayer :url="fileBaseUrl+cware.curriculumData.url" :autoplay="false"></audioPlayer>
                            <div style="margin-top: 20px;">
                               <div>
                                  <div style="text-align: left;">是否允许拖拽：
                                    <el-radio-group v-model="cware.curriculumData.isDrag">
                                      <el-radio :label="true">是</el-radio>
                                      <el-radio :label="false">否</el-radio>
                                    </el-radio-group>
                                  </div>
                                  <div style="margin-top:10px;text-align: left;">完成规则设置：
                                  <el-radio-group v-model="cware.curriculumData.completeSetup">
                                    <el-radio :label="0">默认(系统自动控制)</el-radio>
                                    <el-radio :label="1">按进度
                                   <el-input-number style="margin-top:10px" v-model="cware.curriculumData.setupTage"  size="mini"  :min="0" :max="100" label="描述文字" controls-position="right"></el-input-number>
                                      %</el-radio>
                                    <!-- <el-radio :label="2">时长
                                   <el-input-number style="margin-top:10px" v-model="cware.curriculumData.second"  size="mini"  :min="0" :max="100" label="描述文字" controls-position="right"></el-input-number>
                                      秒</el-radio> -->
                                  </el-radio-group>
                                  <br/>
                                </div>
                              </div>
                              <div style="margin-top:35px;text-align: center;"> <el-button :loading="loading" type="primary" @click="saveContent(1)"  size="mini">保存</el-button> </div>
                            </div>
                          </div>
                          <!--图片-->
                          <div v-if="cware.content.contentType==30">
                            <el-image :src="fileBaseUrl+cware.content.content" fit="fill"></el-image>
                          </div>
                          <div v-if="cware.content.contentType==40">
                              <div style="text-align: center;padding-top: 20px;" v-if="courseFileShow">
                                <div style="padding: 20px;line-height: 40px;">
                                  {{cware.content.contentName}} <span style="color: green;">上传成功</span>
                                  <br/> 系统正对文件进行转化，您可以继续操作</div>
                                <el-button @click="loadPdfFile();" type="primary">确定</el-button>
                              </div>
                              <div v-else>
                                <div style="padding: 10px;color: #767676;line-height:40px; " v-if="converStatus < 2">
                                   <div>文档文件转化中，还未转化完成，</div>  <div >上传时间：{{curCFile.sysCreateTime}}</div>
                                </div>
                                <div style="padding: 10px;color: #767676;color: #ff0000; " v-if="converStatus == 3">
                                    <div>文件转化失败，请重新上传（不要上传加密的文件），请联系管理员</div>
                                </div>
                                <pdfPreview v-if="cware.content.contentType == 40 && cware.content.pdfPath!=''" :filePath="fileBaseUrl+cware.content.pdfPath"></pdfPreview>
                              </div>
                          </div>
                          <div v-if="cware.content.contentType==50" style="text-align: center;">
                               <iframe v-if="scormUrl" :src="scormUrl" frameborder="0" border="0px" style="width:100%;height:400px;border:0px"></iframe>
                          </div>
                      </div>

                  </div>
                </div>
                <div v-if="cware.content.contentType==41">
                   <!--图文内容-->
                    <div>
                      <div><WxEditor v-model="cware.content.content" :minHeight="300"></WxEditor></div>
                      <div style="text-align: center;padding-top: 20px;">
                        <el-button :loading="loading" @click="saveContent(1)" type="primary">保存</el-button>
                        <!-- <el-button @click="deleteContent(1)" type="danger">删除</el-button> -->
                      </div>
                    </div>
                    <!--
                    <div v-else style="padding: 20px;">
                      <div v-html="cware.content.content"></div>
                    </div>
                    -->
                </div>
                <div v-if="cware.content.contentType==52">
                    <div style="padding-top: 10px;">
                        <el-form  label-width="90px">
                          <el-form-item label="名称">
                            <el-input v-model="cware.content.contentName" placeholder="连接的名称"></el-input>
                          </el-form-item>
                          <el-form-item label="URL地址">
                            <el-input v-model="cware.linkInfo.url" placeholder="http://"></el-input>
                          </el-form-item>
                          <el-form-item label="打开方式">
                              <el-radio-group v-model="cware.linkInfo.openType">
                                <el-radio :label="1">页面中嵌入</el-radio>
                                <el-radio :label="2">新窗口打开</el-radio>
                              </el-radio-group>
                              <div v-if="cware.linkInfo.openType==1" style="color:#ff0000; ">注：有些页面是有防嵌入控制代码的 </div>
                          </el-form-item>
                          <el-form-item label="">
                               <el-button @click="saveContent(1)" type="primary">保存</el-button>
                               <!-- <el-button @click="deleteContent(1)" type="danger">删除</el-button> -->
                          </el-form-item>
                        </el-form>
                    </div>
                </div>
            </div>
            <!--查询已有课件内容-->
            <div v-if="cware.findShow" style="padding-top: 10px;">
              <div style="display: flex;justify-content: flex-start;">
                <div>
                  <el-input maxlength="50" v-model="hasCWare.keyword" placeholder="名称"></el-input>
                </div>
                <div style="padding-left: 10px;">
                  <el-button @click="findCWare()" type="primary">搜索</el-button>
                  <el-button @click="closeCWareFind()" type="primary">返回</el-button>
                </div>
              </div>
              <div style="text-align: center;padding-top: 10px;">
                <el-table style="100%" :data="hasCWare.list" border stripe>
                  <el-table-column label="类型"  width="60" prop="author"><template slot-scope="scope">{{getType(scope.row.resType)}}</template></el-table-column>
                  <el-table-column label="名称" prop="name"></el-table-column>
                  <el-table-column label="创建" prop="sysCreateBy" width="100"></el-table-column>
                   <el-table-column label="创建时间" prop="sysCreateTime" width="160"></el-table-column>
                  <el-table-column label="选择" width="70" align="center">
                    <template slot-scope="scope">
                        <el-button size="mini" @click="chooseHasCWare(scope.row)" type="primary"  >选择</el-button>
                    </template>
                  </el-table-column>
                </el-table>
                <div style="text-align: center">
                  <el-pagination
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange"
                    :current-page="hasCWare.pageIndex"
                    :page-sizes="[5, 10]"
                    :page-size="hasCWare.pageSize"
                    layout="total, sizes, prev, pager, next, jumper"
                    :total="hasCWare.count"
                  ></el-pagination>
                </div>
              </div>
            </div>
      </div>
    </el-tab-pane>
    <el-tab-pane label="作业" name="homework">
      <div v-if="homework.show==1">
        <div style="padding: 20px;text-align: center;">
          <el-button @click="changeHomeworkShow(2)" type="primary">添加作业</el-button>
        </div>
      </div>
      <div v-if="homework.show==2">
        <el-form size="mini" label-width="90px">
          <el-form-item label="名称">
            <el-input placeholder="作业的名称(限50字以内)" maxlength="50" show-word-limit v-model="homework.info.name"></el-input>
          </el-form-item>
          <el-form-item label="内容">
            <el-input type="textarea" rows="5" maxlength="255" show-word-limit v-model="homework.info.content" placeholder="限255字以内"></el-input>
          </el-form-item>
          <el-form-item label="附件">
            <div v-if="homework.info.file!=''">
              <a :href="fileBaseUrl+homework.info.file" target="_blank">下载作业附件  </a> <i @click="removeHomeworkFile" style="color: red;" class="el-icon-close"></i>
            </div>
            <div v-else>
              <file-upload dir="files" :isShowTip="false" @success="uploadHomeworkFile" @remove="removeHomeworkFile"></file-upload>
            </div>
          </el-form-item>
          <el-form-item label="截止时间">
            <el-date-picker v-model="homework.info.deadTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="选择日期时间"></el-date-picker>
          </el-form-item>
          <el-form-item label="提交模式">
            <el-radio-group v-model="homework.info.submitMode">
                <el-radio :label="1">附件文档</el-radio>
                <el-radio :label="2">在线填写</el-radio>
                <el-radio :label="3">前两种任选</el-radio>
            </el-radio-group>
          </el-form-item>
        </el-form>
        <div style="text-align: center;padding: 10px;">
            <el-button :loading="loading" type="primary" @click="saveContent(2)">保存</el-button>
            <el-button type="danger" @click="deleteContent(2)">删除</el-button>
        </div>
      </div>
       <div v-if="homework.show==3 && homework.info.id!=''">
         <el-form size="mini" label-width="90px">
           <el-form-item label="名称:">{{homework.info.name}}</el-form-item>
           <el-form-item label="内容:">
             <div v-html="homework.info.content"></div>
           </el-form-item>
           <el-form-item label="附件:">
             <div v-if="homework.info.file!=''">
               <a :href="fileBaseUrl+homework.info.file" target="_blank">下载作业附件 </a>
             </div>
             <div v-else>无</div>
           </el-form-item>
           <el-form-item label="截止时间:">{{homework.info.deadTime}}</el-form-item>
           <el-form-item label="提交模式:">
              <span v-if="homework.info.submitMode==1">附件文档</span>
              <span v-if="homework.info.submitMode==2">在线填写</span>
              <span v-if="homework.info.submitMode==3">在线填写或上传附件</span>
           </el-form-item>
          </el-form>
          <div style="text-align: center;padding: 10px;">
              <el-button type="primary" @click="changeHomeworkShow(2)">修改</el-button>
              <el-button type="danger" @click="deleteContent(2)">删除</el-button>
          </div>
       </div>
    </el-tab-pane>
    <el-tab-pane label="考试" name="exam">
      <div v-if="exam.show==1">
          <div style="padding: 10px; text-align: center;">
            <el-button @click="openCusExam()" type="primary" >自定义考试</el-button>
            <el-button @click="openChoosePaper()" type="primary">选择已有考试</el-button>
          </div>
      </div>
      <div v-if="exam.show==2">
          <div  style="display: flex;justify-content: flex-start;">
            <!--需求原型中没有按知识点选择
            <div>
              <el-select v-model="exam.type" style="width: 140px;" clearable placeholder="选择知识点">
              </el-select>
            </div>
            -->
            <div><el-input v-model="usePaper.keyword" maxlength="50" placeholder="名称"></el-input></div>
            <div style="padding-left: 10px;"><el-button @click="findExamPapers()" type="primary" >查询</el-button></div>
            <div style="padding-left: 10px;"><el-button @click="changeExamShow(1)" type="danger" >返回</el-button></div>
          </div>
          <div>
            <div style="text-align: center;padding-top: 10px; overflow-y: auto;">
              <el-table :empty-text="emptyText" style="100%" height="480" :data="usePaper.list" border stripe>
                <el-table-column prop="testName" label="考试名称"></el-table-column>
                <el-table-column prop="sysCreateTime" label="创建时间"></el-table-column>
                <el-table-column prop="sysCreateBy" label="创建人" width="80px" ></el-table-column>
                <el-table-column label="选择" width="60px">
                  <template slot-scope="scope">
                      <el-button size="mini" @click="chooseExamPaper(scope.row)" type="primary"  >选择</el-button>
                  </template>
                </el-table-column>
              </el-table>
              <!--分页功能-->
              <div v-if="usePaper.total >10" style="text-align: center; margin-top:10px">
                <el-pagination background
                  @current-change="changePaperPage"
                  :current-page="usePaper.pageIndex"
                  :page-sizes="[10, 20, 30, 40]"
                  :page-size="usePaper.pageSize"
                  layout="total,pager"
                  :total="usePaper.total"
                ></el-pagination>
              </div>
            </div>
          </div>
      </div>
      <div v-if="exam.show==3">
          <div style="display: flex;justify-content: space-between;padding:5px 10px;line-height: 30px; border-bottom: 1px solid #e7e7e7;">
            <div>{{exam.paperType==1? '自定义考试':'使用独立考试试卷'}} </div>
            <div>
              <el-checkbox v-model="exam.onlyQuestion">只显示试题</el-checkbox>
              <el-button :loading="loading" style="margin-left: 10px;" @click="saveContent(3)" type="primary"  > 保 存 </el-button>
              <el-button style="margin-left: 10px;" @click="deleteContent(3)" type="danger"  > 删 除 </el-button>
            </div>
          </div>
          <div style="padding-top: 10px;overflow: auto;">
            <div v-if="!exam.onlyQuestion">
            <el-form size="small" label-width="80px">
              <!-- 课程内考虑不需要名辽
              <el-form-item label="考试名称">
                <el-input v-model="exam.info.testName" placeholder="请输入名称"></el-input>
              </el-form-item>
              -->
              <el-form-item label="考试时长">
                <el-col :span="8">
                  <el-input size="mini" v-model="exam.info.testDuration" placeholder="20-120">
                    <template slot="append">分钟</template>
                  </el-input>
                </el-col>
               <!-- <el-col :span="9">
                  <el-form-item label="尝试次数">
                     <el-input-number v-model="exam.info.times" :min="0" :max="10" label="0表不限制"></el-input-number>
                  </el-form-item>
                </el-col> -->
                <el-col :span="12">
                  <el-form-item label="及格线">
                    <el-input size="mini" placeholder="20-100" :maxlength="3" v-model="exam.info.passLine">
                      <template slot="append">%</template>
                    </el-input>
                  </el-form-item>
                </el-col>
              </el-form-item>
              <!-- <el-form-item label="显示">
                <el-col :span="10"><el-checkbox v-model="exam.info.showAnalysis">允许查看解析</el-checkbox> </el-col>
                <el-col :span="14"><el-checkbox v-model="exam.info.showAnswer">允许查看答案</el-checkbox></el-col>
              </el-form-item>
              <el-form-item label="模式">
                <el-col :span="10"><el-checkbox v-model="exam.info.randomMode">随机生成试题</el-checkbox></el-col>
                <el-col :span="14">
                  <el-form-item label="数量">
                     <el-input-number v-model="exam.info.qnum" :min="1" :max="10" label="数量"></el-input-number>
                  </el-form-item>
                </el-col>
              </el-form-item> -->
             <!-- <el-form-item label="试题排列">
                <el-col :span="10">
                  <el-select v-model="exam.arrange">
                    <el-option :value="0" label="按顺序"></el-option>
                    <el-option :value="1" label="只题目乱序"></el-option>
                    <el-option :value="2" label="只选项乱序"></el-option>
                    <el-option :value="3" label="题目选项全乱序"></el-option>
                  </el-select>
                </el-col>
                <el-col :span="14">
                    <el-form-item label="评分方式">
                      <el-radio-group v-model="exam.info.scoringType">
                          <el-radio :label="1">最高一次</el-radio>
                          <el-radio :label="2">最后一次</el-radio>
                      </el-radio-group>
                    </el-form-item>
                </el-col>
              </el-form-item> -->
              <el-form-item label="评分方式">
                <el-col :span="8">
                    <el-radio-group v-model="exam.info.scoringType">
                        <el-radio :label="1">最高一次</el-radio>
                        <el-radio :label="2">最后一次</el-radio>
                    </el-radio-group>
                </el-col>
                <el-col :span="16">
                  <el-form-item label="百分制">
                    <el-checkbox v-model="exam.info.percentScore">实际成绩*100/实际总分</el-checkbox>
                  </el-form-item>
                </el-col>
              </el-form-item>
              <el-form-item label="考试说明">
                 <el-input type="textarea" show-word-limit v-model="exam.info.info" placeholder="关于考试的说明(限255字以内)" maxlength="255"></el-input>
              </el-form-item>
            </el-form>
            </div>
            <div v-if="exam.info.paperType==1">
               <simplePaper :data="exam.paperJson"></simplePaper>
             </div>
             <div v-if="exam.info.paperType==2">
                  <div style="font-size: 20px;padding: 10px;" >试卷： {{usePaper.paperName}}</div>
              </div>
          </div>
      </div>
      <div v-if="exam.show==9">
          <div style="display: flex;justify-content: space-between;padding:5px 10px;line-height: 30px; border: 1px solid #e7e7e7;">
            <div>考试信息</div><div> </div>
          </div>
          <div style="padding-top: 10px;">
            <el-form size="small" label-width="80px">
                <el-form-item label="试卷类型">
                    {{exam.info.paperType==1? '自定义试卷':'使用考试试卷: '+usePaper.paperName}}

                </el-form-item>
                <el-form-item label="考试时长">
                  <el-col :span="6">{{exam.info.testDuration}}分钟</el-col>
                  <!-- <el-col :span="9">
                    <el-form-item label="尝试次数">{{exam.info.times}}</el-form-item>
                  </el-col> -->
                  <el-col :span="9">
                    <el-form-item label="及格线">{{exam.info.passLine}}%</el-form-item>
                  </el-col>
                </el-form-item>
                <!-- <el-form-item label="显示">
                  <el-col :span="10">{{exam.info.showAnalysis? '允许查看解析':'不允许查看解析'}}</el-col>
                  <el-col :span="14"><el-checkbox disabled v-model="exam.info.showAnswer">允许查看答案</el-checkbox></el-col>
                </el-form-item>
                <el-form-item label="模式">
                  <el-col :span="10"><el-checkbox disabled v-model="exam.info.randomMode">随机生成试题</el-checkbox></el-col>
                  <el-col :span="14">
                    <el-form-item label="数量">{{exam.info.qnum}}</el-form-item>
                  </el-col>
                </el-form-item>
                <el-form-item label="试题排列">
                  <el-col :span="10">
                    <el-checkbox-group v-model="exam.info.arrange" disabled >
                        <el-checkbox :label="1">题目乱序</el-checkbox>
                        <el-checkbox :label="2">选项乱序</el-checkbox>
                    </el-checkbox-group>
                  </el-col>
                  <el-col :span="14">
                      <el-form-item label="评分方式">
                        <el-radio-group v-model="exam.info.scoringType" disabled>
                            <el-radio :label="1">最高一次</el-radio>
                            <el-radio :label="2">最后一次</el-radio>
                        </el-radio-group>
                      </el-form-item>
                  </el-col>
                </el-form-item> -->
                <el-form-item label="评分方式">
                  <el-col :span="6">
                      <span v-if="exam.info.scoringType==1">最高一次</span>
                      <span v-if="exam.info.scoringType==2">最后一次</span>
                  </el-col>
                  <el-col :span="10">
                    <el-form-item label="考试成绩">
                      <span v-if="exam.info.percentScore">按百分制显示</span>
                      <span v-else>按实际得分显示</span>
                    </el-form-item>
                  </el-col>
                </el-form-item>
                <el-form-item label="考试说明">{{exam.info.info}}</el-form-item>

              <el-form-item label="">
                <el-button  type="primary" @click="changeExamShow(3)"> 修 改 </el-button>
                <el-button  type="danger" @click="deleteContent(3)"> 删 除 </el-button>
              </el-form-item>
            </el-form>
          </div>
      </div>
    </el-tab-pane>
    <el-tab-pane label="评估"  name="assess">
		   <div v-if="assess.show==1">
         <el-button  type="primary" style="display: block;margin: 0 auto" @click="assessmentHandle">我要评估</el-button>
       </div>
      <!--与前面类似-->
      <div v-else class="assess-div">
        <div>
          <div class="assess-info" style="text-align: center">京东方大学课程评估V2.0</div>
          <div class="assess-info">课程满意度计算方式：{{assess.json.countType}}；</div>
          <div class="assess-info">满意度：{{assess.json.countText}}</div>
          <hr />
          <div v-if="assess.json.items">
            <div v-for="(ass,assIdx) in assess.json.items" :key="assIdx">
              <div class="assess-info">{{assIdx+1}}.{{ass.question}}</div>
              <div v-if="ass.qType==1" class="assess-info" style="height: 20px">
                <span style="float: left">{{ass.minText}}</span>
                <span style="float: right">{{ass.maxText}}</span>
              </div>
              <div v-if="ass.qType==1" class="assess-info">
                <el-radio-group v-model="ass.answer" class="assessRadio1">
                  <el-radio-button :label="1">1</el-radio-button>
                  <el-radio-button :label="2">2</el-radio-button>
                  <el-radio-button :label="3">3</el-radio-button>
                  <el-radio-button :label="4">4</el-radio-button>
                  <el-radio-button :label="5">5</el-radio-button>
                  <el-radio-button :label="6">6</el-radio-button>
                  <el-radio-button :label="7">7</el-radio-button>
                  <el-radio-button :label="8">8</el-radio-button>
                  <el-radio-button :label="9">9</el-radio-button>
                  <el-radio-button :label="10">10</el-radio-button>
                </el-radio-group>
              </div>
              <div v-if="ass.qType==9" class="assess-info">
                <textarea :rows="4" v-model="ass.answer" style="width: 100%" placeholder=""></textarea>
              </div>
            </div>
          </div>
        </div>
       <div style="text-align: center; margin-bottom: 15px"  >
          <el-button type="primary" v-if="!assess.content.id || assess.content.id==''" @click="saveContent(4)">保 存</el-button>
          <el-button type="danger" @click="deleteContent(4)">删 除</el-button>
        </div>
      </div>
    </el-tab-pane>
  </el-tabs>
  <el-dialog title="查看试卷" append-to-body :visible.sync="exam.paperShow" width="800px" custom-class="g-dialog">
        <div>
          <img :src="`${webBaseUrl}/temp/exam_paper.png`" style="width: 760px;">
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button @click="exam.paperShow= false">关闭</el-button>
        </span>
  </el-dialog>
  <el-dialog title="自己录入考试信息" append-to-body :visible.sync="exam.customerShow" width="900px" custom-class="g-dialog">
        <div>
          <simple-paper></simple-paper>
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button @click="exam.customerShow= false">关闭</el-button>
          <el-button @click="changeExamShow(9)">提交</el-button>
        </span>
  </el-dialog>
  </div>
</template>
<script>
  import chooseCourseFile from '@/components/Course/chooseCourseFile.vue'
  import WxEditor from "@/components/Editor/indexCourse.vue";
  import simplePaper from "@/components/Course/simpleTestPaper.vue";
  import FileUpload from '@/components/FileUpload/index.vue';
  import pdfPreview from "@/components/PdfPreview/index.vue";
  import apiCourse from '../../api/modules/course.js';
  import apiCourseFile from '../../api/modules/courseFile.js';
  import apiExamPaper from '../../api/modules/paper.js';
  import audioPlayer from '@/components/AudioPlayer/index.vue';
  import {getType} from '../../utils/tools.js';
  import { deepClone } from "../../utils";
  export default{
    components:{WxEditor,simplePaper,FileUpload,pdfPreview,audioPlayer,chooseCourseFile},
    props: {
      contents:{
        type:Array,
        default(){
          return []
        }
      },
      reset:{
        type: String,
        default:'',
      },
      course:{
        type: Object,
        default(){
          return {
            id:'',
            name:''
          }
        }
      },
      minHeight:{
        type: String,
        default:'550px'
      }
    },
    data(){
      return {
        loading:false,
        converStatus:4,
        courseFileShow:false,
        curContent:{id:'',contentType:0,contenRefId:''},
        curCFile:{},//当前课件的内容
        fileBaseUrl:this.$xpage.constants.fileBaseUrl,
        imageShowUrl: '',
        scormUrl:'',//scorm课件对应的url地址
        activeName: 'courseware',
        getType: getType,
        cwareTypes:[
          //  文件类型,10视频，20音频，30图片， 40 文档，41表图文，50表scrom包,90表其它
          // 图文41，连接52，作业60，考试61，评估62
          {id:'1',type:'video',name:'视频',img:'el-icon-video-camera',resType: 10},
          {id:'2',type:'sound',name:'音频',img:'el-icon-service',resType: 20},
          {id:'3',type:'html',name:'图文',img:'el-icon-document-copy',resType: 41},
          {id:'4',type:'doc',name:'文档',img:'el-icon-document',resType: 40},
          {id:'5',type:'scorm',name:'SCORM',img:'el-icon-suitcase',resType: 50},
          {id:'6',type:'link',name:'外部连接',img:'el-icon-link', resType: 52}
        ],
        cwareChange:{
          show:1,//1表新添加，2表选择
          content:{id:'',contentType:0,sortIndex:1,contentRefId:'',pdfPath:''},
          findShow:false,//是否显示查询
          curType:{type:'jpg',name:''},//这一项要去掉的
          linkInfo:{
            openType:1,
            url:''
          },
          curriculumData:{
            url:'',
            isDrag:true,
            completeSetup:0,
            second:5,
            setupTage:0,
          },
        },
        cware:{
          show:1,//1表新添加，2表选择
          content:{id:'',contentType:0,sortIndex:1,contentRefId:'',pdfPath:''},
          findShow:false,//是否显示查询
          curType:{type:'jpg',name:''},//这一项要去掉的
          linkInfo:{
            openType:1,
            url:''
          },
          curriculumData:{
            url:'',
            isDrag:true,
            completeSetup:0,
            second:5,
            setupTage:0,
          },
        },
        pdfTip:'',//pdf文件的提示
        hasCWare:{ keyword:'', count: 0, pageSize: 10, pageIndex: 1, list:[]},
        homework:{
          show:1,
          content:{id:'',contentType:60,sortIndex:2},
          dtime:'',
          info:{
            id:'',
            courseId: '',
            name:'',
            content:'',
            file:'',
            deadTime: '',
            submitMode: 3,
          }
        },
        homeworkChange:{
          show:1,
          content:{id:'',contentType:60,sortIndex:2},
          dtime:'',
          info:{
            id:'',
            courseId: '',
            name:'',
            content:'',
            file:'',
            deadTime: '',
            submitMode: 3,
          }
        },
        examChange:{
          show:1,
          content:{id:'',contentType:61,sortIndex:3},
          paperJson:{items:[]},
          paperShow:false,
          customerShow:false,
          onlyQuestion:false,
          info:{
            courseId:'',
            contentId:'',
            testName:this.course.name,
            testDuration:30,
            showAnalysis:false,
            showAnswer:false,
            times:1,
            qnum:0,//试题数量，只是模式是随机生成试题时才会有
            arrange:0,
            scoringType:1,
            passLine:60,
            randomMode:false,
            percentScore:true,
            paperType:1,//自定义试卷
            paperId:'',//试卷的id,只有paperType为2的时间才会有值
            info:'',//考试说明
            paperContent:'',//试题的json字符串

          }
        },
        usePaper:{ //使用考试试卷
          pageIndex:1,
          pageSize:10,
          total:0,
          list:[],
          keyword:'',
          paperId:'',//选择的试卷的id
          paperName:'',//选择的试卷的名称
          paperJson:{items:[]},
        },
        emptyText:'加载中...',
        exam:{
          show:1,
          content:{id:'',contentType:61,sortIndex:3},
          paperJson:{items:[]},
          paperShow:false,
          customerShow:false,
          onlyQuestion:false,
          info:{
            courseId:'',
            contentId:'',
            testName:this.course.name,
            testDuration:30,
            showAnalysis:false,
            showAnswer:false,
            times:0,
            qnum:0,//试题数量，只是模式是随机生成试题时才会有
            arrange:0,
            scoringType:1,
            passLine:60,
            randomMode:false,
            percentScore:true,
            passLine:60,
            paperType:1,//自定义试卷
            paperId:'',//试卷的id,只有paperType为2的时间才会有值
            info:'',//考试说明
            paperContent:'',//试题的json字符串
          }
        },
        assess:{
          show:1,
          content:{id:'',contentType:62,sortIndex:4},
          json:{
            countType:'权重配置',
            countText:'（问题1）*80%+（问题2）*10%+（问题3）*10%',
            resultCount:'[q1]*0.8+[q2]*0.1+[q3]*0.1',
            items:[
              {id:'1',question: "您觉的课程对工作有帮助/启发呢？",minText:'完全没用',maxText:'非常有帮助/启发',qType:1},
              {id:'2',question: "您愿意推荐其它同事来上这门课程吗？",minText:'不愿意',maxText:'非常愿意',qType:1},
              {id:'3',question: "您愿意参加该教师开设的其它课程吗？",minText:'不愿意',maxText:'非常愿意',qType:1},
              {id:'4',question: "学员之声（写下您想说的话）",minText:'',maxText:'',qType:9},
            ]
          }
        }
      }
    },
    mounted(){
        //this.init();
        if(process.env.NODE_ENV=='development'){
          this.fileBaseUrl=process.env.VUE_APP_FILE_BASE_URL;
        }
    },
    watch:{
      reset(newVal){
        this.init();
      },
      course(newVal,oldVal){
         //
        this.changeContents();
       }
    },
  methods:{
      init(){
        this.activeName='courseware';
        this.scormUrl='';//scorm的路径
        this.curCFile={},//当前课件的内容
        this.cware.content={id:'',contentType:0,sortIndex:1,contentRefId:'',pdfPath:''};
        this.cware.show=1;
        this.homework.content={id:'',contentType:60,sortIndex:2};
        this.homework.show=1;
        this.homework.info.id='';
        this.exam.content={id:'',contentType:61,sortIndex:3};
        this.exam.show=1;
        this.exam.paperJson={items:[]};
        this.exam.info.id='';
        this.exam.info.paperContent='';
        this.assess.content={id:'', contentType:62,sortIndex:4};
        this.assess.show=1;
        this.hasCWare.keyword='';
        this.hasCWare.list=[];
        this.changeContents();
      },
      changeContents(){
        if(this.contents.length>0){
           let $this=this;
           this.contents.forEach(con=>{
             if(con.sortIndex==1){
               $this.cware.content=con;
               $this.cware.show=2;
               //对于pdf文件的问题处理
               if(con.contentType==40){
                 //console.log('加载pdf文件内容');
                 $this.loadPdfFile();
               }else if(con.contentType==50){
                  //console.log('加载pdf文件内容');
                 if(!this.scormUrl){
                   $this.loadScormFile();
                 }

               }
               if(con.contentType==52){
                 if(con.content.startsWith('\{')){
                    $this.cware.linkInfo=JSON.parse(con.content);
                 }else{
                    $this.cware.linkInfo.url=con.content;
                 }
               }
                if(con.contentType==10 || con.contentType==20){
                 if(con.content.startsWith('\{')){
                    $this.cware.curriculumData=JSON.parse(con.content);
                 }else{
                    $this.cware.curriculumData.url=con.content;
                 }
               }
               $this.cwareChange = deepClone($this.cware);
             }else if(con.sortIndex==2){
               $this.homework.content=con;
               //查询作业信息，并显示
               $this.loadHomeworkInfo();
             }else if(con.sortIndex==3){
               $this.exam.content=con;
               //查询考试信息并显示
               $this.loadExamInfo();
             }else if(con.sortIndex==4){
               $this.assess.content=con;
               //转化文本为json内容
               $this.loadAssessInfo();
             }
           })
        }
      },
      loadPdfFile(){
        //检查当前是否是pdf，如果是pdf那么就不需要再查询一次了
        let fname=this.cware.content.content;
        if(fname && fname.indexOf('.pdf')>-1){
          this.cware.content.pdfPath=this.cware.content.content;
          this.courseFileShow = false;
        }else{
          apiCourseFile.detail(this.cware.content.contentRefId).then(rs=>{
             if(rs.status==200){
               this.courseFileShow = false;
               this.cware.content.pdfPath=rs.result.previewFilePath;
               this.cware.content.content=rs.result.previewFilePath;
              if(rs.result.previewFilePath == '' && rs.result.filePath.indexOf('pdf') > -1) {
               this.$forceUpdate();
                 this.cware.content.pdfPath = rs.result.filePath;
                } else {
                 this.curCFile=rs.result;
                 this.converStatus = rs.result.converStatus;
              }
                this.$forceUpdate();
             }
          });
        }
      },
      loadScormFile(){
        //对于scorm课件内容，需要再查一下
        //this.scormUrl='';
        if(this.scormUrl){
          return;
        }
        apiCourseFile.detail(this.cware.content.contentRefId).then(rs=>{
           if(rs.status==200){
              this.curCFile=rs.result;
              //this.curPdfPath=rs.result.previewFilePath;
              this.cware.content.content='scorm';
              let urlPre=window.location.protocol;
              let configUrl=process.env.VUE_APP_SCORM_URL;
              configUrl=urlPre+configUrl.substring(configUrl.indexOf(':')+1);
              this.scormUrl=configUrl+'?r=1&mode=preview&scormId='+this.curCFile.id;//播放的首页
              //console.log(this.scormUrl,'this.scormUrl')
           }
        });
      },
      loadHomeworkInfo(){
        apiCourse.getHomework(this.homework.content.id).then(res=>{
           if(res.status==200){
               this.homework.info=res.result;
               this.homework.show=3;//显示作业内容
               this.homeworkChange = deepClone(this.homework);
           }else if(res.status==404){
              //没有找到作业信息
              this.homework.info.id='';
              //this.homework.show=1;
           }else{
             this.$message.error(res.message);
           }
        })
      },
      loadExamInfo(){
          apiCourse.getExam(this.exam.content.id).then(res=>{
             if(res.status==200){
                 this.exam.info=res.result;
                 if(res.result.paperType==1){
                   this.exam.paperJson=JSON.parse(res.result.paperContent);
                 }else{
                   apiExamPaper.detail(this.exam.info.paperId).then(rs=>{
                     if(rs.status==200){
                         this.usePaper.paperId=rs.result.id;
                         this.usePaper.paperName=rs.result.testName;
                         this.usePaper.counts=rs.result.counts;
                         //this.usePaper.paperJson= rs.result.paperContent;
                     }
                   })
                 }
                 this.exam.show=9;
                 this.examChange = deepClone(this.exam);
             }else if(res.status==404){
                //没有找到作业信息
                //this.exam.paperJson={items:[]};
                //this.exam.show=1;
                this.exam.info.id='';
             }else{
               this.$message.error(res.message);
             }
          })
      },
      loadAssessInfo(){
        if(this.assess.content && this.assess.content.content!='' && this.assess.content.content.length>10){
          this.assess.json=JSON.parse(this.assess.content.content);
          this.assess.show=2;
        }
      },
      changeContent(tab){
       //检查是否需要保存

      },
      chooseCWareType(cwt){ //选择课件的内容
        this.cware.content.contentType=cwt.resType;
        this.cware.show=2;//切换到第二页
        this.cware.findShow=false;
      },
      toFindCWare(){
        //查询课件内容
        this.cware.findShow=true;
        this.findCWare();
      },
      findCWare(){
        this.hasCWare.list=[];
        this.hasCWare.count=0;
        this.getCoursewareList();
      },
      handleSizeChange(val) {
        this.hasCWare.pageSize = val;
        this.hasCWare.pageIndex = 1;
        this.getCoursewareList();
      },
      handleCurrentChange(val) {
        this.hasCWare.pageIndex = val;
        this.getCoursewareList();
      },
      closeCWareFind(){
        this.cware.findShow=false;
      },
      chooseHasCWare(row){
        this.cware.content.contentRefId=row.id;
        this.cware.content.contentName=row.name;
        this.cware.content.content=row.filePath;
        this.cware.curriculumData.url = row.filePath;
        this.cware.content.duration=row.duration;//时长
        this.cware.findShow=false;
        if(this.cware.content.contentType==40){
          if(row.filePath.indexOf('.pdf')==-1){
              this.cware.content.content=row.previewFilePath;
          }
          this.loadPdfFile();
        }
        this.saveContent(1);
      },
      toCWareReChoose(){
        //检查当前是否已经有内容了，如果有就提示是否删除，如果没有就直接返回
        let $this=this;
        if(this.cware.content.id!='' && this.cware.content.id.length>1){
            this.$confirm('您确定要删除当前课件内容重新选择吗？', '提示', {
                      confirmButtonText: '确定',
                      cancelButtonText: '取消',
                      type: 'warning'
                    }).then(() => {
                      //this.$message({ type: 'success', message: '删除成功!' });
                      //执行删除操作
                      $this.deleteContent(1);
                    }).catch(() => { });
        }else{
          //删除后进行重新选择课件内容
          this.cware.show=1;
        }
      },
      resetContent(index){
        if(index==1){
          this.cware.content.id='';
          this.scormUrl='';
          this.cware.content.contentRefId='';
          this.cware.content.contentName='';
          this.cware.content.content='';
          this.cware.content.duration=0;
          this.cware.show=1;//返回课件选择的界面
        }else if(index==2){
          this.homework.content={id:'',contentType:60,sortIndex:2};
          this.homework.info.id='';
          this.homework.info.name='';
          this.homework.info.content='';
          this.homework.show=1;
        }else if(index==3){
          this.exam.content={id:'',contentType:61,sortIndex:3};
          this.exam.info.id='';
          this.exam.paperJson={items:[]};
          this.exam.info.paperContent='{}';
          this.exam.show=1;
        }else if(index==4){
          this.assess.content={id:'',contentType:62,sortIndex:4};
          this.assess.show=1;
        }
      },
      saveContent(index){
        if(this.course.id==''){
          this.$message.error("请先保存课程信息再添加课件等信息");
          return;
        }
        this.loading=true;
        let postData={
          type:10,
          content:null,
          homework:null,
          exam:null
        }
        if(index==1){
          postData.content=this.cware.content;
          this.cwareChange.content = deepClone(this.cware.content)
          if(this.cware.content.contentType==52){
             if(this.cware.linkInfo.url==''){
               this.$message.error("请填写外连URL地址");
               return;
             }
             postData.content.content=JSON.stringify(this.cware.linkInfo);
             this.cwareChange.linkInfo = deepClone(this.cware.linkInfo)
          }else if(this.cware.content.contentType==10 || this.cware.content.contentType==20){
             if(this.cware.curriculumData.url==''){
                this.$message.error("请选择课件");
                return;
             }
             postData.content.content=JSON.stringify(this.cware.curriculumData);
             this.cwareChange.curriculumData = deepClone(this.cware.curriculumData)
          }
        }else if(index==2){
          postData.content=this.homework.content;
          postData.homework=this.homework.info;
          this.homeworkChange = deepClone(this.homework)
        }else if(index==3){
          postData.content=this.exam.content;
          //console.log(this.exam,'this.exam');
          if(this.exam.info.paperType==2){
            if(!this.exam.info.paperId){
               this.$message.error("您还未选择任何试卷");
               return;
            }
          }else{
            //检查是不是所有的试题都有了答案
            if(this.exam.paperJson.items.length==0){
              this.$message.error("您还没有添加考试的试题");
              return;
            }
            let pass=true;
            this.exam.paperJson.items.forEach(qitem=>{
                if(qitem.options.length==0){
                  pass=false;
                }else{
                  let hasAnswer=qitem.options.some(opt=>{
                    return opt.answer;
                  });
                  if(!hasAnswer){
                    pass=false;
                  }
                }
            });
            if(!pass){
              this.$message.error("试卷试题请填写完整，每个试题必须要有答案");
              this.loading=false;
              return;
            }
            this.exam.info.paperContent=JSON.stringify(this.exam.paperJson);
          }
          postData.exam=this.exam.info;
          this.examChange = deepClone(this.exam);
        }else if(index==4){
          this.assess.content.content=JSON.stringify(this.assess.json);
          postData.content=this.assess.content;
        }

        //为空的时间设置课程id
        if(postData.content.id==''){
          postData.content.courseId=this.course.id;
        }
        let $this=this;
        //保存后也要做相应的状态及数据处理
        apiCourse.saveContent(postData).then(res=>{
          if(res.status==200){
            if(index==1){
              $this.cware.content=res.result.content;
            }else if(index==2){
              $this.homework.content=res.result.content;
              $this.homework.info=res.result.homework;

              $this.homework.show=3;//
            }else if(index==3){
              $this.exam.content=res.result.content;
              $this.exam.info=res.result.exam;

              $this.exam.show=9;//
            }else if(index==4){
              $this.assess.content=res.result.content;
              $this.assess.show=2;
            }
            //if(res.result.homework)
            this.$message.success('保存成功');
            //保存成功的统一处理

          }else{
            this.$message.error(res.message);
          }
            this.loading=false;
        }).catch(err=>{
            this.loading=false;
        })
      },
      deleteContent(index){
          let $this=this;
          let postData={
            id:'',
            ctype:0,
            erasable:this.course.erasable
          }
          let curContent=null;
          if(index==1){
            postData.id=this.cware.content.id;
            postData.ctype=this.cware.content.contentType;
            curContent=this.cware.content;
          }else if(index==2){
            postData.id=this.homework.content.id;
            postData.ctype=this.homework.content.contentType;
            curContent=this.homework.content;
          }else if(index==3){
            postData.id=this.exam.content.id;
            postData.ctype=this.exam.content.contentType;
            curContent=this.exam.content;
          }else if(index==4){
            postData.id=this.assess.content.id;
            postData.ctype=this.assess.content.contentType;
            curContent=this.assess.content;
          }
          if(postData.id==''){
            this.resetContent(index);
            return;
          }
          //处理后也要分别做各自的状态处理
          apiCourse.delContent(postData).then(res=>{
            if(res.status==200){

              this.$message.success("删除成功");
              this.resetContent(index);//重置内容页面
            }else{
              this.$message.error("删除失败");
            }
          })
      },
      chooseFile(cfile){
        this.cware.content.contentRefId=cfile.id;
        //如果是非pdf文档 ，这里需要使用cfile.id再去获取
        this.cware.content.contentName=cfile.name;
        if(this.cware.content.resType === 10 || this.cware.content.resType ==20) {
           this.cware.curriculumData.url = cfile.filePath;
        }else if(this.cware.content.resType === 50){

        }else{
          if(cfile.previewFilePath){
            this.cware.curriculumData.url = cfile.previewFilePath;
          }else{
            this.cware.curriculumData.url = cfile.filePath;
          }
        }

        this.cware.content.duration=cfile.duration;//时长
        this.saveContent(1);

        let $this=this;
        if(this.cware.content.contentType==40){
          setTimeout(function(){
            $this.loadPdfFile();
          },1000);
        }else if(this.cware.content.contentType==50){
          setTimeout(function(){
            $this.loadScormFile();
          },500);
        }
      },
      getCoursewareList() {
        //  name:查询的名称的关键字
        //  self:true/false,默认是true,是否只查询自己上传的课件
        //  resOwner1:资源归属一级的id
        //  resOwner2:资源归属二级的id
        //  resOwner3:资源归属三级的id
        //  resType: 文件类型,10视频，20音频，30图片， 40 文档，41表图文，50表scrom包,90表其它 图文41，连接52，作业60，考试61，评估62
        let data = {
          name: this.hasCWare.keyword,
          // resOwner1: this.course.resOwner1, //资源归属一级的id
          // resOwner2: this.course.resOwner2, // 资源归属二级的id
          // resOwner3: this.course.resOwner3, // 资源归属三级的id
          resType: this.cware.content.contentType,
          pageSize: this.hasCWare.pageSize,
          pageIndex: this.hasCWare.pageIndex,
          self:true
        }
        apiCourseFile.pageList(data).then(res=>{
          if(res.status === 200) {
            this.hasCWare.list = res.result.list;
            this.hasCWare.count = res.result.count;
            if(res.result.count==0){
              this.$message.error("未找到符合条件的数据");
            }
          }

        })
    },
    // 作业上传
    uploadHomeworkFile(res) {
      this.homework.info.file = res.result.filePath;
    },
    removeHomeworkFile(){
      this.homework.info.file='';
    },
    //课件上传
    getFileTypes(ctype){
      if(ctype==10){
        return ["mp4"]
      }else if(ctype==20){
        return ["mp3"]
      }else if(ctype==30){
        return ["jpg","png","gif"]
      }else if(ctype==40){
        return ["doc", "xls", "ppt","docx", "xlsx", "pptx","pdf"]
      }else{
        return ["doc", "xls", "ppt","docx", "xlsx", "pptx","jpg","png","gif","mp3","mp4"]
      }
    },
    handleUploadSuccess({error,result,status}){
      if(status === 200) {
        //上传到课件库
        let courseWare={
          fileName:result.displayName,
          fileType:result.fileType,
          filePath:result.filePath,
          resType:this.cware.content.contentType,
          remark:'课程中直接上传'
        }
        apiCourseFile.saveUpload(courseWare).then(rs=>{
            if(rs.status==200){
              this.courseFileShow = true;
              this.cware.content.contentRefId=rs.result.id;
              this.cware.content.contentName=result.displayName;

              //this.cware.content.content=result.filePath;
              if(rs.result.resType === 40 && rs.result.resType != 'ppt') {
                this.cware.curriculumData.url = rs.result.previewFilePath;
              }
              this.cware.curriculumData.url = rs.result.filePath;
              this.cware.content.duration=rs.result.duration;//时长
              this.courseFileShow=true;
              this.saveContent(1);
            }else{
              this.$message.error('上传课件失败');
            }
        });
      }
    },
    handleRemoveSuccess() {

    },
    changeHomeworkShow(idx){
        this.homework.show=idx;
    },
    assessmentHandle(){
        this.assess.show=2;
    },
    changeExamShow(idx){
      this.exam.show=idx;
    },
    openCusExam(){ //自定义考试
      this.exam.show=3;
      this.exam.info.paperType=1;
      this.exam.info.paperId='';
      this.usePaper.pageIndex=1;
      this.usePaper.keyword="";
    },
    openChoosePaper(){
      this.exam.show=2;
      this.exam.info.paperType=2; //选择试卷
      this.exam.info.paperId='';
      this.findExamPapers();
    },
    findExamPapers(){ //查询已有的考试试卷
      this.emptyText='加载中...';
      this.usePaper.pageIndex=1;
      this.loadExamPapers();
    },
    loadExamPapers(){
      let pars={
        pageIndex:this.usePaper.pageIndex,
        pageSize:this.usePaper.pageSize,
        keyWord:this.usePaper.keyword
      }
      apiExamPaper.querylist(pars).then(rs=>{
          if(rs.status==200){
            this.usePaper.list=rs.result.list;
            this.usePaper.total=rs.result.count;
          }else{
            this.$message.error('查询可用试卷失败');
          }
          this.emptyText='暂无搜索内容';
      })
    },
    changePaperPage(pindex){
       this.usePaper.pageIndex=pindex;
       this.loadExamPapers();
    },
    chooseExamPaper(epaper){ //选择试卷后
      if(epaper.counts==0){
        this.$message.error('此试卷无试题内容，请重新选择');
        return;
      }
      this.exam.info.paperType=2;// 选择已有试卷
      this.exam.info.paperId=epaper.id;// 选择已有试卷
      this.usePaper.paperId=epaper.id;
      this.usePaper.paperName=epaper.testName;
      //this.usePaper.paperJson= epaper.paperContent;
      this.loadExamPaper();
      this.changeExamShow(3);
    },
    loadExamPaper(){
      if(this.exam.info.paperType!=2){
        return;
      }
      apiExamPaper.detail(this.exam.info.paperId).then(rs=>{
        if(rs.status==200){
            this.usePaper.paperId=rs.result.id;
            this.usePaper.paperName=rs.result.testName;
            this.usePaper.counts=rs.result.counts;
            //this.usePaper.paperJson= rs.result.paperContent;
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.el-radio-button__inner, .el-radio-group{
  // vertical-align: ;
}
 .el-input-number--mini{
       width: 95px;
    }


  .assess-div {
    padding: 5px;
    font-size: 14px;
    .assess-info {
      margin-bottom: 10px;

    }
  }
</style>
