提交 f1833097 authored 作者: 王鹏飞's avatar 王鹏飞

bug fixes

上级 dd848f1e
...@@ -58,14 +58,14 @@ ...@@ -58,14 +58,14 @@
<div class="stu-list"> <div class="stu-list">
<div class="title"> <div class="title">
<span>学生列表</span> <span>学生列表</span>
<el-select @change="change" v-model="selectValue" placeholder="请选择"> <el-select v-model="selectValue" placeholder="请选择">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"> </el-option> <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"> </el-option>
</el-select> </el-select>
</div> </div>
<ul> <ul>
<li <li
:class="item.sheet_id === (sheetIds || $route.query.sheet_id) ? 'active' : ''" :class="item.sheet_id === sheetId ? 'active' : ''"
v-for="(item, index) in studentList" v-for="(item, index) in currentStudentList"
:key="index" :key="index"
@click="selectStudent(item)" @click="selectStudent(item)"
> >
...@@ -87,7 +87,7 @@ export default { ...@@ -87,7 +87,7 @@ export default {
data: {}, data: {},
selectValue: 0, selectValue: 0,
studentList: [], studentList: [],
sheetIds: '', sheetId: this.$route.query.sheet_id,
options: [ options: [
{ value: 0, label: '全部' }, { value: 0, label: '全部' },
{ value: 1, label: '未批阅' }, { value: 1, label: '未批阅' },
...@@ -98,6 +98,13 @@ export default { ...@@ -98,6 +98,13 @@ export default {
computed: { computed: {
examId() { examId() {
return this.$route.query.exam_id return this.$route.query.exam_id
},
currentStudentList() {
if (this.selectValue === 0) {
return this.studentList
} else {
return this.studentList.filter(item => item.status === this.selectValue)
}
} }
}, },
created() { created() {
...@@ -109,19 +116,13 @@ export default { ...@@ -109,19 +116,13 @@ export default {
}, },
methods: { methods: {
selectStudent(item) { selectStudent(item) {
this.sheetIds = item.sheet_id this.sheetId = item.sheet_id
this.getTopic(item.sheet_id) this.getTopic()
this.$refs.exam.reset() this.$refs.exam.reset()
}, },
change() {
this.studentList = JSON.parse(window.localStorage.examStudentsList)
if (this.selectValue !== 0) {
this.studentList = this.studentList.filter(item => parseInt(item.status) === parseInt(this.selectValue))
}
},
// 获取考卷 // 获取考卷
getTopic(sheetId) { getTopic() {
api.getReviewDetails({ sheet_id: sheetId || this.$route.query.sheet_id }).then(response => { api.getReviewDetails({ sheet_id: this.sheetId }).then(response => {
this.data = JSON.parse(response.data).sheet this.data = JSON.parse(response.data).sheet
}) })
}, },
...@@ -144,7 +145,7 @@ export default { ...@@ -144,7 +145,7 @@ export default {
return false return false
} }
const param = { const param = {
sheet_id: this.$route.query.sheet_id, sheet_id: this.sheetId,
question_item_id: data.question_item_id, question_item_id: data.question_item_id,
question_id: item.id, question_id: item.id,
comment: item.comment, comment: item.comment,
...@@ -158,8 +159,18 @@ export default { ...@@ -158,8 +159,18 @@ export default {
api.submitReviewDetails(param).then(response => { api.submitReviewDetails(param).then(response => {
item.checked_flag = true item.checked_flag = true
this.$message('批阅成功') this.$message('批阅成功')
if (response.status === 2) {
this.updateStudentStatus(response.status)
}
}) })
}) })
},
updateStudentStatus(stauts) {
const index = this.studentList.findIndex(item => item.sheet_id === this.sheetId)
if (index !== -1) {
this.studentList[index].status = stauts
}
window.localStorage.setItem('examStudentsList', JSON.stringify(this.studentList))
} }
} }
} }
......
...@@ -58,14 +58,14 @@ ...@@ -58,14 +58,14 @@
<div class="stu-list"> <div class="stu-list">
<div class="title"> <div class="title">
<span>学生列表</span> <span>学生列表</span>
<el-select @change="change" v-model="selectValue" placeholder="请选择"> <el-select v-model="selectValue" placeholder="请选择">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"> </el-option> <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"> </el-option>
</el-select> </el-select>
</div> </div>
<ul> <ul>
<li <li
:class="item.sheet_id === (sheetIds || $route.query.sheet_id) ? 'active' : ''" :class="item.sheet_id === sheetId ? 'active' : ''"
v-for="(item, index) in studentList" v-for="(item, index) in currentStudentList"
:key="index" :key="index"
@click="selectStudent(item)" @click="selectStudent(item)"
> >
...@@ -86,7 +86,7 @@ export default { ...@@ -86,7 +86,7 @@ export default {
return { return {
data: {}, data: {},
selectValue: 0, selectValue: 0,
sheetIds: '', sheetId: this.$route.query.sheet_id,
studentList: [], studentList: [],
options: [ options: [
{ value: 0, label: '全部' }, { value: 0, label: '全部' },
...@@ -98,6 +98,13 @@ export default { ...@@ -98,6 +98,13 @@ export default {
computed: { computed: {
examId() { examId() {
return this.$route.query.exam_id return this.$route.query.exam_id
},
currentStudentList() {
if (this.selectValue === 0) {
return this.studentList
} else {
return this.studentList.filter(item => item.status === this.selectValue)
}
} }
}, },
created() { created() {
...@@ -109,19 +116,13 @@ export default { ...@@ -109,19 +116,13 @@ export default {
}, },
methods: { methods: {
selectStudent(item) { selectStudent(item) {
this.sheetIds = item.sheet_id this.sheetId = item.sheet_id
this.getTopic(item.sheet_id) this.getTopic()
this.$refs.exam.reset() this.$refs.exam.reset()
}, },
change() {
this.studentList = JSON.parse(window.localStorage.testStudentsList)
if (this.selectValue !== 0) {
this.studentList = this.studentList.filter(item => parseInt(item.status) === parseInt(this.selectValue))
}
},
// 获取考卷 // 获取考卷
getTopic(sheetId) { getTopic() {
api.getReviewDetails({ sheet_id: sheetId || this.$route.query.sheet_id, type: 'chapter' }).then(response => { api.getReviewDetails({ sheet_id: this.sheetId, type: 'chapter' }).then(response => {
this.data = JSON.parse(response.data).sheet this.data = JSON.parse(response.data).sheet
}) })
}, },
...@@ -145,7 +146,7 @@ export default { ...@@ -145,7 +146,7 @@ export default {
} }
const param = { const param = {
type: 'chapter', type: 'chapter',
sheet_id: this.$route.query.sheet_id, sheet_id: this.sheetId,
question_item_id: data.question_item_id, question_item_id: data.question_item_id,
question_id: item.id, question_id: item.id,
comment: item.comment, comment: item.comment,
...@@ -159,8 +160,18 @@ export default { ...@@ -159,8 +160,18 @@ export default {
api.submitReviewDetails(param).then(response => { api.submitReviewDetails(param).then(response => {
item.checked_flag = true item.checked_flag = true
this.$message('批阅成功') this.$message('批阅成功')
if (response.status === 2) {
this.updateStudentStatus(response.status)
}
}) })
}) })
},
updateStudentStatus(stauts) {
const index = this.studentList.findIndex(item => item.sheet_id === this.sheetId)
if (index !== -1) {
this.studentList[index].status = stauts
}
window.localStorage.setItem('testStudentsList', JSON.stringify(this.studentList))
} }
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论