|
@@ -32,7 +32,7 @@
|
|
|
{{ $t("cusMgt.searchHolder") }}
|
|
|
</Button> -->
|
|
|
</div>
|
|
|
- <Table :columns="examCol" :data="examRep" height="550">
|
|
|
+ <Table :columns="examCol" :data="examRepShow" height="550">
|
|
|
<template slot-scope="{ row }" slot="name">
|
|
|
<p style="word-break: keep-all;">
|
|
|
<template v-if="row.subject.length">
|
|
@@ -215,6 +215,7 @@ export default {
|
|
|
},
|
|
|
],
|
|
|
examRep: [],
|
|
|
+ examRepShow: [],
|
|
|
homeworkCol: [
|
|
|
{
|
|
|
title: this.$t("studentWeb.myAchievement.name"),
|
|
@@ -388,7 +389,7 @@ export default {
|
|
|
this.isTmd = this.userInfo.scope === "tmduser"
|
|
|
},
|
|
|
mounted () {
|
|
|
- document.getElementsByClassName("ivu-table-body")[0].addEventListener("scroll", this.examScroll)
|
|
|
+ // document.getElementsByClassName("ivu-table-body")[0].addEventListener("scroll", this.examScroll)
|
|
|
document.getElementsByClassName("ivu-table-body")[1].addEventListener("scroll", this.hwScroll)
|
|
|
document.getElementsByClassName("ivu-table-body")[2].addEventListener("scroll", this.recordScroll)
|
|
|
this.isLoading = true
|
|
@@ -586,10 +587,10 @@ export default {
|
|
|
userType: "",
|
|
|
school: this.userInfo.azp,
|
|
|
type: 'Exam',
|
|
|
- continuationToken: this.continuationTokenExam,
|
|
|
- count: 20,
|
|
|
+ // continuationToken: this.continuationTokenExam,
|
|
|
+ // count: 20,
|
|
|
}
|
|
|
- if(this.filterType.ownerType != 'all') {
|
|
|
+ /* if(this.filterType.ownerType != 'all') {
|
|
|
param.owner = this.filterType.ownerType
|
|
|
}
|
|
|
if(this.filterType.sourceType != 'all') {
|
|
@@ -597,79 +598,53 @@ export default {
|
|
|
}
|
|
|
if(this.examName != '') {
|
|
|
param.name = this.examName
|
|
|
- }
|
|
|
+ } */
|
|
|
param.userType = this.userInfo.scope === "tmduser" ? "tmdid" : "schoolid"
|
|
|
this.$api.studentWeb.getExamAch(param).then(async res => {
|
|
|
if(!res.code) {
|
|
|
this.continuationTokenExam = res.continuationToken
|
|
|
if(res.result.length) {
|
|
|
- let teaId = []
|
|
|
- res.result.forEach(results => {
|
|
|
- if(!teaId.includes(results.createId)) teaId.push(results.createId)
|
|
|
- })
|
|
|
+ let teaId = [...new Set(res.result.map(item => item.createId || ''))]
|
|
|
let teaName = teaId.length ? await this.getTeacherName(teaId) : []
|
|
|
- res.result.forEach(result => {
|
|
|
- let examData = {...result}
|
|
|
- console.log('44444444444', examData.subject);
|
|
|
- let hasCourse = false
|
|
|
- // 先匹配课程和名单
|
|
|
- examData.subject.forEach((sub, index) => {
|
|
|
- if(sub.id === this.courseNow.id || sub.id === this.courseNow.subject.id) {
|
|
|
- console.log('22222222222');
|
|
|
- if(examData.result[index + index * examData.point.length].cId === this.courseNow.groupId) {
|
|
|
- console.log('333333333333');
|
|
|
- hasCourse = true
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
+ res.result.forEach(item => {
|
|
|
+ let examData = {...item}
|
|
|
+ let subIndex = item.subject.findIndex(subject => subject.id === this.courseNow.id || subject.id === this.courseNow.subject.id)
|
|
|
+ let hasCourse = subIndex != -1 && item.result[subIndex + subIndex * item.point.length].cId === this.courseNow.groupId ? true : false
|
|
|
if(hasCourse) {
|
|
|
- examData.startTime = this.dateFormat(result.time)
|
|
|
+ examData.startTime = this.dateFormat(item.time)
|
|
|
let nameIds = teaName.find(names => {
|
|
|
- return names.id === result.createId
|
|
|
+ return names.id === item.createId
|
|
|
})
|
|
|
examData.creator = !nameIds ? undefined : nameIds.name
|
|
|
examData.type = ""
|
|
|
examData.total = 0
|
|
|
examData.class = []
|
|
|
- if(result.ext) {
|
|
|
- // examData.subjects = result.ext.subjects ? result.ext.subjects : []
|
|
|
- examData.type = result.ext
|
|
|
- }
|
|
|
- if(result.result.length) {
|
|
|
- result.result.forEach(score => {
|
|
|
+ if(item.ext) examData.type = item.ext
|
|
|
+ if(item.result.length) {
|
|
|
+ item.result.forEach(result => {
|
|
|
// 当前班级是否有本人,有才加入examData.class
|
|
|
- let myId = score.sIds.findIndex(sId => {
|
|
|
+ let myId = result.sIds.findIndex(sId => {
|
|
|
return sId === this.userInfo.sub
|
|
|
})
|
|
|
if(myId != -1) {
|
|
|
- // examData.class有值,判断当前班级是否存在
|
|
|
- if(examData.class.length) {
|
|
|
- let haveCid = examData.class.find(myClass => {
|
|
|
- return myClass.cId === score.cId
|
|
|
- })
|
|
|
- if(!haveCid) {
|
|
|
- examData.class.push({
|
|
|
- cId: score.cId,
|
|
|
- cname: score.cname
|
|
|
- })
|
|
|
- }
|
|
|
- } else {
|
|
|
+ // 保存当前活动存在的班级名称,以作展示
|
|
|
+ let haveCid = examData.class.length ? examData.class.find(myClass => {
|
|
|
+ return myClass.cId === result.cId
|
|
|
+ }) : undefined
|
|
|
+ if(!haveCid) {
|
|
|
examData.class.push({
|
|
|
- cId: score.cId,
|
|
|
- cname: score.cname
|
|
|
+ cId: result.cId,
|
|
|
+ cname: result.cname
|
|
|
})
|
|
|
}
|
|
|
- if(examData.subject.length) {
|
|
|
- // 查找当前科目
|
|
|
- let subjIn = examData.subject.findIndex(subj => {
|
|
|
- return subj.id === score.sub
|
|
|
- })
|
|
|
- if(subjIn != -1) {
|
|
|
- examData.subject[subjIn].score = score.sum[myId]
|
|
|
- }
|
|
|
+ let subjIn = examData.subject.length ? examData.subject.findIndex(subj => {
|
|
|
+ return subj.id === result.sub
|
|
|
+ }) : -1
|
|
|
+ if(subjIn != -1) {
|
|
|
+ examData.subject[subjIn].score = result.sum[myId]
|
|
|
} else {
|
|
|
examData.subject.push({
|
|
|
- id: score.sub,
|
|
|
+ id: result.sub,
|
|
|
name: null,
|
|
|
score: 0
|
|
|
})
|
|
@@ -684,11 +659,8 @@ export default {
|
|
|
}
|
|
|
this.examRep.push(examData)
|
|
|
}
|
|
|
-
|
|
|
})
|
|
|
- if(this.examRep.length < 15 && this.continuationTokenExam) {
|
|
|
- this.getExamList()
|
|
|
- }
|
|
|
+ this.examRepShow = [...this.examRep]
|
|
|
}
|
|
|
}
|
|
|
}).finally(() => {
|
|
@@ -847,15 +819,14 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
searchExam(type) {
|
|
|
- this.isLoading = true
|
|
|
if(type === 'record') {
|
|
|
+ this.isLoading = true
|
|
|
this.continuationTokenRecord = null
|
|
|
this.classRep = []
|
|
|
this.getRecordList()
|
|
|
} else {
|
|
|
this.continuationTokenExam = null
|
|
|
- this.examRep = []
|
|
|
- this.getExamList()
|
|
|
+ this.examRepShow = this.examRep.filter(item => this.examName ? item.name.includes(this.examName) : true)
|
|
|
}
|
|
|
},
|
|
|
},
|
|
@@ -864,11 +835,19 @@ export default {
|
|
|
deep: true,
|
|
|
handler(n, o) {
|
|
|
if(n) {
|
|
|
- this.isLoading = true
|
|
|
+ // this.isLoading = true
|
|
|
// this.isSearch = true
|
|
|
this.continuationTokenExam = null
|
|
|
- this.examRep = []
|
|
|
- this.getExamList()
|
|
|
+ this.examRepShow = this.examRep.filter(item => {
|
|
|
+ let filterNum = 0
|
|
|
+ if(this.filterType.ownerType != 'all' ? this.filterType.ownerType === item.owner : true) {
|
|
|
+ filterNum ++
|
|
|
+ }
|
|
|
+ if(this.filterType.sourceType != 'all' ? this.filterType.sourceType === item.source : true) {
|
|
|
+ filterNum ++
|
|
|
+ }
|
|
|
+ return filterNum === 2 ? true : false
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
},
|