<!DOCTYPE html>
<div class="userclass">
    <div style="padding-bottom: 20px">
        <ks-title title="我的作业" v-if="$route.params.id =='' "/>
        <!-- 排序和搜索 -->
        <el-tabs v-model="studenttype" @tab-click="getUserWork()">
            <el-tab-pane label="全部" name="-1"></el-tab-pane>
            <el-tab-pane label="未提交" name="0"></el-tab-pane>
            <el-tab-pane label="已提交" name="1"></el-tab-pane>
            <el-tab-pane label="已点评" name="2"></el-tab-pane>
        </el-tabs>
        <div class="userclass-sort">
            <!-- <el-select v-model="sort" placeholder="请选择" size="medium" @change="changeSelect">
                <el-option v-for="item in sortList" :key="item.value" :label="item.label" :value="item.value">
                </el-option>
            </el-select> -->
            <el-input placeholder="请输入作业名称" size="medium" v-model="key" @change="changeInput">
                <i slot="suffix" class="el-input__icon el-icon-search" @click="changeInput"></i>
            </el-input>
        </div>
        <!-- 作业列表 -->
        <div class="userclass-list">
            <el-table ref="Table" :data="tableData" tooltip-effect="dark" style="width: 100%">
                <el-table-column label="作业名称" show-overflow-tooltip>
                    <template slot-scope="scope">{{ scope.row.workname }}</template>
                </el-table-column>
                <el-table-column label="关联课程" show-overflow-tooltip>
                    <template slot-scope="scope">{{scope.row.roomname}}</template>
                </el-table-column>
                <el-table-column prop="enddate" label="作业截止时间" show-overflow-tooltip>
                </el-table-column>
                <el-table-column label="得分"  width="100">
                    <template slot-scope="scope">
                        <div v-if="scope.row.issubmit">{{scope.row.score}}</div>
                        <div v-else>未提交</div>
                    </template>
                </el-table-column>
                <el-table-column label="操作" width="110">
                    <template slot-scope="scope">
                        <!-- <div v-if="scope.row.worktype == 2">
                            <el-button v-if="!scope.row.issubmit" type="primary" size="small" plain
                                @click="clickwork(scope.row.id,scope.row.worktypeurl)">做作业</el-button>
                            <el-button v-if="scope.row.status" type="primary" size="small" plain
                                @click="clickwork(scope.row.id,scope.row.parsingpage)">查看作业</el-button>
                        </div> 
                        <div v-else>-->
                        <div>
                            <div v-if="scope.row.enstatus">
                                <div v-if="!scope.row.status">
                                    <!--true 不可以编辑 -->
                                    <!-- status	  教师是否批改作业 false：未批改 true：已批改 -->
                                    <!-- issubmit 学生作业是否提交 false：未提交 true：已提交 -->
                                    <!-- stuhoemjsonstatus 草稿数据状态 false:不存在 true :存在 -->
                                    <el-button type="primary" @click="clickwork(scope.row.id,'')" size="small" plain>
                                        {{scope.row.issubmit ? '重新提交':'做作业'}}
                                    </el-button>
                                </div>
                                <div v-else>
                                    <el-button type="primary" @click="clickwork(scope.row.id,'')" size="small" plain>
                                        查批改情况</el-button>
                                </div>
                            </div>
                            <div v-else>你已超时</div>
                        </div>
                    </template>
                </el-table-column>
            </el-table>
        </div>
        <el-pagination style="text-align: center" @current-change="getUserWork" background
            layout="prev, pager, next" :current-page="currentPage" :page-count="pageCount" v-if="pageCount>0">
        </el-pagination>
        <!-- <ks-empty msg="没有任何作业~" v-else /> -->
    </div>
</div>