<!DOCTYPE html>
<div v-loading="loading">
<div class="userclass">
    <div class="userclass-look">
        <p> {{classworkinfo.worklisttitle}}</p>
        <div class="userclass-look__info">布置作业时间：{{classworkinfo.workaddtate}}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            作业截止时间：{{classworkinfo.workenddate}}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            布置老师：{{classworkinfo.workteacher}}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            批阅状态：{{workinfo.statusname}}</div>
    </div>
    <el-button class="userclass-detail__retrun" @click="$router.push({path: `/user/mywork`})">返回作业列表</el-button>
    <!-- 详情页 -->
    <div class="userwork" v-if="worktype == 0">
        <el-form label-width="80x">
            <el-form-item label="作业内容：">
                <div  v-html="classworkinfo.workcontent"></div>
                <!-- {{classworkinfo.workcontent}} -->
            </el-form-item>
            <el-form-item label="作业附件：" v-if="accessorytype != 0">
                <media-preview  :ispreview="false" :type="previewType" :info="accessoryurl" @getlist="getlist"></media-preview>
            </el-form-item>
          </el-form>
    </div>
    <!-- 考试、题库部分列表 -->
    <div class="userclass-list" v-if="worktype != 0">
        <!-- 题库 -->
        <el-table
        v-if="worktype == 1"
        :data="tableExamData"
        >
        <el-table-column
          prop="workname"
          label="作业名称"
          >
        </el-table-column>
        <el-table-column 
          prop="papersumscore"
          label="总题数"
          width="180">
          <template slot-scope="scope">
            {{scope.row.papercount}}题
        </template>
        </el-table-column>
        <el-table-column
          width="180"
          label="答对题数">
            <template slot-scope="scope">
                {{scope.row.paperdocount}}题
            </template>
        </el-table-column>
        <el-table-column label="操作" width="100">
            <template slot-scope="scope">
                <a :href="scope.row.worktypeurl =''?scope.row.parsingpage:scope.row.worktypeurl" target="_blank">
                    <el-button type="primary" size="small" plain >做题目</el-button>
                </a>
            </template>
        </el-table-column>
      </el-table>
      <!-- 考试 -->
      <el-table
      v-if="worktype == 2"
      :data="tableExamData"
      >
      <el-table-column
        prop="papername"
        label="试卷名称"
        >
      </el-table-column>
      <el-table-column
        label="试卷总分"
        width="180">
        <template slot-scope="scope">
          {{scope.row.papersumscore}}分
      </template>
      </el-table-column>
      <el-table-column
        width="180"
        label="得分">
          <template slot-scope="scope">
              {{!scope.row.issubmit ? scope.row.score:'未提交'}}
          </template>
      </el-table-column>
      <el-table-column label="操作" width="100">
          <template slot-scope="scope">
              <a :href="scope.row.worktypeurl =''?scope.row.parsingpage:scope.row.worktypeurl" target="_blank">
                  <el-button type="primary" size="small" plain >{{!workinfo.status ? '做试卷':'重新考试'}}</el-button>
              </a>
              <!-- <el-button v-else type="primary" :disabled="true" size="small" plain >做试卷</el-button> -->
          </template>
      </el-table-column>
    </el-table>
    </div>
</div>
<!-- 作业部分 -->
<div class="userclass" v-if="workinfo.status">
    <div class="userclass-look">
        <p>教师点评</p>
    </div>
    <el-form label-width="120px">
        <el-form-item label="评分等级：">
            <span class="userclass-look__teacher">
                {{workinfo.leveltype == 0 ? '不及格':''}}

                {{workinfo.leveltype == 1 ? '及格':''}}
                
                {{workinfo.leveltype == 2 ? '良好':''}}

                {{workinfo.leveltype == 3 ? '优秀':''}}

                {{workinfo.leveltype == -1 ? '--':''}}
            </span>
        </el-form-item>
        <el-form-item label="老师评分：">
            <span class="userclass-look__teacher">{{workinfo.score}}分</span>
        </el-form-item>
        <el-form-item label="老师评语：">
            <span class="userclass-look__teacher">
                {{workinfo.teachercentent}}
            </span>
        </el-form-item>
        <!-- <el-form-item label="批阅附件：">
            <span class="userclass-look__teacher">100/100分</span>
        </el-form-item> -->
      </el-form>
</div>
<div class="userclass" v-if="worktype == 0">
      <el-form :model="dynamicValidateForm" ref="dynamicValidateForm" label-width="100px" class="demo-dynamic" >
        <div class="userclass-look">
            <p>提交作业</p>
        </div>
        <el-row class="mt10 demo-dynamic__box" :gutter="20" v-for="(domain, index) in dynamicValidateForm.stuhoemjson" :key='index'>
            <el-col :span="20">
                <div class="userclass-no">第{{index + 1}}条作业：</div>
                <el-form-item label="作业名称："  
                :prop="'stuhoemjson.'+ index +'.studenttitle'"
                :rules="[{ required: true, message: '请输入作业名称', trigger: 'blur' }]">
                    <el-input :disabled="workinfo.status" v-model="domain.studenttitle"></el-input>
                </el-form-item>
                <el-form-item label="作业内容："
                :prop="'stuhoemjson.'+ index +'.studentcontent'"
                :rules="[{ required: true, message: '请输入作业内容', trigger: 'blur' }]"
               >
                    <el-input type="textarea"  :disabled="workinfo.status" :autosize="{ minRows: 4, maxRows: 12}" maxlength="500" v-model="domain.studentcontent"></el-input>
                </el-form-item>
                <el-form-item label="上传附件：" 
                    :prop="'stuhoemjson.'+ index +'.studenturl'"
                    :rules="[{ required: true, message: '请上传文件', trigger: 'blur' }]"
                    v-if="useraccessorytype != 0"
                >
                    <el-upload
                        :action="actionUrl"
                        :on-remove="handleRemove"
                        :on-success="handleAvatarSuccess"
                        :before-upload="beforeAvatarUpload"
                        :show-file-list="false"
                        :accept="fileType"
                        multiple
                        v-if="!workinfo.status"
                        >
                        <el-button size="small" type="primary" @click="gelindex(index)">点击上传</el-button>
                        <span style="color: #999;margin-left: 10px;" v-if="userpreviewType == 'image'">注：图片只能上传9张</span>
                    </el-upload>
                    <media-preview :ispreview="!workinfo.status" :type="userpreviewType" :info="domain.studenturl" @getlist="getlist" ></media-preview>
                </el-form-item>
            </el-col>
            <el-col :span="4" v-if="!workinfo.status">
                <el-button v-if="index != 0" type="danger" plain class="delework" @click="removeDomain(domain)">删除</el-button>
            </el-col>
        </el-row>
        <el-form-item class="form-btn"  v-if="!workinfo.status">
          <el-button round @click="addDomain">添加下一条作业</el-button>
          <el-button round @click="submitForm('dynamicValidateForm',1)" type="primary" plain>保存草稿</el-button>
          <el-button round @click="submitForm('dynamicValidateForm',2)" type="primary">提交作业</el-button>
          <!-- <el-button @click="resetForm('dynamicValidateForm')">返回</el-button> -->
        </el-form-item>
      </el-form>
</div>
<!-- 教师教批改 -->
<!-- <div class="userclass"  v-if="workinfo.status">
    <div class="userclass-look">
        <p>教师教批改</p>
    </div>
    <div class="score">
        <el-form label-width="100px" class="demo-dynamic">
            <el-form-item label="评价等级：" style="color: #787c82;">
                {{workinfo.leveltype == 0 ? '不及格':''}}
                
                {{workinfo.leveltype == 1 ? '及格':''}}
                
                {{workinfo.leveltype == 2 ? '良好':''}}

                {{workinfo.leveltype == 3 ? '优秀':''}}
            </el-form-item>
            <el-form-item label="教师评语：">
                <div style="color: #787c82;">
                    {{workinfo.teachercentent}}
                </div>
            </el-form-item>
        </el-form>
    </div>
    <el-dialog title="查看公告" :visible.sync="noticeDialogVisible" width="800px">
        <div class="userclass-noticedetail">
            <div class="noticedetail-title">{{noticeDetail.title}}</div>
            <div style="padding: 20px 0 40px 0;" v-html="noticeDetail.content">
            </div>
            <div style="text-align: center">
                <el-button style="padding: 10px 34px;" round size="medium" @click="noticeDialogVisible = false">返回</el-button>
            </div>
        </div>
    </el-dialog>
</div> -->
</div>