提交 98424fe5 authored 作者: matian's avatar matian

代码提交

上级 49ba11fb
......@@ -26,5 +26,17 @@ export function delExamPaper(data) {
* 查看考试详情
*/
export function getExamPaperDetail(params) {
return httpRequest.get('/api/exam/v1/exam/view', { params })
return httpRequest.get('/api/exam/v1/exam/view/', { params })
}
/**
* 添加考生
*/
export function addStudent(data) {
return httpRequest.post('/api/exam/v1/exam/add-student', data)
}
/**
* 更新考试
*/
export function updateExam(data) {
return httpRequest.post('/api/exam/v1/exam/update', data)
}
......@@ -36,21 +36,29 @@
<v-editor v-model="config.welcome_message" class="editor"></v-editor>
</el-row>
<el-row :span="24" class="btn_next row_margin">
<el-button type="primary" v-if="$route.query.isEdit === '2'" @click="saveExamInfo">保存</el-button>
<div v-if="isEdit === '1'">
<el-button type="primary" disabled>上一步</el-button>
<el-button type="primary" @click="nextStep">下一步</el-button>
</div>
</el-row>
</el-card>
</template>
<script>
// import { createExamList } from '../api'
import { updateExam } from '../api'
import VEditor from '@/components/tinymce/Index.vue'
export default {
components: { VEditor },
props: {
isEdit: {
type: String,
default: ''
}
},
data() {
return {
exam_time: [],
labelPosition: 'left',
name: '',
config: {
enabled_before: false,
......@@ -68,8 +76,21 @@ export default {
},
end_time() {
return this.exam_time[1]
},
row() {
return JSON.parse(this.$route.query.row)
}
},
mounted() {
this.exam_time = [this.row.start_time, this.row.end_time]
this.name = this.row.name
this.config.enabled_before = this.row.config.enabled_before
this.config.enabled_after = this.row.config.enabled_after
this.config.before_login = this.row.config.before_login
this.config.after_login = this.row.config.after_login
this.config.welcome_message = this.row.config.welcome_message
this.config.waiting_message = this.row.config.waiting_message
},
methods: {
nextStep() {
const params = {
......@@ -95,6 +116,29 @@ export default {
// console.log(params)
this.$emit('getBaseInfo', params)
this.$parent.$parent.nextStep()
},
saveExamInfo() {
const params = {
name: this.name,
start_time: this.start_time,
end_time: this.end_time,
config: {
enabled_before: this.config.enabled_before,
enabled_after: this.config.enabled_after,
before_login: this.config.before_login,
after_login: this.config.after_login,
welcome_message: this.config.welcome_message,
waiting_message: this.config.waiting_message
}
}
if (params.name === '') {
this.$message.warning('请输入考试名称')
} else if (params.start_time === '' || params.end_time === '') {
this.$message.warning('请选择考试时间')
}
updateExam(params).then(res => {
history.go(-1)
})
}
}
}
......
......@@ -13,17 +13,21 @@
<div class="paper_desc">考试开始两个小时前,可以对试卷进行替换</div>
</el-row>
<el-row class="btn_next">
<el-button type="primary" v-if="$route.query.isEdit === '2'" @click="saveExamInfo">保存</el-button>
<div v-if="isEdit === '1'">
<el-button type="primary" @click="lastStep">上一步</el-button>
<el-button type="primary" @click="nextStep">下一步</el-button>
</div>
</el-row>
</el-card>
</template>
<script>
import { getExamPaperList } from '../api'
import { getExamPaperList, updateExam } from '../api'
export default {
data() {
return {
row: {},
ExamParerList: [],
q: [],
filterMethod(query, item) {
......@@ -32,17 +36,22 @@ export default {
checkedArrs: []
}
},
props: {
isEdit: {
type: String,
default: ''
}
},
methods: {
getExamParerList() {
const params = { q: '' }
getExamPaperList(params).then(res => {
// this.ExamParerList = res.data.list
// console.log(res.data.list)
this.ExamParerList = res.data.list.reduce((a, b) => {
this.ExamParerList.push({ label: b.paper_title, key: b.id })
return this.ExamParerList
}, [])
this.getCheckedExam()
})
},
lastStep() {
......@@ -54,7 +63,6 @@ export default {
return
}
this.$parent.$parent.nextStep()
console.log(this.q)
for (let i = 0; i < this.q.length; i++) {
const listArray = []
for (let j = 0; j < this.ExamParerList.length; j++) {
......@@ -65,10 +73,28 @@ export default {
}
this.checkedArrs = listArray
}
// console.log(this.checkedArrs)
const qs = this.q.toString()
this.$emit('getCheckPaper', qs)
this.$emit('getCheckPaperList', this.checkedArrs)
},
saveExamInfo() {
const params = { exam_paper: this.q.toString() }
updateExam(params).then(res => {
history.go(-1)
})
},
getCheckedExam() {
if (this.$route.query.papers) {
const papers = JSON.parse(this.$route.query.papers)
const arr = []
papers.forEach(element => {
const findItem = this.ExamParerList.find(item => {
return item.label === element
}).key
findItem && arr.push(findItem)
})
this.q = arr
}
}
},
mounted() {
......
......@@ -24,6 +24,21 @@ const routes = [
path: 'examDetail',
component: () => import('./views/Detail.vue'),
meta: { title: '考试详情' }
},
{
path: 'createStudent',
component: () => import('./views/CreateStudent.vue'),
meta: { title: '添加考生' }
},
{
path: 'baseInfo',
component: () => import('../exam/components/BaseInfo.vue'),
meta: { title: '编辑考试' }
},
{
path: 'checkPaper',
component: () => import('../exam/components/CheckPaper.vue'),
meta: { title: '选择考试' }
}
]
}
......
<template>
<el-form ref="form" :model="form" label-width="80px" :label-position="labelPosition" :rules="rules">
<el-form-item label="姓名" prop="name">
<el-input v-model="form.name" placeholder="请输入姓名" />
</el-form-item>
<el-form-item label="身份证号" prop="id_number">
<el-input v-model="form.id_number" placeholder="请输入身份证号" />
</el-form-item>
<el-form-item label="性别" prop="gender">
<el-select v-model="form.gender">
<el-option label="男" :value="1"></el-option>
<el-option label="女" :value="2"></el-option>
</el-select>
<!-- <el-input v-model="form.gender" placeholder="请输入性别" /> -->
</el-form-item>
<el-form-item label="学校" prop="school">
<el-input v-model="form.school" placeholder="请输入学校" />
</el-form-item>
<el-form-item label="电话" prop="mobile">
<el-input v-model="form.mobile" placeholder="请输入电话" />
</el-form-item>
<el-form-item prop="examinee_number">
<el-checkbox label="自定义准考证号" v-model="isChecked"></el-checkbox>
<el-input v-model="form.examinee_number" placeholder="不超过20个字母必填" v-if="isChecked === true" />
</el-form-item>
<el-form-item>
<el-row style="margin-top: 30px">
<el-button type="primary" @click="handleSubmit">保存</el-button>
</el-row>
</el-form-item>
</el-form>
</template>
<script>
import { addStudent } from '../api'
export default {
data() {
return {
isChecked: false,
labelPosition: 'left',
btnDisabled: false,
paper_category: [
{ label: '测试', value: 1 },
{ label: '考试', value: 2 },
{ label: '模拟', value: 3 }
],
form: {
name: '',
id_number: '',
gender: '',
school: '',
mobile: '',
examinee_number: ''
},
rules: {
name: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
gender: [{ required: true, message: '请选择性别', trigger: 'change' }],
id_number: [{ required: true, message: '请输入身份证号', trigger: 'blur' }]
}
}
},
computed: {
id() {
return this.$route.query.id
}
},
methods: {
handleSubmit() {
this.$refs.form.validate(valid => {
if (valid) {
// 调用接口
addStudent(Object.assign({ exam_id: this.id }, this.form)).then(res => {})
}
history.go(-1)
})
}
}
}
</script>
<style lang="scss" scoped>
:v-deep .el-input-number .el-input-number__decrease {
display: none;
}
:v-deep .el-input-number .el-input-number__increase {
display: none;
}
::v-deep .el-input-number .el-input__inner {
padding-left: 15px;
text-align: left;
}
</style>
......@@ -2,16 +2,20 @@
<app-card>
<app-list v-bind="tableOptions" ref="list" @selection-change="handleSelectionChange">
<div style="margin-bottom: 30px">
<el-button type="primary" icon="el-icon-plus" @click="handleCreatePaper">考试信息编辑</el-button>
<el-button type="primary" icon="el-icon-plus" @click="handleCreatePaper">考试试卷编辑</el-button>
<el-button type="primary" icon="el-icon-plus" @click="handleCreatePaper">信息采集编辑</el-button>
<el-button type="primary" icon="el-icon-plus" @click="handleCreatePaper">考试配置编辑</el-button>
<el-button type="primary" icon="el-icon-plus" @click="handleCreatePaper">复制考试地址</el-button>
<el-button type="primary" icon="el-icon-plus" @click="handleCreatePaper">转移考生</el-button>
<el-button type="primary" icon="el-icon-plus" @click="handleCreatePaper">导出明细</el-button>
<el-button type="primary" icon="el-icon-plus" @click="handleCreatePaper">删除考生</el-button>
<el-button type="primary" icon="el-icon-plus" @click="handleCreatePaper">添加考生</el-button>
<el-button type="primary" icon="el-icon-plus" @click="handleCreatePaper">发送成绩信息</el-button>
<el-dropdown split-button size="small" style="margin-left: 10px; margin-right: 10px">
操作
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="editExamInfo">考试信息编辑</el-dropdown-item>
<el-dropdown-item @click.native="editExam">考试试卷编辑</el-dropdown-item>
<el-dropdown-item @click.native="createPop(row)">信息采集编辑</el-dropdown-item>
<el-dropdown-item @click.native="createPop(row)">考试配置编辑</el-dropdown-item>
<el-dropdown-item @click.native="createPop(row)">转移考生</el-dropdown-item>
<el-dropdown-item @click.native="exportDetail">导出明细</el-dropdown-item>
<el-dropdown-item @click.native="delStudent">删除考生</el-dropdown-item>
<el-dropdown-item @click.native="handleAddStudent">添加考生</el-dropdown-item>
<el-dropdown-item @click.native="createPop(row)">发送成绩信息</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
<template v-slot:table-x="{ row }">
<el-button type="text" @click="handleDetail(row)">查看详情</el-button>
......@@ -23,6 +27,15 @@
<script>
import { getExamPaperDetail } from '../api'
const stuStatus = [
{ id: '1', name: '未开考' },
{ id: '1', name: '已登录' },
{ id: '1', name: '考试中' },
{ id: '1', name: '已中断' },
{ id: '1', name: '已提交' },
{ id: '1', name: '已完成' },
{ id: '1', name: '待批阅' }
]
export default {
data() {
return {
......@@ -39,27 +52,27 @@ export default {
id: this.row.exam_id,
school: '',
relation_status: '',
name: ''
name: this.row.name
}
},
filters: [
{
type: 'input',
prop: 'paperName',
placeholder: '请输入考试名称',
prop: 'name',
placeholder: '请输入考生姓名',
label: '姓名'
},
{
type: 'input',
prop: 'paperLabel',
prop: 'school',
label: '学校'
},
{
type: 'select',
prop: 'paperType',
placeholder: '请选择考试班级',
options: this.natureList,
prop: 'relation_status',
placeholder: '请选择考生状态',
options: stuStatus,
labelKey: 'name',
valueKey: 'id',
label: '考生状态'
......@@ -67,7 +80,7 @@ export default {
],
columns: [
{ type: 'selection', minWidth: '50px', fixed: 'left' },
{ label: '考生状态', prop: 'name' },
{ label: '考生状态', prop: 'relation_status' },
{ label: '准考证号', prop: 'examinee_number' },
{ label: '身份证号', prop: 'id_number' },
{ label: '电话', prop: 'mobile' },
......@@ -76,56 +89,37 @@ export default {
{ label: '参考时间', prop: 'exam_begin_time' },
{ label: '考中异常', prop: 'exam_error' },
{ label: '成绩', prop: 'sheet.score' }
],
data: [
{
stu_name: '里斯',
stu_school: '清华',
stu_status: ''
}
]
}
},
row() {
return this.$route.query.row
console.log(this.$route.query.row)
return JSON.parse(this.$route.query.row)
}
},
methods: {
// 新建试卷
handleCreatePaper() {
this.$router.push({
path: 'newExam'
})
},
// 编辑试卷
handleDdit(row) {
console.log(row)
this.$router.push({
path: 'newPapers',
query: {
paperDetail: row,
isEdit: true
}
})
},
handleSelectionChange(val) {
this.multipleSelection = val
console.log(val)
},
// 批量删除
batchDelete() {
console.log('111')
},
// 查看详情
handleDetail(row) {
// 添加考生
handleAddStudent() {
console.log(this.row, '----')
this.$router.push({
path: 'examDetail'
path: 'createStudent',
query: { id: this.row.exam_id }
})
},
// 单个删除
handleDelete(row) {
// this.$refs.list.refetch()
}
editExamInfo() {
this.$router.push({ path: 'baseInfo', query: { row: JSON.stringify(this.row), isEdit: '2' } })
},
editExam() {
console.log(this.row)
this.$router.push({ path: 'checkPaper', query: { papers: JSON.stringify(this.row.papers), isEdit: '2' } })
},
// 删除考生
delStudent(row) {},
// 导出明细
exportDetail() {}
}
}
</script>
<template>
<app-card>
<app-list v-bind="tableOptions" ref="list" @selection-change="handleSelectionChange">
<app-list v-bind="tableOptions" ref="list">
<template #header-aside>
<el-button type="primary" icon="el-icon-plus" @click="handleCreatePaper">新建试卷</el-button>
</template>
......@@ -70,35 +70,19 @@ export default {
// 新建试卷
handleCreatePaper() {
this.$router.push({
path: 'newExam'
})
},
// 编辑试卷
handleDdit(row) {
console.log(row)
this.$router.push({
path: 'newPapers',
path: 'newExam',
query: {
paperDetail: row,
isEdit: true
isEdit: '1'
}
})
},
handleSelectionChange(val) {
this.multipleSelection = val
console.log(val)
},
// 批量删除
batchDelete() {
console.log('111')
},
// 查看详情
// 查看详情
handleDetail(row) {
this.$router.push({
path: 'examDetail',
query: {
row: row
row: JSON.stringify(row)
}
})
},
......
......@@ -7,8 +7,13 @@
<el-step title="考试配置"></el-step>
<el-step title="考试配置"></el-step>
</el-steps>
<base-info v-if="stepsIndex === 1" @getBaseInfo="getBaseInfo" />
<check-paper v-if="stepsIndex === 2" @getCheckPaper="getCheckPaper" @getCheckPaperList="getCheckPaperList" />
<base-info data="" v-if="stepsIndex === 1" @getBaseInfo="getBaseInfo" :isEdit="isEdit" />
<check-paper
v-if="stepsIndex === 2"
@getCheckPaper="getCheckPaper"
@getCheckPaperList="getCheckPaperList"
:isEdit="isEdit"
/>
<personal-info v-if="stepsIndex === 3" @getInfo="getInfo" />
<exam-setting v-if="stepsIndex === 4" @getExamConfig="getExamConfig" />
<finished
......@@ -38,6 +43,9 @@ export default {
},
data() {
return {
data: {
BaseInfo: {}
},
stepsIndex: 1,
config: {
info: {}
......@@ -48,6 +56,11 @@ export default {
checkedPaper: []
}
},
computed: {
isEdit() {
return this.$route.query.isEdit
}
},
methods: {
// 获取子组件传过来的页面基本信息
......
......@@ -5,11 +5,31 @@
<el-button type="primary" icon="el-icon-plus" @click="handleCreatePaper">新建试卷</el-button>
<el-button type="primary" icon="el-icon-plus" @click="batchDelete">批量删除</el-button>
</div>
<template v-slot:input-filter>
<div class="filter-input">
<el-select v-model="filterInput" placeholder="请选择试题分类">
<el-option :label="treeValue.name" :value="treeValue.id"></el-option>
</el-select>
<div class="pop" @click="dialogVisible = true"></div>
</div>
</template>
<template v-slot:table-x="{ row }">
<el-button type="text" @click="handleDdit(row)">编辑</el-button>
<el-button type="text" @click="handleDetail(row)">查看详情</el-button>
<el-button type="text" @click="handleDelete(row)">删除</el-button>
</template>
<el-dialog title="提示" :visible.sync="dialogVisible" width="30%" :before-close="handleClose">
<el-tree
:data="treeList"
:props="defaultProps"
@node-click="handleNodeClick"
:expand-on-click-node="false"
></el-tree>
<span slot="footer" class="dialog-footer">
<el-button @click="handleClose">取 消</el-button>
<el-button type="primary" @click="dialogConfirm">确 定</el-button>
</span>
</el-dialog>
</app-list>
</app-card>
</template>
......@@ -25,7 +45,14 @@ export default {
return {
visible: false,
multipleSelection: [], // 选择项
paperCategoryList: []
treeList: [],
dialogVisible: false,
defaultProps: '',
filterInput: '',
treeValue: {
name: '',
id: ''
}
}
},
computed: {
......@@ -65,13 +92,10 @@ export default {
},
{
type: 'select',
prop: 'paperType',
placeholder: '请选择试卷分类',
options: this.initTree,
labelKey: 'category_name',
valueKey: 'id',
label: '试卷分类:'
slots: 'input-filter',
prop: 'question_category',
type: 'input',
label: '试卷分类:'
}
],
columns: [
......@@ -86,29 +110,56 @@ export default {
{ label: '更新时间', prop: 'updated_at' },
{ label: '操作', slots: 'table-x', align: 'right', width: 150 }
]
// data: [
// {
// paperMode: '选题组卷',
// paperType: '测试',
// paperName: '期中考试',
// paperTotalScore: 100,
// paperPassScore: 60,
// update_name: '张三',
// update_time: '2022-02-18'
// }
// ]
}
}
},
mounted() {
// 获取试卷分类
this.getPaperCategory()
this.getTreeList()
},
methods: {
getPaperCategory() {
getTreeList() {
getPaperCategory('x1').then(res => {
this.paperCategoryList = res.data
if (Array.isArray(res.data)) {
this.initTree(res.data)
}
})
},
// 过滤数据 变成tree组件需要的数据
initTree(data) {
this.treeList = data.reduce((a, b) => {
b.label = b.category_name
if (b.children.length) {
setData(b.children)
}
a.push(b)
return a
}, [])
function setData(item) {
return item.map(element => {
if (element.children.length) {
setData(element.children)
element.label = element.category_name
} else {
element.label = element.category_name
}
return element
})
}
},
handleNodeClick(data) {
this.treeValue.name = data.label
this.treeValue.id = data.id
},
handleClose() {
this.treeValue.name = ''
this.treeValue.id = ''
this.dialogVisible = false
},
dialogConfirm() {
this.dialogVisible = false
this.filterInput = this.treeValue.name
this.$refs.list.refetch()
},
// 新建试卷
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论