|
@@ -1,18 +1,19 @@
|
|
|
<template>
|
|
|
<div class="page scroll-x">
|
|
|
<topHead></topHead>
|
|
|
- <topNav @navKey='navKeys'></topNav>
|
|
|
+ <topNav @navKey="navKeys"></topNav>
|
|
|
<div class="container d-f">
|
|
|
<div class="leftMenu">
|
|
|
- <li class="active" >
|
|
|
+ <li class="active">
|
|
|
<i class="iconfont iconbanji"></i>
|
|
|
<span>我的班级</span>
|
|
|
</li>
|
|
|
- <li @click="jump(1)">
|
|
|
+ <li @click="jump(1)">
|
|
|
<i class="iconfont iconyuejuan"></i> <span>阅卷任务</span>
|
|
|
</li>
|
|
|
<li @click="jump(2)">
|
|
|
- <i class="iconfont iconzuoye1"></i><span>{{navKey==2?'作业分析':'成绩分析'}}</span>
|
|
|
+ <i class="iconfont iconzuoye1"></i
|
|
|
+ ><span>{{ navKey == 2 ? "作业分析" : "成绩分析" }}</span>
|
|
|
</li>
|
|
|
<li @click="jump(3)">
|
|
|
<i class="iconfont iconcuoti1"></i><span>错题分析</span>
|
|
@@ -20,12 +21,17 @@
|
|
|
</div>
|
|
|
<div class="rightContent">
|
|
|
<div class="recordTitle">
|
|
|
- <span>{{navKey==2?'作业中心':'考试中心'}}> </span>
|
|
|
+ <span>{{ navKey == 2 ? "作业中心" : "考试中心" }}> </span>
|
|
|
<span>我的班级</span>
|
|
|
</div>
|
|
|
<div class="d-f screen screen1">
|
|
|
<span>班级:</span>
|
|
|
- <el-select @change="classC" v-model="params.cid" clearable placeholder="请选择">
|
|
|
+ <el-select
|
|
|
+ @change="classC"
|
|
|
+ v-model="params.cid"
|
|
|
+ clearable
|
|
|
+ placeholder="请选择"
|
|
|
+ >
|
|
|
<el-option
|
|
|
:label="item.name"
|
|
|
:value="item.id"
|
|
@@ -50,21 +56,21 @@
|
|
|
<li>年龄</li>
|
|
|
<li>手机号</li>
|
|
|
</div>
|
|
|
- <div class="none" v-if="tableData.length == 0">
|
|
|
- <div>
|
|
|
- <img src="../../assets/none.png" alt="" />
|
|
|
- </div>
|
|
|
- <div>暂无数据</div>
|
|
|
+ <div class="none" v-if="tableData.length == 0">
|
|
|
+ <div>
|
|
|
+ <img src="../../assets/none.png" alt="" />
|
|
|
</div>
|
|
|
+ <div>暂无数据</div>
|
|
|
+ </div>
|
|
|
<div
|
|
|
- v-else
|
|
|
+ v-else
|
|
|
class="cap_table"
|
|
|
:style="{ minHeight: Common.clientHeight - 400 + 'px' }"
|
|
|
>
|
|
|
<li v-for="(item, i) in tableData" :key="i" class="d-f j-s">
|
|
|
<div>{{ item.sno }}</div>
|
|
|
<div>{{ item.name }}</div>
|
|
|
- <div>{{ item.sex>0?'男':'女' }}</div>
|
|
|
+ <div>{{ item.sex > 0 ? "男" : "女" }}</div>
|
|
|
<div>{{ item.age }}</div>
|
|
|
<div>{{ item.phone }}</div>
|
|
|
</li>
|
|
@@ -89,76 +95,71 @@
|
|
|
import topNav from "@/components/assembly/topnav";
|
|
|
import topHead from "@/components/assembly/head";
|
|
|
import foot from "@/components/assembly/foot";
|
|
|
-import { searchClass, classes } from "@/util/api";
|
|
|
+import { searchClass, classes } from "@/util/api";
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
params: {
|
|
|
page: 1,
|
|
|
size: 10,
|
|
|
- cid:'',
|
|
|
+ cid: "",
|
|
|
},
|
|
|
tableData: [],
|
|
|
classL: [],
|
|
|
total: 0,
|
|
|
- navKey:2,
|
|
|
+ navKey: 2,
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
+ if(this.Common.timeLogin() ==2){
|
|
|
+ localStorage.setItem('open_tiem',time)
|
|
|
+ this.$router.go(0);
|
|
|
+ return
|
|
|
+ }else if(this.Common.timeLogin() ==1){
|
|
|
+ this.$router.push('/login');
|
|
|
+ localStorage.setItem('open_tiem',time)
|
|
|
+ return
|
|
|
+ }
|
|
|
var that = this;
|
|
|
- this.navKey = localStorage.getItem('navKey');
|
|
|
+ this.navKey = localStorage.getItem("navKey");
|
|
|
//班级
|
|
|
classes().then((res) => {
|
|
|
- console.log(res.data[0])
|
|
|
+ console.log(res.data[0]);
|
|
|
if (res.errcode == 0) {
|
|
|
that.classL = res.data;
|
|
|
- that.params.cid = res.total>0?res.data[0].id:'';
|
|
|
+ that.params.cid = res.total > 0 ? res.data[0].id : "";
|
|
|
that.getList();
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
},
|
|
|
methods: {
|
|
|
- navKeys(i){
|
|
|
- this.navKey=i;
|
|
|
- },
|
|
|
- //导出
|
|
|
- exports(){
|
|
|
- var that = this;
|
|
|
- searchClass({page:1,size:1000,cid:this.params.cid}).then((res) => {
|
|
|
+ navKeys(i) {
|
|
|
+ this.navKey = i;
|
|
|
+ },
|
|
|
+ //导出
|
|
|
+ exports() {
|
|
|
+ var that = this;
|
|
|
+ searchClass({ page: 1, size: 1000, cid: this.params.cid }).then((res) => {
|
|
|
if (res.errcode == 0) {
|
|
|
- res.data.forEach((item)=>{
|
|
|
- item.sex = item.sex==1?'男':'女'
|
|
|
- })
|
|
|
- console.log(res.data)
|
|
|
- //导出
|
|
|
+ res.data.forEach((item) => {
|
|
|
+ item.sex = item.sex == 1 ? "男" : "女";
|
|
|
+ });
|
|
|
+ console.log(res.data);
|
|
|
+ //导出
|
|
|
require.ensure([], () => {
|
|
|
const { export_json_to_excel } = require("@/excel/Export2Excel"); //注意这个Export2Excel路径
|
|
|
- const tableHeader = [
|
|
|
- "学号",
|
|
|
- "姓名",
|
|
|
- "性别",
|
|
|
- "年龄",
|
|
|
- "手机号",
|
|
|
- ]; // 设置Excel表格的表头
|
|
|
- const filterVal = [
|
|
|
- "sno",
|
|
|
- "name",
|
|
|
- "sex",
|
|
|
- "age",
|
|
|
- "phone",
|
|
|
- ]; // 跟表格表头对应的绑定的prop
|
|
|
+ const tableHeader = ["学号", "姓名", "性别", "年龄", "手机号"]; // 设置Excel表格的表头
|
|
|
+ const filterVal = ["sno", "name", "sex", "age", "phone"]; // 跟表格表头对应的绑定的prop
|
|
|
let list = this.filterTableData(
|
|
|
JSON.parse(JSON.stringify(res.data))
|
|
|
); // this.selectList为选中的要导出的数据,用filterTableData方法先处理一下数据格式(要进行深度拷贝,以免过滤的时候,影响页面上展示的数据),再存到list
|
|
|
let data = this.formatJson(filterVal, list);
|
|
|
- export_json_to_excel(tableHeader, data, '学生列表'); //最后一个是导出表格的名字
|
|
|
+ export_json_to_excel(tableHeader, data, "学生列表"); //最后一个是导出表格的名字
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
- },
|
|
|
- formatJson(filterVal, Data) {
|
|
|
+ },
|
|
|
+ formatJson(filterVal, Data) {
|
|
|
return Data.map((v) => filterVal.map((j) => v[j]));
|
|
|
},
|
|
|
|
|
@@ -170,20 +171,20 @@ export default {
|
|
|
});
|
|
|
return data;
|
|
|
},
|
|
|
- classC(i){
|
|
|
- console.log(i)
|
|
|
- this.params.page = 1
|
|
|
- this.params.cid = i
|
|
|
- this.getList();
|
|
|
- },
|
|
|
+ classC(i) {
|
|
|
+ console.log(i);
|
|
|
+ this.params.page = 1;
|
|
|
+ this.params.cid = i;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
//重置
|
|
|
- reset(){
|
|
|
- this.params.page=1;
|
|
|
- this.params.cid='';
|
|
|
+ reset() {
|
|
|
+ this.params.page = 1;
|
|
|
+ this.params.cid = "";
|
|
|
this.getList();
|
|
|
},
|
|
|
//搜索
|
|
|
- search(){
|
|
|
+ search() {
|
|
|
this.params.page = 1;
|
|
|
this.getList();
|
|
|
},
|
|
@@ -211,7 +212,7 @@ export default {
|
|
|
that.tableData = res.data;
|
|
|
that.total = res.total;
|
|
|
//关闭loading
|
|
|
- load.close();
|
|
|
+ load.close();
|
|
|
}
|
|
|
});
|
|
|
},
|
|
@@ -219,13 +220,14 @@ export default {
|
|
|
if (id == 2) {
|
|
|
//作业分析
|
|
|
this.$router.push("/tk_fx");
|
|
|
- }else if(id == 1){//阅卷任务
|
|
|
- this.$router.push("/task1");
|
|
|
+ } else if (id == 1) {
|
|
|
+ //阅卷任务
|
|
|
+ this.$router.push("/task1");
|
|
|
}
|
|
|
},
|
|
|
- tk_py(title, id,tid) {
|
|
|
+ tk_py(title, id, tid) {
|
|
|
// console.log(title)
|
|
|
- this.$router.push({ path: "/tk_yp", query: { title, id,tid } });
|
|
|
+ this.$router.push({ path: "/tk_yp", query: { title, id, tid } });
|
|
|
},
|
|
|
},
|
|
|
components: { topHead, topNav, foot },
|
|
@@ -272,7 +274,7 @@ export default {
|
|
|
color: #333;
|
|
|
}
|
|
|
.table_head li,
|
|
|
-.cap_table li > div{
|
|
|
+.cap_table li > div {
|
|
|
width: 20%;
|
|
|
}
|
|
|
|